Commit 9da6043
authored
[mypyc] Add irbuild support for vec types (#20724)
Add basic irbuild support for `vec[t]`. The runtime representation of
`vec[t]` is a C struct. This is similar to how fixed-length tuples are
represented. Multiple different structs are used, depending on the item
type (`VecI32` for `vec[i32`] and so on).
The C extension `librt.vec` that defines the `vec` type was added in
#20653 and #20656. These PRs also explain the implementation in more
detail.
Add RType subclass RVec that is used for vecs. We need a new RType
class, since primitives types can't be generic and they can't be struct
types.
This is based on an old branch, so it mostly uses old-style primitives.
I am planning to modernize some of the primitives in follow-up PRs.
This doesn't include codegen support, and irbuild test cases are only
included for `vec[i64]`. I will create follow-up PRs that add the
remaining irbuild tests, codegen support and run tests. All these tests
are are passing on my local full branch.
Related issue: mypyc/mypyc#8401 parent d488cc1 commit 9da6043
File tree
32 files changed
+2161
-47
lines changed- mypyc
- analysis
- irbuild
- ir
- lib-rt
- vecs
- primitives
- test-data
- test
32 files changed
+2161
-47
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | | - | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
51 | 61 | | |
52 | 62 | | |
53 | 63 | | |
| |||
64 | 74 | | |
65 | 75 | | |
66 | 76 | | |
| 77 | + | |
| 78 | + | |
67 | 79 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
200 | 206 | | |
201 | 207 | | |
202 | 208 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| 70 | + | |
| 71 | + | |
69 | 72 | | |
70 | 73 | | |
| 74 | + | |
71 | 75 | | |
| 76 | + | |
72 | 77 | | |
73 | 78 | | |
74 | 79 | | |
| |||
200 | 205 | | |
201 | 206 | | |
202 | 207 | | |
203 | | - | |
| 208 | + | |
204 | 209 | | |
205 | 210 | | |
206 | 211 | | |
| |||
211 | 216 | | |
212 | 217 | | |
213 | 218 | | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
214 | 242 | | |
215 | 243 | | |
216 | 244 | | |
| |||
417 | 445 | | |
418 | 446 | | |
419 | 447 | | |
| 448 | + | |
420 | 449 | | |
421 | 450 | | |
422 | 451 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
90 | 92 | | |
91 | 93 | | |
92 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
93 | 101 | | |
94 | 102 | | |
95 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
1690 | 1691 | | |
1691 | 1692 | | |
1692 | 1693 | | |
1693 | | - | |
| 1694 | + | |
1694 | 1695 | | |
1695 | 1696 | | |
1696 | 1697 | | |
| |||
1720 | 1721 | | |
1721 | 1722 | | |
1722 | 1723 | | |
1723 | | - | |
| 1724 | + | |
1724 | 1725 | | |
1725 | 1726 | | |
1726 | 1727 | | |
| |||
1750 | 1751 | | |
1751 | 1752 | | |
1752 | 1753 | | |
1753 | | - | |
| 1754 | + | |
1754 | 1755 | | |
1755 | 1756 | | |
1756 | 1757 | | |
| |||
0 commit comments