diff options
author | Evan Cheng <evan.cheng@apple.com> | 2006-07-25 20:40:54 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2006-07-25 20:40:54 +0000 |
commit | 55fc28076fa48723bd170e51638b3b5974ca0fa1 (patch) | |
tree | 954eb5ec8c5be4c9a3b5cb6c6cbe7f6398564370 /lib/ExecutionEngine | |
parent | 55371739dec0ade6fcc77de228fb3e4d098845f7 (diff) | |
download | external_llvm-55fc28076fa48723bd170e51638b3b5974ca0fa1.zip external_llvm-55fc28076fa48723bd170e51638b3b5974ca0fa1.tar.gz external_llvm-55fc28076fa48723bd170e51638b3b5974ca0fa1.tar.bz2 |
- 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29276 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine')
-rw-r--r-- | lib/ExecutionEngine/JIT/JITEmitter.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp index 5e13016..ecde6cf 100644 --- a/lib/ExecutionEngine/JIT/JITEmitter.cpp +++ b/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, " |