[llvm-commits] [llvm] r74334 - /llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp

Chris Lattner sabre at nondot.org
Fri Jun 26 14:47:28 PDT 2009


Author: lattner
Date: Fri Jun 26 16:47:27 2009
New Revision: 74334

URL: http://llvm.org/viewvc/llvm-project?rev=74334&view=rev
Log:
simplify printing of MO_ExternalSymbol in a non-pcrel context.


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=74334&r1=74333&r2=74334&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Fri Jun 26 16:47:27 2009
@@ -637,23 +637,17 @@
     return;
   }
   case MachineOperand::MO_ExternalSymbol: {
-    bool isMemOp  = Modifier && !strcmp(Modifier, "mem");
-    bool needCloseParen = false;
-    std::string Name(TAI->getGlobalPrefix());
-    Name += MO.getSymbolName();
-
-    // Print function stub suffix unless it's Mac OS X 10.5 and up.
-    if (!isMemOp)
-      O << '$';
-    else if (Name[0] == '$') {
-      // The name begins with a dollar-sign. In order to avoid having it look
-      // like an integer immediate to the assembler, enclose it in parens.
-      O << '(';
-      needCloseParen = true;
-    }
-
-    O << Name;
-
+    /// NOTE: MO_ExternalSymbol in a non-pcrel_imm context is *only* generated
+    /// by _GLOBAL_OFFSET_TABLE_ on X86-32.  All others are call operands, which
+    /// are pcrel_imm's.
+    assert(!Subtarget->is64Bit() && !Subtarget->isPICStyleRIPRel());
+    // These are never used as memory operands.
+    assert(!(Modifier && !strcmp(Modifier, "mem")));
+    
+    O << '$';
+    O << TAI->getGlobalPrefix();
+    O << MO.getSymbolName();
+    
     if (MO.getTargetFlags() == X86II::MO_GOT_ABSOLUTE_ADDRESS) {
       O << " + [.-";
       PrintPICBaseSymbol();
@@ -662,12 +656,6 @@
       assert(MO.getTargetFlags() == X86II::MO_NO_FLAG &&
              "Unknown operand flag for external symbol");
     }
-
-    if (needCloseParen)
-      O << ')';
-
-    if (Subtarget->isPICStyleRIPRel())
-      O << "(%rip)";
     return;
   }
   default:





More information about the llvm-commits mailing list