summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-07-25 20:40:54 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-07-25 20:40:54 +0000
commitf6acb34d239ed2828fce6bc2c1a69d92354df73a (patch)
treef7fbac3669a48447ce3ea63724624d22e155411d /llvm/lib/ExecutionEngine
parent66ed41cac17713d7fd90445412d207ab0673f712 (diff)
downloadbcm5719-llvm-f6acb34d239ed2828fce6bc2c1a69d92354df73a.tar.gz
bcm5719-llvm-f6acb34d239ed2828fce6bc2c1a69d92354df73a.zip
- Refactor the code that resolve basic block references to a TargetJITInfo
method. - Added synchronizeICache() to TargetJITInfo. It is called after each block of code is emitted to flush the icache. This ensures correct execution on targets that have separate dcache and icache. - Added PPC / Mac OS X specific code to do icache flushing. llvm-svn: 29276
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r--llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp b/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
index 5e130167279..ecde6cfeca8 100644
--- a/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
@@ -542,6 +542,10 @@ void *JITResolver::getFunctionStub(Function *F) {
TheJIT->updateGlobalMapping(F, Stub);
}
+ // Invalidate the icache if necessary.
+ TheJIT->getJITInfo().
+ synchronizeICache(Stub, MCE.getCurrentPCValue()-(intptr_t)Stub);
+
DEBUG(std::cerr << "JIT: Stub emitted at [" << Stub << "] for function '"
<< F->getName() << "'\n");
@@ -559,6 +563,11 @@ void *JITResolver::getExternalFunctionStub(void *FnAddr) {
if (Stub) return Stub;
Stub = TheJIT->getJITInfo().emitFunctionStub(FnAddr, MCE);
+
+ // Invalidate the icache if necessary.
+ TheJIT->getJITInfo().
+ synchronizeICache(Stub, MCE.getCurrentPCValue()-(intptr_t)Stub);
+
DEBUG(std::cerr << "JIT: Stub emitted at [" << Stub
<< "] for external function at '" << FnAddr << "'\n");
return Stub;
@@ -747,7 +756,7 @@ void JITEmitter::startFunction(MachineFunction &F) {
// About to start emitting the machine code for the function.
emitAlignment(std::max(F.getFunction()->getAlignment(), 8U));
TheJIT->updateGlobalMapping(F.getFunction(), CurBufferPtr);
-
+
MBBLocations.clear();
}
@@ -825,6 +834,12 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
}
}
+ // Resolve BasicaBlock references.
+ TheJIT->getJITInfo().resolveBBRefs(*this);
+
+ // Invalidate the icache if necessary.
+ TheJIT->getJITInfo().synchronizeICache(FnStart, FnEnd-FnStart);
+
DEBUG(std::cerr << "JIT: Finished CodeGen of [" << (void*)FnStart
<< "] Function: " << F.getFunction()->getName()
<< ": " << (FnEnd-FnStart) << " bytes of text, "
OpenPOWER on IntegriCloud