[llvm-commits] [poolalloc] r76745 - in /poolalloc/trunk/lib/PoolAllocate: Heuristic.cpp PAMultipleGlobalPool.cpp PASimple.cpp PoolAllocate.cpp TransformFunctionBody.cpp
John Criswell
criswell at uiuc.edu
Wed Jul 22 09:19:43 PDT 2009
Author: criswell
Date: Wed Jul 22 11:19:42 2009
New Revision: 76745
URL: http://llvm.org/viewvc/llvm-project?rev=76745&view=rev
Log:
Update to the latest LLVM API (SVN Revision 76738).
Switch to using getGlobalContext() while the API is still in flux.
Modified:
poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp
poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp
poolalloc/trunk/lib/PoolAllocate/PASimple.cpp
poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp
Modified: poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp?rev=76745&r1=76744&r2=76745&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp Wed Jul 22 11:19:42 2009
@@ -440,10 +440,12 @@
static Value *NullGlobal = 0;
if (!NullGlobal) {
Module *M = I->getParent()->getParent()->getParent();
+ const Type * PoolTy = PoolAllocate::PoolDescPtrTy;
+ Constant * Init = getGlobalContext().getConstantAggregateZero (PoolTy);
NullGlobal = new GlobalVariable(*M,
PoolAllocate::PoolDescPtrTy, false,
GlobalValue::ExternalLinkage,
- ConstantAggregateZero::get(PoolAllocate::PoolDescPtrTy),
+ Init,
"llvm-poolalloc-null-init");
}
while (isa<AllocaInst>(I)) ++I;
Modified: poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp?rev=76745&r1=76744&r2=76745&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PAMultipleGlobalPool.cpp Wed Jul 22 11:19:42 2009
@@ -82,11 +82,6 @@
currentModule = &M;
if (M.begin() == M.end()) return false;
- //
- // Get the context from the global context.
- //
- Context = &getGlobalContext();
-
Graphs = &getAnalysis<SteensgaardDataStructures>();
assert (Graphs && "No DSA pass available!\n");
@@ -146,7 +141,7 @@
Value * AllocSize;
if (MI->isArrayAllocation()) {
Value * NumElements = MI->getArraySize();
- Value * ElementSize = Context->getConstantInt (Type::Int32Ty,
+ Value * ElementSize = getGlobalContext().getConstantInt (Type::Int32Ty,
TD.getTypeAllocSize(MI->getAllocatedType()));
AllocSize = BinaryOperator::Create (Instruction::Mul,
ElementSize,
@@ -154,7 +149,7 @@
"sizetmp",
MI);
} else {
- AllocSize = Context->getConstantInt (Type::Int32Ty,
+ AllocSize = getGlobalContext().getConstantInt (Type::Int32Ty,
TD.getTypeAllocSize(MI->getAllocatedType()));
}
@@ -346,7 +341,7 @@
Constant * C = ConstantExpr::getBitCast (cast<Constant>(InitFunc), VoidPtrTy);
std::vector<Constant*> UsedFunctions(1,C);
Constant * NewInit =
- ConstantArray::get (LLVMUsedTy, UsedFunctions);
+ getGlobalContext().getConstantArray (LLVMUsedTy, UsedFunctions);
new GlobalVariable (M, LLVMUsedTy, false,
GlobalValue::AppendingLinkage,
@@ -397,11 +392,11 @@
new GlobalVariable
(M,
getPoolType(), false, GlobalValue::ExternalLinkage,
- ConstantAggregateZero::get(getPoolType()),
+ getGlobalContext().getConstantAggregateZero(getPoolType()),
"__poolalloc_GlobalPool");
- Value *ElSize = Context->getConstantInt(Type::Int32Ty, RecSize);
- Value *AlignV = Context->getConstantInt(Type::Int32Ty, Align);
+ Value *ElSize = getGlobalContext().getConstantInt(Type::Int32Ty, RecSize);
+ Value *AlignV = getGlobalContext().getConstantInt(Type::Int32Ty, Align);
Value* Opts[3] = {GV, ElSize, AlignV};
CallInst::Create(PoolInit, Opts, Opts + 3, "", InsertAtEnd);
Modified: poolalloc/trunk/lib/PoolAllocate/PASimple.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PASimple.cpp?rev=76745&r1=76744&r2=76745&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PASimple.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PASimple.cpp Wed Jul 22 11:19:42 2009
@@ -104,11 +104,6 @@
bool PoolAllocateSimple::runOnModule(Module &M) {
if (M.begin() == M.end()) return false;
- //
- // Get the context from the global context.
- //
- Context = &getGlobalContext();
-
// Get the Target Data information and the Graphs
if (CompleteDSA) {
Graphs = &getAnalysis<EQTDDataStructures>();
@@ -184,7 +179,7 @@
Value * AllocSize;
if (MI->isArrayAllocation()) {
Value * NumElements = MI->getArraySize();
- Value * ElementSize = Context->getConstantInt (Type::Int32Ty,
+ Value * ElementSize = getGlobalContext().getConstantInt (Type::Int32Ty,
TD.getTypeAllocSize(MI->getAllocatedType()));
AllocSize = BinaryOperator::Create (Instruction::Mul,
ElementSize,
@@ -192,7 +187,7 @@
"sizetmp",
MI);
} else {
- AllocSize = Context->getConstantInt (Type::Int32Ty,
+ AllocSize = getGlobalContext().getConstantInt (Type::Int32Ty,
TD.getTypeAllocSize(MI->getAllocatedType()));
}
@@ -360,7 +355,7 @@
GlobalVariable *GV =
new GlobalVariable(M,
getPoolType(), false, GlobalValue::ExternalLinkage,
- ConstantAggregateZero::get(getPoolType()),
+ getGlobalContext().getConstantAggregateZero(getPoolType()),
"__poolalloc_GlobalPool");
Function *InitFunc = Function::Create
@@ -368,8 +363,8 @@
GlobalValue::ExternalLinkage, "__poolalloc_init", &M);
BasicBlock * BB = BasicBlock::Create("entry", InitFunc);
- Value *ElSize = Context->getConstantInt(Type::Int32Ty, RecSize);
- Value *AlignV = Context->getConstantInt(Type::Int32Ty, Align);
+ Value *ElSize = getGlobalContext().getConstantInt(Type::Int32Ty, RecSize);
+ Value *AlignV = getGlobalContext().getConstantInt(Type::Int32Ty, Align);
Value* Opts[3] = {GV, ElSize, AlignV};
CallInst::Create(PoolInit, Opts, Opts + 3, "", BB);
Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp?rev=76745&r1=76744&r2=76745&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Wed Jul 22 11:19:42 2009
@@ -111,11 +111,6 @@
CurModule = &M;
//
- // Get the context from the global context.
- //
- Context = &getGlobalContext();
-
- //
// Get references to the DSA information. For SAFECode, we need Top-Down
// DSA. For Automatic Pool Allocation only, we need Bottom-Up DSA. In all
// cases, we need to use the Equivalence-Class version of DSA.
@@ -347,7 +342,7 @@
CallInst *CI = Calls[i];
// poolalloc never returns null. Loop over all uses of the call looking for
// set(eq|ne) X, null.
- OptimizePointerNotNull(CI, Context);
+ OptimizePointerNotNull(CI, &getGlobalContext());
}
// TODO: poolfree accepts a null pointer, so remove any check above it, like
@@ -618,7 +613,7 @@
GlobalVariable *GV =
new GlobalVariable(*CurModule,
PoolDescType, false, GlobalValue::InternalLinkage,
- ConstantAggregateZero::get(PoolDescType), "GlobalPool");
+ getGlobalContext().getConstantAggregateZero(PoolDescType), "GlobalPool");
// Update the global DSGraph to include this.
DSNode *GNode = Graphs->getGlobalsGraph()->addObjectToGraph(GV);
@@ -635,8 +630,8 @@
while (isa<AllocaInst>(InsertPt)) ++InsertPt;
}
- Value *ElSize = Context->getConstantInt(Type::Int32Ty, RecSize);
- Value *AlignV = Context->getConstantInt(Type::Int32Ty, Align);
+ Value *ElSize = getGlobalContext().getConstantInt(Type::Int32Ty, RecSize);
+ Value *AlignV = getGlobalContext().getConstantInt(Type::Int32Ty, Align);
Value* Opts[3] = {GV, ElSize, AlignV};
CallInst::Create(PoolInit, Opts, Opts + 3, "", InsertPt);
++NumPools;
@@ -966,9 +961,9 @@
// Insert the calls to initialize the pool.
unsigned ElSizeV = Heuristic::getRecommendedSize(Node);
- Value *ElSize = Context->getConstantInt(Type::Int32Ty, ElSizeV);
+ Value *ElSize = getGlobalContext().getConstantInt(Type::Int32Ty, ElSizeV);
unsigned AlignV = Heuristic::getRecommendedAlignment(Node);
- Value *Align = Context->getConstantInt(Type::Int32Ty, AlignV);
+ Value *Align = getGlobalContext().getConstantInt(Type::Int32Ty, AlignV);
for (unsigned i = 0, e = PoolInitPoints.size(); i != e; ++i) {
Value* Opts[3] = {PD, ElSize, Align};
Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp?rev=76745&r1=76744&r2=76745&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Wed Jul 22 11:19:42 2009
@@ -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 = ConstantAggregateZero::get(PoolAllocate::PoolDescPtrTy);
+ Value *ArgVal = getGlobalContext().getConstantAggregateZero(PoolAllocate::PoolDescPtrTy);
if (NodeMapping.count(ArgNodes[i]))
if (DSNode *LocalNode = NodeMapping[ArgNodes[i]].getNode())
if (FI.PoolDescriptors.count(LocalNode))
More information about the llvm-commits
mailing list