aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Constants.h
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-02-01 16:37:38 +0000
committerDan Gohman <gohman@apple.com>2010-02-01 16:37:38 +0000
commit2544a1de666ad7197c755b4dab6419f42df01f65 (patch)
tree05631c6b443afea6c84407595974dd8e62c8b483 /include/llvm/Constants.h
parent9a720b0b0eee507bc453d0960ce7c11e7945d79c (diff)
downloadexternal_llvm-2544a1de666ad7197c755b4dab6419f42df01f65.zip
external_llvm-2544a1de666ad7197c755b4dab6419f42df01f65.tar.gz
external_llvm-2544a1de666ad7197c755b4dab6419f42df01f65.tar.bz2
Add a generalized form of ConstantExpr::getOffsetOf which works for
array types as well as struct types, and which accepts arbitrary Constant indicies. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94981 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Constants.h')
-rw-r--r--include/llvm/Constants.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h
index 58077f0..4111f36 100644
--- a/include/llvm/Constants.h
+++ b/include/llvm/Constants.h
@@ -652,10 +652,15 @@ public:
///
static Constant *getSizeOf(const Type* Ty);
- /// getOffsetOf constant expr - computes the offset of a field in a target
- /// independent way (Note: the return type is an i64).
+ /// getOffsetOf constant expr - computes the offset of a struct field in a
+ /// target independent way (Note: the return type is an i64).
+ ///
+ static Constant *getOffsetOf(const StructType* STy, unsigned FieldNo);
+
+ /// getOffsetOf constant expr - This is a generalized form of getOffsetOf,
+ /// which supports any aggregate type, and any Constant index.
///
- static Constant *getOffsetOf(const StructType* Ty, unsigned FieldNo);
+ static Constant *getOffsetOf(const Type* Ty, Constant *FieldNo);
static Constant *getNeg(Constant *C);
static Constant *getFNeg(Constant *C);