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

Brian Gaeke gaeke at niobe.cs.uiuc.edu
Tue Aug 12 22:08:01 PDT 2003


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

SLI.cpp updated: 1.2 -> 1.3

---
Log message:

Don't include llvm/Bytecode/Reader.h.
Include Globals.h to get (most of) the extern decls we use.
Move initModules to Initialization.cpp; simplify its callers a bit.


---
Diffs of the changes:

Index: llvm/lib/Reoptimizer/LightWtProfiling/Trigger/SLI.cpp
diff -u llvm/lib/Reoptimizer/LightWtProfiling/Trigger/SLI.cpp:1.2 llvm/lib/Reoptimizer/LightWtProfiling/Trigger/SLI.cpp:1.3
--- llvm/lib/Reoptimizer/LightWtProfiling/Trigger/SLI.cpp:1.2	Tue Aug  5 13:21:27 2003
+++ llvm/lib/Reoptimizer/LightWtProfiling/Trigger/SLI.cpp	Tue Aug 12 22:05:58 2003
@@ -2,25 +2,20 @@
 #include "llvm/Reoptimizer/InstrUtils.h"
 #include "llvm/Reoptimizer/TraceCache.h"
 #include "llvm/Reoptimizer/VirtualMem.h"
-#include "llvm/Bytecode/Reader.h"
 #include "llvm/iTerminators.h"
 #include "Support/DataTypes.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/Module.h"
 #include "GetTimer.h"
+#include "Globals.h"
 #include <algorithm>
 
 using namespace std;
 
-extern TraceCache *tr;
-extern TraceCache *tr2;
-extern int llvm_length;
-extern const unsigned char LLVMBytecode[];
 extern "C" void llvm_time_end();
-extern void countPath();//unsigned int path);
+extern void countPath();
 extern "C" void llvm_first_trigger();
-Module *M;
-static bool initialized = false;
+extern void initModules ();
 
 enum Color{
   WHITE,
@@ -33,17 +28,6 @@
 
 void doInlining(uint64_t addr1, vector<Function *> &stack, VirtualMem *vm);
 
-Module *initModules(){
-  Module *M;
-  
-  //BytecodeParser Parser;
-  std::string err;
-  M = ParseBytecodeBuffer(LLVMBytecode, llvm_length, "NOFILENAME", &err);
-  assert(M && "Module parsing failed!");
-
-  return M;
-}
-
 void doBackEdgeDFS(BasicBlock *node, map<BasicBlock*, BasicBlock *> &backedges,
 		   map<BasicBlock *, Color> &color){
   color[node] = GREY;
@@ -232,19 +216,12 @@
 //     }
 
 void doInstrumentation(uint64_t addr1, uint64_t addr2, VirtualMem *vm){
- 
-  //static Module *M;
-  
   uint64_t endAddr = addr2;
 
-  //get LLVM module
-  if(!initialized){
-    M = initModules();
-    //std::cerr<<M;
-    initialized = true;
-  }
-  
-  assert(M && "Module unparsed!");
+  // Make sure we have already parsed the LLVM bytecode and have the
+  // resulting LLVM Module handy.
+  if (!M)
+    initModules();
   
   //get BB address
   BasicBlock *root=NULL, *end=NULL;
@@ -525,20 +502,14 @@
 }
 
 void doInlining(uint64_t addr1, vector<Function *> &stack, VirtualMem *vm){
-  static bool initialized = false;
+  // Make sure we have already parsed the LLVM bytecode and have the
+  // resulting LLVM Module handy.
+  if (!M)
+    initModules();
 
-  assert(M && "No module!");
   Function *F = getRevFunction(M, addr1); 
 
   stack.push_back(F); //the functions inlined so far are in stack
-
-  //get LLVM module
-  if(!initialized){
-    M = initModules();
-    initialized = true;
-  }
-  
-  assert(M && "Module unparsed!");
   
   //get BB address
   BasicBlock *root = &F->front();





More information about the llvm-commits mailing list