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

Dale Johannesen dalej at apple.com
Tue Jul 7 16:28:23 PDT 2009


Author: johannes
Date: Tue Jul  7 18:28:22 2009
New Revision: 74968

URL: http://llvm.org/viewvc/llvm-project?rev=74968&view=rev
Log:
Commit the file I actually changed as part of last
patch, instead of one I didn't.


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=74968&r1=74967&r2=74968&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Tue Jul  7 18:28:22 2009
@@ -434,19 +434,22 @@
 
   case MachineOperand::MO_Immediate:
     if (!Modifier || (strcmp(Modifier, "debug") &&
-                      strcmp(Modifier, "mem")))
+                      strcmp(Modifier, "mem") && 
+                      strcmp(Modifier, "asmcall")))
       O << '$';
     O << MO.getImm();
     return;
   case MachineOperand::MO_JumpTableIndex: {
-    bool isMemOp  = Modifier && !strcmp(Modifier, "mem");
+    bool isMemOp  = Modifier && 
+                    (!strcmp(Modifier, "mem") || !strcmp(Modifier, "asmcall"));
     if (!isMemOp) O << '$';
     O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() << '_'
       << MO.getIndex();
     break;
   }
   case MachineOperand::MO_ConstantPoolIndex: {
-    bool isMemOp  = Modifier && !strcmp(Modifier, "mem");
+    bool isMemOp  = Modifier && 
+                    (!strcmp(Modifier, "mem") || !strcmp(Modifier, "asmcall"));
     if (!isMemOp) O << '$';
     O << TAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << '_'
       << MO.getIndex();
@@ -455,7 +458,9 @@
     break;
   }
   case MachineOperand::MO_GlobalAddress: {
-    bool isMemOp = Modifier && !strcmp(Modifier, "mem");
+    bool isMemOp = Modifier &&
+                   (!strcmp(Modifier, "mem") || !strcmp(Modifier, "asmcall"));
+    bool isAsmCallOp = Modifier && !strcmp(Modifier, "asmcall");
 
     const GlobalValue *GV = MO.getGlobal();
     std::string Name = Mang->getValueName(GV);
@@ -478,7 +483,15 @@
       // non-lazily-resolved stubs
       if (GV->isDeclaration() || GV->isWeakForLinker()) {
         // Dynamically-resolved functions need a stub for the function.
-        if (GV->hasHiddenVisibility()) {
+        if (isa<Function>(GV) && isAsmCallOp) {
+          // Function stubs are no longer needed for Mac OS X 10.5 and up.
+          if (Subtarget->isTargetDarwin() && Subtarget->getDarwinVers() >= 9) {
+            O << Name;
+          } else {
+            FnStubs.insert(Name);
+            printSuffixedName(Name, "$stub");
+          }
+        } else if (GV->hasHiddenVisibility()) {
           if (!GV->isDeclaration() && !GV->hasCommonLinkage())
             // Definition is not definitely in the current translation unit.
             O << Name;
@@ -496,7 +509,7 @@
         O << Name;
       }
 
-      if (TM.getRelocationModel() == Reloc::PIC_) {
+      if (TM.getRelocationModel() == Reloc::PIC_ && !isAsmCallOp) {
         O << '-';
         PrintPICBaseSymbol();
       }        
@@ -519,7 +532,8 @@
     /// are pcrel_imm's.
     assert(!Subtarget->is64Bit() && !Subtarget->isPICStyleRIPRel());
     // These are never used as memory operands.
-    assert(!(Modifier && !strcmp(Modifier, "mem")));
+    assert(!(Modifier && 
+             (!strcmp(Modifier, "mem") || !strcmp(Modifier, "asmcall"))));
     
     O << '$';
     O << TAI->getGlobalPrefix();
@@ -725,11 +739,11 @@
       printOperand(MI, OpNo);
       return false;
 
-    case 'P': // Don't print @PLT, but do print as memory.
-      printOperand(MI, OpNo, "mem");
+    case 'P': // This is the operand of a call, treat specially.
+      printOperand(MI, OpNo, "asmcall");
       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);





More information about the llvm-commits mailing list