mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-20 02:58:10 +00:00
make pcrel and non-pcrel global printing more similar.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75298 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
80becf194d
commit
7a4e464da2
@ -107,6 +107,10 @@ void X86ATTAsmPrinter::decorateName(std::string &Name,
|
|||||||
const Function *F = dyn_cast<Function>(GV);
|
const Function *F = dyn_cast<Function>(GV);
|
||||||
if (!F) return;
|
if (!F) return;
|
||||||
|
|
||||||
|
// Save function name for later type emission.
|
||||||
|
if (Subtarget->isTargetCygMing() && F->isDeclaration())
|
||||||
|
CygMingStubs.insert(Name);
|
||||||
|
|
||||||
// We don't want to decorate non-stdcall or non-fastcall functions right now
|
// We don't want to decorate non-stdcall or non-fastcall functions right now
|
||||||
unsigned CC = F->getCallingConv();
|
unsigned CC = F->getCallingConv();
|
||||||
if (CC != CallingConv::X86_StdCall && CC != CallingConv::X86_FastCall)
|
if (CC != CallingConv::X86_StdCall && CC != CallingConv::X86_FastCall)
|
||||||
@ -319,18 +323,15 @@ void X86ATTAsmPrinter::print_pcrel_imm(const MachineInstr *MI, unsigned OpNo) {
|
|||||||
O << Name;
|
O << Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (needCloseParen)
|
||||||
|
O << ')';
|
||||||
|
|
||||||
// Assemble call via PLT for externally visible symbols.
|
// Assemble call via PLT for externally visible symbols.
|
||||||
if (MO.getTargetFlags() == X86II::MO_PLT)
|
if (MO.getTargetFlags() == X86II::MO_PLT)
|
||||||
O << "@PLT";
|
O << "@PLT";
|
||||||
|
|
||||||
if (Subtarget->isTargetCygMing() && GV->isDeclaration())
|
|
||||||
// Save function name for later type emission
|
|
||||||
CygMingStubs.insert(Name);
|
|
||||||
|
|
||||||
printOffset(MO.getOffset());
|
printOffset(MO.getOffset());
|
||||||
|
|
||||||
if (needCloseParen)
|
|
||||||
O << ')';
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,14 +414,15 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
|
|||||||
}
|
}
|
||||||
case MachineOperand::MO_GlobalAddress: {
|
case MachineOperand::MO_GlobalAddress: {
|
||||||
bool isMemOp = Modifier && !strcmp(Modifier, "mem");
|
bool isMemOp = Modifier && !strcmp(Modifier, "mem");
|
||||||
|
if (!isMemOp)
|
||||||
|
O << '$';
|
||||||
|
|
||||||
const GlobalValue *GV = MO.getGlobal();
|
const GlobalValue *GV = MO.getGlobal();
|
||||||
std::string Name = Mang->getValueName(GV);
|
std::string Name = Mang->getValueName(GV);
|
||||||
decorateName(Name, GV);
|
decorateName(Name, GV);
|
||||||
|
|
||||||
bool needCloseParen = false;
|
bool needCloseParen = false;
|
||||||
if (!isMemOp)
|
if (Name[0] == '$') {
|
||||||
O << '$';
|
|
||||||
else if (Name[0] == '$') {
|
|
||||||
// The name begins with a dollar-sign. In order to avoid having it look
|
// 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.
|
// like an integer immediate to the assembler, enclose it in parens.
|
||||||
O << '(';
|
O << '(';
|
||||||
@ -438,6 +440,9 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
|
|||||||
MO.getTargetFlags() == X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE){
|
MO.getTargetFlags() == X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE){
|
||||||
HiddenGVStubs.insert(Name);
|
HiddenGVStubs.insert(Name);
|
||||||
printSuffixedName(Name, "$non_lazy_ptr");
|
printSuffixedName(Name, "$non_lazy_ptr");
|
||||||
|
} else if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB) {
|
||||||
|
FnStubs.insert(Name);
|
||||||
|
printSuffixedName(Name, "$stub");
|
||||||
} else {
|
} else {
|
||||||
O << Name;
|
O << Name;
|
||||||
}
|
}
|
||||||
@ -445,6 +450,10 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
|
|||||||
if (needCloseParen)
|
if (needCloseParen)
|
||||||
O << ')';
|
O << ')';
|
||||||
|
|
||||||
|
// Assemble call via PLT for externally visible symbols.
|
||||||
|
if (MO.getTargetFlags() == X86II::MO_PLT)
|
||||||
|
O << "@PLT";
|
||||||
|
|
||||||
printOffset(MO.getOffset());
|
printOffset(MO.getOffset());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -596,8 +605,7 @@ void X86ATTAsmPrinter::printPICLabel(const MachineInstr *MI, unsigned Op) {
|
|||||||
|
|
||||||
void X86ATTAsmPrinter::printPICJumpTableEntry(const MachineJumpTableInfo *MJTI,
|
void X86ATTAsmPrinter::printPICJumpTableEntry(const MachineJumpTableInfo *MJTI,
|
||||||
const MachineBasicBlock *MBB,
|
const MachineBasicBlock *MBB,
|
||||||
unsigned uid) const
|
unsigned uid) const {
|
||||||
{
|
|
||||||
const char *JTEntryDirective = MJTI->getEntrySize() == 4 ?
|
const char *JTEntryDirective = MJTI->getEntrySize() == 4 ?
|
||||||
TAI->getData32bitsDirective() : TAI->getData64bitsDirective();
|
TAI->getData32bitsDirective() : TAI->getData64bitsDirective();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user