summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorVictor Hernandez <vhernandez@apple.com>2009-10-24 04:23:03 +0000
committerVictor Hernandez <vhernandez@apple.com>2009-10-24 04:23:03 +0000
commit66284e063a1e46500acae48bdc0e4a00652021d1 (patch)
tree7326efcf20c334046c044082a205dc2eb1f17466 /include
parent5a850beb2e3032e6ff3474ce5317f5454060328c (diff)
downloadllvm-66284e063a1e46500acae48bdc0e4a00652021d1.tar.gz
llvm-66284e063a1e46500acae48bdc0e4a00652021d1.tar.bz2
llvm-66284e063a1e46500acae48bdc0e4a00652021d1.tar.xz
Auto-upgrade free instructions to calls to the builtin free function.
Update all analysis passes and transforms to treat free calls just like FreeInst. Remove RaiseAllocations and all its tests since FreeInst no longer needs to be raised. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84987 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm-c/Transforms/IPO.h2
-rw-r--r--include/llvm/Analysis/MallocHelper.h11
-rw-r--r--include/llvm/Instructions.h3
-rw-r--r--include/llvm/LinkAllPasses.h1
-rw-r--r--include/llvm/Support/StandardPasses.h2
-rw-r--r--include/llvm/Transforms/IPO.h7
6 files changed, 13 insertions, 13 deletions
diff --git a/include/llvm-c/Transforms/IPO.h b/include/llvm-c/Transforms/IPO.h
index 9bc947f4d8..0a94315f62 100644
--- a/include/llvm-c/Transforms/IPO.h
+++ b/include/llvm-c/Transforms/IPO.h
@@ -54,7 +54,7 @@ void LLVMAddLowerSetJmpPass(LLVMPassManagerRef PM);
/** See llvm::createPruneEHPass function. */
void LLVMAddPruneEHPass(LLVMPassManagerRef PM);
-/** See llvm::createRaiseAllocationsPass function. */
+// FIXME: Remove in LLVM 3.0.
void LLVMAddRaiseAllocationsPass(LLVMPassManagerRef PM);
/** See llvm::createStripDeadPrototypesPass function. */
diff --git a/include/llvm/Analysis/MallocHelper.h b/include/llvm/Analysis/MallocHelper.h
index e0c4d2c9e4..be307c02ae 100644
--- a/include/llvm/Analysis/MallocHelper.h
+++ b/include/llvm/Analysis/MallocHelper.h
@@ -27,8 +27,8 @@ class Value;
// malloc Call Utility Functions.
//
-/// isMalloc - Returns true if the the value is either a malloc call or a
-/// bitcast of the result of a malloc call
+/// isMalloc - Returns true if the value is either a malloc call or a bitcast of
+/// the result of a malloc call
bool isMalloc(const Value* I);
/// extractMallocCall - Returns the corresponding CallInst if the instruction
@@ -79,6 +79,13 @@ const Type* getMallocAllocatedType(const CallInst* CI);
/// determined.
Value* getMallocArraySize(CallInst* CI, LLVMContext &Context,
const TargetData* TD);
+
+//===----------------------------------------------------------------------===//
+// free Call Utility Functions.
+//
+
+/// isFreeCall - Returns true if the the value is a call to the builtin free()
+bool isFreeCall(const Value* I);
} // End llvm namespace
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index 9a990e7eb9..f7e7a3dbf9 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -956,6 +956,9 @@ public:
const Type *IntPtrTy, const Type *AllocTy,
Value *ArraySize = 0, Function* MallocF = 0,
const Twine &Name = "");
+ /// CreateFree - Generate the IR for a call to the builtin free function.
+ static void CreateFree(Value* Source, Instruction *InsertBefore);
+ static Instruction* CreateFree(Value* Source, BasicBlock *InsertAtEnd);
~CallInst();
diff --git a/include/llvm/LinkAllPasses.h b/include/llvm/LinkAllPasses.h
index 3342ea89c5..9335976f33 100644
--- a/include/llvm/LinkAllPasses.h
+++ b/include/llvm/LinkAllPasses.h
@@ -107,7 +107,6 @@ namespace {
(void) llvm::createPostDomPrinterPass();
(void) llvm::createPostDomOnlyViewerPass();
(void) llvm::createPostDomViewerPass();
- (void) llvm::createRaiseAllocationsPass();
(void) llvm::createReassociatePass();
(void) llvm::createSCCPPass();
(void) llvm::createScalarReplAggregatesPass();
diff --git a/include/llvm/Support/StandardPasses.h b/include/llvm/Support/StandardPasses.h
index c71e6b94fa..611e786448 100644
--- a/include/llvm/Support/StandardPasses.h
+++ b/include/llvm/Support/StandardPasses.h
@@ -96,8 +96,6 @@ namespace llvm {
return;
}
- if (UnitAtATime)
- PM->add(createRaiseAllocationsPass()); // call %malloc -> malloc inst
PM->add(createCFGSimplificationPass()); // Clean up disgusting code
if (UnitAtATime) {
PM->add(createGlobalOptimizerPass()); // Optimize out global vars
diff --git a/include/llvm/Transforms/IPO.h b/include/llvm/Transforms/IPO.h
index 9189c430cb..5e17904422 100644
--- a/include/llvm/Transforms/IPO.h
+++ b/include/llvm/Transforms/IPO.h
@@ -69,13 +69,6 @@ ModulePass *createGlobalOptimizerPass();
//===----------------------------------------------------------------------===//
-/// createRaiseAllocationsPass - Return a new pass that transforms malloc and
-/// free function calls into malloc and free instructions.
-///
-ModulePass *createRaiseAllocationsPass();
-
-
-//===----------------------------------------------------------------------===//
/// createDeadTypeEliminationPass - Return a new pass that eliminates symbol
/// table entries for types that are never used.
///