diff options
author | Chris Lattner <sabre@nondot.org> | 2001-11-01 02:39:36 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-11-01 02:39:36 +0000 |
commit | b86751715ca1b9cc67bac69c51c71add63196fe0 (patch) | |
tree | d857a443a8ddc06debba03335891ad41a3c697ad /include/llvm/iMemory.h | |
parent | dbe0514e12a9e313d165acc87b4ae53ca1f6f781 (diff) | |
download | external_llvm-b86751715ca1b9cc67bac69c51c71add63196fe0.zip external_llvm-b86751715ca1b9cc67bac69c51c71add63196fe0.tar.gz external_llvm-b86751715ca1b9cc67bac69c51c71add63196fe0.tar.bz2 |
Add some useful accessors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1069 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/iMemory.h')
-rw-r--r-- | include/llvm/iMemory.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/llvm/iMemory.h b/include/llvm/iMemory.h index 9e7267d..5ce03ef 100644 --- a/include/llvm/iMemory.h +++ b/include/llvm/iMemory.h @@ -41,11 +41,29 @@ public: } } + // isArrayAllocation - Return true if there is an allocation size parameter + // to the allocation instruction. + // + inline bool isArrayAllocation() const { return Operands.size() == 1; } + + inline const Value *getArraySize() const { + assert(isArrayAllocation()); return Operands[0]; + } + inline Value *getArraySize() { + assert(isArrayAllocation()); return Operands[0]; + } + // getType - Overload to return most specific pointer type... inline const PointerType *getType() const { return (const PointerType*)Instruction::getType(); } + // getAllocatedType - Return the type that is being allocated by the + // instruction. + inline const Type *getAllocatedType() const { + return getType()->getValueType(); + } + virtual Instruction *clone() const = 0; }; |