From: Chris Lattner Date: Thu, 13 Dec 2001 00:40:16 +0000 (+0000) Subject: Implement some nice functions useful for looking at types X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=4adc20b41c066a1c91abe335eebd6a1abed59b53;p=oota-llvm.git 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 --- diff --git a/include/llvm/Type.h b/include/llvm/Type.h index 905aa2d11f5..3617aaed9e1 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) {