llvm.org GIT mirror llvm / 350c0a8
Minor cleanups git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5863 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 17 years ago
1 changed file(s) with 6 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
1313 #include "llvm/Pass.h"
1414 #include "llvm/Target/TargetData.h"
1515 #include "Support/Statistic.h"
16
17 using std::vector;
1816
1917 namespace {
2018 Statistic<> NumLowered("lowerallocs", "Number of allocations lowered");
6159 bool LowerAllocations::doInitialization(Module &M) {
6260 const FunctionType *MallocType =
6361 FunctionType::get(PointerType::get(Type::SByteTy),
64 vector(1, Type::UIntTy), false);
62 std::vector(1, Type::UIntTy), false);
6563 const FunctionType *FreeType =
6664 FunctionType::get(Type::VoidTy,
67 vector(1, PointerType::get(Type::SByteTy)),
65 std::vector(1,
66 PointerType::get(Type::SByteTy)),
6867 false);
6968
7069 MallocFunc = M.getOrInsertFunction("malloc", MallocType);
104103
105104 // Create the call to Malloc...
106105 CallInst *MCall = new CallInst(MallocFunc,
107 vector(1, MallocArg), "", I);
106 std::vector(1, MallocArg), "", I);
108107
109108 // Create a cast instruction to convert to the right type...
110109 CastInst *MCast = new CastInst(MCall, MI->getType(), "", I);
120119 PointerType::get(Type::UByteTy), "", I);
121120
122121 // Insert a call to the free function...
123 CallInst *FCall = new CallInst(FreeFunc, vector(1, MCast), "", I);
122 CallInst *FCall = new CallInst(FreeFunc, std::vector(1, MCast),
123 "", I);
124124
125125 // Delete the old free instruction
126126 I = --BBIL.erase(I);