[llvm-commits] CVS: llvm/lib/Reoptimizer/LightWtProfiling/Trigger/Initialization.cpp

Brian Gaeke gaeke at cs.uiuc.edu
Mon Aug 18 15:35:11 PDT 2003


Changes in directory llvm/lib/Reoptimizer/LightWtProfiling/Trigger:

Initialization.cpp updated: 1.1 -> 1.2

---
Log message:

Include Support/CommandLine.h and Support/DataTypes.h.
Regularize the types of a few of the globals.
Add cl::opt declarations for two of the reoptimizer's parameters.
Add call to cl::ParseEnvironmentOptions() to fill them in (replaces
 getenv stuff).


---
Diffs of the changes:

Index: llvm/lib/Reoptimizer/LightWtProfiling/Trigger/Initialization.cpp
diff -u llvm/lib/Reoptimizer/LightWtProfiling/Trigger/Initialization.cpp:1.1 llvm/lib/Reoptimizer/LightWtProfiling/Trigger/Initialization.cpp:1.2
--- llvm/lib/Reoptimizer/LightWtProfiling/Trigger/Initialization.cpp:1.1	Tue Aug 12 22:06:45 2003
+++ llvm/lib/Reoptimizer/LightWtProfiling/Trigger/Initialization.cpp	Mon Aug 18 15:34:00 2003
@@ -8,40 +8,48 @@
 
 #include "GetTimer.h"
 #include "Globals.h"
+#include "Support/CommandLine.h"
+#include "Support/DataTypes.h"
 #include "llvm/Bytecode/Reader.h"
 
 // Function used as space for the second-level instrumentation trace cache.
 extern "C" void dummyFunction2 ();
 
 // Definitions of globals declared extern in Globals.h
-int reopt_threshold;
-long THRESHOLD_LEVEL_2;
-long LEVEL_TWO_EXITS; 
+int32_t reopt_threshold;
+int32_t THRESHOLD_LEVEL_2;
+int32_t LEVEL_TWO_EXITS;
 TraceCache *tr;
 TraceCache *tr2;
 VirtualMem *vm;
 Module *M;
 
-/// Initialization method for the reoptimizer. A call to this function
-/// from main() is inserted by the opt -instloops pass
+// Command line options. Use these to set the global variables.  For
+// now the reoptimizer code references the global variables
+// explicitly.  When the reoptimizer is encapsulated into an object,
+// we can just use the object's constructor to copy these values into
+// fields of the object.
+cl::opt<int32_t, true>
+FLIThreshold("fli-threshold", cl::init(DEFAULT_THRESHOLD_LEVEL_1),
+	     cl::location(reopt_threshold));
+
+cl::opt<int32_t, true>
+SLIThreshold("sli-threshold", cl::init(DEFAULT_THRESHOLD_LEVEL_2),
+	     cl::location(THRESHOLD_LEVEL_2));
+
+/// reoptimizerInitialize - Initialization method for the
+/// reoptimizer. A call to this function from main() is inserted by
+/// the opt -instloops pass
 /// (Transforms/Instrumentation/ProfilePaths/InstLoops.cpp).
 ///
 extern "C" void reoptimizerInitialize(){
+  cl::ParseEnvironmentOptions ("reoptimizer", "LLVM_REOPTIMIZER",
+			       " llvm dynamic optimizer");
   vm = new VirtualMem();
   tr = new TraceCache(30000, vm);
   tr2 = new TraceCache(dummyFunction2, 30000, vm);
  
-  if(getenv("THRESHOLD_LEVEL_2")!=NULL)
-    THRESHOLD_LEVEL_2 = atoi(getenv("THRESHOLD_LEVEL_2"));
-  else
-    THRESHOLD_LEVEL_2= DEFAULT_THRESHOLD_LEVEL_2;
-
   LEVEL_TWO_EXITS = THRESHOLD_LEVEL_2/3;
-
-  if(getenv("THRESHOLD_LEVEL_1")!=NULL)
-    reopt_threshold = atoi(getenv("THRESHOLD_LEVEL_1"));
-  else
-    reopt_threshold = DEFAULT_THRESHOLD_LEVEL_1;
 
   // FIXME: When do we need to call this?
   //initialize_timer();





More information about the llvm-commits mailing list