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

Chris Lattner lattner at cs.uiuc.edu
Tue Feb 17 12:25:02 PST 2004


Changes in directory llvm/lib/Target/X86:

X86CodeEmitter.cpp updated: 1.52 -> 1.53
X86RegisterInfo.cpp updated: 1.64 -> 1.65

---
Log message:

Add support for GlobalAddress's for alkis


---
Diffs of the changes:  (+14 -3)

Index: llvm/lib/Target/X86/X86CodeEmitter.cpp
diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.52 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.53
--- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.52	Tue Feb 17 01:40:44 2004
+++ llvm/lib/Target/X86/X86CodeEmitter.cpp	Tue Feb 17 12:23:55 2004
@@ -602,7 +602,12 @@
 
     if (MI.getNumOperands() == 5) {
       unsigned Size = sizeOfPtr(Desc);
-      emitConstant(MI.getOperand(4).getImmedValue(), Size);
+      if (MI.getOperand(4).isImmediate())
+        emitConstant(MI.getOperand(4).getImmedValue(), Size);
+      else if (MI.getOperand(4).isGlobalAddress())
+        emitGlobalAddressForPtr(MI.getOperand(4).getGlobal());
+      else
+        assert(0 && "Unknown operand!");
     }
     break;
   }


Index: llvm/lib/Target/X86/X86RegisterInfo.cpp
diff -u llvm/lib/Target/X86/X86RegisterInfo.cpp:1.64 llvm/lib/Target/X86/X86RegisterInfo.cpp:1.65
--- llvm/lib/Target/X86/X86RegisterInfo.cpp:1.64	Tue Feb 17 09:58:13 2004
+++ llvm/lib/Target/X86/X86RegisterInfo.cpp	Tue Feb 17 12:23:55 2004
@@ -100,8 +100,14 @@
 
 static MachineInstr *MakeMIInst(unsigned Opcode, unsigned FrameIndex,
                                 MachineInstr *MI) {
-  return addFrameReference(BuildMI(Opcode, 5), FrameIndex)
-                 .addZImm(MI->getOperand(1).getImmedValue());
+  if (MI->getOperand(1).isImmediate())
+    return addFrameReference(BuildMI(Opcode, 5), FrameIndex)
+      .addZImm(MI->getOperand(1).getImmedValue());
+  else if (MI->getOperand(1).isGlobalAddress())
+    return addFrameReference(BuildMI(Opcode, 5), FrameIndex)
+      .addGlobalAddress(MI->getOperand(1).getGlobal());
+  assert(0 && "Unknown operand for MakeMI!");
+  return 0;
 }
 
 static MachineInstr *MakeRMInst(unsigned Opcode, unsigned FrameIndex,





More information about the llvm-commits mailing list