Commit a3d247d
committed
[MLIR][OpenMP] Enable BlockArgOpenMPOpInterface accessing operands
This patch makes additions to the `BlockArgOpenMPOpInterface` to simplify its
use by letting it handle the matching between operands and their associated
entry block arguments. Most significantly, the following is now possible:
```c++
SmallVector<std::pair<Value, BlockArgument>> pairs;
cast<BlockArgOpenMPOpInterface>(op).getBlockArgsPairs(pairs);
for (auto [var, arg] : pairs) {
// var points to the operand (outside value) and arg points to the entry
// block argument associated to that value.
}
```
This is achieved by making the interface define and use `getXyzVars()` methods,
which by default return empty `OperandRange`s and are overriden by getters
automatically produced for the `Variadic<...> $xyz_vars` tablegen argument of
the corresponding clause. These definitions can then be simplified, since they
no longer need to manually define `numXyzBlockArgs` functions as a result.
A side-effect of this is that all ops implementing this interface will now
publicly define `getXyzVars()` functions for all entry block
argument-generating clauses, even if they don't actually accept all clauses.
However, these would just return empty ranges, so it shouldn't cause issues.
This change uncovered some incorrect definitions of class declarations related
to the `ReductionClauseInterface`, and the `OpenMP_DetachClause` incorrectly
implementing the `BlockArgOpenMPOpInterface`, so these issues are also
addressed.1 parent 81ca350 commit a3d247d
File tree
4 files changed
+99
-61
lines changed- mlir
- include/mlir/Dialect/OpenMP
- lib/Dialect/OpenMP/IR
4 files changed
+99
-61
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | 473 | | |
480 | 474 | | |
481 | 475 | | |
| |||
565 | 559 | | |
566 | 560 | | |
567 | 561 | | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | 562 | | |
575 | 563 | | |
576 | 564 | | |
| |||
629 | 617 | | |
630 | 618 | | |
631 | 619 | | |
632 | | - | |
| 620 | + | |
633 | 621 | | |
634 | 622 | | |
635 | 623 | | |
636 | | - | |
637 | | - | |
638 | 624 | | |
639 | 625 | | |
640 | 626 | | |
| |||
749 | 735 | | |
750 | 736 | | |
751 | 737 | | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
752 | 741 | | |
753 | 742 | | |
754 | 743 | | |
| |||
1060 | 1049 | | |
1061 | 1050 | | |
1062 | 1051 | | |
1063 | | - | |
1064 | | - | |
1065 | 1052 | | |
1066 | 1053 | | |
1067 | 1054 | | |
| |||
1126 | 1113 | | |
1127 | 1114 | | |
1128 | 1115 | | |
1129 | | - | |
1130 | | - | |
1131 | | - | |
1132 | | - | |
1133 | 1116 | | |
1134 | 1117 | | |
1135 | 1118 | | |
| |||
1186 | 1169 | | |
1187 | 1170 | | |
1188 | 1171 | | |
1189 | | - | |
1190 | 1172 | | |
1191 | 1173 | | |
1192 | 1174 | | |
| |||
1316 | 1298 | | |
1317 | 1299 | | |
1318 | 1300 | | |
1319 | | - | |
| 1301 | + | |
1320 | 1302 | | |
1321 | 1303 | | |
1322 | 1304 | | |
1323 | | - | |
1324 | | - | |
1325 | | - | |
1326 | | - | |
1327 | 1305 | | |
1328 | 1306 | | |
1329 | 1307 | | |
| |||
1413 | 1391 | | |
1414 | 1392 | | |
1415 | 1393 | | |
1416 | | - | |
1417 | | - | |
1418 | | - | |
1419 | | - | |
1420 | | - | |
1421 | | - | |
1422 | 1394 | | |
1423 | 1395 | | |
1424 | 1396 | | |
| |||
1448 | 1420 | | |
1449 | 1421 | | |
1450 | 1422 | | |
1451 | | - | |
1452 | | - | |
1453 | | - | |
1454 | | - | |
1455 | | - | |
1456 | | - | |
1457 | 1423 | | |
1458 | 1424 | | |
1459 | 1425 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
287 | | - | |
288 | | - | |
| 287 | + | |
| 288 | + | |
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| |||
824 | 824 | | |
825 | 825 | | |
826 | 826 | | |
827 | | - | |
828 | | - | |
829 | | - | |
830 | | - | |
831 | | - | |
832 | 827 | | |
833 | 828 | | |
834 | 829 | | |
| |||
1151 | 1146 | | |
1152 | 1147 | | |
1153 | 1148 | | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
1154 | 1157 | | |
1155 | 1158 | | |
1156 | 1159 | | |
| |||
1185 | 1188 | | |
1186 | 1189 | | |
1187 | 1190 | | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
1188 | 1199 | | |
1189 | 1200 | | |
1190 | 1201 | | |
| |||
1213 | 1224 | | |
1214 | 1225 | | |
1215 | 1226 | | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
1216 | 1235 | | |
1217 | 1236 | | |
1218 | 1237 | | |
| |||
1249 | 1268 | | |
1250 | 1269 | | |
1251 | 1270 | | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
1252 | 1279 | | |
1253 | 1280 | | |
1254 | 1281 | | |
| |||
1292 | 1319 | | |
1293 | 1320 | | |
1294 | 1321 | | |
1295 | | - | |
1296 | | - | |
1297 | 1322 | | |
1298 | 1323 | | |
1299 | 1324 | | |
| |||
1818 | 1843 | | |
1819 | 1844 | | |
1820 | 1845 | | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
1821 | 1854 | | |
1822 | 1855 | | |
1823 | 1856 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
30 | 35 | | |
31 | | - | |
32 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
33 | 56 | | |
34 | 57 | | |
35 | 58 | | |
36 | | - | |
37 | | - | |
38 | | - | |
| 59 | + | |
| 60 | + | |
39 | 61 | | |
40 | 62 | | |
41 | 63 | | |
| |||
52 | 74 | | |
53 | 75 | | |
54 | 76 | | |
55 | | - | |
| 77 | + | |
56 | 78 | | |
57 | 79 | | |
58 | 80 | | |
| |||
72 | 94 | | |
73 | 95 | | |
74 | 96 | | |
75 | | - | |
| 97 | + | |
76 | 98 | | |
77 | 99 | | |
78 | 100 | | |
| |||
109 | 131 | | |
110 | 132 | | |
111 | 133 | | |
| 134 | + | |
112 | 135 | | |
113 | 136 | | |
114 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
115 | 154 | | |
116 | 155 | | |
117 | 156 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2248 | 2248 | | |
2249 | 2249 | | |
2250 | 2250 | | |
2251 | | - | |
2252 | | - | |
| 2251 | + | |
| 2252 | + | |
2253 | 2253 | | |
2254 | 2254 | | |
2255 | | - | |
2256 | | - | |
| 2255 | + | |
| 2256 | + | |
2257 | 2257 | | |
2258 | 2258 | | |
2259 | 2259 | | |
| |||
0 commit comments