diff options
author | Brian Gaeke <gaeke@uiuc.edu> | 2004-08-20 06:00:58 +0000 |
---|---|---|
committer | Brian Gaeke <gaeke@uiuc.edu> | 2004-08-20 06:00:58 +0000 |
commit | 715c90ba524e736190a6380695ab337eeb5148be (patch) | |
tree | 0ab6881edc06308fc09116d695a55ccbd096cb5f /include/llvm/Constants.h | |
parent | 4e5b9e136f2eafcb2ab4c5b968307c2678e16a96 (diff) | |
download | external_llvm-715c90ba524e736190a6380695ab337eeb5148be.zip external_llvm-715c90ba524e736190a6380695ab337eeb5148be.tar.gz external_llvm-715c90ba524e736190a6380695ab337eeb5148be.tar.bz2 |
Packed types, brought to you by Brad Jones
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15938 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Constants.h')
-rw-r--r-- | include/llvm/Constants.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h index 74541c9..5ef2cb0 100644 --- a/include/llvm/Constants.h +++ b/include/llvm/Constants.h @@ -24,6 +24,7 @@ namespace llvm { class ArrayType; class StructType; class PointerType; +class PackedType; template<class ConstantClass, class TypeClass, class ValType> struct ConstantCreator; @@ -426,6 +427,44 @@ public: }; //===--------------------------------------------------------------------------- +/// ConstantPacked - Constant Packed Declarations +/// +class ConstantPacked : public Constant { + friend struct ConstantCreator<ConstantPacked, PackedType, + std::vector<Constant*> >; + ConstantPacked(const ConstantPacked &); // DO NOT IMPLEMENT +protected: + ConstantPacked(const PackedType *T, const std::vector<Constant*> &Val); +public: + /// get() - Static factory methods - Return objects of the specified value + static Constant *get(const PackedType *T, const std::vector<Constant*> &); + static Constant *get(const std::vector<Constant*> &V); + + /// getType - Specialize the getType() method to always return an PackedType, + /// which reduces the amount of casting needed in parts of the compiler. + /// + inline const PackedType *getType() const { + return reinterpret_cast<const PackedType*>(Value::getType()); + } + + /// isNullValue - Return true if this is the value that would be returned by + /// getNullValue. This always returns false because zero arrays are always + /// created as ConstantAggregateZero objects. + virtual bool isNullValue() const { return false; } + + virtual void destroyConstant(); + virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, + bool DisableChecking = false); + + /// Methods for support type inquiry through isa, cast, and dyn_cast: + static inline bool classof(const ConstantPacked *) { return true; } + static bool classof(const Value *V) { + return V->getValueType() == SimpleConstantVal && + V->getType()->getTypeID() == Type::PackedTyID; + } +}; + +//===--------------------------------------------------------------------------- /// ConstantPointerNull - a constant pointer value that points to null /// class ConstantPointerNull : public Constant { |