summaryrefslogtreecommitdiff
path: root/lib/Target/PowerPC/PPCJITInfo.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-06-25 17:18:44 +0000
committerChris Lattner <sabre@nondot.org>2008-06-25 17:18:44 +0000
commitbc52cada0933f353d30da7b49af9a641bdb2c57d (patch)
treea5f90f85923b79c2cc7a3690f010221c7cbbd2c1 /lib/Target/PowerPC/PPCJITInfo.cpp
parent95f39009aaeb4614f3eeab3864ae1a31289f1a30 (diff)
downloadllvm-bc52cada0933f353d30da7b49af9a641bdb2c57d.tar.gz
llvm-bc52cada0933f353d30da7b49af9a641bdb2c57d.tar.bz2
llvm-bc52cada0933f353d30da7b49af9a641bdb2c57d.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52734 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPCJITInfo.cpp')
-rw-r--r--lib/Target/PowerPC/PPCJITInfo.cpp29
1 files changed, 3 insertions, 26 deletions
diff --git a/lib/Target/PowerPC/PPCJITInfo.cpp b/lib/Target/PowerPC/PPCJITInfo.cpp
index f400297a81..41c755bcd9 100644
--- a/lib/Target/PowerPC/PPCJITInfo.cpp
+++ b/lib/Target/PowerPC/PPCJITInfo.cpp
@@ -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 @@ defined(__APPLE__)
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 @@ void *PPCJITInfo::emitFunctionStub(const Function* F, void *Fn,
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 @@ void *PPCJITInfo::emitFunctionStub(const Function* F, void *Fn,
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);
}