OLD | NEW |
1 ; Test of global initializers. | 1 ; Test of global initializers. |
2 | 2 |
| 3 ; Test -ias=0 to test the lea "hack" until we are fully confident in -ias=1 |
3 ; Check that we generate proper global initializers. | 4 ; Check that we generate proper global initializers. |
4 ; RUN: %p2i -i %s --args -verbose inst | FileCheck %s | 5 ; RUN: %p2i -i %s --args -verbose none -ias=0 | FileCheck %s |
5 | 6 |
6 ; Check that what we generate is valid assembly | 7 ; Test -ias=1 and try to cross reference instructions w/ the symbol table. |
7 ; RUN: %p2i -i %s --args -verbose none \ | 8 ; RUN: %p2i -i %s --args -verbose none \ |
8 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj | 9 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ |
| 10 ; RUN: | llvm-objdump -d -r --symbolize -x86-asm-syntax=intel - \ |
| 11 ; RUN: | FileCheck --check-prefix=IAS %s |
| 12 ; RUN: %p2i -i %s --args --verbose none \ |
| 13 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ |
| 14 ; RUN: | llvm-objdump -d -t --symbolize -x86-asm-syntax=intel - \ |
| 15 ; RUN: | FileCheck --check-prefix=SYMTAB %s |
9 | 16 |
10 ; Check that we don't generate errors | 17 ; Check that we don't generate errors |
11 ; RUN: %p2i -i %s --args -verbose none | FileCheck --check-prefix=ERRORS %s | 18 ; RUN: %p2i -i %s --args -verbose none | FileCheck --check-prefix=ERRORS %s |
12 | 19 |
13 @PrimitiveInit = internal global [4 x i8] c"\1B\00\00\00", align 4 | 20 @PrimitiveInit = internal global [4 x i8] c"\1B\00\00\00", align 4 |
14 ; CHECK: .type PrimitiveInit,@object | 21 ; CHECK: .type PrimitiveInit,@object |
15 ; CHECK-NEXT: .section .data,"aw",@progbits | 22 ; CHECK-NEXT: .section .data,"aw",@progbits |
16 ; CHECK-NEXT: .align 4 | 23 ; CHECK-NEXT: .align 4 |
17 ; CHECK-NEXT: PrimitiveInit: | 24 ; CHECK-NEXT: PrimitiveInit: |
18 ; CHECK-NEXT: .byte | 25 ; CHECK-NEXT: .byte |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 ; CHECK: .att_syntax | 119 ; CHECK: .att_syntax |
113 ; CHECK: leal ArrayInit, | 120 ; CHECK: leal ArrayInit, |
114 ; CHECK: .intel_syntax | 121 ; CHECK: .intel_syntax |
115 ; CHECK: .att_syntax | 122 ; CHECK: .att_syntax |
116 ; CHECK: leal ArrayInitPartial, | 123 ; CHECK: leal ArrayInitPartial, |
117 ; CHECK: .intel_syntax | 124 ; CHECK: .intel_syntax |
118 ; CHECK: .att_syntax | 125 ; CHECK: .att_syntax |
119 ; CHECK: leal ArrayUninit, | 126 ; CHECK: leal ArrayUninit, |
120 ; CHECK: .intel_syntax | 127 ; CHECK: .intel_syntax |
121 | 128 |
| 129 ; llvm-objdump does not indicate what symbol the mov/relocation applies to |
| 130 ; so we grep for "mov {{.*}}, OFFSET", along with "OFFSET {{.*}} symbol" in |
| 131 ; the symbol table as a sanity check. NOTE: The symbol table sorting has no |
| 132 ; relation to the code's references. |
| 133 ; IAS-LABEL: main |
| 134 ; SYMTAB-LABEL: SYMBOL TABLE |
| 135 |
| 136 ; SYMTAB-DAG: 00000000 {{.*}} .data {{.*}} PrimitiveInit |
| 137 ; IAS: mov {{.*}}, 0 |
| 138 ; IAS-NEXT: R_386_32 |
| 139 ; IAS: call |
| 140 |
| 141 ; SYMTAB-DAG: 00000000 {{.*}} .rodata {{.*}} PrimitiveInitConst |
| 142 ; IAS: mov {{.*}}, 0 |
| 143 ; IAS-NEXT: R_386_32 |
| 144 ; IAS: call |
| 145 |
| 146 ; SYMTAB-DAG: 00000000 {{.*}} .bss {{.*}} PrimitiveInitStatic |
| 147 ; IAS: mov {{.*}}, 0 |
| 148 ; IAS-NEXT: R_386_32 |
| 149 ; IAS: call |
| 150 |
| 151 ; SYMTAB-DAG: 00000004 {{.*}} .bss {{.*}} PrimitiveUninit |
| 152 ; IAS: mov {{.*}}, 4 |
| 153 ; IAS-NEXT: R_386_32 |
| 154 ; IAS: call |
| 155 |
| 156 ; SYMTAB-DAG: 00000004{{.*}}.data{{.*}}ArrayInit |
| 157 ; IAS: mov {{.*}}, 4 |
| 158 ; IAS-NEXT: R_386_32 |
| 159 ; IAS: call |
| 160 |
| 161 ; SYMTAB-DAG: 00000018 {{.*}} .data {{.*}} ArrayInitPartial |
| 162 ; IAS: mov {{.*}}, 24 |
| 163 ; IAS-NEXT: R_386_32 |
| 164 ; IAS: call |
| 165 |
| 166 ; SYMTAB-DAG: 00000008 {{.*}} .bss {{.*}} ArrayUninit |
| 167 ; IAS: mov {{.*}}, 8 |
| 168 ; IAS-NEXT: R_386_32 |
| 169 ; IAS: call |
| 170 |
| 171 |
122 declare void @use(i32) | 172 declare void @use(i32) |
123 | 173 |
124 define internal i32 @nacl_tp_tdb_offset(i32 %__0) { | 174 define internal i32 @nacl_tp_tdb_offset(i32 %__0) { |
125 entry: | 175 entry: |
126 ret i32 0 | 176 ret i32 0 |
127 } | 177 } |
128 | 178 |
129 define internal i32 @nacl_tp_tls_offset(i32 %size) { | 179 define internal i32 @nacl_tp_tls_offset(i32 %size) { |
130 entry: | 180 entry: |
131 %result = sub i32 0, %size | 181 %result = sub i32 0, %size |
132 ret i32 %result | 182 ret i32 %result |
133 } | 183 } |
134 | 184 |
135 ; ERRORS-NOT: ICE translation error | 185 ; ERRORS-NOT: ICE translation error |
OLD | NEW |