- virtual Instruction *clone(LLVMContext &Context) 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 ||
- I->getOpcode() == Instruction::Malloc;
- }
- static inline bool classof(const Value *V) {
- return isa<Instruction>(V) && classof(cast<Instruction>(V));
- }
-};
-
-
-//===----------------------------------------------------------------------===//
-// MallocInst Class
-//===----------------------------------------------------------------------===//
-
-/// MallocInst - an instruction to allocated memory on the heap
-///
-class MallocInst : public AllocationInst {
- MallocInst(const MallocInst &MI);
-public:
- explicit MallocInst(const Type *Ty, Value *ArraySize = 0,
- const std::string &NameStr = "",
- Instruction *InsertBefore = 0)
- : AllocationInst(Ty, ArraySize, Malloc,
- 0, NameStr, InsertBefore) {}
- MallocInst(const Type *Ty, Value *ArraySize,
- const std::string &NameStr, BasicBlock *InsertAtEnd)
- : AllocationInst(Ty, ArraySize, Malloc, 0, NameStr, InsertAtEnd) {}
-
- MallocInst(const Type *Ty, const std::string &NameStr,
- Instruction *InsertBefore = 0)
- : AllocationInst(Ty, 0, Malloc, 0, NameStr, InsertBefore) {}
- MallocInst(const Type *Ty, const std::string &NameStr,
- BasicBlock *InsertAtEnd)
- : AllocationInst(Ty, 0, Malloc, 0, NameStr, InsertAtEnd) {}
-
- MallocInst(const Type *Ty, Value *ArraySize,
- unsigned Align, const std::string &NameStr,
- BasicBlock *InsertAtEnd)
- : AllocationInst(Ty, ArraySize, Malloc,
- Align, NameStr, InsertAtEnd) {}
- MallocInst(const Type *Ty, Value *ArraySize,
- unsigned Align, const std::string &NameStr = "",
- Instruction *InsertBefore = 0)
- : AllocationInst(Ty, ArraySize,
- Malloc, Align, NameStr, InsertBefore) {}
-
- virtual MallocInst *clone(LLVMContext &Context) const;
-
- // Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const MallocInst *) { return true; }
- static inline bool classof(const Instruction *I) {
- return (I->getOpcode() == Instruction::Malloc);
- }
- 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 {
- AllocaInst(const AllocaInst &);
-public:
- explicit AllocaInst(const Type *Ty,
- Value *ArraySize = 0,
- const std::string &NameStr = "",
- Instruction *InsertBefore = 0)
- : AllocationInst(Ty, ArraySize, Alloca,
- 0, NameStr, InsertBefore) {}
- AllocaInst(const Type *Ty,
- Value *ArraySize, const std::string &NameStr,
- BasicBlock *InsertAtEnd)
- : AllocationInst(Ty, ArraySize, Alloca, 0, NameStr, InsertAtEnd) {}
-
- AllocaInst(const Type *Ty, const std::string &NameStr,
- Instruction *InsertBefore = 0)
- : AllocationInst(Ty, 0, Alloca, 0, NameStr, InsertBefore) {}
- AllocaInst(const Type *Ty, const std::string &NameStr,
- BasicBlock *InsertAtEnd)
- : AllocationInst(Ty, 0, Alloca, 0, NameStr, InsertAtEnd) {}
-
- AllocaInst(const Type *Ty, Value *ArraySize,
- unsigned Align, const std::string &NameStr = "",
- Instruction *InsertBefore = 0)
- : AllocationInst(Ty, ArraySize, Alloca,
- Align, NameStr, InsertBefore) {}
- AllocaInst(const Type *Ty, Value *ArraySize,
- unsigned Align, const std::string &NameStr,
- BasicBlock *InsertAtEnd)
- : AllocationInst(Ty, ArraySize, Alloca,
- Align, NameStr, InsertAtEnd) {}
-
- virtual AllocaInst *clone(LLVMContext &Context) const;
-