Commit bf79572
authored
Major Infrastructure Upgrade: LLVM 21, Opaque Pointers, and GUI Tooling (#291)
* feat: upgrade to LLVM 21, implement opaque pointer support, and add GUI build tool
This commit performs a major infrastructure upgrade to the LLVM backend,
transitioning to LLVM 21 (via Inkwell 0.8.0). The primary focus is the
implementation of "Opaque Pointer" safety, requiring explicit type
tracking throughout the codegen. It also introduces a graphical build
manager for the toolchain.
Changes:
- **LLVM Backend Upgrade**:
- Upgraded Inkwell to 0.8.0 and LLVM-sys to 211.0.0.
- Migrated from typed pointers to **Opaque Pointers**.
- Updated all `build_load`, `build_store`, and `build_gep` calls to
provide explicit LLVM types, as pointers no longer carry pointee
information.
- Refactored `address.rs` and `lvalue.rs` to infer Wave-level types
during IR generation to ensure correct instruction emission.
- **Optimization & Codegen**:
- Replaced the legacy `PassManagerBuilder` with the new LLVM **PassBuilder**,
supporting modern optimization pipelines (e.g., `default<O3>`).
- Improved aggregate handling in function calls with better size-based
packing/unpacking and bitcasting.
- Adjusted IO logic (`printf`/`scanf`) to manually track C-string
status since LLVM `ptr` is now ambiguous.
- **Lexer Refactoring**:
- Modularized the lexer by splitting logic into `core`, `cursor`,
`trivia`, `literals`, `ident`, and `scan` modules.
- Cleaned up internal imports and visibility.
- **Build System & Tooling**:
- Added a Tkinter-based **GUI Build Manager** to `x.py` for managing
targets and installations visually.
- Improved cross-compilation support in `x.py` for `x86_64-pc-windows-gnu`
targets from Linux hosts using MinGW LLVM prefixes.
- Fixed target directory pathing in the backend.
- **Bug Fixes**:
- Fixed type promotion for C varargs in `printf` (e.g., promoting small
integers to `i32` and floats to `double`).
This update modernizes the compiler backend and prepares the architecture
for future LLVM versions while providing a more user-friendly build
interface.
Signed-off-by: LunaStev <luna@lunastev.org>
* action update
Signed-off-by: LunaStev <luna@lunastev.org>
* action update
Signed-off-by: LunaStev <luna@lunastev.org>
* action update
Signed-off-by: LunaStev <luna@lunastev.org>
* action update
Signed-off-by: LunaStev <luna@lunastev.org>
* action update
Signed-off-by: LunaStev <luna@lunastev.org>
* action update
Signed-off-by: LunaStev <luna@lunastev.org>
* action update
Signed-off-by: LunaStev <luna@lunastev.org>
* action update
Signed-off-by: LunaStev <luna@lunastev.org>
* action update
Signed-off-by: LunaStev <luna@lunastev.org>
* action update
Signed-off-by: LunaStev <luna@lunastev.org>
---------
Signed-off-by: LunaStev <luna@lunastev.org>1 parent 31ccaf7 commit bf79572
File tree
36 files changed
+2482
-1170
lines changed- .github/workflows
- front/lexer/src
- lexer
- llvm
- src
- codegen
- expression
- rvalue
- statement
- src
36 files changed
+2482
-1170
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 47 | + | |
| 48 | + | |
54 | 49 | | |
55 | 50 | | |
56 | 51 | | |
57 | 52 | | |
58 | 53 | | |
59 | 54 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
File renamed without changes.
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
14 | 19 | | |
15 | | - | |
| 20 | + | |
File renamed without changes.
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
File renamed without changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
11 | | - | |
12 | | - | |
| 10 | + | |
| 11 | + | |
0 commit comments