summaryrefslogtreecommitdiff
path: root/lib/IR
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-05-28 18:15:43 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-05-28 18:15:43 +0000
commit665d42accf60bba6444ef7be8cd9e89d7aac177a (patch)
treeefb2e30f95ed5a1ce716d20e03f208e12f59f8bd /lib/IR
parenta5423f2598c8579fd5438f71048467db9d13abcd (diff)
downloadllvm-665d42accf60bba6444ef7be8cd9e89d7aac177a.tar.gz
llvm-665d42accf60bba6444ef7be8cd9e89d7aac177a.tar.bz2
llvm-665d42accf60bba6444ef7be8cd9e89d7aac177a.tar.xz
[pr19844] Add thread local mode to aliases.
This matches gcc's behavior. It also seems natural given that aliases contain other properties that govern how it is accessed (linkage, visibility, dll storage). Clang still has to be updated to expose this feature to C. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209759 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR')
-rw-r--r--lib/IR/AsmWriter.cpp1
-rw-r--r--lib/IR/Globals.cpp6
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/IR/AsmWriter.cpp b/lib/IR/AsmWriter.cpp
index 0fef0d0a18..8aee77ac07 100644
--- a/lib/IR/AsmWriter.cpp
+++ b/lib/IR/AsmWriter.cpp
@@ -1488,6 +1488,7 @@ void AssemblyWriter::printAlias(const GlobalAlias *GA) {
}
PrintVisibility(GA->getVisibility(), Out);
PrintDLLStorageClass(GA->getDLLStorageClass(), Out);
+ PrintThreadLocalModel(GA->getThreadLocalMode(), Out);
Out << "alias ";
diff --git a/lib/IR/Globals.cpp b/lib/IR/Globals.cpp
index c905cfe31e..344a08d8f3 100644
--- a/lib/IR/Globals.cpp
+++ b/lib/IR/Globals.cpp
@@ -113,8 +113,9 @@ GlobalVariable::GlobalVariable(Type *Ty, bool constant, LinkageTypes Link,
: GlobalObject(PointerType::get(Ty, AddressSpace), Value::GlobalVariableVal,
OperandTraits<GlobalVariable>::op_begin(this),
InitVal != nullptr, Link, Name),
- isConstantGlobal(constant), threadLocalMode(TLMode),
+ isConstantGlobal(constant),
isExternallyInitializedConstant(isExternallyInitialized) {
+ setThreadLocalMode(TLMode);
if (InitVal) {
assert(InitVal->getType() == Ty &&
"Initializer should be the same type as the GlobalVariable!");
@@ -132,8 +133,9 @@ GlobalVariable::GlobalVariable(Module &M, Type *Ty, bool constant,
: GlobalObject(PointerType::get(Ty, AddressSpace), Value::GlobalVariableVal,
OperandTraits<GlobalVariable>::op_begin(this),
InitVal != nullptr, Link, Name),
- isConstantGlobal(constant), threadLocalMode(TLMode),
+ isConstantGlobal(constant),
isExternallyInitializedConstant(isExternallyInitialized) {
+ setThreadLocalMode(TLMode);
if (InitVal) {
assert(InitVal->getType() == Ty &&
"Initializer should be the same type as the GlobalVariable!");