mirror of
https://github.com/RPCSX/llvm.git
synced 2025-05-13 10:56:01 +00:00
simplify shouldPrintPLT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74186 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9a36bdbaf1
commit
2b0de6a286
@ -295,8 +295,7 @@ static inline bool shouldPrintGOT(TargetMachine &TM, const X86Subtarget* ST) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline bool shouldPrintPLT(TargetMachine &TM, const X86Subtarget* ST) {
|
static inline bool shouldPrintPLT(TargetMachine &TM, const X86Subtarget* ST) {
|
||||||
return ST->isTargetELF() && TM.getRelocationModel() == Reloc::PIC_ &&
|
return ST->isTargetELF() && TM.getRelocationModel() == Reloc::PIC_;
|
||||||
(ST->isPICStyleRIPRel() || ST->isPICStyleGOT());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool shouldPrintStub(TargetMachine &TM, const X86Subtarget* ST) {
|
static inline bool shouldPrintStub(TargetMachine &TM, const X86Subtarget* ST) {
|
||||||
@ -331,6 +330,8 @@ void X86ATTAsmPrinter::print_pcrel_imm(const MachineInstr *MI, unsigned OpNo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (shouldPrintStub(TM, Subtarget)) {
|
if (shouldPrintStub(TM, Subtarget)) {
|
||||||
|
// DARWIN/X86-32 in != static mode.
|
||||||
|
|
||||||
// Link-once, declaration, or Weakly-linked global variables need
|
// Link-once, declaration, or Weakly-linked global variables need
|
||||||
// non-lazily-resolved stubs
|
// non-lazily-resolved stubs
|
||||||
if (GV->isDeclaration() || GV->isWeakForLinker()) {
|
if (GV->isDeclaration() || GV->isWeakForLinker()) {
|
||||||
@ -361,9 +362,8 @@ void X86ATTAsmPrinter::print_pcrel_imm(const MachineInstr *MI, unsigned OpNo) {
|
|||||||
O << Name;
|
O << Name;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (GV->hasDLLImportLinkage()) {
|
if (GV->hasDLLImportLinkage())
|
||||||
O << "__imp_";
|
O << "__imp_";
|
||||||
}
|
|
||||||
O << Name;
|
O << Name;
|
||||||
|
|
||||||
if (shouldPrintPLT(TM, Subtarget)) {
|
if (shouldPrintPLT(TM, Subtarget)) {
|
||||||
@ -390,7 +390,9 @@ void X86ATTAsmPrinter::print_pcrel_imm(const MachineInstr *MI, unsigned OpNo) {
|
|||||||
Name += MO.getSymbolName();
|
Name += MO.getSymbolName();
|
||||||
// Print function stub suffix unless it's Mac OS X 10.5 and up.
|
// Print function stub suffix unless it's Mac OS X 10.5 and up.
|
||||||
if (shouldPrintStub(TM, Subtarget) &&
|
if (shouldPrintStub(TM, Subtarget) &&
|
||||||
|
// DARWIN/X86-32 in != static mode.
|
||||||
!(Subtarget->isTargetDarwin() && Subtarget->getDarwinVers() >= 9)) {
|
!(Subtarget->isTargetDarwin() && Subtarget->getDarwinVers() >= 9)) {
|
||||||
|
|
||||||
FnStubs.insert(Name);
|
FnStubs.insert(Name);
|
||||||
printSuffixedName(Name, "$stub");
|
printSuffixedName(Name, "$stub");
|
||||||
return;
|
return;
|
||||||
@ -514,6 +516,8 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (shouldPrintStub(TM, Subtarget)) {
|
if (shouldPrintStub(TM, Subtarget)) {
|
||||||
|
// DARWIN/X86-32 in != static mode.
|
||||||
|
|
||||||
// Link-once, declaration, or Weakly-linked global variables need
|
// Link-once, declaration, or Weakly-linked global variables need
|
||||||
// non-lazily-resolved stubs
|
// non-lazily-resolved stubs
|
||||||
if (GV->isDeclaration() || GV->isWeakForLinker()) {
|
if (GV->isDeclaration() || GV->isWeakForLinker()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user