Emit SPARC machine code a word at a time instead of a byte at a time.
authorBrian Gaeke <gaeke@uiuc.edu>
Fri, 23 Apr 2004 17:11:15 +0000 (17:11 +0000)
committerBrian Gaeke <gaeke@uiuc.edu>
Fri, 23 Apr 2004 17:11:15 +0000 (17:11 +0000)
Use emitWordAt() to emit forward-branch fixups.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13119 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/SparcV9/SparcV9CodeEmitter.cpp

index 8f8946e0c2a3c5e175288eaa4b59263c0f1121cc..a0d9a6a28c575c08514453127a5a3653c27fa2f8 100644 (file)
@@ -468,12 +468,16 @@ SparcV9CodeEmitter::~SparcV9CodeEmitter() {
 }
 
 void SparcV9CodeEmitter::emitWord(unsigned Val) {
+#if 0 // I think this was used when the Sparc JIT was being tested on X86:
   // Output the constant in big endian byte order...
   unsigned byteVal;
   for (int i = 3; i >= 0; --i) {
     byteVal = Val >> 8*i;
     MCE.emitByte(byteVal & 255);
   }
+#else
+  MCE.emitWord(Val);
+#endif
 }
 
 unsigned 
@@ -763,7 +767,7 @@ bool SparcV9CodeEmitter::runOnMachineFunction(MachineFunction &MF) {
         else if (hiBits64) { MI->setOperandHi64(ii); }
         DEBUG(std::cerr << "Rewrote BB ref: ");
         unsigned fixedInstr = SparcV9CodeEmitter::getBinaryCodeForInstr(*MI);
-        *Ref = fixedInstr;
+        MCE.emitWordAt (fixedInstr, Ref);
         break;
       }
     }