[llvm-commits] [llvm] r75516 - /llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
Chris Lattner
sabre at nondot.org
Mon Jul 13 14:48:34 PDT 2009
Author: lattner
Date: Mon Jul 13 16:48:33 2009
New Revision: 75516
URL: http://llvm.org/viewvc/llvm-project?rev=75516&view=rev
Log:
refactor operand printing to remove hte last of the "mem" modifier hack. The
only remaining modifier is "subreg".
Modified:
llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=75516&r1=75515&r2=75516&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Mon Jul 13 16:48:33 2009
@@ -499,9 +499,7 @@
case MachineOperand::MO_ConstantPoolIndex:
case MachineOperand::MO_GlobalAddress:
case MachineOperand::MO_ExternalSymbol: {
- bool isMemOp = Modifier && !strcmp(Modifier, "mem");
- if (!isMemOp) O << '$';
-
+ O << '$';
printSymbolOperand(MO);
break;
}
@@ -545,7 +543,7 @@
} else {
assert(DispSpec.isGlobal() || DispSpec.isCPI() ||
DispSpec.isJTI() || DispSpec.isSymbol());
- printOperand(MI, Op+3, "mem");
+ printSymbolOperand(MI->getOperand(Op+3));
}
if (HasParenPart) {
@@ -661,17 +659,21 @@
if (ExtraCode && ExtraCode[0]) {
if (ExtraCode[1] != 0) return true; // Unknown modifier.
+ const MachineOperand &MO = MI->getOperand(OpNo);
+
switch (ExtraCode[0]) {
default: return true; // Unknown modifier.
case 'c': // Don't print "$" before a global var name or constant.
- if (MI->getOperand(OpNo).isImm())
- O << MI->getOperand(OpNo).getImm();
+ if (MO.isImm())
+ O << MO.getImm();
+ else if (MO.isGlobal() || MO.isCPI() || MO.isJTI() || MO.isSymbol())
+ printSymbolOperand(MO);
else
- printOperand(MI, OpNo, "mem");
+ printOperand(MI, OpNo);
return false;
case 'A': // Print '*' before a register (it must be a register)
- if (MI->getOperand(OpNo).isReg()) {
+ if (MO.isReg()) {
O << '*';
printOperand(MI, OpNo);
return false;
@@ -683,8 +685,8 @@
case 'w': // Print HImode register
case 'k': // Print SImode register
case 'q': // Print DImode register
- if (MI->getOperand(OpNo).isReg())
- return printAsmMRegister(MI->getOperand(OpNo), ExtraCode[0]);
+ if (MO.isReg())
+ return printAsmMRegister(MO, ExtraCode[0]);
printOperand(MI, OpNo);
return false;
@@ -692,17 +694,15 @@
print_pcrel_imm(MI, OpNo);
return false;
- case 'n': { // Negate the immediate or print a '-' before the operand.
+ case 'n': // Negate the immediate or print a '-' before the operand.
// Note: this is a temporary solution. It should be handled target
// independently as part of the 'MC' work.
- const MachineOperand &MO = MI->getOperand(OpNo);
if (MO.isImm()) {
O << -MO.getImm();
return false;
}
O << '-';
}
- }
}
printOperand(MI, OpNo);
More information about the llvm-commits
mailing list