/// 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) {
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) {
}
// 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");
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");
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()