diff options
author | Dan Gohman <gohman@apple.com> | 2009-03-14 02:33:41 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-03-14 02:33:41 +0000 |
commit | 72bb0a64afe5cd9b046030591e1fce71f1fde45a (patch) | |
tree | 227b33ed291dc290aa8bcb1480f7538d51cfbb96 /lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp | |
parent | 9a49d31b6f94febb408b5d25d3e768c04292cf10 (diff) | |
download | external_llvm-72bb0a64afe5cd9b046030591e1fce71f1fde45a.zip external_llvm-72bb0a64afe5cd9b046030591e1fce71f1fde45a.tar.gz external_llvm-72bb0a64afe5cd9b046030591e1fce71f1fde45a.tar.bz2 |
Use %rip-relative addressing on x86-64 whenever practical, as
it has a smaller encoding than absolute addressing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67002 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp')
-rw-r--r-- | lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp index 810f993..5da6d7a 100644 --- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp @@ -471,14 +471,15 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo, O << "@GOT"; else O << "@GOTOFF"; - } else if (Subtarget->isPICStyleRIPRel() && !NotRIPRel && - TM.getRelocationModel() != Reloc::Static) { - if (Subtarget->GVRequiresExtraLoad(GV, TM, false)) - O << "@GOTPCREL"; - - if (needCloseParen) { - needCloseParen = false; - O << ')'; + } else if (Subtarget->isPICStyleRIPRel() && !NotRIPRel) { + if (TM.getRelocationModel() != Reloc::Static) { + if (Subtarget->GVRequiresExtraLoad(GV, TM, false)) + O << "@GOTPCREL"; + + if (needCloseParen) { + needCloseParen = false; + O << ')'; + } } // Use rip when possible to reduce code size, except when @@ -692,7 +693,7 @@ bool X86ATTAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, switch (ExtraCode[0]) { default: return true; // Unknown modifier. case 'c': // Don't print "$" before a global var name or constant. - printOperand(MI, OpNo, "mem"); + printOperand(MI, OpNo, "mem", /*NotRIPRel=*/true); return false; case 'b': // Print QImode register case 'h': // Print QImode high register |