[llvm-commits] [poolalloc] r78618 - in /poolalloc/trunk/lib: AssistDS/FuncSpec.cpp DSA/DataStructure.cpp PoolAllocate/Heuristic.cpp PoolAllocate/PAMultipleGlobalPool.cpp PoolAllocate/PASimple.cpp PoolAllocate/PointerCompress.cpp PoolAllocate/PoolAllocate.cpp PoolAllocate/TransformFunctionBody.cpp
Andrew Lenharth
alenhar2 at cs.uiuc.edu
Mon Aug 10 16:41:00 PDT 2009
Author: alenhar2
Date: Mon Aug 10 18:41:00 2009
New Revision: 78618
URL: http://llvm.org/viewvc/llvm-project?rev=78618&view=rev
Log:
bring up to API
Modified:
poolalloc/trunk/lib/AssistDS/FuncSpec.cpp
poolalloc/trunk/lib/DSA/DataStructure.cpp
poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp
poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp
poolalloc/trunk/lib/PoolAllocate/PASimple.cpp
poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp
poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp
Modified: poolalloc/trunk/lib/AssistDS/FuncSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/FuncSpec.cpp?rev=78618&r1=78617&r2=78618&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/FuncSpec.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/FuncSpec.cpp Mon Aug 10 18:41:00 2009
@@ -40,11 +40,11 @@
if (const PointerType* Ty = dyn_cast<PointerType>(ii->getType())) {
if (isa<FunctionType>(Ty->getElementType())) {
FPArgs.push_back(ii->getArgNo());
- cerr << "Eligable: " << I->getName() << "\n";
+ cerr << "Eligable: " << I->getNameStr() << "\n";
}
} else if (isa<FunctionType>(ii->getType())) {
FPArgs.push_back(ii->getArgNo());
- cerr << "Eligable: " << I->getName() << "\n";
+ cerr << "Eligable: " << I->getNameStr() << "\n";
}
for(Value::use_iterator ui = I->use_begin(), ue = I->use_end();
ui != ue; ++ui)
@@ -66,7 +66,7 @@
for (std::map<std::pair<Function*, std::vector<std::pair<unsigned, Constant*> > >, Function* >::iterator I = toClone.begin(), E = toClone.end(); I != E; ++I) {
Function* DirectF = CloneFunction(I->first.first);
- DirectF->setName(I->first.first->getName() + "_SPEC");
+ DirectF->setName(I->first.first->getNameStr() + "_SPEC");
DirectF->setLinkage(GlobalValue::InternalLinkage);
I->first.first->getParent()->getFunctionList().push_back(DirectF);
I->second = DirectF;
Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=78618&r1=78617&r2=78618&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructure.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructure.cpp Mon Aug 10 18:41:00 2009
@@ -586,7 +586,7 @@
STy = cast<StructType>(NewTy);
nt.insert(nt.end(), STy->element_begin(), STy->element_end());
//and merge
- STy = StructType::get(nt);
+ STy = StructType::get(STy->getContext(), nt);
DOUT << "Trying with: " << *STy << "\n";
return mergeTypeInfo(STy, 0);
}
@@ -610,7 +610,7 @@
nt.push_back(STy->getElementType(x));
nt.push_back(NewTy);
//and merge
- STy = StructType::get(nt);
+ STy = StructType::get(STy->getContext(), nt);
DOUT << "Trying with: " << *STy << "\n";
return mergeTypeInfo(STy, 0);
}
Modified: poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp?rev=78618&r1=78617&r2=78618&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp Mon Aug 10 18:41:00 2009
@@ -441,7 +441,7 @@
if (!NullGlobal) {
Module *M = I->getParent()->getParent()->getParent();
const Type * PoolTy = PoolAllocate::PoolDescPtrTy;
- Constant * Init = getGlobalContext().getConstantAggregateZero (PoolTy);
+ Constant * Init = ConstantAggregateZero::get(PoolTy);
NullGlobal = new GlobalVariable(*M,
PoolAllocate::PoolDescPtrTy, false,
GlobalValue::ExternalLinkage,
Modified: poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp?rev=78618&r1=78617&r2=78618&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp Mon Aug 10 18:41:00 2009
@@ -141,16 +141,16 @@
Value * AllocSize;
if (MI->isArrayAllocation()) {
Value * NumElements = MI->getArraySize();
- Value * ElementSize = getGlobalContext().getConstantInt (Type::Int32Ty,
- TD.getTypeAllocSize(MI->getAllocatedType()));
+ Value * ElementSize = ConstantInt::get(Type::Int32Ty,
+ TD.getTypeAllocSize(MI->getAllocatedType()));
AllocSize = BinaryOperator::Create (Instruction::Mul,
ElementSize,
NumElements,
"sizetmp",
MI);
} else {
- AllocSize = getGlobalContext().getConstantInt (Type::Int32Ty,
- TD.getTypeAllocSize(MI->getAllocatedType()));
+ AllocSize = ConstantInt::get(Type::Int32Ty,
+ TD.getTypeAllocSize(MI->getAllocatedType()));
}
Value* args[] = {Pool, AllocSize};
@@ -340,8 +340,7 @@
ArrayType * LLVMUsedTy = ArrayType::get(VoidPtrTy, 1);
Constant * C = ConstantExpr::getBitCast (cast<Constant>(InitFunc), VoidPtrTy);
std::vector<Constant*> UsedFunctions(1,C);
- Constant * NewInit =
- getGlobalContext().getConstantArray (LLVMUsedTy, UsedFunctions);
+ Constant * NewInit = ConstantArray::get(LLVMUsedTy, UsedFunctions);
new GlobalVariable (M, LLVMUsedTy, false,
GlobalValue::AppendingLinkage,
@@ -392,11 +391,10 @@
new GlobalVariable
(M,
getPoolType(), false, GlobalValue::ExternalLinkage,
- getGlobalContext().getConstantAggregateZero(getPoolType()),
- "__poolalloc_GlobalPool");
+ ConstantAggregateZero::get(getPoolType()), "__poolalloc_GlobalPool");
- Value *ElSize = getGlobalContext().getConstantInt(Type::Int32Ty, RecSize);
- Value *AlignV = getGlobalContext().getConstantInt(Type::Int32Ty, Align);
+ Value *ElSize = ConstantInt::get(Type::Int32Ty, RecSize);
+ Value *AlignV = ConstantInt::get(Type::Int32Ty, Align);
Value* Opts[3] = {GV, ElSize, AlignV};
CallInst::Create(PoolInit, Opts, Opts + 3, "", InsertAtEnd);
@@ -420,7 +418,7 @@
void
PoolAllocateMultipleGlobalPool::print(std::ostream &OS, const Module * M) const {
for (PoolMapTy::const_iterator I = PoolMap.begin(), E = PoolMap.end(); I != E; ++I) {
- OS << I->first << " -> " << I->second->getName() << "\n";
+ OS << I->first << " -> " << I->second->getNameStr() << "\n";
}
}
Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PASimple.cpp?rev=78618&r1=78617&r2=78618&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PASimple.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Mon Aug 10 18:41:00 2009
@@ -179,16 +179,16 @@
Value * AllocSize;
if (MI->isArrayAllocation()) {
Value * NumElements = MI->getArraySize();
- Value * ElementSize = getGlobalContext().getConstantInt (Type::Int32Ty,
- TD.getTypeAllocSize(MI->getAllocatedType()));
+ Value * ElementSize = ConstantInt::get(Type::Int32Ty,
+ TD.getTypeAllocSize(MI->getAllocatedType()));
AllocSize = BinaryOperator::Create (Instruction::Mul,
ElementSize,
NumElements,
"sizetmp",
MI);
} else {
- AllocSize = getGlobalContext().getConstantInt (Type::Int32Ty,
- TD.getTypeAllocSize(MI->getAllocatedType()));
+ AllocSize = ConstantInt::get(Type::Int32Ty,
+ TD.getTypeAllocSize(MI->getAllocatedType()));
}
Value* args[] = {TheGlobalPool, AllocSize};
@@ -355,16 +355,16 @@
GlobalVariable *GV =
new GlobalVariable(M,
getPoolType(), false, GlobalValue::ExternalLinkage,
- getGlobalContext().getConstantAggregateZero(getPoolType()),
- "__poolalloc_GlobalPool");
+ ConstantAggregateZero::get(getPoolType()),
+ "__poolalloc_GlobalPool");
Function *InitFunc = Function::Create
(FunctionType::get(Type::VoidTy, std::vector<const Type*>(), false),
GlobalValue::ExternalLinkage, "__poolalloc_init", &M);
BasicBlock * BB = BasicBlock::Create("entry", InitFunc);
- Value *ElSize = getGlobalContext().getConstantInt(Type::Int32Ty, RecSize);
- Value *AlignV = getGlobalContext().getConstantInt(Type::Int32Ty, Align);
+ Value *ElSize = ConstantInt::get(Type::Int32Ty, RecSize);
+ Value *AlignV = ConstantInt::get(Type::Int32Ty, Align);
Value* Opts[3] = {GV, ElSize, AlignV};
CallInst::Create(PoolInit, Opts, Opts + 3, "", BB);
Modified: poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp?rev=78618&r1=78617&r2=78618&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PointerCompress.cpp Mon Aug 10 18:41:00 2009
@@ -268,7 +268,7 @@
Elements.push_back(ComputeCompressedType(STy->getElementType(i),
NodeOffset+SL->getElementOffset(i),
Nodes));
- return StructType::get(Elements);
+ return StructType::get(STy->getContext(),Elements);
} else if (const ArrayType *ATy = dyn_cast<ArrayType>(OrigTy)) {
return ArrayType::get(ComputeCompressedType(ATy->getElementType(),
NodeOffset, Nodes),
@@ -287,7 +287,7 @@
assert(PoolBase == 0 && "Mixing and matching optimized vs not!");
// Get the pool base pointer.
- Constant *Zero = getGlobalContext().getConstantInt(Type::Int32Ty, 0);
+ Constant *Zero = ConstantInt::get(Type::Int32Ty, 0);
Value *Opts[2] = {Zero, Zero};
Value *BasePtrPtr = GetElementPtrInst::Create(getPoolDesc(), Opts, Opts + 2,
"poolbaseptrptr", &I);
@@ -299,7 +299,7 @@
isa<GlobalVariable>(PoolDesc))) {
BasicBlock::iterator IP = I.getParent()->getParent()->begin()->begin();
while (isa<AllocaInst>(IP)) ++IP;
- Constant *Zero = getGlobalContext().getConstantInt(Type::Int32Ty, 0);
+ Constant *Zero = ConstantInt::get(Type::Int32Ty, 0);
Value *Opts[2] = {Zero, Zero};
Value *BasePtrPtr = GetElementPtrInst::Create(getPoolDesc(), Opts, Opts + 2,
"poolbaseptrptr", IP);
@@ -383,7 +383,7 @@
/// value, creating a new forward ref value as needed.
Value *getTransformedValue(Value *V) {
if (isa<ConstantPointerNull>(V)) // null -> uint 0
- return getGlobalContext().getConstantInt(SCALARUINTTYPE, 0);
+ return ConstantInt::get(SCALARUINTTYPE, 0);
if (isa<UndefValue>(V)) // undef -> uint undef
return UndefValue::get(SCALARUINTTYPE);
@@ -713,7 +713,7 @@
if (Field) {
uint64_t FieldOffs = TD.getStructLayout(cast<StructType>(NTy))
->getElementOffset(Field);
- Constant *FieldOffsCst = getGlobalContext().getConstantInt(SCALARUINTTYPE, FieldOffs);
+ Constant *FieldOffsCst = ConstantInt::get(SCALARUINTTYPE, FieldOffs);
Val = BinaryOperator::CreateAdd(Val, FieldOffsCst,
GEPI.getName(), &GEPI);
}
@@ -732,8 +732,8 @@
if (Idx->getType() != SCALARUINTTYPE)
Idx = CastInst::CreateSExtOrBitCast(Idx, SCALARUINTTYPE, Idx->getName(), &GEPI);
- Constant *Scale = getGlobalContext().getConstantInt(SCALARUINTTYPE,
- TD.getTypeAllocSize(ElTy));
+ Constant *Scale = ConstantInt::get(SCALARUINTTYPE,
+ TD.getTypeAllocSize(ElTy));
Idx = BinaryOperator::CreateMul(Idx, Scale, "fieldidx", &GEPI);
Val = BinaryOperator::CreateAdd(Val, Idx, GEPI.getName(), &GEPI);
}
@@ -828,7 +828,7 @@
}
} else {
// FIXME: This assumes that all null pointers are compressed!
- SrcVal = getGlobalContext().getConstantInt(MEMUINTTYPE, 0);
+ SrcVal = ConstantInt::get(MEMUINTTYPE, 0);
}
// Get the pool base pointer.
@@ -862,11 +862,11 @@
std::vector<Value*> Ops;
Ops.push_back(CI.getOperand(1));
// Transform to pass in the compressed size.
- Ops.push_back(getGlobalContext().getConstantInt(Type::Int32Ty, PI->getNewSize()));
+ Ops.push_back(ConstantInt::get(Type::Int32Ty, PI->getNewSize()));
// Pointer compression can reduce the alignment restriction to 4 bytes from 8.
// Reevaluate the desired alignment.
- Ops.push_back(getGlobalContext().getConstantInt(Type::Int32Ty,
+ 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 = CallInst::Create(PtrComp.PoolInitPC, Ops.begin(), Ops.end(), "", &CI);
@@ -901,11 +901,12 @@
if (OldSizeV != PI->getNewSize()) {
// Emit code to scale the allocated size down by the old size then up by
// the new size. We actually compute (N+OS-1)/OS * NS.
- Value *OldSize = getGlobalContext().getConstantInt(Type::Int32Ty, OldSizeV);
- Value *NewSize = getGlobalContext().getConstantInt(Type::Int32Ty, PI->getNewSize());
+ Value *OldSize = ConstantInt::get(Type::Int32Ty, OldSizeV);
+ Value *NewSize = ConstantInt::get(Type::Int32Ty, PI->getNewSize());
Size = BinaryOperator::CreateAdd(Size,
- getGlobalContext().getConstantInt(Type::Int32Ty, OldSizeV-1),
+ ConstantInt::get(Type::Int32Ty,
+ OldSizeV-1),
"roundup", &CI);
Size = BinaryOperator::CreateUDiv(Size, OldSize, "numnodes", &CI);
Size = BinaryOperator::CreateMul(Size, NewSize, "newbytes", &CI);
@@ -1185,7 +1186,7 @@
Value*> &PreassignedPools,
Function &F, DSGraph* DSG,
PA::FuncInfo *FI) {
- DEBUG(std::cerr << "In function '" << F.getName() << "':\n");
+ DEBUG(std::cerr << "In function '" << F.getNameStr() << "':\n");
for (unsigned i = 0, e = FI->NodesToPA.size(); i != e; ++i) {
const DSNode *N = FI->NodesToPA[i];
@@ -1251,7 +1252,7 @@
if (FI == 0) {
std::cerr << "DIDN'T FIND POOL INFO FOR: "
- << *F.getType() << F.getName() << "!\n";
+ << *F.getType() << F.getNameStr() << "!\n";
return false;
}
@@ -1302,7 +1303,7 @@
// particular, if one pool points to another, we need to know if the outgoing
// pointer is compressed.
const TargetData &TD = DSG->getTargetData();
- std::cerr << "In function '" << F.getName() << "':\n";
+ std::cerr << "In function '" << F.getNameStr() << "':\n";
for (std::map<const DSNode*, CompressedPoolInfo>::iterator
I = PoolsToCompress.begin(), E = PoolsToCompress.end(); I != E; ++I) {
@@ -1311,7 +1312,7 @@
// Only dump info about a compressed pool if this is the home for it.
if (isa<AllocaInst>(I->second.getPoolDesc()) ||
(isa<GlobalValue>(I->second.getPoolDesc()) &&
- F.hasExternalLinkage() && F.getName() == "main")) {
+ F.hasExternalLinkage() && F.getNameStr() == "main")) {
std::cerr << " COMPRESSING POOL:\nPCS:";
I->second.dump();
}
@@ -1356,7 +1357,7 @@
// Next, create the clone prototype and insert it into the module.
Clone = Function::Create (CFTy, GlobalValue::ExternalLinkage,
- F->getName()+"_pc");
+ F->getNameStr()+"_pc");
F->getParent()->getFunctionList().insert(F, Clone);
return Clone;
}
@@ -1402,7 +1403,7 @@
// Next, create the clone prototype and insert it into the module.
Clone = Function::Create (CFTy, GlobalValue::InternalLinkage,
- F->getName()+".pc");
+ F->getNameStr()+".pc");
F->getParent()->getFunctionList().insert(F, Clone);
// Remember where this clone came from.
@@ -1410,8 +1411,8 @@
ClonedFunctionInfoMap.insert(std::make_pair(Clone, F)).first->second;
++NumCloned;
- std::cerr << " CLONING FUNCTION: " << F->getName() << " -> "
- << Clone->getName() << "\n";
+ std::cerr << " CLONING FUNCTION: " << F->getNameStr() << " -> "
+ << Clone->getNameStr() << "\n";
if (F->isDeclaration()) {
Clone->setLinkage(GlobalValue::ExternalLinkage);
@@ -1430,7 +1431,7 @@
for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end();
I != E; ++I, ++CI) {
// Transfer the argument names over.
- CI->setName(I->getName());
+ CI->setName(I->getNameStr());
// If we are compressing this argument, set up RemappedArgs.
if (CI->getType() != I->getType()) {
Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp?rev=78618&r1=78617&r2=78618&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Mon Aug 10 18:41:00 2009
@@ -307,7 +307,7 @@
if (isa<Constant>(User->getOperand(1)) &&
cast<Constant>(User->getOperand(1))->isNullValue()) {
bool CondIsTrue = ICI->getPredicate() == ICmpInst::ICMP_NE;
- User->replaceAllUsesWith(Context->getConstantInt(Type::Int1Ty, CondIsTrue));
+ User->replaceAllUsesWith(ConstantInt::get(Type::Int1Ty, CondIsTrue));
}
} else if ((User->getOpcode() == Instruction::Trunc) ||
(User->getOpcode() == Instruction::ZExt) ||
@@ -613,7 +613,7 @@
GlobalVariable *GV =
new GlobalVariable(*CurModule,
PoolDescType, false, GlobalValue::InternalLinkage,
- getGlobalContext().getConstantAggregateZero(PoolDescType), "GlobalPool");
+ ConstantAggregateZero::get(PoolDescType), "GlobalPool");
// Update the global DSGraph to include this.
DSNode *GNode = Graphs->getGlobalsGraph()->addObjectToGraph(GV);
@@ -630,8 +630,8 @@
while (isa<AllocaInst>(InsertPt)) ++InsertPt;
}
- Value *ElSize = getGlobalContext().getConstantInt(Type::Int32Ty, RecSize);
- Value *AlignV = getGlobalContext().getConstantInt(Type::Int32Ty, Align);
+ Value *ElSize = ConstantInt::get(Type::Int32Ty, RecSize);
+ Value *AlignV = ConstantInt::get(Type::Int32Ty, Align);
Value* Opts[3] = {GV, ElSize, AlignV};
CallInst::Create(PoolInit, Opts, Opts + 3, "", InsertPt);
++NumPools;
@@ -660,7 +660,7 @@
// Is this main? If so, make the pool descriptors globals, not automatic
// vars.
- bool IsMain = F.getName() == "main" && F.hasExternalLinkage();
+ bool IsMain = F.getNameStr() == "main" && F.hasExternalLinkage();
// Perform all global assignments as specified.
for (unsigned i = 0, e = ResultPools.size(); i != e; ++i) {
@@ -744,11 +744,11 @@
}
if (!FI.NodesToPA.empty()) {
- std::cerr << "[" << F.getName() << "] " << FI.NodesToPA.size()
+ std::cerr << "[" << F.getNameStr() << "] " << FI.NodesToPA.size()
<< " nodes pool allocatable\n";
CreatePools(NewF, G, FI.NodesToPA, FI.PoolDescriptors);
} else {
- DEBUG(std::cerr << "[" << F.getName() << "] transforming body.\n");
+ DEBUG(std::cerr << "[" << F.getNameStr() << "] transforming body.\n");
}
// Transform the body of the function now... collecting information about uses
@@ -850,11 +850,11 @@
InitializedBefore.clear();
DestroyedAfter.clear();
- DEBUG(std::cerr << "POOL: " << PD->getName() << " information:\n");
+ DEBUG(std::cerr << "POOL: " << PD->getNameStr() << " information:\n");
DEBUG(std::cerr << " Live in blocks: ");
DEBUG(for (std::set<BasicBlock*>::iterator I = LiveBlocks.begin(),
E = LiveBlocks.end(); I != E; ++I)
- std::cerr << (*I)->getName() << " ");
+ std::cerr << (*I)->getNameStr() << " ");
DEBUG(std::cerr << "\n");
@@ -869,7 +869,7 @@
/*empty*/;
PoolInitPoints.push_back(InsertPoint);
- if (F.getName() != "main")
+ if (F.getNameStr() != "main")
for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
if (isa<ReturnInst>(BB->getTerminator()) ||
isa<UnwindInst>(BB->getTerminator()))
@@ -961,14 +961,14 @@
// Insert the calls to initialize the pool.
unsigned ElSizeV = Heuristic::getRecommendedSize(Node);
- Value *ElSize = getGlobalContext().getConstantInt(Type::Int32Ty, ElSizeV);
+ Value *ElSize = ConstantInt::get(Type::Int32Ty, ElSizeV);
unsigned AlignV = Heuristic::getRecommendedAlignment(Node);
- Value *Align = getGlobalContext().getConstantInt(Type::Int32Ty, AlignV);
+ Value *Align = ConstantInt::get(Type::Int32Ty, AlignV);
for (unsigned i = 0, e = PoolInitPoints.size(); i != e; ++i) {
Value* Opts[3] = {PD, ElSize, Align};
CallInst::Create(PoolInit, Opts, Opts + 3, "", PoolInitPoints[i]);
- DEBUG(std::cerr << PoolInitPoints[i]->getParent()->getName() << " ");
+ DEBUG(std::cerr << PoolInitPoints[i]->getParent()->getNameStr() << " ");
}
DEBUG(std::cerr << "\n Destroy in blocks: ");
@@ -977,7 +977,7 @@
for (unsigned i = 0, e = PoolDestroyPoints.size(); i != e; ++i) {
// Insert the pooldestroy call for this pool.
CallInst::Create(PoolDestroy, PD, "", PoolDestroyPoints[i]);
- DEBUG(std::cerr << PoolDestroyPoints[i]->getParent()->getName()<<" ");
+ DEBUG(std::cerr << PoolDestroyPoints[i]->getParent()->getNameStr()<<" ");
}
DEBUG(std::cerr << "\n\n");
Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp?rev=78618&r1=78617&r2=78618&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Mon Aug 10 18:41:00 2009
@@ -215,8 +215,8 @@
if (PH == 0 || isa<ConstantPointerNull>(PH)) return;
TargetData &TD = PAInfo.getAnalysis<TargetData>();
- Value *AllocSize = getGlobalContext().getConstantInt(Type::Int32Ty,
- TD.getTypeAllocSize(MI.getAllocatedType()));
+ Value *AllocSize = ConstantInt::get(Type::Int32Ty,
+ TD.getTypeAllocSize(MI.getAllocatedType()));
if (MI.isArrayAllocation())
AllocSize = BinaryOperator::Create(Instruction::Mul, AllocSize,
@@ -273,7 +273,7 @@
Value *PH = getPoolHandle(&MI);
if (PH == 0 || isa<ConstantPointerNull>(PH)) return;
TargetData &TD = PAInfo.getAnalysis<TargetData>();
- Value *AllocSize = getGlobalContext().getConstantInt(Type::Int32Ty, TD.getTypeAllocSize(MI.getAllocatedType()));
+ Value *AllocSize = ConstantInt::get(Type::Int32Ty, TD.getTypeAllocSize(MI.getAllocatedType()));
if (MI.isArrayAllocation())
AllocSize = BinaryOperator::Create(Instruction::Mul, AllocSize,
@@ -367,8 +367,8 @@
BBI);
// We know that the memory returned by poolalloc is at least 4 byte aligned.
- Value* Opts[4] = {Ptr, getGlobalContext().getConstantInt(Type::Int8Ty, 0),
- V2, getGlobalContext().getConstantInt(Type::Int32Ty, 4)};
+ Value* Opts[4] = {Ptr, ConstantInt::get(Type::Int8Ty, 0),
+ V2, ConstantInt::get(Type::Int32Ty, 4)};
CallInst::Create(MemSet, Opts, Opts + 4, "", BBI);
}
@@ -728,7 +728,7 @@
// pool descriptors to pass in...
std::vector<Value*> Args;
for (unsigned i = 0, e = ArgNodes.size(); i != e; ++i) {
- Value *ArgVal = getGlobalContext().getConstantAggregateZero(PoolAllocate::PoolDescPtrTy);
+ Value *ArgVal = ConstantAggregateZero::get(PoolAllocate::PoolDescPtrTy);
if (NodeMapping.count(ArgNodes[i]))
if (DSNode *LocalNode = NodeMapping[ArgNodes[i]].getNode())
if (FI.PoolDescriptors.count(LocalNode))
@@ -743,8 +743,8 @@
0,
"PD",
InsertPt);
- Value *ElSize = getGlobalContext().getConstantInt(Type::Int32Ty,0);
- Value *Align = getGlobalContext().getConstantInt(Type::Int32Ty,0);
+ Value *ElSize = ConstantInt::get(Type::Int32Ty,0);
+ Value *Align = ConstantInt::get(Type::Int32Ty,0);
Value* Opts[3] = {ArgVal, ElSize, Align};
CallInst::Create(PAInfo.PoolInit, Opts, Opts + 3,"", TheCall);
BasicBlock::iterator BBI = TheCall;
More information about the llvm-commits
mailing list