[llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp

Anand Shukla ashukla at cs.uiuc.edu
Fri Sep 20 11:44:00 PDT 2002


Changes in directory llvm/lib/Transforms/Instrumentation/ProfilePaths:

ProfilePaths.cpp updated: 1.20 -> 1.21

---
Log message:

Added checking threshold


---
Diffs of the changes:

Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.20 llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.21
--- llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp:1.20	Mon Sep 16 00:24:49 2002
+++ llvm/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp	Fri Sep 20 11:43:27 2002
@@ -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 @@
     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
 }





More information about the llvm-commits mailing list