diff options
author | Victor Hernandez <vhernandez@apple.com> | 2009-10-26 23:43:48 +0000 |
---|---|---|
committer | Victor Hernandez <vhernandez@apple.com> | 2009-10-26 23:43:48 +0000 |
commit | 046e78ce55a7c3d82b7b6758d2d77f2d99f970bf (patch) | |
tree | 1dad2445d3c6c08dc6d901e27806df980a7f855a /include/llvm | |
parent | dda9583e5194c08ddd409f3e1c211e17acd6d5b8 (diff) | |
download | external_llvm-046e78ce55a7c3d82b7b6758d2d77f2d99f970bf.zip external_llvm-046e78ce55a7c3d82b7b6758d2d77f2d99f970bf.tar.gz external_llvm-046e78ce55a7c3d82b7b6758d2d77f2d99f970bf.tar.bz2 |
Remove FreeInst.
Remove LowerAllocations pass.
Update some more passes to treate free calls just like they were treating FreeInst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85176 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/Analysis/AliasSetTracker.h | 3 | ||||
-rw-r--r-- | include/llvm/Analysis/MallocHelper.h | 5 | ||||
-rw-r--r-- | include/llvm/InstrTypes.h | 1 | ||||
-rw-r--r-- | include/llvm/Instruction.def | 71 | ||||
-rw-r--r-- | include/llvm/Instructions.h | 29 | ||||
-rw-r--r-- | include/llvm/LinkAllPasses.h | 1 | ||||
-rw-r--r-- | include/llvm/Support/IRBuilder.h | 3 | ||||
-rw-r--r-- | include/llvm/Support/InstVisitor.h | 1 | ||||
-rw-r--r-- | include/llvm/Transforms/Scalar.h | 9 |
9 files changed, 38 insertions, 85 deletions
diff --git a/include/llvm/Analysis/AliasSetTracker.h b/include/llvm/Analysis/AliasSetTracker.h index 239f30f..42a377e 100644 --- a/include/llvm/Analysis/AliasSetTracker.h +++ b/include/llvm/Analysis/AliasSetTracker.h @@ -29,7 +29,6 @@ namespace llvm { class AliasAnalysis; class LoadInst; class StoreInst; -class FreeInst; class VAArgInst; class AliasSetTracker; class AliasSet; @@ -298,7 +297,6 @@ public: bool add(Value *Ptr, unsigned Size); // Add a location bool add(LoadInst *LI); bool add(StoreInst *SI); - bool add(FreeInst *FI); bool add(VAArgInst *VAAI); bool add(CallSite CS); // Call/Invoke instructions bool add(CallInst *CI) { return add(CallSite(CI)); } @@ -313,7 +311,6 @@ public: bool remove(Value *Ptr, unsigned Size); // Remove a location bool remove(LoadInst *LI); bool remove(StoreInst *SI); - bool remove(FreeInst *FI); bool remove(VAArgInst *VAAI); bool remove(CallSite CS); bool remove(CallInst *CI) { return remove(CallSite(CI)); } diff --git a/include/llvm/Analysis/MallocHelper.h b/include/llvm/Analysis/MallocHelper.h index be307c0..22cf1b5 100644 --- a/include/llvm/Analysis/MallocHelper.h +++ b/include/llvm/Analysis/MallocHelper.h @@ -1,4 +1,4 @@ -//===- llvm/Analysis/MallocHelper.h ---- Identify malloc calls --*- C++ -*-===// +//===- llvm/Analysis/MallocFreeHelper.h - Identify malloc/free --*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -8,7 +8,8 @@ //===----------------------------------------------------------------------===// // // This family of functions identifies calls to malloc, bitcasts of malloc -// calls, and the types and array sizes associated with them. +// calls, and the types and array sizes associated with them. It also +// identifies calls to the free builtin. // //===----------------------------------------------------------------------===// diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h index 6b84857..e83acba 100644 --- a/include/llvm/InstrTypes.h +++ b/include/llvm/InstrTypes.h @@ -117,7 +117,6 @@ public: static inline bool classof(const UnaryInstruction *) { return true; } static inline bool classof(const Instruction *I) { return I->getOpcode() == Instruction::Alloca || - I->getOpcode() == Instruction::Free || I->getOpcode() == Instruction::Load || I->getOpcode() == Instruction::VAArg || I->getOpcode() == Instruction::ExtractValue || diff --git a/include/llvm/Instruction.def b/include/llvm/Instruction.def index 5c8fe3e..ec86b35 100644 --- a/include/llvm/Instruction.def +++ b/include/llvm/Instruction.def @@ -128,48 +128,47 @@ HANDLE_BINARY_INST(24, Xor , BinaryOperator) // Memory operators... FIRST_MEMORY_INST(25) -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) +HANDLE_MEMORY_INST(25, Alloca, AllocaInst) // Stack management +HANDLE_MEMORY_INST(26, Load , LoadInst ) // Memory manipulation instrs +HANDLE_MEMORY_INST(27, Store , StoreInst ) +HANDLE_MEMORY_INST(28, GetElementPtr, GetElementPtrInst) + LAST_MEMORY_INST(28) // Cast operators ... // NOTE: The order matters here because CastInst::isEliminableCastPair // NOTE: (see Instructions.cpp) encodes a table based on this ordering. - 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) + FIRST_CAST_INST(29) +HANDLE_CAST_INST(29, Trunc , TruncInst ) // Truncate integers +HANDLE_CAST_INST(30, ZExt , ZExtInst ) // Zero extend integers +HANDLE_CAST_INST(31, SExt , SExtInst ) // Sign extend integers +HANDLE_CAST_INST(32, FPToUI , FPToUIInst ) // floating point -> UInt +HANDLE_CAST_INST(33, FPToSI , FPToSIInst ) // floating point -> SInt +HANDLE_CAST_INST(34, UIToFP , UIToFPInst ) // UInt -> floating point +HANDLE_CAST_INST(35, SIToFP , SIToFPInst ) // SInt -> floating point +HANDLE_CAST_INST(36, FPTrunc , FPTruncInst ) // Truncate floating point +HANDLE_CAST_INST(37, FPExt , FPExtInst ) // Extend floating point +HANDLE_CAST_INST(38, PtrToInt, PtrToIntInst) // Pointer -> Integer +HANDLE_CAST_INST(39, IntToPtr, IntToPtrInst) // Integer -> Pointer +HANDLE_CAST_INST(40, BitCast , BitCastInst ) // Type cast + LAST_CAST_INST(40) // Other operators... - 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) + FIRST_OTHER_INST(41) +HANDLE_OTHER_INST(41, ICmp , ICmpInst ) // Integer comparison instruction +HANDLE_OTHER_INST(42, FCmp , FCmpInst ) // Floating point comparison instr. +HANDLE_OTHER_INST(43, PHI , PHINode ) // PHI node instruction +HANDLE_OTHER_INST(44, Call , CallInst ) // Call a function +HANDLE_OTHER_INST(45, Select , SelectInst ) // select instruction +HANDLE_OTHER_INST(46, UserOp1, Instruction) // May be used internally in a pass +HANDLE_OTHER_INST(47, UserOp2, Instruction) // Internal to passes only +HANDLE_OTHER_INST(48, VAArg , VAArgInst ) // vaarg instruction +HANDLE_OTHER_INST(49, ExtractElement, ExtractElementInst)// extract from vector +HANDLE_OTHER_INST(50, InsertElement, InsertElementInst) // insert into vector +HANDLE_OTHER_INST(51, ShuffleVector, ShuffleVectorInst) // shuffle two vectors. +HANDLE_OTHER_INST(52, ExtractValue, ExtractValueInst)// extract from aggregate +HANDLE_OTHER_INST(53, InsertValue, InsertValueInst) // insert into aggregate + + LAST_OTHER_INST(53) #undef FIRST_TERM_INST #undef HANDLE_TERM_INST diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index 1e2c93f..7cb6786 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -104,35 +104,6 @@ public: //===----------------------------------------------------------------------===// -// FreeInst Class -//===----------------------------------------------------------------------===// - -/// FreeInst - an instruction to deallocate memory -/// -class FreeInst : public UnaryInstruction { - void AssertOK(); -public: - explicit FreeInst(Value *Ptr, Instruction *InsertBefore = 0); - FreeInst(Value *Ptr, BasicBlock *InsertAfter); - - virtual FreeInst *clone() const; - - // Accessor methods for consistency with other memory operations - Value *getPointerOperand() { return getOperand(0); } - const Value *getPointerOperand() const { return getOperand(0); } - - // Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const FreeInst *) { return true; } - static inline bool classof(const Instruction *I) { - return (I->getOpcode() == Instruction::Free); - } - static inline bool classof(const Value *V) { - return isa<Instruction>(V) && classof(cast<Instruction>(V)); - } -}; - - -//===----------------------------------------------------------------------===// // LoadInst Class //===----------------------------------------------------------------------===// diff --git a/include/llvm/LinkAllPasses.h b/include/llvm/LinkAllPasses.h index bc5722e..28538b7 100644 --- a/include/llvm/LinkAllPasses.h +++ b/include/llvm/LinkAllPasses.h @@ -91,7 +91,6 @@ namespace { (void) llvm::createLoopUnswitchPass(); (void) llvm::createLoopRotatePass(); (void) llvm::createLoopIndexSplitPass(); - (void) llvm::createLowerAllocationsPass(); (void) llvm::createLowerInvokePass(); (void) llvm::createLowerSetJmpPass(); (void) llvm::createLowerSwitchPass(); diff --git a/include/llvm/Support/IRBuilder.h b/include/llvm/Support/IRBuilder.h index 83df9ed..84bfd09 100644 --- a/include/llvm/Support/IRBuilder.h +++ b/include/llvm/Support/IRBuilder.h @@ -433,9 +433,6 @@ public: const Twine &Name = "") { return Insert(new AllocaInst(Ty, ArraySize), Name); } - FreeInst *CreateFree(Value *Ptr) { - return Insert(new FreeInst(Ptr)); - } // Provided to resolve 'CreateLoad(Ptr, "...")' correctly, instead of // converting the string to 'bool' for the isVolatile parameter. LoadInst *CreateLoad(Value *Ptr, const char *Name) { diff --git a/include/llvm/Support/InstVisitor.h b/include/llvm/Support/InstVisitor.h index 1e34e66..ae35a3c 100644 --- a/include/llvm/Support/InstVisitor.h +++ b/include/llvm/Support/InstVisitor.h @@ -166,7 +166,6 @@ public: RetTy visitICmpInst(ICmpInst &I) { DELEGATE(CmpInst);} RetTy visitFCmpInst(FCmpInst &I) { DELEGATE(CmpInst);} RetTy visitAllocaInst(AllocaInst &I) { DELEGATE(Instruction); } - RetTy visitFreeInst(FreeInst &I) { DELEGATE(Instruction); } RetTy visitLoadInst(LoadInst &I) { DELEGATE(Instruction); } RetTy visitStoreInst(StoreInst &I) { DELEGATE(Instruction); } RetTy visitGetElementPtrInst(GetElementPtrInst &I){ DELEGATE(Instruction); } diff --git a/include/llvm/Transforms/Scalar.h b/include/llvm/Transforms/Scalar.h index c537899..f700c49 100644 --- a/include/llvm/Transforms/Scalar.h +++ b/include/llvm/Transforms/Scalar.h @@ -225,15 +225,6 @@ extern const PassInfo *const LoopSimplifyID; //===----------------------------------------------------------------------===// // -// LowerAllocations - Turn free instructions into @free calls. -// -// AU.addRequiredID(LowerAllocationsID); -// -Pass *createLowerAllocationsPass(); -extern const PassInfo *const LowerAllocationsID; - -//===----------------------------------------------------------------------===// -// // TailCallElimination - This pass eliminates call instructions to the current // function which occur immediately before return instructions. // |