[llvm-commits] CVS: llvm/lib/Target/X86/X86CodeEmitter.cpp X86JITInfo.cpp

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



Changes in directory llvm/lib/Target/X86:

X86CodeEmitter.cpp updated: 1.96 -> 1.97
X86JITInfo.cpp updated: 1.17 -> 1.18
---
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:  (+7 -7)

 X86CodeEmitter.cpp |   10 +++++-----
 X86JITInfo.cpp     |    4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)


Index: llvm/lib/Target/X86/X86CodeEmitter.cpp
diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.96 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.97
--- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.96	Tue May  2 13:27:26 2006
+++ llvm/lib/Target/X86/X86CodeEmitter.cpp	Tue May  2 14:14:47 2006
@@ -116,7 +116,7 @@
 /// emitPCRelativeValue - Emit a 32-bit PC relative address.
 ///
 void Emitter::emitPCRelativeValue(unsigned Address) {
-  MCE.emitWord(Address-MCE.getCurrentPCValue()-4);
+  MCE.emitWordLE(Address-MCE.getCurrentPCValue()-4);
 }
 
 /// emitPCRelativeBlockAddress - This method emits the PC relative address of
@@ -134,7 +134,7 @@
     // Otherwise, remember where this reference was and where it is to so we can
     // deal with it later.
     BBRefs.push_back(std::make_pair(MBB, MCE.getCurrentPCValue()));
-    MCE.emitWord(0);
+    MCE.emitWordLE(0);
   }
 }
 
@@ -145,7 +145,7 @@
   MCE.addRelocation(MachineRelocation(MCE.getCurrentPCOffset(),
                                       X86::reloc_pcrel_word, GV, 0,
                                       !isTailCall /*Doesn'tNeedStub*/));
-  MCE.emitWord(0);
+  MCE.emitWordLE(0);
 }
 
 /// emitGlobalAddress - Emit the specified address to the code stream assuming
@@ -155,7 +155,7 @@
 void Emitter::emitGlobalAddressForPtr(GlobalValue *GV, int Disp /* = 0 */) {
   MCE.addRelocation(MachineRelocation(MCE.getCurrentPCOffset(),
                                       X86::reloc_absolute_word, GV));
-  MCE.emitWord(Disp);   // The relocated value will be added to the displacement
+  MCE.emitWordLE(Disp); // The relocated value will be added to the displacement
 }
 
 /// emitExternalSymbolAddress - Arrange for the address of an external symbol to
@@ -165,7 +165,7 @@
                                         bool isTailCall) {
   MCE.addRelocation(MachineRelocation(MCE.getCurrentPCOffset(),
           isPCRelative ? X86::reloc_pcrel_word : X86::reloc_absolute_word, ES));
-  MCE.emitWord(0);
+  MCE.emitWordLE(0);
 }
 
 /// N86 namespace - Native X86 Register numbers... used by X86 backend.


Index: llvm/lib/Target/X86/X86JITInfo.cpp
diff -u llvm/lib/Target/X86/X86JITInfo.cpp:1.17 llvm/lib/Target/X86/X86JITInfo.cpp:1.18
--- llvm/lib/Target/X86/X86JITInfo.cpp:1.17	Sat Apr 29 13:41:44 2006
+++ llvm/lib/Target/X86/X86JITInfo.cpp	Tue May  2 14:14:47 2006
@@ -170,14 +170,14 @@
   if (Fn != X86CompilationCallback) {
     MCE.startFunctionStub(5);
     MCE.emitByte(0xE9);
-    MCE.emitWord((intptr_t)Fn-MCE.getCurrentPCValue()-4);
+    MCE.emitWordLE((intptr_t)Fn-MCE.getCurrentPCValue()-4);
     return MCE.finishFunctionStub(0);
   }
 
   MCE.startFunctionStub(6);
   MCE.emitByte(0xE8);   // Call with 32 bit pc-rel destination...
 
-  MCE.emitWord((intptr_t)Fn-MCE.getCurrentPCValue()-4);
+  MCE.emitWordLE((intptr_t)Fn-MCE.getCurrentPCValue()-4);
 
   MCE.emitByte(0xCD);   // Interrupt - Just a marker identifying the stub!
   return MCE.finishFunctionStub(0);






More information about the llvm-commits mailing list