aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-07-27 06:33:55 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-07-27 06:33:55 +0000
commit55b5053b8e22cf165d1f0ce3aa9a04707e368a15 (patch)
treee233659f222141b7cbc531ca15d6cb41277c3c45
parent2d4ed2d4fde60fa27fe91b8875414d2958ee8030 (diff)
Move synchronizeICache from TargetJITInfo into a static function in JITEmitter.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29334 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Target/TargetJITInfo.h4
-rw-r--r--lib/ExecutionEngine/JIT/JITEmitter.cpp22
2 files changed, 17 insertions, 9 deletions
diff --git a/include/llvm/Target/TargetJITInfo.h b/include/llvm/Target/TargetJITInfo.h
index dee5a95375..26c7d38333 100644
--- a/include/llvm/Target/TargetJITInfo.h
+++ b/include/llvm/Target/TargetJITInfo.h
@@ -87,10 +87,6 @@ namespace llvm {
/// function.
virtual void resolveBBRefs(MachineCodeEmitter &MCE) {}
- /// synchronizeICache - On some targets, the JIT emitted code must be
- /// explicitly refetched to ensure correct execution.
- virtual void synchronizeICache(const void *Addr, size_t len) {}
-
/// addBBRef - Add a BasicBlock reference to be resolved after the function
/// is emitted.
void addBBRef(MachineBasicBlock *BB, intptr_t PC) {
diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp
index ecde6cfeca..9cbd00f566 100644
--- a/lib/ExecutionEngine/JIT/JITEmitter.cpp
+++ b/lib/ExecutionEngine/JIT/JITEmitter.cpp
@@ -516,6 +516,20 @@ static JITResolver &getJITResolver(MachineCodeEmitter *MCE = 0) {
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 @@ void *JITResolver::getFunctionStub(Function *F) {
}
// 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 @@ void *JITResolver::getExternalFunctionStub(void *FnAddr) {
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 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
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()