Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(570)

Side by Side Diff: tests_lit/llvm2ice_tests/mangle.ll

Issue 455633002: Subzero: Add the "llvm2ice -ffunction-sections" argument. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/llvm2ice.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 ; Tests the Subzero "name mangling" when using the "llvm2ice --prefix" 1 ; Tests the Subzero "name mangling" when using the "llvm2ice --prefix"
2 ; option. 2 ; option. Also does a quick smoke test of -ffunction-sections.
3 3
4 ; RUN: %llvm2ice --verbose none %s | FileCheck %s 4 ; RUN: %llvm2ice --verbose none -ffunction-sections %s | FileCheck %s
5 ; TODO: The following line causes this test to fail. 5 ; TODO: The following line causes this test to fail.
6 ; RUIN: %llvm2ice --verbose none %s \ 6 ; RUIN: %llvm2ice --verbose none %s \
7 ; RUIN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj 7 ; RUIN: | llvm-mc -arch=x86 -x86-asm-syntax=intel -filetype=obj
8 ; RUN: %llvm2ice --verbose none --prefix Subzero %s | FileCheck --check-prefix=M ANGLE %s 8 ; RUN: %llvm2ice --verbose none --prefix Subzero -ffunction-sections %s \
9 ; RUN: | FileCheck --check-prefix=MANGLE %s
9 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s 10 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s
10 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s 11 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s
11 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ 12 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \
12 ; RUN: | FileCheck --check-prefix=DUMP %s 13 ; RUN: | FileCheck --check-prefix=DUMP %s
13 14
14 define internal void @FuncC(i32 %i) { 15 define internal void @FuncC(i32 %i) {
15 entry: 16 entry:
16 ret void 17 ret void
17 } 18 }
18 ; FuncC is a C symbol that isn't recognized as a C++ mangled symbol. 19 ; FuncC is a C symbol that isn't recognized as a C++ mangled symbol.
20 ; CHECK-LABEL: .text.FuncC
19 ; CHECK: FuncC: 21 ; CHECK: FuncC:
20 ; MANGLE: SubzeroFuncC 22 ; MANGLE-LABEL: .text.SubzeroFuncC
23 ; MANGLE: SubzeroFuncC:
21 24
22 define internal void @_ZN13TestNamespace4FuncEi(i32 %i) { 25 define internal void @_ZN13TestNamespace4FuncEi(i32 %i) {
23 entry: 26 entry:
24 ret void 27 ret void
25 } 28 }
26 ; This is Func(int) nested inside namespace TestNamespace. 29 ; This is Func(int) nested inside namespace TestNamespace.
30 ; CHECK-LABEL: .text._ZN13TestNamespace4FuncEi
27 ; CHECK: _ZN13TestNamespace4FuncEi: 31 ; CHECK: _ZN13TestNamespace4FuncEi:
32 ; MANGLE-LABEL: .text._ZN7Subzero13TestNamespace4FuncEi
28 ; MANGLE: _ZN7Subzero13TestNamespace4FuncEi: 33 ; MANGLE: _ZN7Subzero13TestNamespace4FuncEi:
29 34
30 define internal void @_ZN13TestNamespace15NestedNamespace4FuncEi(i32 %i) { 35 define internal void @_ZN13TestNamespace15NestedNamespace4FuncEi(i32 %i) {
31 entry: 36 entry:
32 ret void 37 ret void
33 } 38 }
34 ; This is Func(int) nested inside two namespaces. 39 ; This is Func(int) nested inside two namespaces.
40 ; CHECK-LABEL: .text._ZN13TestNamespace15NestedNamespace4FuncEi
35 ; CHECK: _ZN13TestNamespace15NestedNamespace4FuncEi: 41 ; CHECK: _ZN13TestNamespace15NestedNamespace4FuncEi:
42 ; MANGLE-LABEL: .text._ZN7Subzero13TestNamespace15NestedNamespace4FuncEi
36 ; MANGLE: _ZN7Subzero13TestNamespace15NestedNamespace4FuncEi: 43 ; MANGLE: _ZN7Subzero13TestNamespace15NestedNamespace4FuncEi:
37 44
38 define internal void @_Z13FuncCPlusPlusi(i32 %i) { 45 define internal void @_Z13FuncCPlusPlusi(i32 %i) {
39 entry: 46 entry:
40 ret void 47 ret void
41 } 48 }
42 ; This is a non-nested, mangled C++ symbol. 49 ; This is a non-nested, mangled C++ symbol.
50 ; CHECK-LABEL: .text._Z13FuncCPlusPlusi
43 ; CHECK: _Z13FuncCPlusPlusi: 51 ; CHECK: _Z13FuncCPlusPlusi:
52 ; MANGLE-LABEL: .text._ZN7Subzero13FuncCPlusPlusEi
44 ; MANGLE: _ZN7Subzero13FuncCPlusPlusEi: 53 ; MANGLE: _ZN7Subzero13FuncCPlusPlusEi:
45 54
46 define internal void @_ZN12_GLOBAL__N_18FuncAnonEi(i32 %i) { 55 define internal void @_ZN12_GLOBAL__N_18FuncAnonEi(i32 %i) {
47 entry: 56 entry:
48 ret void 57 ret void
49 } 58 }
50 ; This is FuncAnon(int) nested inside an anonymous namespace. 59 ; This is FuncAnon(int) nested inside an anonymous namespace.
60 ; CHECK-LABEL: .text._ZN12_GLOBAL__N_18FuncAnonEi
51 ; CHECK: _ZN12_GLOBAL__N_18FuncAnonEi: 61 ; CHECK: _ZN12_GLOBAL__N_18FuncAnonEi:
62 ; MANGLE-LABEL: .text._ZN7Subzero12_GLOBAL__N_18FuncAnonEi
52 ; MANGLE: _ZN7Subzero12_GLOBAL__N_18FuncAnonEi: 63 ; MANGLE: _ZN7Subzero12_GLOBAL__N_18FuncAnonEi:
53 64
54 ; Now for the illegitimate examples. 65 ; Now for the illegitimate examples.
55 66
56 ; Test for _ZN with no suffix. Don't crash, prepend Subzero. 67 ; Test for _ZN with no suffix. Don't crash, prepend Subzero.
57 define internal void @_ZN(i32 %i) { 68 define internal void @_ZN(i32 %i) {
58 entry: 69 entry:
59 ret void 70 ret void
60 } 71 }
72 ; MANGLE-LABEL: .text.Subzero_ZN
61 ; MANGLE: Subzero_ZN: 73 ; MANGLE: Subzero_ZN:
62 74
63 ; Test for _Z<len><str> where <len> is smaller than it should be. 75 ; Test for _Z<len><str> where <len> is smaller than it should be.
64 define internal void @_Z12FuncCPlusPlusi(i32 %i) { 76 define internal void @_Z12FuncCPlusPlusi(i32 %i) {
65 entry: 77 entry:
66 ret void 78 ret void
67 } 79 }
80 ; MANGLE-LABEL: .text._ZN7Subzero12FuncCPlusPluEsi
68 ; MANGLE: _ZN7Subzero12FuncCPlusPluEsi: 81 ; MANGLE: _ZN7Subzero12FuncCPlusPluEsi:
69 82
70 ; Test for _Z<len><str> where <len> is slightly larger than it should be. 83 ; Test for _Z<len><str> where <len> is slightly larger than it should be.
71 define internal void @_Z14FuncCPlusPlusi(i32 %i) { 84 define internal void @_Z14FuncCPlusPlusi(i32 %i) {
72 entry: 85 entry:
73 ret void 86 ret void
74 } 87 }
88 ; MANGLE-LABEL: .text._ZN7Subzero14FuncCPlusPlusiE
75 ; MANGLE: _ZN7Subzero14FuncCPlusPlusiE: 89 ; MANGLE: _ZN7Subzero14FuncCPlusPlusiE:
76 90
77 ; Test for _Z<len><str> where <len> is much larger than it should be. 91 ; Test for _Z<len><str> where <len> is much larger than it should be.
78 define internal void @_Z114FuncCPlusPlusi(i32 %i) { 92 define internal void @_Z114FuncCPlusPlusi(i32 %i) {
79 entry: 93 entry:
80 ret void 94 ret void
81 } 95 }
96 ; MANGLE-LABEL: .text.Subzero_Z114FuncCPlusPlusi
82 ; MANGLE: Subzero_Z114FuncCPlusPlusi: 97 ; MANGLE: Subzero_Z114FuncCPlusPlusi:
83 98
84 ; Test for _Z<len><str> where we try to overflow the uint32_t holding <len>. 99 ; Test for _Z<len><str> where we try to overflow the uint32_t holding <len>.
85 define internal void @_Z4294967296FuncCPlusPlusi(i32 %i) { 100 define internal void @_Z4294967296FuncCPlusPlusi(i32 %i) {
86 entry: 101 entry:
87 ret void 102 ret void
88 } 103 }
104 ; MANGLE-LABEL: .text.Subzero_Z4294967296FuncCPlusPlusi
89 ; MANGLE: Subzero_Z4294967296FuncCPlusPlusi: 105 ; MANGLE: Subzero_Z4294967296FuncCPlusPlusi:
90 106
91 ; Test for _Z<len><str> where <len> is 0. 107 ; Test for _Z<len><str> where <len> is 0.
92 define internal void @_Z0FuncCPlusPlusi(i32 %i) { 108 define internal void @_Z0FuncCPlusPlusi(i32 %i) {
93 entry: 109 entry:
94 ret void 110 ret void
95 } 111 }
112 ; MANGLE-LABEL: .text._ZN7Subzero0EFuncCPlusPlusi
96 ; MANGLE: _ZN7Subzero0EFuncCPlusPlusi: 113 ; MANGLE: _ZN7Subzero0EFuncCPlusPlusi:
97 114
98 ; Test for _Z<len><str> where <len> is -1. LLVM explicitly allows the 115 ; Test for _Z<len><str> where <len> is -1. LLVM explicitly allows the
99 ; '-' character in identifiers. 116 ; '-' character in identifiers.
100 117
101 define internal void @_Z-1FuncCPlusPlusi(i32 %i) { 118 define internal void @_Z-1FuncCPlusPlusi(i32 %i) {
102 entry: 119 entry:
103 ret void 120 ret void
104 } 121 }
122 ; MANGLE-LABEL: .text.Subzero_Z-1FuncCPlusPlusi
105 ; MANGLE: Subzero_Z-1FuncCPlusPlusi: 123 ; MANGLE: Subzero_Z-1FuncCPlusPlusi:
106 124
107 125
108 ; Test for substitution incrementing. This single test captures: 126 ; Test for substitution incrementing. This single test captures:
109 ; S<num>_ ==> S<num+1>_ for single-digit <num> 127 ; S<num>_ ==> S<num+1>_ for single-digit <num>
110 ; S_ ==> S0_ 128 ; S_ ==> S0_
111 ; String length increase, e.g. SZZZ_ ==> S1000_ 129 ; String length increase, e.g. SZZZ_ ==> S1000_
112 ; At least one digit wrapping without length increase, e.g. SZ9ZZ_ ==> SZA00_ 130 ; At least one digit wrapping without length increase, e.g. SZ9ZZ_ ==> SZA00_
113 ; Unrelated identifiers containing S[0-9A-Z]* , e.g. MyClassS1x 131 ; Unrelated identifiers containing S[0-9A-Z]* , e.g. MyClassS1x
114 ; A proper substring of S<num>_ at the end of the string 132 ; A proper substring of S<num>_ at the end of the string
115 ; (to test parser edge cases) 133 ; (to test parser edge cases)
116 134
117 define internal void @_Z3fooP10MyClassS1xP10MyClassS2xRS_RS1_S_S1_SZZZ_SZ9ZZ_S12 345() { 135 define internal void @_Z3fooP10MyClassS1xP10MyClassS2xRS_RS1_S_S1_SZZZ_SZ9ZZ_S12 345() {
118 ; MANGLE: _ZN7Subzero3fooEP10MyClassS1xP10MyClassS2xRS0_RS2_S0_S2_S1000_SZA00_ S12345: 136 ; MANGLE-LABEL: .text._ZN7Subzero3fooEP10MyClassS1xP10MyClassS2xRS0_RS2_S0_S2_S1 000_SZA00_S12345
137 ; MANGLE: _ZN7Subzero3fooEP10MyClassS1xP10MyClassS2xRS0_RS2_S0_S2_S1000_SZA00_S1 2345:
119 entry: 138 entry:
120 ret void 139 ret void
121 } 140 }
122 141
123 ; Test that unmangled (non-C++) strings don't have substitutions updated. 142 ; Test that unmangled (non-C++) strings don't have substitutions updated.
124 define internal void @foo_S_S0_SZ_S() { 143 define internal void @foo_S_S0_SZ_S() {
125 ; MANGLE: Subzerofoo_S_S0_SZ_S: 144 ; MANGLE-LABEL: .text.Subzerofoo_S_S0_SZ_S
145 ; MANGLE: Subzerofoo_S_S0_SZ_S:
126 entry: 146 entry:
127 ret void 147 ret void
128 } 148 }
129 149
130 ; ERRORS-NOT: ICE translation error 150 ; ERRORS-NOT: ICE translation error
131 ; DUMP-NOT: SZ 151 ; DUMP-NOT: SZ
OLDNEW
« no previous file with comments | « src/llvm2ice.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698