Commit 62bfcde
authored
[CIR][CodeGen][LowerToLLVM] Set calling convention for call ops (#836)
This PR implements the CIRGen and Lowering part of calling convention
attribute of `cir.call`-like operations. Here we have **4 kinds of
operations**: (direct or indirect) x (`call` or `try_call`).
According to our need and feasibility of constructing a test case, this
PR includes:
* For CIRGen, only direct `call`. Until now, the only extra calling
conventions are SPIR ones, which cannot be set from source code manually
using attributes. Meanwhile, OpenCL C *does not allow* function pointers
or exceptions, therefore the only case remaining is direct call.
* For Lowering, direct and indirect `call`, but not any `try_call`.
Although it's possible to write all 4 kinds of calls with calling
convention in ClangIR assembly, exceptions is quite hard to write and
read. I prefer source-code-level test for it when it's available in the
future. For example, possibly C++ `thiscall` with exceptions.
* Extra: the verification of calling convention consistency for direct
`call` and direct `try_call`.
All unsupported cases are guarded by assertions or MLIR diags.1 parent 8c017d9 commit 62bfcde
File tree
6 files changed
+80
-15
lines changed- clang
- lib/CIR
- CodeGen
- Dialect/IR
- Lowering/DirectToLLVM
- test/CIR
- CodeGen/OpenCL
- IR
- Lowering
6 files changed
+80
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
450 | | - | |
| 450 | + | |
451 | 451 | | |
452 | 452 | | |
453 | 453 | | |
| |||
468 | 468 | | |
469 | 469 | | |
470 | 470 | | |
| 471 | + | |
| 472 | + | |
471 | 473 | | |
472 | 474 | | |
473 | 475 | | |
| |||
484 | 486 | | |
485 | 487 | | |
486 | 488 | | |
487 | | - | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
488 | 492 | | |
489 | 493 | | |
490 | 494 | | |
491 | | - | |
492 | | - | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
493 | 498 | | |
494 | 499 | | |
495 | 500 | | |
| |||
765 | 770 | | |
766 | 771 | | |
767 | 772 | | |
768 | | - | |
769 | | - | |
770 | | - | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
771 | 776 | | |
772 | 777 | | |
773 | 778 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2704 | 2704 | | |
2705 | 2705 | | |
2706 | 2706 | | |
| 2707 | + | |
| 2708 | + | |
| 2709 | + | |
| 2710 | + | |
| 2711 | + | |
| 2712 | + | |
2707 | 2713 | | |
2708 | 2714 | | |
2709 | 2715 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
875 | 875 | | |
876 | 876 | | |
877 | 877 | | |
| 878 | + | |
878 | 879 | | |
879 | 880 | | |
880 | 881 | | |
881 | 882 | | |
| 883 | + | |
| 884 | + | |
882 | 885 | | |
883 | | - | |
884 | | - | |
| 886 | + | |
| 887 | + | |
885 | 888 | | |
886 | 889 | | |
887 | | - | |
888 | | - | |
889 | | - | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
890 | 896 | | |
891 | 897 | | |
892 | 898 | | |
| |||
899 | 905 | | |
900 | 906 | | |
901 | 907 | | |
902 | | - | |
| 908 | + | |
903 | 909 | | |
904 | 910 | | |
905 | | - | |
906 | | - | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
907 | 914 | | |
908 | 915 | | |
909 | 916 | | |
| 917 | + | |
| 918 | + | |
910 | 919 | | |
911 | 920 | | |
912 | 921 | | |
| |||
932 | 941 | | |
933 | 942 | | |
934 | 943 | | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
935 | 948 | | |
936 | 949 | | |
937 | 950 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
| 22 | + | |
| 23 | + | |
20 | 24 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1304 | 1304 | | |
1305 | 1305 | | |
1306 | 1306 | | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
1307 | 1317 | | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
1308 | 1323 | | |
1309 | 1324 | | |
1310 | 1325 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
0 commit comments