[llvm-commits] [llvm] r52734 - in /llvm/trunk: include/llvm/Target/TargetJITInfo.h lib/ExecutionEngine/JIT/JITEmitter.cpp lib/Target/PowerPC/PPCJITInfo.cpp lib/Target/PowerPC/PPCJITInfo.h
Chris Lattner
sabre at nondot.org
Wed Jun 25 10:18:44 PDT 2008
Author: lattner
Date: Wed Jun 25 12:18:44 2008
New Revision: 52734
URL: http://llvm.org/viewvc/llvm-project?rev=52734&view=rev
Log:
Switch the PPC backend and target-independent JIT to use the libsystem
InvalidateInstructionCache method instead of calling through
a hook on the JIT. This is a host feature, not a target feature.
Modified:
llvm/trunk/include/llvm/Target/TargetJITInfo.h
llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp
llvm/trunk/lib/Target/PowerPC/PPCJITInfo.cpp
llvm/trunk/lib/Target/PowerPC/PPCJITInfo.h
Modified: llvm/trunk/include/llvm/Target/TargetJITInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetJITInfo.h?rev=52734&r1=52733&r2=52734&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetJITInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetJITInfo.h Wed Jun 25 12:18:44 2008
@@ -94,11 +94,6 @@
assert(NumRelocs == 0 && "This target does not have relocations!");
}
- /// InvalidateInstructionCache - Before the JIT can run a block of code
- // that has been emitted it must invalidate the instruction cache on some
- // platforms.
- virtual void InvalidateInstructionCache(const void *Addr, unsigned len) {}
-
/// needsGOT - Allows a target to specify that it would like the
// JIT to manage a GOT for it.
bool needsGOT() const { return useGOT; }
Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=52734&r1=52733&r2=52734&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Wed Jun 25 12:18:44 2008
@@ -32,6 +32,7 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/MutexGuard.h"
#include "llvm/System/Disassembler.h"
+#include "llvm/System/Memory.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/ADT/Statistic.h"
#include <algorithm>
@@ -742,7 +743,7 @@
}
// Invalidate the icache if necessary.
- TheJIT->getJITInfo().InvalidateInstructionCache(FnStart, FnEnd-FnStart);
+ sys::Memory::InvalidateInstructionCache(FnStart, FnEnd-FnStart);
// Add it to the JIT symbol table if the host wants it.
AddFunctionToSymbolTable(F.getFunction()->getNameStart(),
Modified: llvm/trunk/lib/Target/PowerPC/PPCJITInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCJITInfo.cpp?rev=52734&r1=52733&r2=52734&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCJITInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCJITInfo.cpp Wed Jun 25 12:18:44 2008
@@ -17,7 +17,7 @@
#include "PPCTargetMachine.h"
#include "llvm/Function.h"
#include "llvm/CodeGen/MachineCodeEmitter.h"
-#include "llvm/Config/alloca.h"
+#include "llvm/System/Memory.h"
#include "llvm/Support/Debug.h"
#include <set>
using namespace llvm;
@@ -330,29 +330,6 @@
extern "C" void sys_icache_invalidate(const void *Addr, size_t len);
#endif
-void PPCJITInfo::InvalidateInstructionCache(const void *Addr, unsigned len) {
-#if (defined(__POWERPC__) || defined (__ppc__) || \
- defined(_POWER) || defined(_ARCH_PPC))
-# if defined(__APPLE__)
- sys_icache_invalidate(Addr, len);
-# elif defined(__GNUC__)
- const size_t LineSize = 32;
-
- const intptr_t Mask = ~(LineSize - 1);
- const intptr_t StartLine = ((intptr_t) Addr) & Mask;
- const intptr_t EndLine = ((intptr_t) Addr + len + LineSize - 1) & Mask;
-
- for (intptr_t Line = StartLine; Line < EndLine; Line += LineSize)
- asm volatile("dcbf 0, %0" : : "r"(Line));
- asm volatile("sync");
-
- for (intptr_t Line = StartLine; Line < EndLine; Line += LineSize)
- asm volatile("icbi 0, %0" : : "r"(Line));
- asm volatile("isync");
-# endif
-#endif
-}
-
void *PPCJITInfo::emitFunctionStub(const Function* F, void *Fn,
MachineCodeEmitter &MCE) {
// If this is just a call to an external function, emit a branch instead of a
@@ -369,7 +346,7 @@
MCE.emitWordBE(0);
MCE.emitWordBE(0);
EmitBranchToAt(Addr, (intptr_t)Fn, false, is64Bit);
- InvalidateInstructionCache((void*)Addr, 7*4);
+ sys::Memory::InvalidateInstructionCache((void*)Addr, 7*4);
return MCE.finishFunctionStub(F);
}
@@ -397,7 +374,7 @@
MCE.emitWordBE(0);
MCE.emitWordBE(0);
EmitBranchToAt(BranchAddr, (intptr_t)Fn, true, is64Bit);
- InvalidateInstructionCache((void*)Addr, 10*4);
+ sys::Memory::InvalidateInstructionCache((void*)Addr, 10*4);
return MCE.finishFunctionStub(F);
}
Modified: llvm/trunk/lib/Target/PowerPC/PPCJITInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCJITInfo.h?rev=52734&r1=52733&r2=52734&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCJITInfo.h (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCJITInfo.h Wed Jun 25 12:18:44 2008
@@ -41,11 +41,6 @@
/// code.
///
virtual void replaceMachineCodeForFunction(void *Old, void *New);
-
- /// InvalidateInstructionCache - Before the JIT can run a block of code
- // that has been emitted it must invalidate the instruction cache on some
- // platforms.
- virtual void InvalidateInstructionCache(const void *Addr, unsigned len);
};
}
More information about the llvm-commits
mailing list