diff options
| author | Anand Shukla <ashukla@cs.uiuc.edu> | 2002-09-20 16:44:35 +0000 |
|---|---|---|
| committer | Anand Shukla <ashukla@cs.uiuc.edu> | 2002-09-20 16:44:35 +0000 |
| commit | 77dca144038cbe740a4b911271e2376250c4997d (patch) | |
| tree | 3c9d7954cdb0fffcf5c300aa37170a106d8d70b2 /llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp | |
| parent | 0a79c117ac1e258b5b4ca019639d6d426cb863f5 (diff) | |
| download | bcm5719-llvm-77dca144038cbe740a4b911271e2376250c4997d.tar.gz bcm5719-llvm-77dca144038cbe740a4b911271e2376250c4997d.zip | |
Added checking threshold
llvm-svn: 3864
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp b/llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp index cd341920a55..48d5e85e646 100644 --- a/llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp +++ b/llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp @@ -26,11 +26,13 @@ #include "llvm/Transforms/Instrumentation/ProfilePaths.h" #include "llvm/Transforms/Utils/UnifyFunctionExitNodes.h" +#include "llvm/Transforms/Instrumentation/Graph.h" #include "llvm/Support/CFG.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/iMemory.h" -#include "llvm/Transforms/Instrumentation/Graph.h" +#include "llvm/GlobalVariable.h" +#include "llvm/Module.h" #include <iostream> #include <fstream> @@ -184,15 +186,29 @@ bool ProfilePaths::runOnFunction(Function &F){ AllocaInst(Type::IntTy, ConstantUInt::get(Type::UIntTy, numPaths), "Count"); + static GlobalVariable *threshold = NULL; + static bool insertedThreshold = false; + + if(!insertedThreshold){ + threshold = new GlobalVariable(Type::IntTy, false, true, 0, + "reopt_threshold"); + + F.getParent()->getGlobalList().push_back(threshold); + insertedThreshold = true; + } + + assert(threshold && "GlobalVariable threshold not defined!"); + // insert initialization code in first (entry) BB // this includes initializing r and count - insertInTopBB(&F.getEntryNode(),numPaths, rVar, countVar); + insertInTopBB(&F.getEntryNode(),numPaths, rVar, countVar, threshold); //now process the graph: get path numbers, //get increments along different paths, //and assign "increments" and "updates" (to r and count) //"optimally". Finally, insert llvm code along various edges - processGraph(g, rVar, countVar, be, stDummy, exDummy, numPaths, mn); + processGraph(g, rVar, countVar, be, stDummy, exDummy, numPaths, mn, + threshold); return true; // Always modifies function } |

