1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

simplify printing of MO_ExternalSymbol in a non-pcrel context.

llvm-svn: 74334
This commit is contained in:
Chris Lattner 2009-06-26 21:47:27 +00:00
parent 2f5abb6b29
commit 3a48623aef

View File

@ -637,23 +637,17 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
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 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
assert(MO.getTargetFlags() == X86II::MO_NO_FLAG &&
"Unknown operand flag for external symbol");
}
if (needCloseParen)
O << ')';
if (Subtarget->isPICStyleRIPRel())
O << "(%rip)";
return;
}
default: