Commit 935e630
authored
feat: Basic IR codegen (#11)
* feat(codegen): add LLVM IR generation and JIT execution support
* feat(codegen): enhance LLVM IR generation with type system and JIT execution
* feat(codegen): implement bitwise operations and loop constructs
* feat(codegen): add variable type tracking for proper type-aware loads
* feat(codegen): add comprehensive test suite and module declarations
Add comprehensive_test.rs and test.rs files with extensive test coverage.
Declare test modules in codegen.rs to organize test structure.
* feat(codegen): add modulo operator and type conversion support
Add modulo operator implementation for both integer and floating-point types. Support mixed int/float operations through automatic type conversion. Improve return type handling for boolean values.
* feat(codegen): add boolean-to-float conversion for arithmetic operations
* style: format code
* refactor: Improve IR generation error handling and code structure
This commit standardizes error handling in by refactoring long, chained error maps into more readable blocks. It also removes internal test modules to simplify the build structure.
* **IR Generation:** Refactors complex LLVM builder calls and conversions (like float/int/bool promotions, bitwise operations) to use dedicated code blocks, improving readability and maintainability of error messages.
* **Code Structure:** Removes and modules from , aligning with the typical Rust practice of placing tests directly within the module being tested or in a dedicated directory.
* **Minor Cleanup:** Removes unused variable assignment in .
* refactor(tests): extract common test helpers to shared module
* refactor(parser): rename parse_program to parse_gml and mark visitors as WIP
* refactor(codegen): modularize IR generator implementation
* feat(codegen): add terminator-aware control flow handling
Add early termination checks in statement processing to skip remaining statements when a block already has a terminator. Improve control flow handling in if statements and blocks by checking for existing terminators before adding branches.
* refactor(codegen): reorganize module structure and enhance type mapping
* chore(ci): delete rust beta
* chore(ci): add LLVM 18 installation to CI workflow
* chore(ci): switch test to beta channel
* test: update codegen test to use std::f64::consts::TAU
* chore(ci): add LLVM 18 installation to GitHub workflows
* chore(ci): add libpolly-18-dev to LLVM dependencies
* Fix(CI): Allow LLVM v18 downgrade on Windows build
The 'windows-latest' runner pre-installs a newer LLVM version (e.g., v20), causing the 'choco install llvm --version=18.1.8' step to fail.
Added '--allow-downgrade' to the Chocolatey command to force the installation of the required LLVM v18.1.8.
* ci: set explicit clang path for macos build
* feat: Implement macOS Universal 2 Binary build in CI1 parent fa728a2 commit 935e630
35 files changed
Lines changed: 4598 additions & 171 deletions
File tree
- .github/workflows
- src
- codegen
- ir_generator
- handler
- parser
- visitor
- tests
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
25 | 33 | | |
26 | 34 | | |
27 | 35 | | |
28 | 36 | | |
29 | 37 | | |
30 | | - | |
| 38 | + | |
31 | 39 | | |
32 | 40 | | |
33 | 41 | | |
34 | 42 | | |
35 | 43 | | |
36 | | - | |
| 44 | + | |
37 | 45 | | |
38 | 46 | | |
39 | 47 | | |
40 | 48 | | |
41 | 49 | | |
42 | | - | |
| 50 | + | |
43 | 51 | | |
44 | 52 | | |
45 | 53 | | |
| |||
49 | 57 | | |
50 | 58 | | |
51 | 59 | | |
52 | | - | |
| 60 | + | |
53 | 61 | | |
54 | 62 | | |
55 | | - | |
56 | 63 | | |
57 | | - | |
| 64 | + | |
58 | 65 | | |
59 | 66 | | |
60 | | - | |
| 67 | + | |
61 | 68 | | |
62 | 69 | | |
63 | 70 | | |
| 71 | + | |
| 72 | + | |
64 | 73 | | |
65 | 74 | | |
66 | 75 | | |
| |||
79 | 88 | | |
80 | 89 | | |
81 | 90 | | |
| 91 | + | |
82 | 92 | | |
83 | | - | |
| 93 | + | |
84 | 94 | | |
85 | 95 | | |
86 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
87 | 122 | | |
88 | 123 | | |
89 | 124 | | |
90 | 125 | | |
91 | | - | |
92 | | - | |
| 126 | + | |
| 127 | + | |
93 | 128 | | |
94 | 129 | | |
95 | 130 | | |
96 | 131 | | |
97 | 132 | | |
98 | | - | |
| 133 | + | |
99 | 134 | | |
100 | 135 | | |
101 | 136 | | |
102 | 137 | | |
103 | 138 | | |
104 | | - | |
| 139 | + | |
105 | 140 | | |
106 | 141 | | |
107 | 142 | | |
108 | 143 | | |
109 | 144 | | |
110 | 145 | | |
111 | | - | |
| 146 | + | |
| 147 | + | |
112 | 148 | | |
113 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
114 | 162 | | |
115 | 163 | | |
116 | 164 | | |
117 | | - | |
118 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
119 | 169 | | |
120 | 170 | | |
121 | 171 | | |
122 | 172 | | |
123 | 173 | | |
124 | 174 | | |
125 | | - | |
126 | 175 | | |
127 | 176 | | |
128 | | - | |
| 177 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
20 | 28 | | |
21 | 29 | | |
22 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
71 | 93 | | |
72 | 94 | | |
73 | 95 | | |
| |||
110 | 132 | | |
111 | 133 | | |
112 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
113 | 143 | | |
114 | 144 | | |
115 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
18 | 26 | | |
19 | 27 | | |
20 | 28 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
0 commit comments