summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/MipsJITInfo.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@mips.com>2012-12-03 23:11:12 +0000
committerAkira Hatanaka <ahatanaka@mips.com>2012-12-03 23:11:12 +0000
commit4c128509a53afdc049dee5b6485ea398da08fbfa (patch)
tree3f75c1bc30b3783437c4eb30ee97cfde81a6b918 /llvm/lib/Target/Mips/MipsJITInfo.cpp
parent979dfbb6a1facaf221ebbf80ede0819b2e68ce38 (diff)
downloadbcm5719-llvm-4c128509a53afdc049dee5b6485ea398da08fbfa.tar.gz
bcm5719-llvm-4c128509a53afdc049dee5b6485ea398da08fbfa.zip
Classic JIT is still being supported by MIPS, along with MCJIT.
This change adds endian-awareness to MipsJITInfo and emitWordLE in MipsCodeEmitter has become emitWord now to support both endianness. Patch by Petar Jovanovic. llvm-svn: 169177
Diffstat (limited to 'llvm/lib/Target/Mips/MipsJITInfo.cpp')
-rw-r--r--llvm/lib/Target/Mips/MipsJITInfo.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/lib/Target/Mips/MipsJITInfo.cpp b/llvm/lib/Target/Mips/MipsJITInfo.cpp
index cd910bb02a7..5fd600ebc90 100644
--- a/llvm/lib/Target/Mips/MipsJITInfo.cpp
+++ b/llvm/lib/Target/Mips/MipsJITInfo.cpp
@@ -222,10 +222,17 @@ void *MipsJITInfo::emitFunctionStub(const Function *F, void *Fn,
// addiu t9, t9, %lo(EmittedAddr)
// jalr t8, t9
// nop
- JCE.emitWordLE(0xf << 26 | 25 << 16 | Hi);
- JCE.emitWordLE(9 << 26 | 25 << 21 | 25 << 16 | Lo);
- JCE.emitWordLE(25 << 21 | 24 << 11 | 9);
- JCE.emitWordLE(0);
+ if (IsLittleEndian) {
+ JCE.emitWordLE(0xf << 26 | 25 << 16 | Hi);
+ JCE.emitWordLE(9 << 26 | 25 << 21 | 25 << 16 | Lo);
+ JCE.emitWordLE(25 << 21 | 24 << 11 | 9);
+ JCE.emitWordLE(0);
+ } else {
+ JCE.emitWordBE(0xf << 26 | 25 << 16 | Hi);
+ JCE.emitWordBE(9 << 26 | 25 << 21 | 25 << 16 | Lo);
+ JCE.emitWordBE(25 << 21 | 24 << 11 | 9);
+ JCE.emitWordBE(0);
+ }
sys::Memory::InvalidateInstructionCache(Addr, 16);
if (!sys::Memory::setRangeExecutable(Addr, 16))
OpenPOWER on IntegriCloud