• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mtriple=i386-unknown-linux-gnu | FileCheck %s -check-prefix=LINUX
2; RUN: llc < %s -mtriple=i386-apple-darwin9.7 | FileCheck %s -check-prefix=DARWIN
3; RUN: llc < %s -mtriple=i386-apple-darwin10 -relocation-model=static | FileCheck %s -check-prefix=DARWIN-STATIC
4; RUN: llc < %s -mtriple=x86_64-apple-darwin10 | FileCheck %s -check-prefix=DARWIN64
5; RUN: llc < %s -mtriple=i386-unknown-linux-gnu -data-sections -function-sections | FileCheck %s -check-prefix=LINUX-SECTIONS
6; RUN: llc < %s -mtriple=i386-unknown-linux-gnu -function-sections | FileCheck %s -check-prefix=LINUX-FUNC-SECTIONS
7; RUN: llc < %s -mtriple=x86_64-pc-linux -data-sections -function-sections -relocation-model=pic | FileCheck %s -check-prefix=LINUX-SECTIONS-PIC
8; RUN: llc < %s -mtriple=i686-pc-win32 -data-sections -function-sections | FileCheck %s -check-prefix=WIN32-SECTIONS
9; RUN: llc < %s -mtriple=i686-pc-win32 -function-sections | FileCheck %s -check-prefix=WIN32-FUNC-SECTIONS
10
11define void @F1() {
12  ret void
13}
14
15; WIN32-SECTIONS: .section        .text,"xr",one_only,_F1
16; WIN32-SECTIONS: .globl _F1
17
18define void @F2(i32 %y) {
19bb0:
20switch i32 %y, label %bb5 [
21    i32 1, label %bb1
22    i32 2, label %bb2
23    i32 3, label %bb3
24    i32 4, label %bb4
25  ]
26bb1:
27  ret void
28bb2:
29  ret void
30bb3:
31  ret void
32bb4:
33  ret void
34bb5:
35  ret void
36}
37
38; LINUX:     .size   F2,
39; LINUX-NEX: .cfi_endproc
40; LINUX-NEX: .section        .rodata,"a",@progbits
41
42; LINUX-SECTIONS: .section        .text.F2,"ax",@progbits
43; LINUX-SECTIONS: .size   F2,
44; LINUX-SECTIONS-NEXT: .cfi_endproc
45; LINUX-SECTIONS-NEXT: .section        .rodata.F2,"a",@progbits
46
47; LINUX-FUNC-SECTIONS: .section        .text.F2,"ax",@progbits
48; LINUX-FUNC-SECTIONS: .size   F2,
49; LINUX-FUNC-SECTIONS-NEXT: .cfi_endproc
50; LINUX-FUNC-SECTIONS-NEXT: .section        .rodata.F2,"a",@progbits
51
52; WIN32-FUNC-SECTIONS: .section        .text,"xr",one_only,_F2
53; WIN32-FUNC-SECTIONS-NOT: .section
54; WIN32-FUNC-SECTIONS: .section        .rdata,"dr",associative,_F2
55
56
57; LINUX-SECTIONS-PIC: .section        .text.F2,"ax",@progbits
58; LINUX-SECTIONS-PIC: .size   F2,
59; LINUX-SECTIONS-PIC-NEXT: .cfi_endproc
60; LINUX-SECTIONS-PIC-NEXT: .section        .rodata.F2,"a",@progbits
61
62declare void @G()
63
64define void @F3(i32 %y) personality i8* bitcast (void ()* @G to i8*) {
65bb0:
66  invoke void @G()
67          to label %bb2 unwind label %bb1
68bb1:
69  landingpad { i8*, i32 }
70          catch i8* null
71  br label %bb2
72bb2:
73
74switch i32 %y, label %bb7 [
75    i32 1, label %bb3
76    i32 2, label %bb4
77    i32 3, label %bb5
78    i32 4, label %bb6
79  ]
80bb3:
81  ret void
82bb4:
83  ret void
84bb5:
85  ret void
86bb6:
87  ret void
88bb7:
89  ret void
90}
91
92; DARWIN64: _F3:
93; DARWIN64: Lfunc_end
94; DARWIN64-NEXT: .cfi_endproc
95; DARWIN64-NOT: .section
96; DARWIN64: .data_region jt32
97; DARWIN64: LJTI{{.*}}:
98; DARWIN64-NEXT: .long
99; DARWIN64-NEXT: .long
100; DARWIN64-NEXT: .long
101; DARWIN64-NEXT: .long
102; DARWIN64-NEXT: .end_data_region
103; DARWIN64-NEXT: .section        __TEXT,__gcc_except_tab
104
105; int G1;
106@G1 = common global i32 0
107
108; LINUX: .type   G1,@object
109; LINUX: .comm  G1,4,4
110
111; DARWIN: .comm _G1,4,2
112
113
114
115
116; const int G2 __attribute__((weak)) = 42;
117@G2 = weak_odr unnamed_addr constant i32 42
118
119
120; TODO: linux drops this into .rodata, we drop it into ".gnu.linkonce.r.G2"
121
122; DARWIN: .section __TEXT,__const{{$}}
123; DARWIN: _G2:
124; DARWIN:    .long 42
125
126
127; int * const G3 = &G1;
128@G3 = unnamed_addr constant i32* @G1
129
130; DARWIN: .section        __DATA,__const
131; DARWIN: .globl _G3
132; DARWIN: _G3:
133; DARWIN:     .long _G1
134
135; LINUX:   .section        .rodata,"a",@progbits
136; LINUX:   .globl  G3
137
138; LINUX-SECTIONS: .section        .rodata.G3,"a",@progbits
139; LINUX-SECTIONS: .globl  G3
140
141; WIN32-SECTIONS: .section        .rdata,"dr",one_only,_G3
142; WIN32-SECTIONS: .globl  _G3
143
144
145; _Complex long long const G4 = 34;
146@G4 = private unnamed_addr constant {i64,i64} { i64 34, i64 0 }
147
148; DARWIN: .section        __TEXT,__literal16,16byte_literals
149; DARWIN: L_G4:
150; DARWIN:     .long 34
151
152; DARWIN-STATIC: .section        __TEXT,__literal16,16byte_literals
153; DARWIN-STATIC: L_G4:
154; DARWIN-STATIC:     .long 34
155
156; DARWIN64: .section        __TEXT,__literal16,16byte_literals
157; DARWIN64: L_G4:
158; DARWIN64:     .quad 34
159
160; int G5 = 47;
161@G5 = global i32 47
162
163; LINUX: .data
164; LINUX: .globl G5
165; LINUX: G5:
166; LINUX:    .long 47
167
168; DARWIN: .section        __DATA,__data
169; DARWIN: .globl _G5
170; DARWIN: _G5:
171; DARWIN:    .long 47
172
173
174; PR4584
175@"foo bar" = linkonce global i32 42
176
177; LINUX: .type  "foo bar",@object
178; LINUX: .weak  "foo bar"
179; LINUX: "foo bar":
180
181; DARWIN: .globl        "_foo bar"
182; DARWIN:       .weak_definition "_foo bar"
183; DARWIN: "_foo bar":
184
185; PR4650
186@G6 = weak_odr unnamed_addr constant [1 x i8] c"\01"
187
188; LINUX:   .type        G6,@object
189; LINUX:   .weak        G6
190; LINUX: G6:
191; LINUX:   .byte        1
192; LINUX:   .size        G6, 1
193
194; DARWIN:  .section __TEXT,__const{{$}}
195; DARWIN:  .globl _G6
196; DARWIN:  .weak_definition _G6
197; DARWIN:_G6:
198; DARWIN:  .byte 1
199
200
201@G7 = unnamed_addr constant [10 x i8] c"abcdefghi\00"
202
203; DARWIN:       __TEXT,__cstring,cstring_literals
204; DARWIN:       .globl _G7
205; DARWIN: _G7:
206; DARWIN:       .asciz  "abcdefghi"
207
208; LINUX:        .section        .rodata.str1.1,"aMS",@progbits,1
209; LINUX:        .globl G7
210; LINUX: G7:
211; LINUX:        .asciz  "abcdefghi"
212
213; LINUX-SECTIONS: .section        .rodata.str1.1,"aMS",@progbits,1
214; LINUX-SECTIONS:       .globl G7
215
216; WIN32-SECTIONS: .section        .rdata,"dr",one_only,_G7
217; WIN32-SECTIONS:       .globl _G7
218
219
220@G8 = unnamed_addr constant [4 x i16] [ i16 1, i16 2, i16 3, i16 0 ]
221
222; DARWIN:       .section        __TEXT,__const
223; DARWIN:       .globl _G8
224; DARWIN: _G8:
225
226; LINUX:        .section        .rodata.str2.2,"aMS",@progbits,2
227; LINUX:        .globl G8
228; LINUX:G8:
229
230@G9 = unnamed_addr constant [4 x i32] [ i32 1, i32 2, i32 3, i32 0 ]
231
232; DARWIN:       .globl _G9
233; DARWIN: _G9:
234
235; LINUX:        .section        .rodata.str4.4,"aMS",@progbits,4
236; LINUX:        .globl G9
237; LINUX:G9
238
239
240@G10 = weak global [100 x i32] zeroinitializer, align 32 ; <[100 x i32]*> [#uses=0]
241
242
243; DARWIN:       .section        __DATA,__data{{$}}
244; DARWIN: .globl _G10
245; DARWIN:       .weak_definition _G10
246; DARWIN:       .p2align  5
247; DARWIN: _G10:
248; DARWIN:       .space  400
249
250; LINUX:        .bss
251; LINUX:        .weak   G10
252; LINUX:        .p2align  5
253; LINUX: G10:
254; LINUX:        .zero   400
255
256
257
258;; Zero sized objects should round up to 1 byte in zerofill directives.
259; rdar://7886017
260@G11 = global [0 x i32] zeroinitializer
261@G12 = global {} zeroinitializer
262@G13 = global { [0 x {}] } zeroinitializer
263
264; DARWIN: .globl _G11
265; DARWIN: .zerofill __DATA,__common,_G11,1,2
266; DARWIN: .globl _G12
267; DARWIN: .zerofill __DATA,__common,_G12,1,3
268; DARWIN: .globl _G13
269; DARWIN: .zerofill __DATA,__common,_G13,1,3
270
271@G14 = private unnamed_addr constant [4 x i8] c"foo\00", align 1
272
273; LINUX-SECTIONS:        .type   .LG14,@object           # @G14
274; LINUX-SECTIONS:        .section        .rodata.str1.1,"aMS",@progbits,1
275; LINUX-SECTIONS: .LG14:
276; LINUX-SECTIONS:        .asciz  "foo"
277; LINUX-SECTIONS:        .size   .LG14, 4
278
279; WIN32-SECTIONS:        .section        .rdata,"dr",one_only,_G14
280; WIN32-SECTIONS: _G14:
281; WIN32-SECTIONS:        .asciz  "foo"
282
283; cannot be merged on MachO, but can on other formats.
284@G15 = unnamed_addr constant i64 0
285
286; LINUX: .section        .rodata.cst8,"aM",@progbits,8
287; LINUX: G15:
288
289; DARWIN: .section      __TEXT,__const
290; DARWIN: _G15:
291
292; DARWIN-STATIC: .section       __TEXT,__const
293; DARWIN-STATIC: _G15:
294
295; DARWIN64: .section       __TEXT,__const
296; DARWIN64: _G15:
297
298; LINUX-SECTIONS: .section      .rodata.cst8,"aM",@progbits,8
299; LINUX-SECTIONS: G15:
300
301; WIN32-SECTIONS: .section      .rdata,"dr",one_only,_G15
302; WIN32-SECTIONS: _G15:
303
304@G16 = unnamed_addr constant i256 0
305
306; LINUX: .section        .rodata.cst32,"aM",@progbits,32
307; LINUX: G16:
308
309; LINUX-SECTIONS: .section      .rodata.cst32,"aM",@progbits,32
310; LINUX-SECTIONS: G16:
311
312; WIN32-SECTIONS: .section      .rdata,"dr",one_only,_G16
313; WIN32-SECTIONS: _G16:
314
315; PR26570
316
317@G17 = internal global i8 0
318; LINUX: .type	G17,@object
319; LINUX: .local	G17
320; LINUX: .comm	G17,1,1
321
322; DARWIN: .zerofill __DATA,__bss,_G17,1,0
323
324; LINUX-SECTIONS: .type	G17,@object
325; LINUX-SECTIONS: .section	.bss.G17,"aw",@nobits
326; LINUX-SECTIONS: .byte	0
327; LINUX-SECTIONS: .size	G17, 1
328
329; WIN32-SECTIONS: .section	.bss,"bw",one_only,_G17
330; WIN32-SECTIONS: _G17:
331; WIN32-SECTIONS:.byte	0
332