aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/llvm-c/Core.h1
-rw-r--r--include/llvm/InstrTypes.h3
-rw-r--r--include/llvm/Instruction.def73
-rw-r--r--include/llvm/Instructions.h54
-rw-r--r--include/llvm/Support/IRBuilder.h4
-rw-r--r--include/llvm/Support/InstVisitor.h13
-rw-r--r--include/llvm/Transforms/Scalar.h5
7 files changed, 47 insertions, 106 deletions
diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h
index 74c170928f..353cab20b2 100644
--- a/include/llvm-c/Core.h
+++ b/include/llvm-c/Core.h
@@ -457,7 +457,6 @@ void LLVMDisposeTypeHandle(LLVMTypeHandleRef TypeHandle);
macro(UnaryInstruction) \
macro(AllocationInst) \
macro(AllocaInst) \
- macro(MallocInst) \
macro(CastInst) \
macro(BitCastInst) \
macro(FPExtInst) \
diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h
index cc923dec29..45d366f1ef 100644
--- a/include/llvm/InstrTypes.h
+++ b/include/llvm/InstrTypes.h
@@ -116,8 +116,7 @@ public:
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const UnaryInstruction *) { return true; }
static inline bool classof(const Instruction *I) {
- return I->getOpcode() == Instruction::Malloc ||
- I->getOpcode() == Instruction::Alloca ||
+ return I->getOpcode() == Instruction::Alloca ||
I->getOpcode() == Instruction::Free ||
I->getOpcode() == Instruction::Load ||
I->getOpcode() == Instruction::VAArg ||
diff --git a/include/llvm/Instruction.def b/include/llvm/Instruction.def
index e603c1257e..5c8fe3eacc 100644
--- a/include/llvm/Instruction.def
+++ b/include/llvm/Instruction.def
@@ -128,49 +128,48 @@ HANDLE_BINARY_INST(24, Xor , BinaryOperator)
// Memory operators...
FIRST_MEMORY_INST(25)
-HANDLE_MEMORY_INST(25, Malloc, MallocInst) // Heap management instructions
-HANDLE_MEMORY_INST(26, Free , FreeInst )
-HANDLE_MEMORY_INST(27, Alloca, AllocaInst) // Stack management
-HANDLE_MEMORY_INST(28, Load , LoadInst ) // Memory manipulation instrs
-HANDLE_MEMORY_INST(29, Store , StoreInst )
-HANDLE_MEMORY_INST(30, GetElementPtr, GetElementPtrInst)
- LAST_MEMORY_INST(30)
+HANDLE_MEMORY_INST(25, Free , FreeInst ) // Heap management instructions
+HANDLE_MEMORY_INST(26, Alloca, AllocaInst) // Stack management
+HANDLE_MEMORY_INST(27, Load , LoadInst ) // Memory manipulation instrs
+HANDLE_MEMORY_INST(28, Store , StoreInst )
+HANDLE_MEMORY_INST(29, GetElementPtr, GetElementPtrInst)
+ LAST_MEMORY_INST(29)
// Cast operators ...
// NOTE: The order matters here because CastInst::isEliminableCastPair
// NOTE: (see Instructions.cpp) encodes a table based on this ordering.
- FIRST_CAST_INST(31)
-HANDLE_CAST_INST(31, Trunc , TruncInst ) // Truncate integers
-HANDLE_CAST_INST(32, ZExt , ZExtInst ) // Zero extend integers
-HANDLE_CAST_INST(33, SExt , SExtInst ) // Sign extend integers
-HANDLE_CAST_INST(34, FPToUI , FPToUIInst ) // floating point -> UInt
-HANDLE_CAST_INST(35, FPToSI , FPToSIInst ) // floating point -> SInt
-HANDLE_CAST_INST(36, UIToFP , UIToFPInst ) // UInt -> floating point
-HANDLE_CAST_INST(37, SIToFP , SIToFPInst ) // SInt -> floating point
-HANDLE_CAST_INST(38, FPTrunc , FPTruncInst ) // Truncate floating point
-HANDLE_CAST_INST(39, FPExt , FPExtInst ) // Extend floating point
-HANDLE_CAST_INST(40, PtrToInt, PtrToIntInst) // Pointer -> Integer
-HANDLE_CAST_INST(41, IntToPtr, IntToPtrInst) // Integer -> Pointer
-HANDLE_CAST_INST(42, BitCast , BitCastInst ) // Type cast
- LAST_CAST_INST(42)
+ FIRST_CAST_INST(30)
+HANDLE_CAST_INST(30, Trunc , TruncInst ) // Truncate integers
+HANDLE_CAST_INST(31, ZExt , ZExtInst ) // Zero extend integers
+HANDLE_CAST_INST(32, SExt , SExtInst ) // Sign extend integers
+HANDLE_CAST_INST(33, FPToUI , FPToUIInst ) // floating point -> UInt
+HANDLE_CAST_INST(34, FPToSI , FPToSIInst ) // floating point -> SInt
+HANDLE_CAST_INST(35, UIToFP , UIToFPInst ) // UInt -> floating point
+HANDLE_CAST_INST(36, SIToFP , SIToFPInst ) // SInt -> floating point
+HANDLE_CAST_INST(37, FPTrunc , FPTruncInst ) // Truncate floating point
+HANDLE_CAST_INST(38, FPExt , FPExtInst ) // Extend floating point
+HANDLE_CAST_INST(39, PtrToInt, PtrToIntInst) // Pointer -> Integer
+HANDLE_CAST_INST(40, IntToPtr, IntToPtrInst) // Integer -> Pointer
+HANDLE_CAST_INST(41, BitCast , BitCastInst ) // Type cast
+ LAST_CAST_INST(41)
// Other operators...
- FIRST_OTHER_INST(43)
-HANDLE_OTHER_INST(43, ICmp , ICmpInst ) // Integer comparison instruction
-HANDLE_OTHER_INST(44, FCmp , FCmpInst ) // Floating point comparison instr.
-HANDLE_OTHER_INST(45, PHI , PHINode ) // PHI node instruction
-HANDLE_OTHER_INST(46, Call , CallInst ) // Call a function
-HANDLE_OTHER_INST(47, Select , SelectInst ) // select instruction
-HANDLE_OTHER_INST(48, UserOp1, Instruction) // May be used internally in a pass
-HANDLE_OTHER_INST(49, UserOp2, Instruction) // Internal to passes only
-HANDLE_OTHER_INST(50, VAArg , VAArgInst ) // vaarg instruction
-HANDLE_OTHER_INST(51, ExtractElement, ExtractElementInst)// extract from vector
-HANDLE_OTHER_INST(52, InsertElement, InsertElementInst) // insert into vector
-HANDLE_OTHER_INST(53, ShuffleVector, ShuffleVectorInst) // shuffle two vectors.
-HANDLE_OTHER_INST(54, ExtractValue, ExtractValueInst)// extract from aggregate
-HANDLE_OTHER_INST(55, InsertValue, InsertValueInst) // insert into aggregate
-
- LAST_OTHER_INST(55)
+ FIRST_OTHER_INST(42)
+HANDLE_OTHER_INST(42, ICmp , ICmpInst ) // Integer comparison instruction
+HANDLE_OTHER_INST(43, FCmp , FCmpInst ) // Floating point comparison instr.
+HANDLE_OTHER_INST(44, PHI , PHINode ) // PHI node instruction
+HANDLE_OTHER_INST(45, Call , CallInst ) // Call a function
+HANDLE_OTHER_INST(46, Select , SelectInst ) // select instruction
+HANDLE_OTHER_INST(47, UserOp1, Instruction) // May be used internally in a pass
+HANDLE_OTHER_INST(48, UserOp2, Instruction) // Internal to passes only
+HANDLE_OTHER_INST(49, VAArg , VAArgInst ) // vaarg instruction
+HANDLE_OTHER_INST(50, ExtractElement, ExtractElementInst)// extract from vector
+HANDLE_OTHER_INST(51, InsertElement, InsertElementInst) // insert into vector
+HANDLE_OTHER_INST(52, ShuffleVector, ShuffleVectorInst) // shuffle two vectors.
+HANDLE_OTHER_INST(53, ExtractValue, ExtractValueInst)// extract from aggregate
+HANDLE_OTHER_INST(54, InsertValue, InsertValueInst) // insert into aggregate
+
+ LAST_OTHER_INST(54)
#undef FIRST_TERM_INST
#undef HANDLE_TERM_INST
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index d9e59ed3a2..438c220b2c 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -37,8 +37,7 @@ class DominatorTree;
// AllocationInst Class
//===----------------------------------------------------------------------===//
-/// AllocationInst - This class is the common base class of MallocInst and
-/// AllocaInst.
+/// AllocationInst - This class is the base class of AllocaInst.
///
class AllocationInst : public UnaryInstruction {
protected:
@@ -85,56 +84,7 @@ public:
// 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 {
-public:
- explicit MallocInst(const Type *Ty, Value *ArraySize = 0,
- const Twine &NameStr = "",
- Instruction *InsertBefore = 0)
- : AllocationInst(Ty, ArraySize, Malloc,
- 0, NameStr, InsertBefore) {}
- MallocInst(const Type *Ty, Value *ArraySize,
- const Twine &NameStr, BasicBlock *InsertAtEnd)
- : AllocationInst(Ty, ArraySize, Malloc, 0, NameStr, InsertAtEnd) {}
-
- MallocInst(const Type *Ty, const Twine &NameStr,
- Instruction *InsertBefore = 0)
- : AllocationInst(Ty, 0, Malloc, 0, NameStr, InsertBefore) {}
- MallocInst(const Type *Ty, const Twine &NameStr,
- BasicBlock *InsertAtEnd)
- : AllocationInst(Ty, 0, Malloc, 0, NameStr, InsertAtEnd) {}
-
- MallocInst(const Type *Ty, Value *ArraySize,
- unsigned Align, const Twine &NameStr,
- BasicBlock *InsertAtEnd)
- : AllocationInst(Ty, ArraySize, Malloc,
- Align, NameStr, InsertAtEnd) {}
- MallocInst(const Type *Ty, Value *ArraySize,
- unsigned Align, const Twine &NameStr = "",
- Instruction *InsertBefore = 0)
- : AllocationInst(Ty, ArraySize,
- Malloc, Align, NameStr, InsertBefore) {}
-
- virtual MallocInst *clone() 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);
+ return I->getOpcode() == Instruction::Alloca;
}
static inline bool classof(const Value *V) {
return isa<Instruction>(V) && classof(cast<Instruction>(V));
diff --git a/include/llvm/Support/IRBuilder.h b/include/llvm/Support/IRBuilder.h
index 1f659787eb..f4d1101cdf 100644
--- a/include/llvm/Support/IRBuilder.h
+++ b/include/llvm/Support/IRBuilder.h
@@ -429,10 +429,6 @@ public:
// Instruction creation methods: Memory Instructions
//===--------------------------------------------------------------------===//
- MallocInst *CreateMalloc(const Type *Ty, Value *ArraySize = 0,
- const Twine &Name = "") {
- return Insert(new MallocInst(Ty, ArraySize), Name);
- }
AllocaInst *CreateAlloca(const Type *Ty, Value *ArraySize = 0,
const Twine &Name = "") {
return Insert(new AllocaInst(Ty, ArraySize), Name);
diff --git a/include/llvm/Support/InstVisitor.h b/include/llvm/Support/InstVisitor.h
index 5d7c2f72ba..440657cfef 100644
--- a/include/llvm/Support/InstVisitor.h
+++ b/include/llvm/Support/InstVisitor.h
@@ -46,17 +46,17 @@ namespace llvm {
/// /// Declare the class. Note that we derive from InstVisitor instantiated
/// /// with _our new subclasses_ type.
/// ///
-/// struct CountMallocVisitor : public InstVisitor<CountMallocVisitor> {
+/// struct CountAllocaVisitor : public InstVisitor<CountAllocaVisitor> {
/// unsigned Count;
-/// CountMallocVisitor() : Count(0) {}
+/// CountAllocaVisitor() : Count(0) {}
///
-/// void visitMallocInst(MallocInst &MI) { ++Count; }
+/// void visitAllocaInst(AllocaInst &AI) { ++Count; }
/// };
///
/// And this class would be used like this:
-/// CountMallocVistor CMV;
-/// CMV.visit(function);
-/// NumMallocs = CMV.Count;
+/// CountAllocaVisitor CAV;
+/// CAV.visit(function);
+/// NumAllocas = CAV.Count;
///
/// The defined has 'visit' methods for Instruction, and also for BasicBlock,
/// Function, and Module, which recursively process all contained instructions.
@@ -165,7 +165,6 @@ public:
RetTy visitUnreachableInst(UnreachableInst &I) { DELEGATE(TerminatorInst);}
RetTy visitICmpInst(ICmpInst &I) { DELEGATE(CmpInst);}
RetTy visitFCmpInst(FCmpInst &I) { DELEGATE(CmpInst);}
- RetTy visitMallocInst(MallocInst &I) { DELEGATE(AllocationInst);}
RetTy visitAllocaInst(AllocaInst &I) { DELEGATE(AllocationInst);}
RetTy visitFreeInst(FreeInst &I) { DELEGATE(Instruction); }
RetTy visitLoadInst(LoadInst &I) { DELEGATE(Instruction); }
diff --git a/include/llvm/Transforms/Scalar.h b/include/llvm/Transforms/Scalar.h
index 2483768ead..fee4e65938 100644
--- a/include/llvm/Transforms/Scalar.h
+++ b/include/llvm/Transforms/Scalar.h
@@ -225,12 +225,11 @@ extern const PassInfo *const LoopSimplifyID;
//===----------------------------------------------------------------------===//
//
-// LowerAllocations - Turn malloc and free instructions into @malloc and @free
-// calls.
+// LowerAllocations - Turn free instructions into @free calls.
//
// AU.addRequiredID(LowerAllocationsID);
//
-Pass *createLowerAllocationsPass(bool LowerMallocArgToInteger = false);
+Pass *createLowerAllocationsPass();
extern const PassInfo *const LowerAllocationsID;
//===----------------------------------------------------------------------===//