diff options
| author | Chih-Hung Hsieh <chh@google.com> | 2018-02-28 17:48:55 +0000 |
|---|---|---|
| committer | Chih-Hung Hsieh <chh@google.com> | 2018-02-28 17:48:55 +0000 |
| commit | 9f9e4681ace64e6200f82d9d7f011701fd4e9cc8 (patch) | |
| tree | 85cd726554c7030c6168567b5af93507d6996032 /llvm/lib/CodeGen | |
| parent | 29abfe4a8fe08bdd2f1c3b9e139a4547eb9261cc (diff) | |
| download | bcm5719-llvm-9f9e4681ace64e6200f82d9d7f011701fd4e9cc8.tar.gz bcm5719-llvm-9f9e4681ace64e6200f82d9d7f011701fd4e9cc8.zip | |
[TLS] use emulated TLS if the target supports only this mode
Emulated TLS is enabled by llc flag -emulated-tls,
which is passed by clang driver.
When llc is called explicitly or from other drivers like LTO,
missing -emulated-tls flag would generate wrong TLS code for targets
that supports only this mode.
Now use useEmulatedTLS() instead of Options.EmulatedTLS to decide whether
emulated TLS code should be generated.
Unit tests are modified to run with and without the -emulated-tls flag.
Differential Revision: https://reviews.llvm.org/D42999
llvm-svn: 326341
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/LowerEmuTLS.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/TargetPassConfig.cpp | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 979a03cf107..69e8038dff0 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -429,7 +429,7 @@ MCSymbol *AsmPrinter::getSymbol(const GlobalValue *GV) const { /// EmitGlobalVariable - Emit the specified global variable to the .s file. void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) { - bool IsEmuTLSVar = TM.Options.EmulatedTLS && GV->isThreadLocal(); + bool IsEmuTLSVar = TM.useEmulatedTLS() && GV->isThreadLocal(); assert(!(IsEmuTLSVar && GV->hasCommonLinkage()) && "No emulated TLS variables in the common section"); diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 1dc9d5e2345..06a5569e95d 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -198,7 +198,7 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE( if (Global) { const MCSymbol *Sym = Asm->getSymbol(Global); if (Global->isThreadLocal()) { - if (Asm->TM.Options.EmulatedTLS) { + if (Asm->TM.useEmulatedTLS()) { // TODO: add debug info for emulated thread local mode. } else { // FIXME: Make this work with -gsplit-dwarf. diff --git a/llvm/lib/CodeGen/LowerEmuTLS.cpp b/llvm/lib/CodeGen/LowerEmuTLS.cpp index 0cf578b5056..36c1d358a9b 100644 --- a/llvm/lib/CodeGen/LowerEmuTLS.cpp +++ b/llvm/lib/CodeGen/LowerEmuTLS.cpp @@ -68,7 +68,7 @@ bool LowerEmuTLS::runOnModule(Module &M) { return false; auto &TM = TPC->getTM<TargetMachine>(); - if (!TM.Options.EmulatedTLS) + if (!TM.useEmulatedTLS()) return false; bool Changed = false; diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp index f502ae202c3..98e4fa9c0d0 100644 --- a/llvm/lib/CodeGen/TargetPassConfig.cpp +++ b/llvm/lib/CodeGen/TargetPassConfig.cpp @@ -748,7 +748,7 @@ bool TargetPassConfig::addCoreISelPasses() { } bool TargetPassConfig::addISelPasses() { - if (TM->Options.EmulatedTLS) + if (TM->useEmulatedTLS()) addPass(createLowerEmuTLSPass()); addPass(createPreISelIntrinsicLoweringPass()); |

