llvm.org GIT mirror llvm / f18a32e
Revert r180737. The companion patch was reverted, and this is not relevant right now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180889 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 7 years ago
3 changed file(s) with 0 addition(s) and 105 deletion(s). Raw diff Collapse all Expand all
485485 unsigned uid) const;
486486 void EmitLLVMUsedList(const ConstantArray *InitList);
487487 void EmitXXStructorList(const Constant *List, bool isCtor);
488 void EmitTLSInitFuncs(const ConstantArray *InitList);
489488 GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy *C);
490489 };
491490 }
12531253 return true;
12541254 }
12551255
1256 if (GV->getName() == "llvm.tls_init_funcs") {
1257 EmitTLSInitFuncs(cast(GV->getInitializer()));
1258 return true;
1259 }
1260
12611256 return false;
12621257 }
12631258
13221317 EmitAlignment(Align);
13231318 EmitXXStructor(Structors[i].second);
13241319 }
1325 }
1326
1327 /// EmitTLSInitFuncs - Emit the TLS initialization functions.
1328 void AsmPrinter::EmitTLSInitFuncs(const ConstantArray *InitList) {
1329 const DataLayout *TD = TM.getDataLayout();
1330 OutStreamer.SwitchSection(getObjFileLowering().getTLSThreadInitSection());
1331 EmitAlignment(Log2_32(TD->getPointerPrefAlignment()));
1332 for (unsigned I = 0, E = InitList->getNumOperands(); I != E; ++I)
1333 EmitGlobalConstant(
1334 dyn_cast(InitList->getOperand(I)->stripPointerCasts()));
13351320 }
13361321
13371322 //===--------------------------------------------------------------------===//
+0
-89
test/CodeGen/X86/tls-init-funcs.ll less more
None ; RUN: llc < %s -mtriple x86_64-apple-macosx10 | FileCheck %s
1
2 ; CHECK: .section __DATA,__thread_init,thread_local_init_function_pointers
3 ; CHECK: .align 3
4 ; CHECK: .quad ___tls_init
5
6 %struct.A = type { i8 }
7 %struct.B = type { i32 }
8
9 @i = thread_local global i32 37, align 4
10 @a = thread_local global %struct.A zeroinitializer, align 1
11 @b = thread_local global %struct.B zeroinitializer, align 4
12 @z = global %struct.A zeroinitializer, align 1
13 @y = global %struct.B zeroinitializer, align 4
14 @__tls_guard = internal thread_local unnamed_addr global i1 false
15 @llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_a }]
16 @llvm.tls_init_funcs = appending global [1 x void ()*] [void ()* @__tls_init]
17
18 @_ZTH1i = alias void ()* @__tls_init
19 @_ZTH1a = alias void ()* @__tls_init
20 @_ZTH1b = alias void ()* @__tls_init
21
22 declare void @_ZN1AC1Ev(%struct.A*)
23
24 declare void @_ZN1BC1Ei(%struct.B*, i32)
25
26 define internal void @_GLOBAL__I_a() section "__TEXT,__StaticInit,regular,pure_instructions" {
27 entry:
28 tail call void @_ZN1AC1Ev(%struct.A* @z)
29 tail call void @_ZN1BC1Ei(%struct.B* @y, i32 42)
30 ret void
31 }
32
33 define internal void @__tls_init() {
34 entry:
35 %.b = load i1* @__tls_guard, align 1
36 store i1 true, i1* @__tls_guard, align 1
37 br i1 %.b, label %exit, label %init
38
39 init: ; preds = %entry
40 tail call void @_ZN1AC1Ev(%struct.A* @a)
41 tail call void @_ZN1BC1Ei(%struct.B* @b, i32 927)
42 br label %exit
43
44 exit: ; preds = %entry, %init
45 ret void
46 }
47
48 define weak_odr hidden i32* @_ZTW1i() {
49 %.b.i = load i1* @__tls_guard, align 1
50 store i1 true, i1* @__tls_guard, align 1
51 br i1 %.b.i, label %__tls_init.exit, label %init.i
52
53 init.i: ; preds = %0
54 tail call void @_ZN1AC1Ev(%struct.A* @a)
55 tail call void @_ZN1BC1Ei(%struct.B* @b, i32 927)
56 br label %__tls_init.exit
57
58 __tls_init.exit: ; preds = %0, %init.i
59 ret i32* @i
60 }
61
62 define weak_odr hidden %struct.A* @_ZTW1a() {
63 %.b.i = load i1* @__tls_guard, align 1
64 store i1 true, i1* @__tls_guard, align 1
65 br i1 %.b.i, label %__tls_init.exit, label %init.i
66
67 init.i: ; preds = %0
68 tail call void @_ZN1AC1Ev(%struct.A* @a)
69 tail call void @_ZN1BC1Ei(%struct.B* @b, i32 927)
70 br label %__tls_init.exit
71
72 __tls_init.exit: ; preds = %0, %init.i
73 ret %struct.A* @a
74 }
75
76 define weak_odr hidden %struct.B* @_ZTW1b() {
77 %.b.i = load i1* @__tls_guard, align 1
78 store i1 true, i1* @__tls_guard, align 1
79 br i1 %.b.i, label %__tls_init.exit, label %init.i
80
81 init.i: ; preds = %0
82 tail call void @_ZN1AC1Ev(%struct.A* @a)
83 tail call void @_ZN1BC1Ei(%struct.B* @b, i32 927)
84 br label %__tls_init.exit
85
86 __tls_init.exit: ; preds = %0, %init.i
87 ret %struct.B* @b
88 }