///
class AllocationInst : public Instruction {
protected:
+ void init(const Type *Ty, Value *ArraySize, unsigned iTy);
AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
const std::string &Name = "", Instruction *InsertBefore = 0);
+ AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
+ const std::string &Name, BasicBlock *InsertAtEnd);
+
public:
/// isArrayAllocation - Return true if there is an allocation size parameter
class MallocInst : public AllocationInst {
MallocInst(const MallocInst &MI);
public:
- MallocInst(const Type *Ty, Value *ArraySize = 0, const std::string &Name = "",
- Instruction *InsertBefore = 0)
+ explicit MallocInst(const Type *Ty, Value *ArraySize = 0,
+ const std::string &Name = "",
+ Instruction *InsertBefore = 0)
: AllocationInst(Ty, ArraySize, Malloc, Name, InsertBefore) {}
+ MallocInst(const Type *Ty, Value *ArraySize, const std::string &Name,
+ BasicBlock *InsertAtEnd)
+ : AllocationInst(Ty, ArraySize, Malloc, Name, InsertAtEnd) {}
virtual Instruction *clone() const {
return new MallocInst(*this);
class AllocaInst : public AllocationInst {
AllocaInst(const AllocaInst &);
public:
- AllocaInst(const Type *Ty, Value *ArraySize = 0, const std::string &Name = "",
- Instruction *InsertBefore = 0)
+ explicit AllocaInst(const Type *Ty, Value *ArraySize = 0,
+ const std::string &Name = "",
+ Instruction *InsertBefore = 0)
: AllocationInst(Ty, ArraySize, Alloca, Name, InsertBefore) {}
+ AllocaInst(const Type *Ty, Value *ArraySize, const std::string &Name,
+ BasicBlock *InsertAtEnd)
+ : AllocationInst(Ty, ArraySize, Alloca, Name, InsertAtEnd) {}
virtual Instruction *clone() const {
return new AllocaInst(*this);
/// FreeInst - an instruction to deallocate memory
///
-struct FreeInst : public Instruction {
- FreeInst(Value *Ptr, Instruction *InsertBefore = 0);
+class FreeInst : public Instruction {
+ void init(Value *Ptr);
+
+public:
+ explicit FreeInst(Value *Ptr, Instruction *InsertBefore = 0);
+ FreeInst(Value *Ptr, BasicBlock *InsertAfter);
virtual Instruction *clone() const { return new FreeInst(Operands[0]); }
}
public:
LoadInst(Value *Ptr, const std::string &Name, Instruction *InsertBefore);
+ LoadInst(Value *Ptr, const std::string &Name, BasicBlock *InsertAtEnd);
LoadInst(Value *Ptr, const std::string &Name = "", bool isVolatile = false,
Instruction *InsertBefore = 0);
+ LoadInst(Value *Ptr, const std::string &Name, bool isVolatile,
+ BasicBlock *InsertAtEnd);
/// isVolatile - Return true if this is a load from a volatile memory
/// location.
}
public:
StoreInst(Value *Val, Value *Ptr, Instruction *InsertBefore);
+ StoreInst(Value *Val, Value *Ptr, BasicBlock *InsertAtEnd);
StoreInst(Value *Val, Value *Ptr, bool isVolatile = false,
Instruction *InsertBefore = 0);
+ StoreInst(Value *Val, Value *Ptr, bool isVolatile, BasicBlock *InsertAtEnd);
/// isVolatile - Return true if this is a load from a volatile memory
public:
GetElementPtrInst(Value *Ptr, const std::vector<Value*> &Idx,
const std::string &Name = "", Instruction *InsertBefore =0);
+ GetElementPtrInst(Value *Ptr, const std::vector<Value*> &Idx,
+ const std::string &Name, BasicBlock *InsertAtEnd);
virtual Instruction *clone() const { return new GetElementPtrInst(*this); }
// getType - Overload to return most specific pointer type...