aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/ARM/ARMJITInfo.cpp
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2009-12-15 22:42:46 +0000
committerJeffrey Yasskin <jyasskin@google.com>2009-12-15 22:42:46 +0000
commit32d7e6ebde29faeea75ecb718b4281414b0eea0b (patch)
treee028decfe52b4e0740391a657d01b1bef54c2492 /lib/Target/ARM/ARMJITInfo.cpp
parent6be413dd64c359f03b91321defceef9d641f1235 (diff)
Change indirect-globals to use a dedicated allocIndirectGV. This lets us
remove start/finishGVStub and the BufferState helper class from the MachineCodeEmitter interface. It has the side-effect of not setting the indirect global writable and then executable on ARM, but that shouldn't be necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91464 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMJITInfo.cpp')
-rw-r--r--lib/Target/ARM/ARMJITInfo.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/Target/ARM/ARMJITInfo.cpp b/lib/Target/ARM/ARMJITInfo.cpp
index aa50cfd307..bef5a0612f 100644
--- a/lib/Target/ARM/ARMJITInfo.cpp
+++ b/lib/Target/ARM/ARMJITInfo.cpp
@@ -139,17 +139,11 @@ ARMJITInfo::getLazyResolverFunction(JITCompilerFn F) {
void *ARMJITInfo::emitGlobalValueIndirectSym(const GlobalValue *GV, void *Ptr,
JITCodeEmitter &JCE) {
- MachineCodeEmitter::BufferState BS;
- JCE.startGVStub(BS, GV, 4, 4);
- intptr_t Addr = (intptr_t)JCE.getCurrentPCValue();
- if (!sys::Memory::setRangeWritable((void*)Addr, 4)) {
- llvm_unreachable("ERROR: Unable to mark indirect symbol writable");
- }
- JCE.emitWordLE((intptr_t)Ptr);
- if (!sys::Memory::setRangeExecutable((void*)Addr, 4)) {
- llvm_unreachable("ERROR: Unable to mark indirect symbol executable");
- }
- void *PtrAddr = JCE.finishGVStub(BS);
+ uint8_t Buffer[4];
+ uint8_t *Cur = Buffer;
+ MachineCodeEmitter::emitWordLEInto(Cur, (intptr_t)Ptr);
+ void *PtrAddr = JCE.allocIndirectGV(
+ GV, Buffer, sizeof(Buffer), /*Alignment=*/4);
addIndirectSymAddr(Ptr, (intptr_t)PtrAddr);
return PtrAddr;
}