[llvm-commits] CVS: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp X86ATTAsmPrinter.cpp
Evan Cheng
evan.cheng at apple.com
Sun Feb 26 00:28:24 PST 2006
Changes in directory llvm/lib/Target/X86:
X86IntelAsmPrinter.cpp updated: 1.20 -> 1.21
X86ATTAsmPrinter.cpp updated: 1.27 -> 1.28
---
Log message:
Fixed ConstantPoolIndex operand asm print bug. This fixed 2005-07-17-INT-To-FP
and 2005-05-12-Int64ToFP.
---
Diffs of the changes: (+31 -19)
X86ATTAsmPrinter.cpp | 24 +++++++++++++++---------
X86IntelAsmPrinter.cpp | 26 ++++++++++++++++----------
2 files changed, 31 insertions(+), 19 deletions(-)
Index: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.20 llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.21
--- llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.20 Sat Feb 25 03:54:52 2006
+++ llvm/lib/Target/X86/X86IntelAsmPrinter.cpp Sun Feb 26 02:28:12 2006
@@ -109,6 +109,21 @@
assert(0 && "Shouldn't use addPCDisp() when building X86 MachineInstrs");
abort ();
return;
+ case MachineOperand::MO_ConstantPoolIndex: {
+ bool isMemOp = Modifier && !strcmp(Modifier, "mem");
+ if (!isMemOp) O << "OFFSET ";
+ O << "[" << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << "_"
+ << MO.getConstantPoolIndex();
+ if (forDarwin && TM.getRelocationModel() == Reloc::PIC)
+ O << "-\"L" << getFunctionNumber() << "$pb\"";
+ int Offset = MO.getOffset();
+ if (Offset > 0)
+ O << " + " << Offset;
+ else if (Offset < 0)
+ O << Offset;
+ O << "]";
+ return;
+ }
case MachineOperand::MO_GlobalAddress: {
bool isCallOp = Modifier && !strcmp(Modifier, "call");
bool isMemOp = Modifier && !strcmp(Modifier, "mem");
@@ -192,19 +207,10 @@
NeedPlus = true;
}
- if (DispSpec.isGlobalAddress()) {
+ if (DispSpec.isGlobalAddress() || DispSpec.isConstantPoolIndex()) {
if (NeedPlus)
O << " + ";
printOp(DispSpec, "mem");
- } else if (DispSpec.isConstantPoolIndex()) {
- O << "[" << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << "_"
- << DispSpec.getConstantPoolIndex();
- if (forDarwin && TM.getRelocationModel() == Reloc::PIC)
- O << "-\"L" << getFunctionNumber() << "$pb\"";
- if (DispSpec.getOffset())
- O << " + " << DispSpec.getOffset();
- O << "]";
- return;
} else {
int DispVal = DispSpec.getImmedValue();
if (DispVal || (!BaseReg.getReg() && !IndexReg.getReg())) {
Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.27 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.28
--- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.27 Sat Feb 25 03:54:52 2006
+++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Sun Feb 26 02:28:12 2006
@@ -115,6 +115,20 @@
std::cerr << "Shouldn't use addPCDisp() when building X86 MachineInstrs";
abort ();
return;
+ case MachineOperand::MO_ConstantPoolIndex: {
+ bool isMemOp = Modifier && !strcmp(Modifier, "mem");
+ if (!isMemOp) O << '$';
+ O << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << "_"
+ << MO.getConstantPoolIndex();
+ if (forDarwin && TM.getRelocationModel() == Reloc::PIC)
+ O << "-\"L" << getFunctionNumber() << "$pb\"";
+ int Offset = MO.getOffset();
+ if (Offset > 0)
+ O << "+" << Offset;
+ else if (Offset < 0)
+ O << Offset;
+ return;
+ }
case MachineOperand::MO_GlobalAddress: {
bool isCallOp = Modifier && !strcmp(Modifier, "call");
bool isMemOp = Modifier && !strcmp(Modifier, "mem");
@@ -198,16 +212,8 @@
return;
}
- if (DispSpec.isGlobalAddress()) {
+ if (DispSpec.isGlobalAddress() || DispSpec.isConstantPoolIndex()) {
printOperand(MI, Op+3, "mem");
- } else if (DispSpec.isConstantPoolIndex()) {
- O << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << "_"
- << DispSpec.getConstantPoolIndex();
- if (forDarwin && TM.getRelocationModel() == Reloc::PIC)
- O << "-\"L" << getFunctionNumber() << "$pb\"";
- if (DispSpec.getOffset())
- O << "+" << DispSpec.getOffset();
- return;
} else {
int DispVal = DispSpec.getImmedValue();
if (DispVal || (!IndexReg.getReg() && !BaseReg.getReg()))
More information about the llvm-commits
mailing list