aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2009-07-07 23:28:22 +0000
committerDale Johannesen <dalej@apple.com>2009-07-07 23:28:22 +0000
commit9fcff043feeb1aad86652f23d830fba9d116141e (patch)
tree1011d08bd782d9b9b518a8c6e8f45903a4bfebb4 /lib
parent8ea5ec681bd4838c84e545f8a1226a62d3b2f089 (diff)
downloadexternal_llvm-9fcff043feeb1aad86652f23d830fba9d116141e.zip
external_llvm-9fcff043feeb1aad86652f23d830fba9d116141e.tar.gz
external_llvm-9fcff043feeb1aad86652f23d830fba9d116141e.tar.bz2
Commit the file I actually changed as part of last
patch, instead of one I didn't. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74968 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp34
1 files changed, 24 insertions, 10 deletions
diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
index 127f228..d205457 100644
--- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
+++ b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
@@ -434,19 +434,22 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
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 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
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 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
// 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 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
O << Name;
}
- if (TM.getRelocationModel() == Reloc::PIC_) {
+ if (TM.getRelocationModel() == Reloc::PIC_ && !isAsmCallOp) {
O << '-';
PrintPICBaseSymbol();
}
@@ -519,7 +532,8 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
/// 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 @@ bool X86ATTAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
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);