[llvm-commits] CVS: llvm/tools/lli/JIT/JIT.cpp

Misha Brukman brukman at cs.uiuc.edu
Fri Jun 6 02:01:01 PDT 2003


Changes in directory llvm/tools/lli/JIT:

JIT.cpp updated: 1.6 -> 1.7

---
Log message:

::: HACK ALERT ::: HACK ALERT ::: HACK ALERT ::: HACK ALERT ::: HACK ALERT :::

The JIT is designed to code-generate a function at-a-time. That means that any
pass can only make local changes to its function. Period.

Because the Sparc PreSelection pass claims to be a BasicBlock pass while adding
globals to the Module, it cannot be run with the other passes, because by this
time, the globals have been output already by the JIT, and the addresses of any
globals appearing AFTER this point are not recognized.

However, the PreSelection pass is a requirement for correctness in the Sparc
codegen path, so it MUST be run.

::: HACK ALERT ::: HACK ALERT ::: HACK ALERT ::: HACK ALERT ::: HACK ALERT :::


---
Diffs of the changes:

Index: llvm/tools/lli/JIT/JIT.cpp
diff -u llvm/tools/lli/JIT/JIT.cpp:1.6 llvm/tools/lli/JIT/JIT.cpp:1.7
--- llvm/tools/lli/JIT/JIT.cpp:1.6	Sun Jun  1 22:23:16 2003
+++ llvm/tools/lli/JIT/JIT.cpp	Fri Jun  6 01:59:55 2003
@@ -11,6 +11,9 @@
 #include "llvm/Module.h"
 #include "Support/CommandLine.h"
 
+// FIXME: REMOVE THIS
+#include "llvm/PassManager.h"
+
 namespace {
   cl::opt<std::string>
   Arch("march", cl::desc("Architecture: `x86' or `sparc'"), cl::Prefix,
@@ -27,7 +30,6 @@
 
 }
 
-
 /// createJIT - Create an return a new JIT compiler if there is one available
 /// for the current target.  Otherwise it returns null.
 ///
@@ -65,6 +67,17 @@
   MCE = createEmitter(*this);
 
   setupPassManager();
+
+  // THIS GOES BEYOND UGLY HACKS
+  if (TM.getName() == "UltraSparc-Native") {
+    extern Pass *createPreSelectionPass(TargetMachine &TM);
+    PassManager PM;
+    // Specialize LLVM code for this target machine and then
+    // run basic dataflow optimizations on LLVM code.
+    PM.add(createPreSelectionPass(TM));
+    PM.run(*M);
+  }
+
   emitGlobals();
 }
 





More information about the llvm-commits mailing list