Commit 7108b12
authored
[RDF] RegisterRef/RegisterId improvements. NFC (llvm#168030)
RegisterId can represent a physical register, a MCRegUnit, or
an index into a side structure that stores register masks. These 3
types were encoded by using the physical reg, stack slot, and
virtual register encoding partitions from the Register class.
This encoding scheme alias wasn't well contained so
Register::index2StackSlot and Register::stackSlotIndex appeared
in multiple places.
This patch gives RegisterRef its own encoding defines and separates
it from Register.
I've removed the generic idx() method in favor of getAsMCReg(),
getAsMCRegUnit(), and getMaskIdx() for some degree of type safety.
Some places used the RegisterId field of RegisterRef directly as a
register. Those have been updated to use getAsMCReg.
Some special cases for RegisterId 0 have been removed as it can
be treated like a MCRegister by existing code.
I think I want to rename the Reg field of RegisterRef to Id, but
I'll do that in another patch.
Additionally, callers of the RegisterRef constructor need to be
audited for implicit conversions from Register/MCRegister
to unsigned.1 parent 8b105cb commit 7108b12
File tree
3 files changed
+50
-46
lines changed- llvm
- include/llvm/CodeGen
- lib/CodeGen
3 files changed
+50
-46
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
89 | 94 | | |
90 | 95 | | |
91 | 96 | | |
| |||
99 | 104 | | |
100 | 105 | | |
101 | 106 | | |
102 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
103 | 121 | | |
104 | 122 | | |
105 | 123 | | |
| |||
110 | 128 | | |
111 | 129 | | |
112 | 130 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
| 131 | + | |
| 132 | + | |
118 | 133 | | |
119 | | - | |
| 134 | + | |
| 135 | + | |
120 | 136 | | |
121 | | - | |
122 | | - | |
123 | | - | |
| 137 | + | |
124 | 138 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
| 139 | + | |
133 | 140 | | |
134 | 141 | | |
135 | 142 | | |
| |||
141 | 148 | | |
142 | 149 | | |
143 | 150 | | |
144 | | - | |
| 151 | + | |
145 | 152 | | |
146 | 153 | | |
147 | 154 | | |
148 | | - | |
| 155 | + | |
149 | 156 | | |
150 | 157 | | |
151 | 158 | | |
| |||
158 | 165 | | |
159 | 166 | | |
160 | 167 | | |
161 | | - | |
| 168 | + | |
162 | 169 | | |
163 | 170 | | |
164 | 171 | | |
| |||
167 | 174 | | |
168 | 175 | | |
169 | 176 | | |
170 | | - | |
| 177 | + | |
171 | 178 | | |
172 | 179 | | |
173 | 180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1827 | 1827 | | |
1828 | 1828 | | |
1829 | 1829 | | |
1830 | | - | |
| 1830 | + | |
1831 | 1831 | | |
1832 | 1832 | | |
1833 | 1833 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | 129 | | |
133 | 130 | | |
134 | 131 | | |
135 | | - | |
| 132 | + | |
136 | 133 | | |
137 | 134 | | |
138 | 135 | | |
| |||
142 | 139 | | |
143 | 140 | | |
144 | 141 | | |
145 | | - | |
| 142 | + | |
146 | 143 | | |
147 | 144 | | |
148 | 145 | | |
| |||
162 | 159 | | |
163 | 160 | | |
164 | 161 | | |
165 | | - | |
| 162 | + | |
166 | 163 | | |
167 | 164 | | |
168 | | - | |
| 165 | + | |
169 | 166 | | |
170 | | - | |
| 167 | + | |
| 168 | + | |
171 | 169 | | |
172 | 170 | | |
173 | 171 | | |
| |||
187 | 185 | | |
188 | 186 | | |
189 | 187 | | |
190 | | - | |
191 | | - | |
| 188 | + | |
| 189 | + | |
192 | 190 | | |
193 | 191 | | |
194 | 192 | | |
| |||
225 | 223 | | |
226 | 224 | | |
227 | 225 | | |
228 | | - | |
229 | | - | |
| 226 | + | |
| 227 | + | |
230 | 228 | | |
231 | 229 | | |
232 | 230 | | |
| |||
252 | 250 | | |
253 | 251 | | |
254 | 252 | | |
255 | | - | |
256 | | - | |
257 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
258 | 257 | | |
259 | | - | |
| 258 | + | |
260 | 259 | | |
261 | 260 | | |
262 | | - | |
| 261 | + | |
263 | 262 | | |
264 | | - | |
265 | | - | |
266 | | - | |
| 263 | + | |
267 | 264 | | |
268 | 265 | | |
269 | 266 | | |
| |||
280 | 277 | | |
281 | 278 | | |
282 | 279 | | |
283 | | - | |
| 280 | + | |
284 | 281 | | |
285 | 282 | | |
286 | 283 | | |
| |||
295 | 292 | | |
296 | 293 | | |
297 | 294 | | |
298 | | - | |
| 295 | + | |
299 | 296 | | |
300 | 297 | | |
301 | 298 | | |
| |||
310 | 307 | | |
311 | 308 | | |
312 | 309 | | |
313 | | - | |
| 310 | + | |
314 | 311 | | |
315 | 312 | | |
316 | 313 | | |
| |||
0 commit comments