summaryrefslogtreecommitdiff
path: root/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
diff options
context:
space:
mode:
authorAnand Shukla <ashukla@cs.uiuc.edu>2003-02-14 20:41:53 +0000
committerAnand Shukla <ashukla@cs.uiuc.edu>2003-02-14 20:41:53 +0000
commit92d5e30e762601ce1076e548d2281fac39e40fe3 (patch)
tree60bf5434d7a467f75236cb71d3d4198c11ffecaa /lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
parentf1c283859b4a2279773d22e0db59763f1f846212 (diff)
downloadllvm-92d5e30e762601ce1076e548d2281fac39e40fe3.tar.gz
llvm-92d5e30e762601ce1076e548d2281fac39e40fe3.tar.bz2
llvm-92d5e30e762601ce1076e548d2281fac39e40fe3.tar.xz
Changes to runtime framework
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5572 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp')
-rw-r--r--lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp b/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
index 4c689b12ee..39e7c35121 100644
--- a/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
+++ b/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,