diff options
author | Victor Hernandez <vhernandez@apple.com> | 2009-10-23 21:09:37 +0000 |
---|---|---|
committer | Victor Hernandez <vhernandez@apple.com> | 2009-10-23 21:09:37 +0000 |
commit | 7b929dad59785f62a66f7c58615082f98441e95e (patch) | |
tree | fe3eb2cd3b56e7c3e89454d73e56986f3ce12ba2 /include/llvm | |
parent | 4ab74cdc124af6b4f57c2d2d09548e01d64a1f34 (diff) | |
download | external_llvm-7b929dad59785f62a66f7c58615082f98441e95e.zip external_llvm-7b929dad59785f62a66f7c58615082f98441e95e.tar.gz external_llvm-7b929dad59785f62a66f7c58615082f98441e95e.tar.bz2 |
Remove AllocationInst. Since MallocInst went away, AllocaInst is the only subclass of AllocationInst, so it no longer is necessary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84969 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/Instructions.h | 82 | ||||
-rw-r--r-- | include/llvm/Support/InstVisitor.h | 3 |
2 files changed, 20 insertions, 65 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index dbeb9e1..9a990e7 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -34,22 +34,28 @@ class LLVMContext; class DominatorTree; //===----------------------------------------------------------------------===// -// AllocationInst Class +// AllocaInst Class //===----------------------------------------------------------------------===// -/// AllocationInst - This class is the base class of AllocaInst. +/// AllocaInst - an instruction to allocate memory on the stack /// -class AllocationInst : public UnaryInstruction { -protected: - AllocationInst(const Type *Ty, Value *ArraySize, - unsigned iTy, unsigned Align, const Twine &Name = "", - Instruction *InsertBefore = 0); - AllocationInst(const Type *Ty, Value *ArraySize, - unsigned iTy, unsigned Align, const Twine &Name, - BasicBlock *InsertAtEnd); +class AllocaInst : public UnaryInstruction { public: + explicit AllocaInst(const Type *Ty, Value *ArraySize = 0, + const Twine &Name = "", Instruction *InsertBefore = 0); + AllocaInst(const Type *Ty, Value *ArraySize, + const Twine &Name, BasicBlock *InsertAtEnd); + + AllocaInst(const Type *Ty, const Twine &Name, Instruction *InsertBefore = 0); + AllocaInst(const Type *Ty, const Twine &Name, BasicBlock *InsertAtEnd); + + AllocaInst(const Type *Ty, Value *ArraySize, unsigned Align, + const Twine &Name = "", Instruction *InsertBefore = 0); + AllocaInst(const Type *Ty, Value *ArraySize, unsigned Align, + const Twine &Name, BasicBlock *InsertAtEnd); + // Out of line virtual method, so the vtable, etc. has a home. - virtual ~AllocationInst(); + virtual ~AllocaInst(); /// isArrayAllocation - Return true if there is an allocation size parameter /// to the allocation instruction that is not 1. @@ -79,63 +85,13 @@ public: unsigned getAlignment() const { return (1u << SubclassData) >> 1; } void setAlignment(unsigned Align); - virtual AllocationInst *clone() const = 0; - - // Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const AllocationInst *) { return true; } - static inline bool classof(const Instruction *I) { - return I->getOpcode() == Instruction::Alloca; - } - static inline bool classof(const Value *V) { - return isa<Instruction>(V) && classof(cast<Instruction>(V)); - } -}; - - -//===----------------------------------------------------------------------===// -// AllocaInst Class -//===----------------------------------------------------------------------===// - -/// AllocaInst - an instruction to allocate memory on the stack -/// -class AllocaInst : public AllocationInst { -public: - explicit AllocaInst(const Type *Ty, - Value *ArraySize = 0, - const Twine &NameStr = "", - Instruction *InsertBefore = 0) - : AllocationInst(Ty, ArraySize, Alloca, - 0, NameStr, InsertBefore) {} - AllocaInst(const Type *Ty, - Value *ArraySize, const Twine &NameStr, - BasicBlock *InsertAtEnd) - : AllocationInst(Ty, ArraySize, Alloca, 0, NameStr, InsertAtEnd) {} - - AllocaInst(const Type *Ty, const Twine &NameStr, - Instruction *InsertBefore = 0) - : AllocationInst(Ty, 0, Alloca, 0, NameStr, InsertBefore) {} - AllocaInst(const Type *Ty, const Twine &NameStr, - BasicBlock *InsertAtEnd) - : AllocationInst(Ty, 0, Alloca, 0, NameStr, InsertAtEnd) {} - - AllocaInst(const Type *Ty, Value *ArraySize, - unsigned Align, const Twine &NameStr = "", - Instruction *InsertBefore = 0) - : AllocationInst(Ty, ArraySize, Alloca, - Align, NameStr, InsertBefore) {} - AllocaInst(const Type *Ty, Value *ArraySize, - unsigned Align, const Twine &NameStr, - BasicBlock *InsertAtEnd) - : AllocationInst(Ty, ArraySize, Alloca, - Align, NameStr, InsertAtEnd) {} - - virtual AllocaInst *clone() const; - /// isStaticAlloca - Return true if this alloca is in the entry block of the /// function and is a constant size. If so, the code generator will fold it /// into the prolog/epilog code, so it is basically free. bool isStaticAlloca() const; + virtual AllocaInst *clone() const; + // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const AllocaInst *) { return true; } static inline bool classof(const Instruction *I) { diff --git a/include/llvm/Support/InstVisitor.h b/include/llvm/Support/InstVisitor.h index 440657c..1e34e66 100644 --- a/include/llvm/Support/InstVisitor.h +++ b/include/llvm/Support/InstVisitor.h @@ -165,7 +165,7 @@ public: RetTy visitUnreachableInst(UnreachableInst &I) { DELEGATE(TerminatorInst);} RetTy visitICmpInst(ICmpInst &I) { DELEGATE(CmpInst);} RetTy visitFCmpInst(FCmpInst &I) { DELEGATE(CmpInst);} - RetTy visitAllocaInst(AllocaInst &I) { DELEGATE(AllocationInst);} + RetTy visitAllocaInst(AllocaInst &I) { DELEGATE(Instruction); } RetTy visitFreeInst(FreeInst &I) { DELEGATE(Instruction); } RetTy visitLoadInst(LoadInst &I) { DELEGATE(Instruction); } RetTy visitStoreInst(StoreInst &I) { DELEGATE(Instruction); } @@ -198,7 +198,6 @@ public: // RetTy visitTerminatorInst(TerminatorInst &I) { DELEGATE(Instruction); } RetTy visitBinaryOperator(BinaryOperator &I) { DELEGATE(Instruction); } - RetTy visitAllocationInst(AllocationInst &I) { DELEGATE(Instruction); } RetTy visitCmpInst(CmpInst &I) { DELEGATE(Instruction); } RetTy visitCastInst(CastInst &I) { DELEGATE(Instruction); } |