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

Evan Cheng evan.cheng at apple.com
Sun Feb 26 01:12:50 PST 2006



Changes in directory llvm/lib/Target/X86:

X86CodeEmitter.cpp updated: 1.91 -> 1.92
---
Log message:

ConstantPoolIndex is now the displacement portion of the address (rather
than base).


---
Diffs of the changes:  (+4 -10)

 X86CodeEmitter.cpp |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)


Index: llvm/lib/Target/X86/X86CodeEmitter.cpp
diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.91 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.92
--- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.91	Wed Feb 22 14:19:42 2006
+++ llvm/lib/Target/X86/X86CodeEmitter.cpp	Sun Feb 26 03:12:34 2006
@@ -239,6 +239,9 @@
   if (Op3.isGlobalAddress()) {
     GV = Op3.getGlobal();
     DispVal = Op3.getOffset();
+  } else if (Op3.isConstantPoolIndex()) {
+    DispVal += MCE.getConstantPoolEntryAddress(Op3.getConstantPoolIndex());
+    DispVal += Op3.getOffset();
   } else {
     DispVal = Op3.getImmedValue();
   }
@@ -247,16 +250,7 @@
   const MachineOperand &Scale    = MI.getOperand(Op+1);
   const MachineOperand &IndexReg = MI.getOperand(Op+2);
 
-  unsigned BaseReg = 0;
-
-  if (Base.isConstantPoolIndex()) {
-    // Emit a direct address reference [disp32] where the displacement of the
-    // constant pool entry is controlled by the MCE.
-    assert(!GV && "Constant Pool reference cannot be relative to global!");
-    DispVal += MCE.getConstantPoolEntryAddress(Base.getConstantPoolIndex());
-  } else {
-    BaseReg = Base.getReg();
-  }
+  unsigned BaseReg = Base.getReg();
 
   // Is a SIB byte needed?
   if (IndexReg.getReg() == 0 && BaseReg != X86::ESP) {






More information about the llvm-commits mailing list