[llvm-commits] CVS: poolalloc/lib/PoolAllocate/PoolAllocate.cpp TransformFunctionBody.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun Nov 9 19:26:11 PST 2003
Changes in directory poolalloc/lib/PoolAllocate:
PoolAllocate.cpp updated: 1.36 -> 1.37
TransformFunctionBody.cpp updated: 1.4 -> 1.5
---
Log message:
Eliminate the PoolDescTypeMap, as it is not used anywhere and it is not always initialized
---
Diffs of the changes: (+7 -34)
Index: poolalloc/lib/PoolAllocate/PoolAllocate.cpp
diff -u poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.36 poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.37
--- poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.36 Sun Nov 9 18:13:55 2003
+++ poolalloc/lib/PoolAllocate/PoolAllocate.cpp Sun Nov 9 19:25:28 2003
@@ -414,8 +414,6 @@
// Set the rest of the new arguments names to be PDa<n> and add entries to the
// pool descriptors map
std::map<DSNode*, Value*> &PoolDescriptors = FI.PoolDescriptors;
- //Dinakar set the type of pooldesctriptors
- std::map<const Value*, const Type*> &PoolDescTypeMap = FI.PoolDescType;
Function::aiterator NI = New->abegin();
if (FuncECs.findClass(&F)) {
@@ -429,11 +427,9 @@
for (int i = 0; i < FI.PoolArgFirst; ++NI, ++i)
;
- for (unsigned i = 0, e = FI.ArgNodes.size(); i != e; ++i, ++NI) {
- PoolDescTypeMap[NI] = FI.ArgNodes[i]->getType();
-
+ for (unsigned i = 0, e = FI.ArgNodes.size(); i != e; ++i, ++NI)
PoolDescriptors.insert(std::make_pair(FI.ArgNodes[i], NI));
- }
+
NI = New->abegin();
if (EqClass2LastPoolArg.count(FuncECs.findClass(&F)))
for (int i = 0; i <= EqClass2LastPoolArg[FuncECs.findClass(&F)]; ++i,++NI)
@@ -443,7 +439,6 @@
if (FI.ArgNodes.size())
for (unsigned i = 0, e = FI.ArgNodes.size(); i != e; ++i, ++NI) {
NI->setName("PDa"); // Add pd entry
- PoolDescTypeMap[NI] = FI.ArgNodes[i]->getType();
PoolDescriptors.insert(std::make_pair(FI.ArgNodes[i], NI));
}
NI = New->abegin();
@@ -487,9 +482,7 @@
//
void PoolAllocate::CreatePools(Function &F,
const std::vector<DSNode*> &NodesToPA,
- std::map<DSNode*, Value*> &PoolDescriptors,
- std::map<const Value *,
- const Type *> &PoolDescTypeMap) {
+ std::map<DSNode*, Value*> &PoolDescriptors) {
// Loop over all of the pools, inserting code into the entry block of the
// function for the initialization and code in the exit blocks for
@@ -511,7 +504,6 @@
// Update the PoolDescriptors map
PoolDescriptors.insert(std::make_pair(Node, AI));
- PoolDescTypeMap[AI] = Node->getType();
}
}
@@ -541,7 +533,7 @@
DEBUG(std::cerr << NodesToPA.size() << " nodes to pool allocate\n");
if (!NodesToPA.empty()) // Insert pool alloca's
- CreatePools(NewF, NodesToPA, FI.PoolDescriptors, FI.PoolDescType);
+ CreatePools(NewF, NodesToPA, FI.PoolDescriptors);
// Transform the body of the function now... collecting information about uses
// of the pools.
@@ -551,8 +543,7 @@
// Create pool construction/destruction code
if (!NodesToPA.empty())
- InitializeAndDestroyPools(NewF, NodesToPA,
- FI.PoolDescriptors, FI.PoolDescType);
+ InitializeAndDestroyPools(NewF, NodesToPA, FI.PoolDescriptors);
}
/// InitializeAndDestroyPools - This inserts calls to poolinit and pooldestroy
@@ -560,10 +551,7 @@
///
void PoolAllocate::InitializeAndDestroyPools(Function &F,
const std::vector<DSNode*> &NodesToPA,
- std::map<DSNode*, Value*> &PoolDescriptors,
- std::map<const Value *,
- const Type *> &PoolDescTypeMap) {
-
+ std::map<DSNode*, Value*> &PoolDescriptors) {
TargetData &TD = getAnalysis<TargetData>();
// Insert poolinit calls after all of the allocas...
Index: poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp
diff -u poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.4 poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.5
--- poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.4 Sun Nov 9 18:13:04 2003
+++ poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp Sun Nov 9 19:25:28 2003
@@ -306,14 +306,8 @@
Value *V = new CallInst(PAInfo.PoolAlloc, make_vector(PH, AllocSize, 0),
Name, &MI);
- const Type *phtype = MI.getType()->getElementType();
- std::map<const Value*, const Type*> &PoolDescType = FI.PoolDescType;
- if (!PoolDescType.count(PH))
- PoolDescType[PH] = phtype;
-
- Value *Casted = V;
-
// Cast to the appropriate type if necessary
+ Value *Casted = V;
if (V->getType() != MI.getType())
Casted = new CastInst(V, MI.getType(), V->getName(), &MI);
@@ -349,15 +343,6 @@
Value *PH = getPoolHandle(Arg); // Get the pool handle for this DSNode...
if (PH == 0) return;
- const Type *phtype = 0;
- if (const PointerType *ptype = dyn_cast<PointerType>(Arg->getType()))
- phtype = ptype->getElementType();
-
- assert((phtype != 0) && "Needs to be implemented \n ");
- std::map<const Value*, const Type*> &PoolDescType = FI.PoolDescType;
- if (!PoolDescType.count(PH))
- PoolDescType[PH] = phtype;
-
// Insert a cast and a call to poolfree...
Value *Casted = Arg;
if (Arg->getType() != PointerType::get(Type::SByteTy))
More information about the llvm-commits
mailing list