Commit c349c34
authored
[eudsl-tblgen] add lots of stuff (support retrieving ArgumentInits from Record) (#318)
This is kind of a niche PR so I don't expect anyone to really closely
review but I'm describing it anyway just to capture some findings.
The basic feature added in this PR is the ability to recover from an
instantiated `def` which template args were used in the `class`
call/invocation/thing. E.g.,
```
class Test_Op<string mnemonic, list<Trait> traits = []>
: Op<Test_Dialect, mnemonic, traits>;
def Test_AndOp : Test_Op<"and"> { ... }
```
With this PR you can recover that the `mnemonic` passed as the first
argument to `Test_Op` when instantiating `Test_AndOp` is `"and"`. This
sounds like something that should've been always possible but turns out
tablegen literally doesn't keep that information in any way/shape/form.
In order to make this work I had to hack the parser to keep it around
(note, this isn't completely straightforward because arguments can have
unevaluated [bang
operators](https://llvm.org/docs/TableGen/ProgRef.html#bang-operators)).
For context, I intended on using this functionality to translate LLVM
`Intrinsic`s into MLIR OpDefs but turns out it didn't really work out
(not because the feature doesn't work but because I have ~30k
`Intrinsic`s lol).1 parent c0c6123 commit c349c34
File tree
14 files changed
+426
-58
lines changed- .github/workflows
- projects
- common/eudsl
- eudsl-llvmpy
- eudsl-py/tests
- eudsl-tblgen
- src
- tests
- td
- mlir-python-bindings
14 files changed
+426
-58
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
184 | 187 | | |
185 | 188 | | |
186 | 189 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
| 28 | + | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
323 | | - | |
| 323 | + | |
| 324 | + | |
324 | 325 | | |
325 | 326 | | |
326 | 327 | | |
327 | 328 | | |
328 | 329 | | |
329 | 330 | | |
330 | | - | |
| 331 | + | |
331 | 332 | | |
332 | 333 | | |
333 | 334 | | |
| |||
File renamed without changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
213 | 212 | | |
214 | 213 | | |
215 | 214 | | |
| |||
240 | 239 | | |
241 | 240 | | |
242 | 241 | | |
243 | | - | |
244 | 242 | | |
245 | 243 | | |
246 | 244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
75 | 89 | | |
76 | 90 | | |
77 | 91 | | |
| |||
307 | 321 | | |
308 | 322 | | |
309 | 323 | | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
310 | 384 | | |
311 | 385 | | |
312 | 386 | | |
| |||
336 | 410 | | |
337 | 411 | | |
338 | 412 | | |
| 413 | + | |
| 414 | + | |
339 | 415 | | |
340 | 416 | | |
341 | 417 | | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
342 | 422 | | |
343 | 423 | | |
344 | 424 | | |
| |||
531 | 611 | | |
532 | 612 | | |
533 | 613 | | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
534 | 617 | | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
535 | 628 | | |
536 | 629 | | |
537 | 630 | | |
| |||
574 | 667 | | |
575 | 668 | | |
576 | 669 | | |
577 | | - | |
| 670 | + | |
578 | 671 | | |
579 | 672 | | |
580 | 673 | | |
| |||
2872 | 2965 | | |
2873 | 2966 | | |
2874 | 2967 | | |
2875 | | - | |
| 2968 | + | |
| 2969 | + | |
| 2970 | + | |
2876 | 2971 | | |
2877 | 2972 | | |
2878 | 2973 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
94 | 93 | | |
95 | 94 | | |
96 | 95 | | |
| |||
142 | 141 | | |
143 | 142 | | |
144 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
145 | 147 | | |
146 | 148 | | |
147 | 149 | | |
| |||
181 | 183 | | |
182 | 184 | | |
183 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
184 | 192 | | |
185 | 193 | | |
186 | 194 | | |
| |||
219 | 227 | | |
220 | 228 | | |
221 | 229 | | |
222 | | - | |
223 | 230 | | |
224 | 231 | | |
225 | 232 | | |
| |||
253 | 260 | | |
254 | 261 | | |
255 | 262 | | |
256 | | - | |
257 | 263 | | |
258 | 264 | | |
259 | 265 | | |
| |||
0 commit comments