mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-07 14:33:15 +00:00
changed function numbering
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2815 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4b244ac1b4
commit
d4d79067c0
@ -69,6 +69,17 @@ static Node *findBB(std::vector<Node *> &st, BasicBlock *BB){
|
||||
bool ProfilePaths::runOnFunction(Function &F){
|
||||
|
||||
static int mn = -1;
|
||||
|
||||
if(F.size() <=1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//increment counter for instrumented functions. mn is now function#
|
||||
mn++;
|
||||
|
||||
//std::cerr<<"MN = "<<mn<<"\n";;
|
||||
//std::cerr<<F;
|
||||
|
||||
// Transform the cfg s.t. we have just one exit node
|
||||
BasicBlock *ExitNode = getAnalysis<UnifyFunctionExitNodes>().getExitNode();
|
||||
|
||||
@ -82,18 +93,10 @@ bool ProfilePaths::runOnFunction(Function &F){
|
||||
// The nodes must be uniquesly identified:
|
||||
// That is, no two nodes must hav same BB*
|
||||
|
||||
// First enter just nodes: later enter edges
|
||||
//<<<<<<< ProfilePaths.cpp
|
||||
//for (Function::iterator BB = M->begin(), BE=M->end(); BB != BE; ++BB){
|
||||
//Node *nd=new Node(*BB);
|
||||
//nodes.push_back(nd);
|
||||
//if(*BB==ExitNode)
|
||||
//=======
|
||||
for (Function::iterator BB = F.begin(), BE = F.end(); BB != BE; ++BB) {
|
||||
Node *nd=new Node(BB);
|
||||
nodes.push_back(nd);
|
||||
if(&*BB == ExitNode)
|
||||
//>>>>>>> 1.13
|
||||
exitNode=nd;
|
||||
if(&*BB==F.begin())
|
||||
startNode=nd;
|
||||
@ -106,13 +109,6 @@ bool ProfilePaths::runOnFunction(Function &F){
|
||||
|
||||
for(BasicBlock::succ_iterator s=succ_begin(BB), se=succ_end(BB);
|
||||
s!=se; ++s){
|
||||
//tempVec.push_back(*s);
|
||||
//}
|
||||
|
||||
//sort(tempVec.begin(), tempVec.end(), BBSort());
|
||||
|
||||
//for(vector<BasicBlock *>::iterator s=tempVec.begin(), se=tempVec.end();
|
||||
//s!=se; ++s){
|
||||
Node *nd2=findBB(nodes,*s);
|
||||
assert(nd2 && "No node for this edge!");
|
||||
Edge ed(nd,nd2,0);
|
||||
@ -122,16 +118,13 @@ bool ProfilePaths::runOnFunction(Function &F){
|
||||
|
||||
Graph g(nodes,edges, startNode, exitNode);
|
||||
|
||||
//#ifdef DEBUG_PATH_PROFILES
|
||||
//std::cerr<<"Original graph\n";
|
||||
//printGraph(g);
|
||||
//#endif
|
||||
#ifdef DEBUG_PATH_PROFILES
|
||||
std::cerr<<"Original graph\n";
|
||||
printGraph(g);
|
||||
#endif
|
||||
|
||||
BasicBlock *fr=&F.front();
|
||||
BasicBlock *fr = &F.front();
|
||||
|
||||
// If only one BB, don't instrument
|
||||
if (++F.begin() == F.end()) {
|
||||
mn++;
|
||||
// The graph is made acyclic: this is done
|
||||
// by removing back edges for now, and adding them later on
|
||||
vector<Edge> be;
|
||||
@ -219,7 +212,7 @@ bool ProfilePaths::runOnFunction(Function &F){
|
||||
to<<"::::: "<<mn<<" "<<i<<" "<<size<<"\n";
|
||||
}
|
||||
*/
|
||||
}
|
||||
//}
|
||||
|
||||
return true; // Always modifies function
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user