diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2009-02-27 13:37:18 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2009-02-27 13:37:18 +0000 |
commit | 9a58023c6ce1e77447a21d07a3de4c1ac98a3d24 (patch) | |
tree | 842f2838176d1b9fdf5147364cada22a85ce38b2 /lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp | |
parent | 0186250b31b54f2496afbdf927d5b7c432cf675d (diff) | |
download | external_llvm-9a58023c6ce1e77447a21d07a3de4c1ac98a3d24.zip external_llvm-9a58023c6ce1e77447a21d07a3de4c1ac98a3d24.tar.gz external_llvm-9a58023c6ce1e77447a21d07a3de4c1ac98a3d24.tar.bz2 |
Refactor TLS code and add some tests. The tests and expected results are:
pic | declaration | linkage | visibility |
!pic | declaration | external | default | tls1.ll tls2.ll | local exec
pic | declaration | external | default | tls1-pic.ll tls2-pic.ll | general dynamic
!pic | !declaration | external | default | tls3.ll tls4.ll | initial exec
pic | !declaration | external | default | tls3-pic.ll tls4-pic.ll | general dynamic
!pic | declaration | external | hidden | tls7.ll tls8.ll | local exec
pic | declaration | external | hidden | X | local dynamic
!pic | !declaration | external | hidden | tls9.ll tls10.ll | local exec
pic | !declaration | external | hidden | X | local dynamic
!pic | declaration | internal | default | tls5.ll tls6.ll | local exec
pic | declaration | internal | default | X | local dynamic
The ones marked with an X have not been implemented since local dynamic is not implemented.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65632 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp')
-rw-r--r-- | lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp index ca1d738..e0bd6a3 100644 --- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp @@ -439,13 +439,30 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo, printOffset(MO.getOffset()); if (isThreadLocal) { - if (TM.getRelocationModel() == Reloc::PIC_ || Subtarget->is64Bit()) - O << "@TLSGD"; // general dynamic TLS model - else - if (GV->isDeclaration()) - O << "@INDNTPOFF"; // initial exec TLS model + TLSModel::Model model = getTLSModel(GVar, TM.getRelocationModel()); + switch (model) { + case TLSModel::GeneralDynamic: + O << "@TLSGD"; + break; + case TLSModel::LocalDynamic: + // O << "@TLSLD"; // local dynamic not implemented + O << "@TLSGD"; + break; + case TLSModel::InitialExec: + if (Subtarget->is64Bit()) + O << "@TLSGD"; // 64 bit intial exec not implemented else - O << "@NTPOFF"; // local exec TLS model + O << "@INDNTPOFF"; + break; + case TLSModel::LocalExec: + if (Subtarget->is64Bit()) + O << "@TLSGD"; // 64 bit local exec not implemented + else + O << "@NTPOFF"; + break; + default: + assert (0 && "Unknown TLS model"); + } } else if (isMemOp) { if (shouldPrintGOT(TM, Subtarget)) { if (Subtarget->GVRequiresExtraLoad(GV, TM, false)) |