[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp PPCJITInfo.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue May 2 12:15:02 PDT 2006



Changes in directory llvm/lib/Target/PowerPC:

PPCCodeEmitter.cpp updated: 1.54 -> 1.55
PPCJITInfo.cpp updated: 1.20 -> 1.21
---
Log message:

Fix a purely hypothetical problem (for now): emitWord emits in the host
byte format.  This doesn't work when using the code emitter in a cross target
environment.  Since the code emitter is only really used by the JIT, this
isn't a current problem, but if we ever start emitting .o files, it would be.


---
Diffs of the changes:  (+12 -16)

 PPCCodeEmitter.cpp |    6 +-----
 PPCJITInfo.cpp     |   22 +++++++++++-----------
 2 files changed, 12 insertions(+), 16 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp
diff -u llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.54 llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.55
--- llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.54	Tue May  2 13:27:26 2006
+++ llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp	Tue May  2 14:14:47 2006
@@ -54,10 +54,6 @@
     ///
     void emitBasicBlock(MachineBasicBlock &MBB);
 
-    /// emitWord - write a 32-bit word to memory at the current PC
-    ///
-    void emitWord(unsigned w) { MCE.emitWord(w); }
-
     /// getValueBit - return the particular bit of Val
     ///
     unsigned getValueBit(int64_t Val, unsigned bit) { return (Val >> bit) & 1; }
@@ -133,7 +129,7 @@
     unsigned Opcode = MI.getOpcode();
     switch (MI.getOpcode()) {
     default:
-      emitWord(getBinaryCodeForInstr(*I));
+      MCE.emitWordBE(getBinaryCodeForInstr(*I));
       break;
     case PPC::IMPLICIT_DEF_GPR:
     case PPC::IMPLICIT_DEF_F8:


Index: llvm/lib/Target/PowerPC/PPCJITInfo.cpp
diff -u llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.20 llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.21
--- llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.20	Mon May  1 23:50:05 2006
+++ llvm/lib/Target/PowerPC/PPCJITInfo.cpp	Tue May  2 14:14:47 2006
@@ -168,23 +168,23 @@
   if (Fn != PPC32CompilationCallback) {
     MCE.startFunctionStub(4*4);
     void *Addr = (void*)(intptr_t)MCE.getCurrentPCValue();
-    MCE.emitWord(0);
-    MCE.emitWord(0);
-    MCE.emitWord(0);
-    MCE.emitWord(0);
+    MCE.emitWordBE(0);
+    MCE.emitWordBE(0);
+    MCE.emitWordBE(0);
+    MCE.emitWordBE(0);
     EmitBranchToAt(Addr, Fn, false);
     return MCE.finishFunctionStub(0);
   }
 
   MCE.startFunctionStub(4*7);
-  MCE.emitWord(0x9421ffe0);     // stwu    r1,-32(r1)
-  MCE.emitWord(0x7d6802a6);     // mflr r11
-  MCE.emitWord(0x91610028);     // stw r11, 40(r1)
+  MCE.emitWordBE(0x9421ffe0);     // stwu    r1,-32(r1)
+  MCE.emitWordBE(0x7d6802a6);     // mflr r11
+  MCE.emitWordBE(0x91610028);     // stw r11, 40(r1)
   void *Addr = (void*)(intptr_t)MCE.getCurrentPCValue();
-  MCE.emitWord(0);
-  MCE.emitWord(0);
-  MCE.emitWord(0);
-  MCE.emitWord(0);
+  MCE.emitWordBE(0);
+  MCE.emitWordBE(0);
+  MCE.emitWordBE(0);
+  MCE.emitWordBE(0);
   EmitBranchToAt(Addr, Fn, true/*is call*/);
   return MCE.finishFunctionStub(0);
 }






More information about the llvm-commits mailing list