[llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp

Evan Cheng evan.cheng at apple.com
Wed Jul 26 23:34:10 PDT 2006



Changes in directory llvm/lib/ExecutionEngine/JIT:

JITEmitter.cpp updated: 1.107 -> 1.108
---
Log message:

Move synchronizeICache from TargetJITInfo into a static function in JITEmitter.cpp

---
Diffs of the changes:  (+17 -5)

 JITEmitter.cpp |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)


Index: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
diff -u llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.107 llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.108
--- llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.107	Tue Jul 25 15:40:54 2006
+++ llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp	Thu Jul 27 01:33:55 2006
@@ -516,6 +516,20 @@
   return TheJITResolver;
 }
 
+#if (defined(__POWERPC__) || defined (__ppc__) || defined(_POWER)) && \
+    defined(__APPLE__)
+extern "C" void sys_icache_invalidate(const void *Addr, size_t len);
+#endif
+
+/// synchronizeICache - On some targets, the JIT emitted code must be
+/// explicitly refetched to ensure correct execution.
+static void synchronizeICache(const void *Addr, size_t len) {
+#if (defined(__POWERPC__) || defined (__ppc__) || defined(_POWER)) && \
+    defined(__APPLE__)
+  sys_icache_invalidate(Addr, Len);
+#endif
+}
+
 /// getFunctionStub - This returns a pointer to a function stub, creating
 /// one on demand as needed.
 void *JITResolver::getFunctionStub(Function *F) {
@@ -543,8 +557,7 @@
   }
 
   // Invalidate the icache if necessary.
-  TheJIT->getJITInfo().
-    synchronizeICache(Stub, MCE.getCurrentPCValue()-(intptr_t)Stub);
+  synchronizeICache(Stub, MCE.getCurrentPCValue()-(intptr_t)Stub);
 
   DEBUG(std::cerr << "JIT: Stub emitted at [" << Stub << "] for function '"
                   << F->getName() << "'\n");
@@ -565,8 +578,7 @@
   Stub = TheJIT->getJITInfo().emitFunctionStub(FnAddr, MCE);
 
   // Invalidate the icache if necessary.
-  TheJIT->getJITInfo().
-    synchronizeICache(Stub, MCE.getCurrentPCValue()-(intptr_t)Stub);
+  synchronizeICache(Stub, MCE.getCurrentPCValue()-(intptr_t)Stub);
 
   DEBUG(std::cerr << "JIT: Stub emitted at [" << Stub
         << "] for external function at '" << FnAddr << "'\n");
@@ -838,7 +850,7 @@
   TheJIT->getJITInfo().resolveBBRefs(*this);
 
   // Invalidate the icache if necessary.
-  TheJIT->getJITInfo().synchronizeICache(FnStart, FnEnd-FnStart);
+  synchronizeICache(FnStart, FnEnd-FnStart);
 
   DEBUG(std::cerr << "JIT: Finished CodeGen of [" << (void*)FnStart
                   << "] Function: " << F.getFunction()->getName()






More information about the llvm-commits mailing list