mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-29 10:32:47 +00:00
* Add data structures to BU pass to keep track of call sites for functions
* Reenable the TD analysis git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4212 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a2c5c2b23a
commit
8d00c8210e
@ -11,11 +11,11 @@
|
||||
|
||||
class Type;
|
||||
class DSGraph;
|
||||
class DSNodeHandle;
|
||||
class LocalDataStructures; // A collection of local graphs for a program
|
||||
class BUDataStructures; // A collection of bu graphs for a program
|
||||
class TDDataStructures; // A collection of td graphs for a program
|
||||
|
||||
|
||||
// FIXME: move this stuff to a private header
|
||||
namespace DataStructureAnalysis {
|
||||
// isPointerType - Return true if this first class type is big enough to hold
|
||||
@ -63,8 +63,19 @@ public:
|
||||
// only performs a "Bottom Up" propogation (hence the name).
|
||||
//
|
||||
class BUDataStructures : public Pass {
|
||||
public:
|
||||
struct CallSite {
|
||||
Function *Caller;
|
||||
std::vector<DSNodeHandle> Context;
|
||||
|
||||
CallSite(Function &C, const std::vector<DSNodeHandle> &Con)
|
||||
: Caller(&C), Context(Con) {}
|
||||
};
|
||||
|
||||
private:
|
||||
// DSInfo, one graph for each function
|
||||
std::map<const Function*, DSGraph*> DSInfo;
|
||||
std::map<const Function*, std::vector<CallSite> > CallSites;
|
||||
public:
|
||||
~BUDataStructures() { releaseMemory(); }
|
||||
|
||||
@ -77,6 +88,12 @@ public:
|
||||
return *I->second;
|
||||
}
|
||||
|
||||
const std::vector<CallSite> *getCallSites(const Function &F) const {
|
||||
std::map<const Function*, std::vector<CallSite> >::const_iterator I
|
||||
= CallSites.find(&F);
|
||||
return I != CallSites.end() ? &I->second : 0;
|
||||
}
|
||||
|
||||
// print - Print out the analysis results...
|
||||
void print(std::ostream &O, const Module *M) const;
|
||||
|
||||
@ -92,8 +109,6 @@ private:
|
||||
DSGraph &calculateGraph(Function &F);
|
||||
};
|
||||
|
||||
|
||||
#if 0
|
||||
// TDDataStructures - Analysis that computes new data structure graphs
|
||||
// for each function using the closed graphs for the callers computed
|
||||
// by the bottom-up pass.
|
||||
@ -126,11 +141,10 @@ public:
|
||||
}
|
||||
private:
|
||||
DSGraph &calculateGraph(Function &F);
|
||||
void pushGraphIntoCallee(DSGraph &callerGraph, DSGraph &calleeGraph,
|
||||
std::map<Value*, DSNodeHandle> &OldValMap,
|
||||
std::map<const DSNode*, DSNode*> &OldNodeMap);
|
||||
|
||||
void ResolveCallSite(DSGraph &Graph,
|
||||
const BUDataStructures::CallSite &CallSite);
|
||||
};
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// GlobalDSGraph - A common graph for all the globals and their outgoing links
|
||||
|
@ -11,11 +11,11 @@
|
||||
|
||||
class Type;
|
||||
class DSGraph;
|
||||
class DSNodeHandle;
|
||||
class LocalDataStructures; // A collection of local graphs for a program
|
||||
class BUDataStructures; // A collection of bu graphs for a program
|
||||
class TDDataStructures; // A collection of td graphs for a program
|
||||
|
||||
|
||||
// FIXME: move this stuff to a private header
|
||||
namespace DataStructureAnalysis {
|
||||
// isPointerType - Return true if this first class type is big enough to hold
|
||||
@ -63,8 +63,19 @@ public:
|
||||
// only performs a "Bottom Up" propogation (hence the name).
|
||||
//
|
||||
class BUDataStructures : public Pass {
|
||||
public:
|
||||
struct CallSite {
|
||||
Function *Caller;
|
||||
std::vector<DSNodeHandle> Context;
|
||||
|
||||
CallSite(Function &C, const std::vector<DSNodeHandle> &Con)
|
||||
: Caller(&C), Context(Con) {}
|
||||
};
|
||||
|
||||
private:
|
||||
// DSInfo, one graph for each function
|
||||
std::map<const Function*, DSGraph*> DSInfo;
|
||||
std::map<const Function*, std::vector<CallSite> > CallSites;
|
||||
public:
|
||||
~BUDataStructures() { releaseMemory(); }
|
||||
|
||||
@ -77,6 +88,12 @@ public:
|
||||
return *I->second;
|
||||
}
|
||||
|
||||
const std::vector<CallSite> *getCallSites(const Function &F) const {
|
||||
std::map<const Function*, std::vector<CallSite> >::const_iterator I
|
||||
= CallSites.find(&F);
|
||||
return I != CallSites.end() ? &I->second : 0;
|
||||
}
|
||||
|
||||
// print - Print out the analysis results...
|
||||
void print(std::ostream &O, const Module *M) const;
|
||||
|
||||
@ -92,8 +109,6 @@ private:
|
||||
DSGraph &calculateGraph(Function &F);
|
||||
};
|
||||
|
||||
|
||||
#if 0
|
||||
// TDDataStructures - Analysis that computes new data structure graphs
|
||||
// for each function using the closed graphs for the callers computed
|
||||
// by the bottom-up pass.
|
||||
@ -126,11 +141,10 @@ public:
|
||||
}
|
||||
private:
|
||||
DSGraph &calculateGraph(Function &F);
|
||||
void pushGraphIntoCallee(DSGraph &callerGraph, DSGraph &calleeGraph,
|
||||
std::map<Value*, DSNodeHandle> &OldValMap,
|
||||
std::map<const DSNode*, DSNode*> &OldNodeMap);
|
||||
|
||||
void ResolveCallSite(DSGraph &Graph,
|
||||
const BUDataStructures::CallSite &CallSite);
|
||||
};
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// GlobalDSGraph - A common graph for all the globals and their outgoing links
|
||||
|
Loading…
Reference in New Issue
Block a user