[llvm-commits] [poolalloc] r136715 - in /poolalloc/trunk: ./ include/dsa/ lib/ lib/DSA/
John Criswell
criswell at uiuc.edu
Tue Aug 2 12:36:45 PDT 2011
Author: criswell
Date: Tue Aug 2 14:36:45 2011
New Revision: 136715
URL: http://llvm.org/viewvc/llvm-project?rev=136715&view=rev
Log:
Modified DSA to compile with mainline LLVM (what should eventually become
LLVM 3.0).
Modified:
poolalloc/trunk/Makefile
poolalloc/trunk/include/dsa/AddressTakenAnalysis.h
poolalloc/trunk/include/dsa/CallTargets.h
poolalloc/trunk/include/dsa/DSGraph.h
poolalloc/trunk/include/dsa/DSNode.h
poolalloc/trunk/include/dsa/DSSupport.h
poolalloc/trunk/include/dsa/DataStructure.h
poolalloc/trunk/include/dsa/TypeSafety.h
poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp
poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp
poolalloc/trunk/lib/DSA/CallTargets.cpp
poolalloc/trunk/lib/DSA/DSGraph.cpp
poolalloc/trunk/lib/DSA/DSTest.cpp
poolalloc/trunk/lib/DSA/DataStructure.cpp
poolalloc/trunk/lib/DSA/DataStructureStats.cpp
poolalloc/trunk/lib/DSA/EntryPointAnalysis.cpp
poolalloc/trunk/lib/DSA/GraphChecker.cpp
poolalloc/trunk/lib/DSA/Local.cpp
poolalloc/trunk/lib/DSA/Makefile
poolalloc/trunk/lib/DSA/Printer.cpp
poolalloc/trunk/lib/DSA/SanityCheck.cpp
poolalloc/trunk/lib/DSA/StdLibPass.cpp
poolalloc/trunk/lib/DSA/TypeSafety.cpp
poolalloc/trunk/lib/Makefile
Modified: poolalloc/trunk/Makefile
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/Makefile?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/Makefile (original)
+++ poolalloc/trunk/Makefile Tue Aug 2 14:36:45 2011
@@ -10,7 +10,7 @@
#
# Directories that needs to be built.
#
-DIRS = tools
+DIRS = lib tools
#
# Include the Master Makefile that knows how to build all.
Modified: poolalloc/trunk/include/dsa/AddressTakenAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/AddressTakenAnalysis.h?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/AddressTakenAnalysis.h (original)
+++ poolalloc/trunk/include/dsa/AddressTakenAnalysis.h Tue Aug 2 14:36:45 2011
@@ -30,7 +30,7 @@
std::set<Function*> addressTakenFunctions;
public:
static char ID;
- AddressTakenAnalysis();
+ AddressTakenAnalysis() : ModulePass (ID) { };
virtual ~AddressTakenAnalysis();
bool runOnModule(llvm::Module&);
Modified: poolalloc/trunk/include/dsa/CallTargets.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/CallTargets.h?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/CallTargets.h (original)
+++ poolalloc/trunk/include/dsa/CallTargets.h Tue Aug 2 14:36:45 2011
@@ -35,7 +35,7 @@
void findIndTargets(Module &M);
public:
static char ID;
- CallTargetFinder() : ModulePass((intptr_t)&ID) {}
+ CallTargetFinder() : ModulePass(ID) {}
virtual bool runOnModule(Module &M);
Modified: poolalloc/trunk/include/dsa/DSGraph.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DSGraph.h?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/DSGraph.h (original)
+++ poolalloc/trunk/include/dsa/DSGraph.h Tue Aug 2 14:36:45 2011
@@ -250,14 +250,14 @@
/// constructed for.
const TargetData &TD;
- SuperSet<const Type*>& TypeSS;
+ SuperSet<Type*>& TypeSS;
void operator=(const DSGraph &); // DO NOT IMPLEMENT
DSGraph(const DSGraph&); // DO NOT IMPLEMENT
public:
// Create a new, empty, DSGraph.
DSGraph(EquivalenceClasses<const GlobalValue*> &ECs, const TargetData &td,
- SuperSet<const Type*>& tss,
+ SuperSet<Type*>& tss,
DSGraph *GG = 0)
:GlobalsGraph(GG), UseAuxCalls(false),
ScalarMap(ECs), TD(td), TypeSS(tss)
@@ -272,7 +272,7 @@
// method.
//
DSGraph( DSGraph* DSG, EquivalenceClasses<const GlobalValue*> &ECs,
- SuperSet<const Type*>& tss,
+ SuperSet<Type*>& tss,
unsigned CloneFlags = 0);
~DSGraph();
@@ -285,7 +285,7 @@
return ScalarMap.getGlobalECs();
}
- SuperSet<const Type*>& getTypeSS() const {
+ SuperSet<Type*>& getTypeSS() const {
return TypeSS;
}
Modified: poolalloc/trunk/include/dsa/DSNode.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DSNode.h?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/DSNode.h (original)
+++ poolalloc/trunk/include/dsa/DSNode.h Tue Aug 2 14:36:45 2011
@@ -41,7 +41,7 @@
///
class DSNode : public ilist_node<DSNode> {
public:
- typedef std::map<unsigned, SuperSet<const Type*>::setPtr> TyMapTy;
+ typedef std::map<unsigned, SuperSet<Type*>::setPtr> TyMapTy;
typedef std::map<unsigned, DSNodeHandle> LinkMapTy;
private:
@@ -210,7 +210,7 @@
Size = NSize;
}
- void growSizeForType(const Type *Ty, unsigned Offset);
+ void growSizeForType(Type *Ty, unsigned Offset);
/// hasLink - Return true if this memory object has a link in slot LinkNo
///
@@ -244,7 +244,7 @@
/// completely (and return true) if the information is incompatible with what
/// is already known.
///
- void mergeTypeInfo(const Type *Ty, unsigned Offset);
+ void mergeTypeInfo(Type *Ty, unsigned Offset);
void mergeTypeInfo(const TyMapTy::mapped_type TyIt, unsigned Offset);
void mergeTypeInfo(const DSNode* D, unsigned Offset);
Modified: poolalloc/trunk/include/dsa/DSSupport.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DSSupport.h?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/DSSupport.h (original)
+++ poolalloc/trunk/include/dsa/DSSupport.h Tue Aug 2 14:36:45 2011
@@ -38,7 +38,7 @@
/// isPointerType - Return true if this first class type is big enough to hold
/// a pointer.
///
- bool isPointerType(const Type *Ty);
+ bool isPointerType(Type *Ty);
//===----------------------------------------------------------------------===//
/// DSNodeHandle - Implement a "handle" to a data structure node that takes care
Modified: poolalloc/trunk/include/dsa/DataStructure.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DataStructure.h?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/DataStructure.h (original)
+++ poolalloc/trunk/include/dsa/DataStructure.h Tue Aug 2 14:36:45 2011
@@ -78,7 +78,7 @@
/// with other global values in the DSGraphs.
EquivalenceClasses<const GlobalValue*> GlobalECs;
- SuperSet<const Type*>* TypeSS;
+ SuperSet<Type*>* TypeSS;
// Callgraph, as computed so far
DSCallGraph callgraph;
@@ -98,7 +98,7 @@
void formGlobalFunctionList();
- DataStructures(intptr_t id, const char* name)
+ DataStructures(char & id, const char* name)
: ModulePass(id), TD(0), GraphSource(0), printname(name), GlobalsGraph(0) {
// For now, the graphs are owned by this pass
DSGraphsStolen = false;
@@ -143,7 +143,7 @@
const DSCallGraph& getCallGraph() const { return callgraph; }
- SuperSet<const Type*>& getTypeSS() const { return *TypeSS; }
+ SuperSet<Type*>& getTypeSS() const { return *TypeSS; }
/// deleteValue/copyValue - Interfaces to update the DSGraphs in the program.
/// These correspond to the interfaces defined in the AliasAnalysis class.
@@ -157,7 +157,7 @@
class BasicDataStructures : public DataStructures {
public:
static char ID;
- BasicDataStructures() : DataStructures((intptr_t)&ID, "basic.") {}
+ BasicDataStructures() : DataStructures(ID, "basic.") {}
~BasicDataStructures() { releaseMemory(); }
virtual bool runOnModule(Module &M);
@@ -180,7 +180,7 @@
AddressTakenAnalysis* addrAnalysis;
public:
static char ID;
- LocalDataStructures() : DataStructures((intptr_t)&ID, "local.") {}
+ LocalDataStructures() : DataStructures(ID, "local.") {}
~LocalDataStructures() { releaseMemory(); }
virtual bool runOnModule(Module &M);
@@ -203,7 +203,7 @@
AllocIdentify *AllocWrappersAnalysis;
public:
static char ID;
- StdLibDataStructures() : DataStructures((intptr_t)&ID, "stdlib.") {}
+ StdLibDataStructures() : DataStructures(ID, "stdlib.") {}
~StdLibDataStructures() { releaseMemory(); }
virtual bool runOnModule(Module &M);
@@ -234,12 +234,12 @@
public:
static char ID;
//Child constructor (CBU)
- BUDataStructures(intptr_t CID, const char* name, const char* printname,
+ BUDataStructures(char & CID, const char* name, const char* printname,
bool filter)
: DataStructures(CID, printname), debugname(name), filterCallees(filter) {}
//main constructor
BUDataStructures()
- : DataStructures((intptr_t)&ID, "bu."), debugname("dsa-bu"),
+ : DataStructures(ID, "bu."), debugname("dsa-bu"),
filterCallees(true) {}
~BUDataStructures() { releaseMemory(); }
@@ -285,7 +285,7 @@
void buildIndirectFunctionSets (void);
public:
static char ID;
- CompleteBUDataStructures(intptr_t CID = (intptr_t)&ID,
+ CompleteBUDataStructures(char & CID = ID,
const char* name = "dsa-cbu",
const char* printname = "cbu.")
: BUDataStructures(CID, name, printname, false) {}
@@ -312,7 +312,7 @@
public:
static char ID;
EquivBUDataStructures()
- : CompleteBUDataStructures((intptr_t)&ID, "dsa-eq", "eq.") {}
+ : CompleteBUDataStructures(ID, "dsa-eq", "eq.") {}
~EquivBUDataStructures() { releaseMemory(); }
virtual bool runOnModule(Module &M);
@@ -361,7 +361,7 @@
public:
static char ID;
- TDDataStructures(intptr_t CID = (intptr_t)&ID, const char* printname = "td.", bool useEQ = false)
+ TDDataStructures(char & CID = ID, const char* printname = "td.", bool useEQ = false)
: DataStructures(CID, printname), useEQBU(useEQ) {}
~TDDataStructures();
@@ -396,7 +396,7 @@
public:
static char ID;
EQTDDataStructures()
- :TDDataStructures((intptr_t)&ID, "eqtd.", true)
+ :TDDataStructures(ID, "eqtd.", true)
{}
~EQTDDataStructures();
};
@@ -414,7 +414,7 @@
public:
static char ID;
SteensgaardDataStructures() :
- DataStructures((intptr_t)&ID, "steensgaard."),
+ DataStructures(ID, "steensgaard."),
ResultGraph(NULL) {}
~SteensgaardDataStructures();
virtual bool runOnModule(Module &M);
Modified: poolalloc/trunk/include/dsa/TypeSafety.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/TypeSafety.h?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/TypeSafety.h (original)
+++ poolalloc/trunk/include/dsa/TypeSafety.h Tue Aug 2 14:36:45 2011
@@ -57,7 +57,7 @@
public:
static char ID;
- TypeSafety() : ModulePass((intptr_t)(&ID)) {}
+ TypeSafety() : ModulePass(ID) {}
virtual bool runOnModule (Module & M);
const char *getPassName() const {
Modified: poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp (original)
+++ poolalloc/trunk/lib/DSA/AddressTakenAnalysis.cpp Tue Aug 2 14:36:45 2011
@@ -14,6 +14,7 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/Constants.h"
#include "llvm/Pass.h"
#include "llvm/Module.h"
#include "llvm/Function.h"
@@ -31,9 +32,6 @@
using namespace llvm;
-AddressTakenAnalysis::AddressTakenAnalysis() :ModulePass(&ID) {
-}
-
AddressTakenAnalysis::~AddressTakenAnalysis() {}
static bool isAddressTaken(Value* V) {
Modified: poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp (original)
+++ poolalloc/trunk/lib/DSA/AllocatorIdentification.cpp Tue Aug 2 14:36:45 2011
@@ -12,6 +12,7 @@
#define DEBUG_TYPE "allocator-identify"
+#include "llvm/Constants.h"
#include "llvm/Instructions.h"
#include "llvm/Module.h"
#include "llvm/Pass.h"
@@ -63,19 +64,19 @@
// check that V is not stroed to a location taht is accessible outside this fn
for(Value::use_iterator ui = V->use_begin(), ue = V->use_end();
ui != ue; ++ui) {
- if(isa<StoreInst>(ui))
+ if(isa<StoreInst>(*ui))
return false;
- if(isa<ICmpInst>(ui))
+ if(isa<ICmpInst>(*ui))
continue;
- if(isa<ReturnInst>(ui))
+ if(isa<ReturnInst>(*ui))
continue;
- if(BitCastInst *BI = dyn_cast<BitCastInst>(ui)) {
+ if(BitCastInst *BI = dyn_cast<BitCastInst>(*ui)) {
if(isNotStored(BI))
continue;
else
return false;
}
- if(PHINode *PN = dyn_cast<PHINode>(ui)) {
+ if(PHINode *PN = dyn_cast<PHINode>(*ui)) {
if(isNotStored(PN))
continue;
else
@@ -87,7 +88,7 @@
return true;
}
-AllocIdentify::AllocIdentify() : ModulePass(&ID) {}
+AllocIdentify::AllocIdentify() : ModulePass(ID) {}
AllocIdentify::~AllocIdentify() {}
bool AllocIdentify::runOnModule(Module& M) {
@@ -112,7 +113,7 @@
for(Value::use_iterator ui = F->use_begin(), ue = F->use_end();
ui != ue; ++ui) {
// iterate though all calls to malloc
- if (CallInst* CI = dyn_cast<CallInst>(ui)) {
+ if (CallInst* CI = dyn_cast<CallInst>(*ui)) {
// The function that calls malloc could be a potential allocator
Function *WrapperF = CI->getParent()->getParent();
if(WrapperF->doesNotReturn())
@@ -164,7 +165,7 @@
for(Value::use_iterator ui = F->use_begin(), ue = F->use_end();
ui != ue; ++ui) {
// iterate though all calls to malloc
- if (CallInst* CI = dyn_cast<CallInst>(ui)) {
+ if (CallInst* CI = dyn_cast<CallInst>(*ui)) {
// The function that calls malloc could be a potential allocator
Function *WrapperF = CI->getParent()->getParent();
Modified: poolalloc/trunk/lib/DSA/CallTargets.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/CallTargets.cpp?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/CallTargets.cpp (original)
+++ poolalloc/trunk/lib/DSA/CallTargets.cpp Tue Aug 2 14:36:45 2011
@@ -55,7 +55,7 @@
for (Function::iterator F = I->begin(), FE = I->end(); F != FE; ++F)
for (BasicBlock::iterator B = F->begin(), BE = F->end(); B != BE; ++B)
if (isa<CallInst>(B) || isa<InvokeInst>(B)) {
- CallSite cs = CallSite::get(B);
+ CallSite cs(B);
AllSites.push_back(cs);
Function* CF = cs.getCalledFunction();
Modified: poolalloc/trunk/lib/DSA/DSGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DSGraph.cpp?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DSGraph.cpp (original)
+++ poolalloc/trunk/lib/DSA/DSGraph.cpp Tue Aug 2 14:36:45 2011
@@ -31,6 +31,7 @@
#include "llvm/ADT/Statistic.h"
#include "llvm/Support/Timer.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Type.h"
#include "llvm/GlobalAlias.h"
#include <iostream>
@@ -106,7 +107,7 @@
DSGraph::DSGraph(DSGraph* G, EquivalenceClasses<const GlobalValue*> &ECs,
- SuperSet<const Type*>& tss,
+ SuperSet<Type*>& tss,
unsigned CloneFlags)
: GlobalsGraph(0), ScalarMap(ECs), TD(G->TD), TypeSS(tss) {
UseAuxCalls = false;
@@ -196,10 +197,6 @@
OldNodeMap[I] = New;
}
-#ifndef NDEBUG
- Timer::addPeakMemoryMeasurement();
-#endif
-
// Rewrite the links in the new nodes to point into the current graph now.
// Note that we don't loop over the node's list to do this. The problem is
// that remaping links can cause recursive merging to happen, which means
@@ -1603,16 +1600,16 @@
// function callable from this call site.
//
if (!noDSACallFP) {
- FunctionType::param_iterator Pi = FT->param_begin(), Pe = FT->param_end(),
- Ai = F->getFunctionType()->param_begin(),
- Ae = F->getFunctionType()->param_end();
- while (Ai != Ae && Pi != Pe) {
- if ((Ai->get()->isFPOrFPVectorTy() && !Pi->get()->isFPOrFPVectorTy())
+ unsigned ANumParams = F->getFunctionType()->getNumParams();
+ unsigned PNumParams = FT->getNumParams();
+ unsigned NumParams = (ANumParams < PNumParams) ? ANumParams : PNumParams;
+ for (unsigned index = 0; index < NumParams; ++index) {
+ Type * AType = F->getFunctionType()->getParamType(index);
+ Type * PType = FT->getParamType(index);
+ if ((AType->isFPOrFPVectorTy() && !PType->isFPOrFPVectorTy())
||
- (!Ai->get()->isFPOrFPVectorTy() && Pi->get()->isFPOrFPVectorTy()))
+ (!AType->isFPOrFPVectorTy() && PType->isFPOrFPVectorTy()))
return false;
- ++Ai;
- ++Pi;
}
}
Modified: poolalloc/trunk/lib/DSA/DSTest.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DSTest.cpp?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DSTest.cpp (original)
+++ poolalloc/trunk/lib/DSA/DSTest.cpp Tue Aug 2 14:36:45 2011
@@ -280,7 +280,6 @@
// (meant to be called as a helper)
static void printTypesForNode(llvm::raw_ostream &O, NodeValue &NV) {
DSNode *N = NV.getNode();
- Module *M = NV.getParentModule();
if (N->isNodeCompletelyFolded()) {
O << "Folded";
@@ -296,10 +295,11 @@
O << ii->first << ":";
if (ii->second) {
bool first = true;
- for (svset<const Type*>::const_iterator ni = ii->second->begin(),
+ for (svset<Type*>::const_iterator ni = ii->second->begin(),
ne = ii->second->end(); ni != ne; ++ni) {
if (!first) O << "|";
- WriteTypeSymbolic(O, *ni, M);
+ Type * t = *ni;
+ t->print (O);
first = false;
}
}
Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructure.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructure.cpp Tue Aug 2 14:36:45 2011
@@ -350,7 +350,7 @@
// Iterate through all the Types, at that offset, checking if we have
// found a pointer type/integer type
- for (svset<const Type*>::const_iterator ni = TyMap[offset]->begin(),
+ for (svset<Type*>::const_iterator ni = TyMap[offset]->begin(),
ne = TyMap[offset]->end(); ni != ne; ++ni) {
if((*ni)->isPointerTy()) {
pointerTy = true;
@@ -382,7 +382,7 @@
offset2++;
continue;
}
- for (svset<const Type*>::const_iterator ni = TyMap[offset2]->begin(),
+ for (svset<Type*>::const_iterator ni = TyMap[offset2]->begin(),
ne = TyMap[offset2]->end(); ni != ne; ++ni) {
if((*ni)->isPointerTy()) {
pointerTy = true;
@@ -406,7 +406,7 @@
/// to accomodate NewTy at the given offset. This is useful for
/// updating the size of a DSNode, without actually inferring a
/// Type.
-void DSNode::growSizeForType(const Type *NewTy, unsigned Offset) {
+void DSNode::growSizeForType(Type *NewTy, unsigned Offset) {
if (!NewTy || NewTy->isVoidTy()) return;
@@ -428,7 +428,7 @@
///
/// This method returns true if the node is completely folded, otherwise false.
///
-void DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset) {
+void DSNode::mergeTypeInfo(Type *NewTy, unsigned Offset) {
if (!NewTy || NewTy->isVoidTy()) return;
if (isCollapsedNode()) return;
@@ -442,7 +442,7 @@
// struct type.
if(NewTy->isStructTy()) {
const TargetData &TD = getParentGraph()->getTargetData();
- const StructType *STy = cast<StructType>(NewTy);
+ StructType *STy = cast<StructType>(NewTy);
const StructLayout *SL = TD.getStructLayout(cast<StructType>(STy));
unsigned count = 0;
for(Type::subtype_iterator ii = STy->element_begin(), ee = STy->element_end(); ii!= ee; ++ii, ++count) {
@@ -463,13 +463,13 @@
const TargetData &TD = getParentGraph()->getTargetData();
if (!TyMap[Offset]){
TyMap[Offset] = TyIt;
- for (svset<const Type*>::const_iterator ni = TyMap[Offset]->begin(),
+ for (svset<Type*>::const_iterator ni = TyMap[Offset]->begin(),
ne = TyMap[Offset]->end(); ni != ne; ++ni) {
if (Offset + TD.getTypeAllocSize(*ni) >= getSize())
growSize(Offset + TD.getTypeAllocSize(*ni));
}
} else if (TyIt) {
- svset<const Type*> S(*TyMap[Offset]);
+ svset<Type*> S(*TyMap[Offset]);
S.insert(TyIt->begin(), TyIt->end());
TyMap[Offset] = getParentGraph()->getTypeSS().getOrCreate(S);
}
@@ -1588,7 +1588,7 @@
GraphSource = 0;
Clone = false;
TD = T;
- TypeSS = new SuperSet<const Type*>();
+ TypeSS = new SuperSet<Type*>();
GlobalsGraph = new DSGraph(GlobalECs, *T, *TypeSS);
}
Modified: poolalloc/trunk/lib/DSA/DataStructureStats.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructureStats.cpp?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructureStats.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructureStats.cpp Tue Aug 2 14:36:45 2011
@@ -14,6 +14,8 @@
#include "dsa/DataStructure.h"
#include "dsa/DSGraph.h"
#include "dsa/TypeSafety.h"
+
+#include "llvm/Constants.h"
#include "llvm/Function.h"
#include "llvm/Instructions.h"
#include "llvm/Pass.h"
@@ -69,7 +71,7 @@
bool isNodeForValueUntyped(Value *V, unsigned offset, const Function *);
public:
static char ID;
- DSGraphStats() : FunctionPass((intptr_t)&ID) {}
+ DSGraphStats() : FunctionPass(ID) {}
/// Driver functions to compute the Load/Store Dep. Graph per function.
bool runOnFunction(Function& F);
Modified: poolalloc/trunk/lib/DSA/EntryPointAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/EntryPointAnalysis.cpp?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/EntryPointAnalysis.cpp (original)
+++ poolalloc/trunk/lib/DSA/EntryPointAnalysis.cpp Tue Aug 2 14:36:45 2011
@@ -46,7 +46,7 @@
}
-EntryPointAnalysis::EntryPointAnalysis() :ModulePass(&ID), haveNames(false) {
+EntryPointAnalysis::EntryPointAnalysis() :ModulePass(ID), haveNames(false) {
}
EntryPointAnalysis::~EntryPointAnalysis() {}
Modified: poolalloc/trunk/lib/DSA/GraphChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/GraphChecker.cpp?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/GraphChecker.cpp (original)
+++ poolalloc/trunk/lib/DSA/GraphChecker.cpp Tue Aug 2 14:36:45 2011
@@ -84,7 +84,7 @@
}
-DSGC::DSGC() : FunctionPass((intptr_t)&ID) {
+DSGC::DSGC() : FunctionPass(ID) {
if (!AbortIfAnyCollapsed && AbortIfCollapsed.empty() &&
CheckFlags.empty() && AbortIfMerged.empty()) {
errs() << "The -datastructure-gc is useless if you don't specify any"
Modified: poolalloc/trunk/lib/DSA/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Local.cpp?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Local.cpp (original)
+++ poolalloc/trunk/lib/DSA/Local.cpp Tue Aug 2 14:36:45 2011
@@ -78,7 +78,7 @@
////////////////////////////////////////////////////////////////////////////
// Helper functions used to implement the visitation functions...
- void MergeConstantInitIntoNode(DSNodeHandle &NH, const Type* Ty, Constant *C);
+ void MergeConstantInitIntoNode(DSNodeHandle &NH, Type* Ty, Constant *C);
/// createNode - Create a new DSNode, ensuring that it is properly added to
/// the graph.
@@ -377,7 +377,7 @@
// check that it is the inserted value
if(TypeInferenceOptimize)
if(LI.getNumUses() == 1)
- if(StoreInst *SI = dyn_cast<StoreInst>(LI.use_begin()))
+ if(StoreInst *SI = dyn_cast<StoreInst>(*(LI.use_begin())))
if(SI->getOperand(0) == &LI) {
++NumIgnoredInst;
return;
@@ -386,7 +386,7 @@
}
void GraphBuilder::visitStoreInst(StoreInst &SI) {
- const Type *StoredTy = SI.getOperand(0)->getType();
+ Type *StoredTy = SI.getOperand(0)->getType();
DSNodeHandle Dest = getValueDest(SI.getOperand(1));
if (Dest.isNull()) return;
@@ -462,7 +462,7 @@
void GraphBuilder::visitIntToPtrInst(IntToPtrInst &I) {
DSNode *N = createNode();
if(I.getNumUses() == 1) {
- if(isa<ICmpInst>(I.use_begin())) {
+ if(isa<ICmpInst>(*(I.use_begin()))) {
NumBoringIntToPtr++;
return;
}
@@ -476,13 +476,13 @@
void GraphBuilder::visitPtrToIntInst(PtrToIntInst& I) {
DSNode* N = getValueDest(I.getOperand(0)).getNode();
if(I.getNumUses() == 1) {
- if(isa<ICmpInst>(I.use_begin())) {
+ if(isa<ICmpInst>(*(I.use_begin()))) {
NumBoringIntToPtr++;
return;
}
}
if(I.getNumUses() == 1) {
- Value *V = dyn_cast<Value>(I.use_begin());
+ Value *V = dyn_cast<Value>(*(I.use_begin()));
while(V && V->getNumUses() == 1) {
if(isa<LoadInst>(V))
break;
@@ -490,7 +490,7 @@
break;
if(isa<CallInst>(V))
break;
- V = dyn_cast<Value>(V->use_begin());
+ V = dyn_cast<Value>(*(V->use_begin()));
}
if(isa<BranchInst>(V)){
NumBoringIntToPtr++;
@@ -516,14 +516,14 @@
void GraphBuilder::visitInsertValueInst(InsertValueInst& I) {
setDestTo(I, createNode()->setAllocaMarker());
- const Type *StoredTy = I.getInsertedValueOperand()->getType();
+ Type *StoredTy = I.getInsertedValueOperand()->getType();
DSNodeHandle Dest = getValueDest(&I);
Dest.mergeWith(getValueDest(I.getAggregateOperand()));
// Mark that the node is written to...
Dest.getNode()->setModifiedMarker();
unsigned Offset = 0;
- const Type* STy = I.getAggregateOperand()->getType();
+ Type* STy = I.getAggregateOperand()->getType();
llvm::InsertValueInst::idx_iterator i = I.idx_begin(), e = I.idx_end();
for (; i != e; i++) {
const StructLayout *SL = TD.getStructLayout(cast<StructType>(STy));
@@ -545,7 +545,7 @@
// Make that the node is read from...
Ptr.getNode()->setReadMarker();
unsigned Offset = 0;
- const Type* STy = I.getAggregateOperand()->getType();
+ Type* STy = I.getAggregateOperand()->getType();
llvm::ExtractValueInst::idx_iterator i = I.idx_begin(), e = I.idx_end();
for (; i != e; i++) {
const StructLayout *SL = TD.getStructLayout(cast<StructType>(STy));
@@ -608,7 +608,7 @@
//
for (gep_type_iterator I = gep_type_begin(GEP), E = gep_type_end(GEP);
I != E; ++I)
- if (const StructType *STy = dyn_cast<StructType>(*I)) {
+ if (StructType *STy = dyn_cast<StructType>(*I)) {
// indexing into a structure
// next index must be a constant
const ConstantInt* CUI = cast<ConstantInt>(I.getOperand());
@@ -622,7 +622,7 @@
}
Offset += (unsigned)TD.getStructLayout(STy)->getElementOffset(FieldNo);
if(TypeInferenceOptimize) {
- if(const ArrayType* AT = dyn_cast<ArrayType>(STy->getTypeAtIndex(FieldNo))) {
+ if(ArrayType* AT = dyn_cast<ArrayType>(STy->getTypeAtIndex(FieldNo))) {
Value.getNode()->mergeTypeInfo(AT, Value.getOffset() + Offset);
if((++I) == E) {
break;
@@ -645,16 +645,16 @@
}
}
}
- } else if(const ArrayType *ATy = dyn_cast<ArrayType>(*I)) {
+ } else if(ArrayType *ATy = dyn_cast<ArrayType>(*I)) {
// indexing into an array.
Value.getNode()->setArrayMarker();
- const Type *CurTy = ATy->getElementType();
+ Type *CurTy = ATy->getElementType();
if(!isa<ArrayType>(CurTy) &&
Value.getNode()->getSize() <= 0) {
Value.getNode()->growSize(TD.getTypeAllocSize(CurTy));
} else if(isa<ArrayType>(CurTy) && Value.getNode()->getSize() <= 0){
- const Type *ETy = (cast<ArrayType>(CurTy))->getElementType();
+ Type *ETy = (cast<ArrayType>(CurTy))->getElementType();
while(isa<ArrayType>(ETy)) {
ETy = (cast<ArrayType>(ETy))->getElementType();
}
@@ -672,7 +672,7 @@
break;
}
} else if (const PointerType *PtrTy = dyn_cast<PointerType>(*I)) {
- const Type *CurTy = PtrTy->getElementType();
+ Type *CurTy = PtrTy->getElementType();
//
// Unless we're advancing the pointer by zero bytes via array indexing,
@@ -691,7 +691,7 @@
if(!isa<ArrayType>(CurTy) && Value.getNode()->getSize() <= 0){
Value.getNode()->growSize(TD.getTypeAllocSize(CurTy));
} else if(isa<ArrayType>(CurTy) && Value.getNode()->getSize() <= 0){
- const Type *ETy = (cast<ArrayType>(CurTy))->getElementType();
+ Type *ETy = (cast<ArrayType>(CurTy))->getElementType();
while(isa<ArrayType>(ETy)) {
ETy = (cast<ArrayType>(ETy))->getElementType();
}
@@ -1081,7 +1081,7 @@
//
void
GraphBuilder::MergeConstantInitIntoNode(DSNodeHandle &NH,
- const Type* Ty,
+ Type* Ty,
Constant *C) {
//
// Ensure a type-record exists...
@@ -1114,7 +1114,7 @@
// For an array, we don't worry about different elements pointing to
// different objects; we essentially pretend that all array elements alias.
//
- const Type * ElementType = cast<ArrayType>(Ty)->getElementType();
+ Type * ElementType = cast<ArrayType>(Ty)->getElementType();
for (unsigned i = 0, e = CA->getNumOperands(); i != e; ++i) {
Constant * ConstElement = cast<Constant>(CA->getOperand(i));
MergeConstantInitIntoNode(NH, ElementType, ConstElement);
@@ -1137,7 +1137,7 @@
// Get the type and constant value of this particular element of the
// constant structure.
//
- const Type * ElementType = cast<StructType>(Ty)->getElementType(i);
+ Type * ElementType = cast<StructType>(Ty)->getElementType(i);
Constant * ConstElement = cast<Constant>(CS->getOperand(i));
//
@@ -1192,8 +1192,8 @@
// Ensure that the DSNode is large enough to hold the new constant that we'll
// be adding to it.
//
- const Type * ElementType = GV->getType()->getElementType();
- while(const ArrayType *ATy = dyn_cast<ArrayType>(ElementType)) {
+ Type * ElementType = GV->getType()->getElementType();
+ while(ArrayType *ATy = dyn_cast<ArrayType>(ElementType)) {
ElementType = ATy->getElementType();
}
if(!NH.getNode()->isNodeCompletelyFolded()) {
Modified: poolalloc/trunk/lib/DSA/Makefile
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Makefile?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Makefile (original)
+++ poolalloc/trunk/lib/DSA/Makefile Tue Aug 2 14:36:45 2011
@@ -12,7 +12,7 @@
BUILD_ARCHIVE := 1
ifneq ($(OS),Cygwin)
ifneq ($(OS),MingW)
-SHARED_LIBRARY := 1
+#SHARED_LIBRARY := 1
#LOADABLE_MODULE := 1
endif
endif
@@ -21,7 +21,7 @@
#Essentially we're tasked with linking in the pieces that our plugin
#makes use of--but /not/ the tool we're using does /not/ make use of.
#It's dirty, but apparently what we're stuck with since we're a plugin
-LDFLAGS = $(LLVM_OBJ_ROOT)/lib/Support/$(BuildMode)/Triple.o
+#LDFLAGS = $(LLVM_OBJ_ROOT)/lib/Support/$(BuildMode)/Triple.o
include $(LEVEL)/Makefile.common
Modified: poolalloc/trunk/lib/DSA/Printer.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Printer.cpp?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Printer.cpp (original)
+++ poolalloc/trunk/lib/DSA/Printer.cpp Tue Aug 2 14:36:45 2011
@@ -66,9 +66,10 @@
ee = N->type_end(); ii != ee; ++ii) {
OS << ii->first << ": ";
if (ii->second)
- for (svset<const Type*>::const_iterator ni = ii->second->begin(),
+ for (svset<Type*>::const_iterator ni = ii->second->begin(),
ne = ii->second->end(); ni != ne; ++ni) {
- WriteTypeSymbolic(OS, *ni, M);
+ Type * t = *ni;
+ t->print (OS);
OS << ", ";
}
else
@@ -334,7 +335,7 @@
unsigned TotalNumNodes = 0, TotalCallNodes = 0;
for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
if (C.hasDSGraph(*I)) {
- DSGraph* Gr = C.getDSGraph((Function&)*I);
+ DSGraph* Gr = C.getDSGraph((const Function&)*I);
unsigned NumCalls = Gr->shouldUseAuxCalls() ?
Gr->getAuxFunctionCalls().size() : Gr->getFunctionCalls().size();
bool IsDuplicateGraph = false;
Modified: poolalloc/trunk/lib/DSA/SanityCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/SanityCheck.cpp?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/SanityCheck.cpp (original)
+++ poolalloc/trunk/lib/DSA/SanityCheck.cpp Tue Aug 2 14:36:45 2011
@@ -31,7 +31,7 @@
class SanityCheck : public ModulePass {
public:
static char ID;
- SanityCheck() : ModulePass ((intptr_t)&ID) {
+ SanityCheck() : ModulePass (ID) {
dsaPass = 0;
}
virtual bool runOnModule(Module &M);
Modified: poolalloc/trunk/lib/DSA/StdLibPass.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/StdLibPass.cpp?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/StdLibPass.cpp (original)
+++ poolalloc/trunk/lib/DSA/StdLibPass.cpp Tue Aug 2 14:36:45 2011
@@ -409,7 +409,7 @@
StdLibDataStructures::eraseCallsTo(Function* F) {
for (Value::use_iterator ii = F->use_begin(), ee = F->use_end();
ii != ee; ++ii)
- if (CallInst* CI = dyn_cast<CallInst>(ii)){
+ if (CallInst* CI = dyn_cast<CallInst>(*ii)){
if (CI->getOperand(0) == F) {
DSGraph* Graph = getDSGraph(*CI->getParent()->getParent());
//delete the call
@@ -417,7 +417,7 @@
<< CI->getParent()->getParent()->getNameStr() << "\n");
Graph->removeFunctionCalls(*F);
}
- }else if (InvokeInst* CI = dyn_cast<InvokeInst>(ii)){
+ }else if (InvokeInst* CI = dyn_cast<InvokeInst>(*ii)){
if (CI->getOperand(0) == F) {
DSGraph* Graph = getDSGraph(*CI->getParent()->getParent());
//delete the call
@@ -425,11 +425,11 @@
<< CI->getParent()->getParent()->getNameStr() << "\n");
Graph->removeFunctionCalls(*F);
}
- } else if(ConstantExpr *CE = dyn_cast<ConstantExpr>(ii)) {
+ } else if(ConstantExpr *CE = dyn_cast<ConstantExpr>(*ii)) {
if(CE->isCast()) {
for (Value::use_iterator ci = CE->use_begin(), ce = CE->use_end();
ci != ce; ++ci) {
- if (CallInst* CI = dyn_cast<CallInst>(ci)){
+ if (CallInst* CI = dyn_cast<CallInst>(*ci)){
if(CI->getOperand(0) == CE) {
DSGraph* Graph = getDSGraph(*CI->getParent()->getParent());
//delete the call
@@ -476,7 +476,7 @@
//
for (Value::use_iterator ii = F->use_begin(), ee = F->use_end();
ii != ee; ++ii) {
- if (CallInst* CI = dyn_cast<CallInst>(ii)) {
+ if (CallInst* CI = dyn_cast<CallInst>(*ii)) {
if (CI->getOperand(0) == F) {
DSGraph* Graph = getDSGraph(*CI->getParent()->getParent());
DSNodeHandle RetNode = Graph->getNodeForValue(CI);
@@ -626,7 +626,7 @@
void StdLibDataStructures::processFunction(int x, Function *F) {
for (Value::use_iterator ii = F->use_begin(), ee = F->use_end();
ii != ee; ++ii)
- if (CallInst* CI = dyn_cast<CallInst>(ii)){
+ if (CallInst* CI = dyn_cast<CallInst>(*ii)){
if (CI->getOperand(0) == F) {
DSGraph* Graph = getDSGraph(*CI->getParent()->getParent());
@@ -698,7 +698,7 @@
}
}
}
- } else if (InvokeInst* CI = dyn_cast<InvokeInst>(ii)){
+ } else if (InvokeInst* CI = dyn_cast<InvokeInst>(*ii)){
if (CI->getOperand(0) == F) {
DSGraph* Graph = getDSGraph(*CI->getParent()->getParent());
@@ -770,12 +770,12 @@
}
}
}
- } else if(ConstantExpr *CE = dyn_cast<ConstantExpr>(ii)) {
+ } else if(ConstantExpr *CE = dyn_cast<ConstantExpr>(*ii)) {
if(CE->isCast())
for (Value::use_iterator ci = CE->use_begin(), ce = CE->use_end();
ci != ce; ++ci) {
- if (CallInst* CI = dyn_cast<CallInst>(ci)){
+ if (CallInst* CI = dyn_cast<CallInst>(*ci)){
if (CI->getOperand(0) == CE) {
DSGraph* Graph = getDSGraph(*CI->getParent()->getParent());
Modified: poolalloc/trunk/lib/DSA/TypeSafety.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/TypeSafety.cpp?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/TypeSafety.cpp (original)
+++ poolalloc/trunk/lib/DSA/TypeSafety.cpp Tue Aug 2 14:36:45 2011
@@ -200,7 +200,7 @@
// Get the information about the current field.
//
unsigned offset = tn->first;
- SuperSet<const Type*>::setPtr TypeSet = tn->second;
+ SuperSet<Type*>::setPtr TypeSet = tn->second;
//
// If this is the last field, then we are done searching.
@@ -219,18 +219,18 @@
// next field.
//
if (TypeSet) {
- for (svset<const Type*>::const_iterator ni = TypeSet->begin(),
+ for (svset<Type*>::const_iterator ni = TypeSet->begin(),
ne = TypeSet->end(); ni != ne; ++ni) {
unsigned field_length = TD->getTypeStoreSize (*ni);
if ((offset + field_length) > next_offset) {
overlaps = true;
if(TypeInferenceOptimize) {
if(const ArrayType *AT = dyn_cast<ArrayType>(*ni)) {
- const Type *ElemTy = AT->getElementType();
- while(const ArrayType *AT1 = dyn_cast<ArrayType>(ElemTy))
+ Type *ElemTy = AT->getElementType();
+ while(ArrayType *AT1 = dyn_cast<ArrayType>(ElemTy))
ElemTy = AT1->getElementType();
if(next_offset < (TD->getTypeStoreSize(ElemTy) + offset)) {
- const StructType *ST = dyn_cast<StructType>(ElemTy);
+ StructType *ST = dyn_cast<StructType>(ElemTy);
assert(ST && "Array Not of struct type ???? ");
overlaps = false;
}
Modified: poolalloc/trunk/lib/Makefile
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/Makefile?rev=136715&r1=136714&r2=136715&view=diff
==============================================================================
--- poolalloc/trunk/lib/Makefile (original)
+++ poolalloc/trunk/lib/Makefile Tue Aug 2 14:36:45 2011
@@ -6,6 +6,7 @@
#
# List all of the subdirectories that we will compile.
#
-DIRS=DSA PoolAllocate AssistDS
+#DIRS=DSA PoolAllocate AssistDS
+DIRS=DSA
include $(LEVEL)/Makefile.common
More information about the llvm-commits
mailing list