[llvm-commits] CVS: reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp

Brian Gaeke gaeke at cs.uiuc.edu
Mon Sep 8 16:00:02 PDT 2003


Changes in directory reopt/lib/LightWtProfiling:

RuntimeOptimizations.cpp updated: 1.6 -> 1.7

---
Log message:

Take out debug message.
Don't dump traces to file.
Jot down some notes about code-generating the function (#if 0'd out).


---
Diffs of the changes:

Index: reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp
diff -u reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp:1.6 reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp:1.7
--- reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp:1.6	Tue Sep  2 01:46:39 2003
+++ reopt/lib/LightWtProfiling/RuntimeOptimizations.cpp	Mon Sep  8 15:58:59 2003
@@ -13,6 +13,7 @@
 #include "Support/StringExtras.h"
 #include "llvm/PassManager.h"
 #include "llvm/BasicBlock.h"
+#include "llvm/Analysis/Verifier.h"
 #include <set>
 #include <fstream>
 
@@ -30,8 +31,7 @@
 void optimizeTrace (std::vector<BasicBlock *> &vBB, uint64_t a) {
   static std::set<uint64_t> alreadyDone;
   if (alreadyDone.find (a) != alreadyDone.end ()) {
-    DEBUG(std::cerr << "In optimizeTrace; already did this trace! a = "
-	  << a << "\n");
+    // Used to have debug msg here, but it generated megabytes of spam.
     return;
   } else {
     alreadyDone.insert(a);
@@ -51,14 +51,32 @@
 
   // Create Trace object.
   Trace T (vBB);
-  static int count = 0;
-  count++;
-  std::string filename ("traceout" + itostr (count) + ".txt");
-  DEBUG(std::cerr << "Dumping trace to file " << filename << "\n");
-  std::ofstream o (filename.c_str ());
-  T.print (o);
 
   // Try to turn it into a function
   Function *TF = runTraceToFunction (T);
   DEBUG(std::cerr << "Function created from trace: \n" << *TF);
+
+  // Run some stuff on it
+  FunctionPassManager PM;
+  PM.add (createVerifierPass ());
+  PM.run (*TF);
+
+#if 0
+
+  // Make the ExecutionEngine generate code for the function and give us
+  // a pointer to it.
+  // FIXME: Register allocation hints presumably would need to be added
+  // to the PassManager of the ExecutionEngine.
+  ExecutionEngine *EE = new ExecutionEngine (TF->getParent (), false, false);
+  void (*p)() = EE->getPointerToFunction (TF);
+
+  // Generate basic block with fixup code for entry:
+  // Suppose we have a ValueToRegMap which maps values to machine registers
+  // at the entry to the first on-trace basic block. 
+  // (How would we get this?)
+  // For each value V in the Trace's live-in set,
+  //   We want to copy V from its register in the matrix function ...
+
+   
+#endif
 }





More information about the llvm-commits mailing list