diff options
author | Chris Lattner <sabre@nondot.org> | 2001-12-13 00:40:16 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-12-13 00:40:16 +0000 |
commit | 4adc20b41c066a1c91abe335eebd6a1abed59b53 (patch) | |
tree | 357547ee0c026db89210a183798b0f810dba9e65 /include | |
parent | a4268ad38974da17ba38378328c84919245c2f5c (diff) | |
download | external_llvm-4adc20b41c066a1c91abe335eebd6a1abed59b53.zip external_llvm-4adc20b41c066a1c91abe335eebd6a1abed59b53.tar.gz external_llvm-4adc20b41c066a1c91abe335eebd6a1abed59b53.tar.bz2 |
Implement some nice functions useful for looking at types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1442 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Type.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/llvm/Type.h b/include/llvm/Type.h index 905aa2d..3617aae 100644 --- a/include/llvm/Type.h +++ b/include/llvm/Type.h @@ -146,6 +146,14 @@ public: // bool isLosslesslyConvertableTo(const Type *Ty) const; + // isSized - Return true if it makes sense to take the size of this type. To + // get the actual size for a particular target, it is reasonable to use the + // TargetData subsystem to do this. + // + bool isSized() const { + return ID != TypeTyID && ID != MethodTyID && ID != OpaqueTyID; + } + //===--------------------------------------------------------------------===// // Type Iteration support // @@ -190,9 +198,13 @@ public: // Note that all other types can just compare to see if this == Type::xxxTy; // inline bool isPrimitiveType() const { return ID < FirstDerivedTyID; } - inline bool isDerivedType() const { return ID >= FirstDerivedTyID; } + // isFirstClassType - Return true if the value is holdable in a register. + inline bool isFirstClassType() const { + return isPrimitiveType() || ID == PointerTyID; + } + // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const Type *T) { return true; } static inline bool classof(const Value *V) { |