diff options
author | Anand Shukla <ashukla@cs.uiuc.edu> | 2003-02-14 20:41:53 +0000 |
---|---|---|
committer | Anand Shukla <ashukla@cs.uiuc.edu> | 2003-02-14 20:41:53 +0000 |
commit | f8c09ee341e16b940cbf4e4268ea44275ddfbf78 (patch) | |
tree | a60c0bc541a4a8aa62d5ee287c3e268f5177a1d8 /llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp | |
parent | b5cbfa0f15521ea2272cd010326031720ed4d461 (diff) | |
download | bcm5719-llvm-f8c09ee341e16b940cbf4e4268ea44275ddfbf78.tar.gz bcm5719-llvm-f8c09ee341e16b940cbf4e4268ea44275ddfbf78.zip |
Changes to runtime framework
llvm-svn: 5572
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp')
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp b/llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp index 4c689b12eec..39e7c351210 100644 --- a/llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp +++ b/llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp @@ -155,6 +155,8 @@ bool ProfilePaths::runOnFunction(Function &F){ // numPaths is the number of acyclic paths in the graph int numPaths=valueAssignmentToEdges(g, nodePriority, be); + //if(numPaths<=1) return false; + if(numPaths<=1 || numPaths >5000) return false; #ifdef DEBUG_PATH_PROFILES @@ -172,10 +174,17 @@ bool ProfilePaths::runOnFunction(Function &F){ AllocaInst(Type::IntTy, ConstantUInt::get(Type::UIntTy,1),"R"); - Instruction *countVar=new - AllocaInst(Type::IntTy, - ConstantUInt::get(Type::UIntTy, numPaths), "Count"); - + //Instruction *countVar=new + //AllocaInst(Type::IntTy, + // ConstantUInt::get(Type::UIntTy, numPaths), "Count"); + + //initialize counter array! + std::vector<Constant*> arrayInitialize; + for(int xi=0; xi<numPaths; xi++) + arrayInitialize.push_back(ConstantSInt::get(Type::IntTy, 0)); + + Constant *initializer = ConstantArray::get(ArrayType::get(Type::IntTy, numPaths), arrayInitialize); + GlobalVariable *countVar = new GlobalVariable(ArrayType::get(Type::IntTy, numPaths), false, true, initializer, "Count", F.getParent()); static GlobalVariable *threshold = NULL; static bool insertedThreshold = false; @@ -191,7 +200,7 @@ bool ProfilePaths::runOnFunction(Function &F){ // insert initialization code in first (entry) BB // this includes initializing r and count - insertInTopBB(&F.getEntryNode(),numPaths, rVar, countVar, threshold); + insertInTopBB(&F.getEntryNode(),numPaths, rVar, threshold); //now process the graph: get path numbers, //get increments along different paths, |