summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/MipsCodeEmitter.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/MipsCodeEmitter.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/MipsCodeEmitter.cpp')
-rw-r--r--llvm/lib/Target/Mips/MipsCodeEmitter.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/lib/Target/Mips/MipsCodeEmitter.cpp b/llvm/lib/Target/Mips/MipsCodeEmitter.cpp
index 6c0eb159dce..2942716dc20 100644
--- a/llvm/lib/Target/Mips/MipsCodeEmitter.cpp
+++ b/llvm/lib/Target/Mips/MipsCodeEmitter.cpp
@@ -85,7 +85,7 @@ class MipsCodeEmitter : public MachineFunctionPass {
private:
- void emitWordLE(unsigned Word);
+ void emitWord(unsigned Word);
/// Routines that handle operands which add machine relocations which are
/// fixed up by the relocation stage.
@@ -127,7 +127,7 @@ bool MipsCodeEmitter::runOnMachineFunction(MachineFunction &MF) {
MCPEs = &MF.getConstantPool()->getConstants();
MJTEs = 0;
if (MF.getJumpTableInfo()) MJTEs = &MF.getJumpTableInfo()->getJumpTables();
- JTI->Initialize(MF, IsPIC);
+ JTI->Initialize(MF, IsPIC, Subtarget->isLittle());
MCE.setModuleInfo(&getAnalysis<MachineModuleInfo> ());
do {
@@ -274,16 +274,19 @@ void MipsCodeEmitter::emitInstruction(const MachineInstr &MI) {
if ((MI.getDesc().TSFlags & MipsII::FormMask) == MipsII::Pseudo)
return;
- emitWordLE(getBinaryCodeForInstr(MI));
+ emitWord(getBinaryCodeForInstr(MI));
++NumEmitted; // Keep track of the # of mi's emitted
MCE.processDebugLoc(MI.getDebugLoc(), false);
}
-void MipsCodeEmitter::emitWordLE(unsigned Word) {
+void MipsCodeEmitter::emitWord(unsigned Word) {
DEBUG(errs() << " 0x";
errs().write_hex(Word) << "\n");
- MCE.emitWordLE(Word);
+ if (Subtarget->isLittle())
+ MCE.emitWordLE(Word);
+ else
+ MCE.emitWordBE(Word);
}
/// createMipsJITCodeEmitterPass - Return a pass that emits the collected Mips
OpenPOWER on IntegriCloud