Changes in directory llvm-poolalloc/lib/PoolAllocate:
AccessTrace.cpp updated: 1.9 -> 1.10 Heuristic.cpp updated: 1.17 -> 1.18 PointerCompress.cpp updated: 1.76 -> 1.77 PoolAllocate.cpp updated: 1.133 -> 1.134 PoolOptimize.cpp updated: 1.11 -> 1.12 TransformFunctionBody.cpp updated: 1.61 -> 1.62 --- Log message: unbitrot this, it might even still work, who knows --- Diffs of the changes: (+68 -99) AccessTrace.cpp | 6 ++-- Heuristic.cpp | 4 +- PointerCompress.cpp | 64 ++++++++++++++++------------------------------ PoolAllocate.cpp | 29 ++++++++++---------- PoolOptimize.cpp | 29 +++++++------------- TransformFunctionBody.cpp | 35 +++++++++++-------------- 6 files changed, 68 insertions(+), 99 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp diff -u llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp:1.9 llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp:1.10 --- llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp:1.9 Wed Jan 10 14:44:31 2007 +++ llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp Wed Apr 11 12:27:53 2007 @@ -100,14 +100,14 @@ // Create the function prototypes for runtime library. InitializeLibraryFunctions(M); - Function *MainFunc = M.getMainFunction(); - if (MainFunc && !MainFunc->isExternal()) + Function *MainFunc = M.getFunction("main"); + if (MainFunc && !MainFunc->isDeclaration()) // Insert a call to the library init function into the beginning of main. new CallInst(AccessTraceInitFn, "", MainFunc->begin()->begin()); // Look at all of the loads in the program. for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { - if (F->isExternal()) continue; + if (F->isDeclaration()) continue; PA::FuncInfo *FI = PoolAlloc->getFuncInfoOrClone(*F); assert(FI && "DIDN'T FIND POOL INFO!"); Index: llvm-poolalloc/lib/PoolAllocate/Heuristic.cpp diff -u llvm-poolalloc/lib/PoolAllocate/Heuristic.cpp:1.17 llvm-poolalloc/lib/PoolAllocate/Heuristic.cpp:1.18 --- llvm-poolalloc/lib/PoolAllocate/Heuristic.cpp:1.17 Wed Jan 10 14:44:31 2007 +++ llvm-poolalloc/lib/PoolAllocate/Heuristic.cpp Wed Apr 11 12:27:53 2007 @@ -74,7 +74,7 @@ // If we are on a 64-bit system, we want to align 8-byte integers and // pointers. - if (TD.getTypeAlignment(Ty) == 8) + if (TD.getPrefTypeAlignment(Ty) == 8) return true; } @@ -85,7 +85,7 @@ const StructLayout *SL = TD.getStructLayout(STy); for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { if (Wants8ByteAlignment(STy->getElementType(i), - Offs+SL->MemberOffsets[i], TD)) + Offs+SL->getElementOffset(i), TD)) return true; } } else if (const SequentialType *STy = dyn_cast<SequentialType>(Ty)) { Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.76 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.77 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.76 Wed Jan 10 14:44:31 2007 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Wed Apr 11 12:27:53 2007 @@ -263,7 +263,7 @@ for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) Elements.push_back(ComputeCompressedType(STy->getElementType(i), - NodeOffset+SL->MemberOffsets[i], + NodeOffset+SL->getElementOffset(i), Nodes)); return StructType::get(Elements); } else if (const ArrayType *ATy = dyn_cast<ArrayType>(OrigTy)) { @@ -707,7 +707,7 @@ uint64_t Field = (unsigned)cast<ConstantInt>(Idx)->getZExtValue(); if (Field) { uint64_t FieldOffs = TD.getStructLayout(cast<StructType>(NTy)) - ->MemberOffsets[Field]; + ->getElementOffset(Field); Constant *FieldOffsCst = ConstantInt::get(SCALARUINTTYPE, FieldOffs); Val = BinaryOperator::createAdd(Val, FieldOffsCst, GEPI.getName(), &GEPI); @@ -765,10 +765,9 @@ Value *BasePtr = SrcPI->EmitPoolBaseLoad(LI); // Get the pointer to load from. - std::vector<Value*> Ops; - Ops.push_back(getTransformedValue(LI.getOperand(0))); - if (Ops[0]->getType() == Type::Int16Ty) - Ops[0] = CastInst::createZExtOrBitCast(Ops[0], Type::Int32Ty, "extend_idx", &LI); + Value* Ops = getTransformedValue(LI.getOperand(0)); + if (Ops->getType() == Type::Int16Ty) + Ops = CastInst::createZExtOrBitCast(Ops, Type::Int32Ty, "extend_idx", &LI); Value *SrcPtr = new GetElementPtrInst(BasePtr, Ops, LI.getOperand(0)->getName()+".pp", &LI); const Type *DestTy = LoadingCompressedPtr ? MEMUINTTYPE : LI.getType(); @@ -831,10 +830,9 @@ Value *BasePtr = DestPI->EmitPoolBaseLoad(SI); // Get the pointer to store to. - std::vector<Value*> Ops; - Ops.push_back(getTransformedValue(SI.getOperand(1))); - if (Ops[0]->getType() == Type::Int16Ty) - Ops[0] = CastInst::createZExtOrBitCast(Ops[0], Type::Int32Ty, "extend_idx", &SI); + Value* Ops = getTransformedValue(SI.getOperand(1)); + if (Ops->getType() == Type::Int16Ty) + Ops = CastInst::createZExtOrBitCast(Ops, Type::Int32Ty, "extend_idx", &SI); Value *DestPtr = new GetElementPtrInst(BasePtr, Ops, SI.getOperand(1)->getName()+".pp", @@ -866,7 +864,7 @@ Ops.push_back(ConstantInt::get(Type::Int32Ty, PA::Heuristic::getRecommendedAlignment(PI->getNewType(), TD))); // TODO: Compression could reduce the alignment restriction for the pool! - Value *PB = new CallInst(PtrComp.PoolInitPC, Ops, "", &CI); + Value *PB = new CallInst(PtrComp.PoolInitPC, &Ops[0], Ops.size(), "", &CI); if (!DisablePoolBaseASR) { // Load the pool base immediately. PB->setName(CI.getOperand(1)->getName()+".poolbase"); @@ -883,9 +881,7 @@ const CompressedPoolInfo *PI = getPoolInfoForPoolDesc(CI.getOperand(1)); if (PI == 0) return; // Pool isn't compressed. - std::vector<Value*> Ops; - Ops.push_back(CI.getOperand(1)); - new CallInst(PtrComp.PoolDestroyPC, Ops, "", &CI); + new CallInst(PtrComp.PoolDestroyPC, CI.getOperand(1), "", &CI); CI.eraseFromParent(); } @@ -893,9 +889,6 @@ const CompressedPoolInfo *PI = getPoolInfo(&CI); if (PI == 0) return; // Pool isn't compressed. - std::vector<Value*> Ops; - Ops.push_back(CI.getOperand(1)); // PD - Value *Size = CI.getOperand(2); // If there was a recommended size, shrink it down now. @@ -913,8 +906,7 @@ Size = BinaryOperator::createMul(Size, NewSize, "newbytes", &CI); } - Ops.push_back(Size); - Value *NC = new CallInst(PtrComp.PoolAllocPC, Ops, CI.getName(), &CI); + Value *NC = new CallInst(PtrComp.PoolAllocPC, CI.getOperand(1), Size, CI.getName(), &CI); setTransformedValue(CI, NC); } @@ -953,7 +945,7 @@ // Indirect call: you CAN'T passed compress pointers in. Don't even think // about it. return; - } else if (Callee->isExternal()) { + } else if (Callee->isDeclaration()) { // We don't have a DSG for the callee in this case. Assume that things will // work out if we pass compressed pointers. std::vector<Value*> Operands; @@ -969,10 +961,8 @@ return; } else if (Callee->getName() == "read") { if (const CompressedPoolInfo *DestPI = getPoolInfo(CI.getOperand(2))) { - std::vector<Value*> Ops; - Ops.push_back(getTransformedValue(CI.getOperand(2))); Value *BasePtr = DestPI->EmitPoolBaseLoad(CI); - Value *SrcPtr = new GetElementPtrInst(BasePtr, Ops, + Value *SrcPtr = new GetElementPtrInst(BasePtr, getTransformedValue(CI.getOperand(2)), CI.getOperand(2)->getName()+".pp", &CI); SrcPtr = CastInst::createPointerCast(SrcPtr, CI.getOperand(2)->getType(), "", &CI); CI.setOperand(2, SrcPtr); @@ -980,10 +970,8 @@ } } else if (Callee->getName() == "fwrite") { if (const CompressedPoolInfo *DestPI = getPoolInfo(CI.getOperand(1))) { - std::vector<Value*> Ops; - Ops.push_back(getTransformedValue(CI.getOperand(1))); Value *BasePtr = DestPI->EmitPoolBaseLoad(CI); - Value *SrcPtr = new GetElementPtrInst(BasePtr, Ops, + Value *SrcPtr = new GetElementPtrInst(BasePtr, getTransformedValue(CI.getOperand(1)), CI.getOperand(1)->getName()+".pp", &CI); SrcPtr = CastInst::createPointerCast(SrcPtr, CI.getOperand(1)->getType(), "", &CI); CI.setOperand(1, SrcPtr); @@ -993,10 +981,8 @@ Callee->getName() == "llvm.memset.i32" || Callee->getName() == "llvm.memset.i64") { if (const CompressedPoolInfo *DestPI = getPoolInfo(CI.getOperand(1))) { - std::vector<Value*> Ops; - Ops.push_back(getTransformedValue(CI.getOperand(1))); Value *BasePtr = DestPI->EmitPoolBaseLoad(CI); - Value *SrcPtr = new GetElementPtrInst(BasePtr, Ops, + Value *SrcPtr = new GetElementPtrInst(BasePtr, getTransformedValue(CI.getOperand(1)), CI.getOperand(1)->getName()+".pp", &CI); SrcPtr = CastInst::createPointerCast(SrcPtr, CI.getOperand(1)->getType(), "", &CI); CI.setOperand(1, SrcPtr); @@ -1007,20 +993,16 @@ Callee->getName() == "llvm.memcpy.i64") { bool doret = false; if (const CompressedPoolInfo *DestPI = getPoolInfo(CI.getOperand(1))) { - std::vector<Value*> Ops; - Ops.push_back(getTransformedValue(CI.getOperand(1))); Value *BasePtr = DestPI->EmitPoolBaseLoad(CI); - Value *SrcPtr = new GetElementPtrInst(BasePtr, Ops, + Value *SrcPtr = new GetElementPtrInst(BasePtr, getTransformedValue(CI.getOperand(1)), CI.getOperand(1)->getName()+".pp", &CI); SrcPtr = CastInst::createPointerCast(SrcPtr, CI.getOperand(1)->getType(), "", &CI); CI.setOperand(1, SrcPtr); doret = true; } if (const CompressedPoolInfo *DestPI = getPoolInfo(CI.getOperand(2))) { - std::vector<Value*> Ops; - Ops.push_back(getTransformedValue(CI.getOperand(2))); Value *BasePtr = DestPI->EmitPoolBaseLoad(CI); - Value *SrcPtr = new GetElementPtrInst(BasePtr, Ops, + Value *SrcPtr = new GetElementPtrInst(BasePtr, getTransformedValue(CI.getOperand(2)), CI.getOperand(2)->getName()+".pp", &CI); SrcPtr = CastInst::createPointerCast(SrcPtr, CI.getOperand(2)->getType(), "", &CI); CI.setOperand(2, SrcPtr); @@ -1049,7 +1031,7 @@ } Function *Clone = PtrComp.GetExtFunctionClone(Callee, CompressedArgs); - Value *NC = new CallInst(Clone, Operands, CI.getName(), &CI); + Value *NC = new CallInst(Clone, &Operands[0], Operands.size(), CI.getName(), &CI); if (NC->getType() != CI.getType()) // Compressing return value? setTransformedValue(CI, NC); else { @@ -1126,7 +1108,7 @@ else Operands.push_back(CI.getOperand(i)); - Value *NC = new CallInst(Clone, Operands, CI.getName(), &CI); + Value *NC = new CallInst(Clone, &Operands[0], Operands.size(), CI.getName(), &CI); if (NC->getType() != CI.getType()) // Compressing return value? setTransformedValue(CI, NC); else { @@ -1245,7 +1227,7 @@ CompressPoolsInFunction(Function &F, std::vector<std::pair<Value*, Value*> > *PremappedVals, std::set<const DSNode*> *ExternalPoolsToCompress){ - if (F.isExternal()) return false; + if (F.isDeclaration()) return false; // If this is a pointer compressed clone of a pool allocated function, get the // the pool allocated function. Rewriting a clone means that there are @@ -1423,12 +1405,12 @@ std::cerr << " CLONING FUNCTION: " << F->getName() << " -> " << Clone->getName() << "\n"; - if (F->isExternal()) { + if (F->isDeclaration()) { Clone->setLinkage(GlobalValue::ExternalLinkage); return Clone; } - std::map<const Value*, Value*> ValueMap; + DenseMap<const Value*, Value*> ValueMap; // Create dummy Value*'s of pointer type for any arguments that are // compressed. These are needed to satisfy typing constraints before the @@ -1462,7 +1444,7 @@ // Invert the ValueMap into the NewToOldValueMap std::map<Value*, const Value*> &NewToOldValueMap = CFI.NewToOldValueMap; - for (std::map<const Value*, Value*>::iterator I = ValueMap.begin(), + for (DenseMap<const Value*, Value*>::iterator I = ValueMap.begin(), E = ValueMap.end(); I != E; ++I) NewToOldValueMap.insert(std::make_pair(I->second, I->first)); Index: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.133 llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.134 --- llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.133 Mon Jan 22 10:41:10 2007 +++ llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp Wed Apr 11 12:27:53 2007 @@ -128,7 +128,7 @@ // Loop over the functions in the original program finding the pool desc. // arguments necessary for each function that is indirectly callable. for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (!I->isExternal() && ECGraphs->ContainsDSGraphFor(*I)) + if (!I->isDeclaration() && ECGraphs->ContainsDSGraphFor(*I)) FindFunctionPoolArgs(*I); std::map<Function*, Function*> FuncMap; @@ -140,7 +140,7 @@ std::set<Function*> ClonedFunctions; {TIME_REGION(X, "MakeFunctionClone"); for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (!I->isExternal() && !ClonedFunctions.count(I) && + if (!I->isDeclaration() && !ClonedFunctions.count(I) && ECGraphs->ContainsDSGraphFor(*I)) if (Function *Clone = MakeFunctionClone(*I)) { FuncMap[I] = Clone; @@ -152,7 +152,7 @@ // clones. {TIME_REGION(X, "ProcessFunctionBody"); for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (!I->isExternal() && !ClonedFunctions.count(I) && + if (!I->isDeclaration() && !ClonedFunctions.count(I) && ECGraphs->ContainsDSGraphFor(*I)) { std::map<Function*, Function*>::iterator FI = FuncMap.find(I); ProcessFunctionBody(*I, FI != FuncMap.end() ? *FI->second : *I); @@ -409,9 +409,9 @@ // Map the existing arguments of the old function to the corresponding // arguments of the new function, and copy over the names. #ifdef SAFECODE - std::map<const Value*, Value*> &ValueMap = FI.ValueMap; + DenseMap<const Value*, Value*> &ValueMap = FI.ValueMap; #else - std::map<const Value*, Value*> ValueMap; + DenseMap<const Value*, Value*> ValueMap; #endif for (Function::arg_iterator I = F.arg_begin(); NI != New->arg_end(); ++I, ++NI) { @@ -427,7 +427,7 @@ // Invert the ValueMap into the NewToOldValueMap std::map<Value*, const Value*> &NewToOldValueMap = FI.NewToOldValueMap; - for (std::map<const Value*, Value*>::iterator I = ValueMap.begin(), + for (DenseMap<const Value*, Value*>::iterator I = ValueMap.begin(), E = ValueMap.end(); I != E; ++I) NewToOldValueMap.insert(std::make_pair(I->second, I->first)); return FI.Clone = New; @@ -469,8 +469,8 @@ } // Otherwise get the main function to insert the poolinit calls. - Function *MainFunc = M.getMainFunction(); - if (MainFunc == 0 || MainFunc->isExternal()) { + Function *MainFunc = M.getFunction("main"); + if (MainFunc == 0 || MainFunc->isDeclaration()) { std::cerr << "Cannot pool allocate this program: it has global " << "pools but no 'main' function yet!\n"; return true; @@ -532,7 +532,7 @@ DSNode *GNode = ECGraphs->getGlobalsGraph().addObjectToGraph(GV); GNode->setModifiedMarker()->setReadMarker(); - Function *MainFunc = CurModule->getMainFunction(); + Function *MainFunc = CurModule->getFunction("main"); assert(MainFunc && "No main in program??"); BasicBlock::iterator InsertPt; @@ -545,8 +545,8 @@ Value *ElSize = ConstantInt::get(Type::Int32Ty, RecSize); Value *AlignV = ConstantInt::get(Type::Int32Ty, Align); - new CallInst(PoolInit, make_vector((Value*)GV, ElSize, AlignV, 0), - "", InsertPt); + Value* Opts[3] = {GV, ElSize, AlignV}; + new CallInst(PoolInit, &Opts[0], 3, "", InsertPt); ++NumPools; return GV; } @@ -886,8 +886,8 @@ Value *Align = ConstantInt::get(Type::Int32Ty, AlignV); for (unsigned i = 0, e = PoolInitPoints.size(); i != e; ++i) { - new CallInst(PoolInit, make_vector((Value*)PD, ElSize, Align, 0), - "", PoolInitPoints[i]); + Value* Opts[3] = {PD, ElSize, Align}; + new CallInst(PoolInit, &Opts[0], 3, "", PoolInitPoints[i]); DEBUG(std::cerr << PoolInitPoints[i]->getParent()->getName() << " "); } @@ -896,8 +896,7 @@ // Loop over all of the places to insert pooldestroy's... for (unsigned i = 0, e = PoolDestroyPoints.size(); i != e; ++i) { // Insert the pooldestroy call for this pool. - new CallInst(PoolDestroy, make_vector((Value*)PD, 0), "", - PoolDestroyPoints[i]); + new CallInst(PoolDestroy, PD, "", PoolDestroyPoints[i]); DEBUG(std::cerr << PoolDestroyPoints[i]->getParent()->getName()<<" "); } DEBUG(std::cerr << "\n\n"); Index: llvm-poolalloc/lib/PoolAllocate/PoolOptimize.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PoolOptimize.cpp:1.11 llvm-poolalloc/lib/PoolAllocate/PoolOptimize.cpp:1.12 --- llvm-poolalloc/lib/PoolAllocate/PoolOptimize.cpp:1.11 Wed Jan 10 14:44:32 2007 +++ llvm-poolalloc/lib/PoolAllocate/PoolOptimize.cpp Wed Apr 11 12:27:53 2007 @@ -18,6 +18,7 @@ #include "llvm/Module.h" #include "llvm/ADT/Statistic.h" #include "llvm/Support/Debug.h" +#include <set> using namespace llvm; namespace { @@ -108,27 +109,20 @@ CallInst *CI = Calls[i]; // poolrealloc(PD, null, X) -> poolalloc(PD, X) if (isa<ConstantPointerNull>(CI->getOperand(2))) { - std::vector<Value*> Ops; - Ops.push_back(CI->getOperand(1)); - Ops.push_back(CI->getOperand(3)); - Value *New = new CallInst(PoolAlloc, Ops, CI->getName(), CI); + Value *New = new CallInst(PoolAlloc, CI->getOperand(1), CI->getOperand(3), + CI->getName(), CI); CI->replaceAllUsesWith(New); CI->eraseFromParent(); } else if (isa<Constant>(CI->getOperand(3)) && cast<Constant>(CI->getOperand(3))->isNullValue()) { // poolrealloc(PD, X, 0) -> poolfree(PD, X) - std::vector<Value*> Ops; - Ops.push_back(CI->getOperand(1)); - Ops.push_back(CI->getOperand(2)); - new CallInst(PoolFree, Ops, "", CI); + new CallInst(PoolFree, CI->getOperand(1), CI->getOperand(2), "", CI); CI->replaceAllUsesWith(Constant::getNullValue(CI->getType())); CI->eraseFromParent(); } else if (isa<ConstantPointerNull>(CI->getOperand(1))) { // poolrealloc(null, X, Y) -> realloc(X, Y) - std::vector<Value*> Ops; - Ops.push_back(CI->getOperand(2)); - Ops.push_back(CI->getOperand(3)); - Value *New = new CallInst(Realloc, Ops, CI->getName(), CI); + Value *New = new CallInst(Realloc, CI->getOperand(2), CI->getOperand(3), + CI->getName(), CI); CI->replaceAllUsesWith(New); CI->eraseFromParent(); } @@ -154,10 +148,7 @@ CallInst *CI = Calls[i]; // poolmemalign(null, X, Y) -> memalign(X, Y) if (isa<ConstantPointerNull>(CI->getOperand(1))) { - std::vector<Value*> Ops; - Ops.push_back(CI->getOperand(2)); - Ops.push_back(CI->getOperand(3)); - Value *New = new CallInst(MemAlign, Ops, CI->getName(), CI); + Value *New = new CallInst(MemAlign, CI->getOperand(2), CI->getOperand(3), CI->getName(), CI); CI->replaceAllUsesWith(New); CI->eraseFromParent(); } @@ -228,18 +219,18 @@ std::vector<Value*> Args; if (CI->getCalledFunction() == PoolAlloc) { Args.assign(CI->op_begin()+1, CI->op_end()); - Value *New = new CallInst(PoolAllocBP, Args, CI->getName(), CI); + Value *New = new CallInst(PoolAllocBP, &Args[0], Args.size(), CI->getName(), CI); CI->replaceAllUsesWith(New); CI->eraseFromParent(); } else if (CI->getCalledFunction() == PoolInit) { Args.assign(CI->op_begin()+1, CI->op_end()); Args.erase(Args.begin()+1); // Drop the size argument. - new CallInst(PoolInitBP, Args, "", CI); + new CallInst(PoolInitBP, &Args[0], Args.size(), "", CI); CI->eraseFromParent(); } else { assert(CI->getCalledFunction() == PoolDestroy); Args.assign(CI->op_begin()+1, CI->op_end()); - new CallInst(PoolDestroyBP, Args, "", CI); + new CallInst(PoolDestroyBP, &Args[0], Args.size(), "", CI); CI->eraseFromParent(); } } Index: llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp diff -u llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.61 llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.62 --- llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.61 Wed Jan 10 14:44:32 2007 +++ llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp Wed Apr 11 12:27:53 2007 @@ -155,8 +155,7 @@ // Insert a call to poolalloc Value *PH = getPoolHandle(I); - Instruction *V = new CallInst(PAInfo.PoolAlloc, make_vector(PH, Size, 0), - Name, I); + Instruction *V = new CallInst(PAInfo.PoolAlloc, PH, Size, Name, I); AddPoolUse(*V, PH, PoolUses); @@ -269,8 +268,7 @@ G.getScalarMap()[Casted] = G.getScalarMap()[Arg]; } - CallInst *FreeI = new CallInst(PAInfo.PoolFree, make_vector(PH, Casted, 0), - "", Where); + CallInst *FreeI = new CallInst(PAInfo.PoolFree, PH, Casted, "", Where); AddPoolUse(*FreeI, PH, PoolFrees); return FreeI; } @@ -329,9 +327,9 @@ BBI); // We know that the memory returned by poolalloc is at least 4 byte aligned. - new CallInst(MemSet, make_vector(Ptr, ConstantInt::get(Type::Int8Ty, 0), - V2, ConstantInt::get(Type::Int32Ty, 4), 0), - "", BBI); + Value* Opts[4] = {Ptr, ConstantInt::get(Type::Int8Ty, 0), + V2, ConstantInt::get(Type::Int32Ty, 4)}; + new CallInst(MemSet, Opts, 4, "", BBI); } @@ -350,9 +348,8 @@ OldPtr = CastInst::createPointerCast(OldPtr, VoidPtrTy, OldPtr->getName(), I); std::string Name = I->getName(); I->setName(""); - Instruction *V = new CallInst(PAInfo.PoolRealloc, make_vector(PH, OldPtr, - Size, 0), - Name, I); + Value* Opts[3] = {PH, OldPtr, Size}; + Instruction *V = new CallInst(PAInfo.PoolRealloc, Opts, 3, Name, I); Instruction *Casted = V; if (V->getType() != I->getType()) Casted = CastInst::createPointerCast(V, I->getType(), V->getName(), I); @@ -419,8 +416,8 @@ Size = CastInst::createZExtOrBitCast(Size, Type::Int32Ty, Size->getName(), I); std::string Name = I->getName(); I->setName(""); - Instruction *V = new CallInst(PAInfo.PoolMemAlign, - make_vector(PH, Align, Size, 0), Name, I); + Value* Opts[3] = {PH, Align, Size}; + Instruction *V = new CallInst(PAInfo.PoolMemAlign, Opts, 3, Name, I); Instruction *Casted = V; if (V->getType() != I->getType()) @@ -471,7 +468,7 @@ // If this function is one of the memory manipulating functions built into // libc, emulate it with pool calls as appropriate. - if (CF && CF->isExternal()) + if (CF && CF->isDeclaration()) if (CF->getName() == "calloc") { visitCallocCall(CS); return; @@ -581,7 +578,7 @@ EquivClassGraphs::callee_iterator I = ECGraphs.callee_begin(OrigInst), E = ECGraphs.callee_end(OrigInst); for (; I != E; ++I) - if (!I->second->isExternal()) + if (!I->second->isDeclaration()) assert(CalleeGraph == &ECGraphs.getDSGraph(*I->second) && "Callees at call site do not have a common graph!"); #endif @@ -655,9 +652,9 @@ ArgVal = new AllocaInst(ArrayType::get(VoidPtrTy, 16), 0, "PD", InsertPt); Value *ElSize = ConstantInt::get(Type::Int32Ty,0); Value *Align = ConstantInt::get(Type::Int32Ty,0); - new CallInst(PAInfo.PoolInit, make_vector(ArgVal, ElSize, Align, 0),"", TheCall); - new CallInst(PAInfo.PoolDestroy, make_vector(ArgVal, 0), "", - TheCall->getNext()); + Value* Opts[3] = {ArgVal, ElSize, Align}; + new CallInst(PAInfo.PoolInit, Opts, 3,"", TheCall); + new CallInst(PAInfo.PoolDestroy, ArgVal, "", TheCall->getNext()); } //probably need to update DSG // std::cerr << "WARNING: NULL POOL ARGUMENTS ARE PASSED IN!\n"; @@ -675,9 +672,9 @@ if (InvokeInst *II = dyn_cast<InvokeInst>(TheCall)) { NewCall = new InvokeInst(NewCallee, II->getNormalDest(), - II->getUnwindDest(), Args, Name, TheCall); + II->getUnwindDest(), &Args[0], Args.size(), Name, TheCall); } else { - NewCall = new CallInst(NewCallee, Args, Name, TheCall); + NewCall = new CallInst(NewCallee, &Args[0], Args.size(), Name, TheCall); } // Add all of the uses of the pool descriptor _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits