[llvm-commits] [llvm] r75079 - /llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
Chris Lattner
sabre at nondot.org
Wed Jul 8 17:32:12 PDT 2009
Author: lattner
Date: Wed Jul 8 19:32:12 2009
New Revision: 75079
URL: http://llvm.org/viewvc/llvm-project?rev=75079&view=rev
Log:
simplify some logic
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=75079&r1=75078&r2=75079&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Wed Jul 8 19:32:12 2009
@@ -590,24 +590,26 @@
const MachineOperand &IndexReg = MI->getOperand(Op+2);
const MachineOperand &DispSpec = MI->getOperand(Op+3);
- if (DispSpec.isGlobal() ||
- DispSpec.isCPI() ||
- DispSpec.isJTI() ||
- DispSpec.isSymbol()) {
- printOperand(MI, Op+3, "mem");
- } else {
- int DispVal = DispSpec.getImm();
- if (DispVal || (!IndexReg.getReg() && !BaseReg.getReg()))
- O << DispVal;
- }
-
// If we really don't want to print out (rip), don't.
bool HasBaseReg = BaseReg.getReg() != 0;
if (HasBaseReg && Modifier && !strcmp(Modifier, "no-rip") &&
BaseReg.getReg() == X86::RIP)
HasBaseReg = false;
-
- if (IndexReg.getReg() || HasBaseReg) {
+
+ // HasParenPart - True if we will print out the () part of the mem ref.
+ bool HasParenPart = IndexReg.getReg() || HasBaseReg;
+
+ if (DispSpec.isImm()) {
+ int DispVal = DispSpec.getImm();
+ if (DispVal || !HasParenPart)
+ O << DispVal;
+ } else {
+ assert(DispSpec.isGlobal() || DispSpec.isCPI() ||
+ DispSpec.isJTI() || DispSpec.isSymbol());
+ printOperand(MI, Op+3, "mem");
+ }
+
+ if (HasParenPart) {
assert(IndexReg.getReg() != X86::ESP &&
"X86 doesn't allow scaling by ESP");
More information about the llvm-commits
mailing list