aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2023-08-18 15:11:38 +0100
committerAndrew Kelley <andrew@ziglang.org>2023-08-20 11:58:14 -0700
commit321961d860b03967358b5602e0e7832364e1e11c (patch)
tree33179c402d474ddf18f61ca8b301df072678e09d /src/Module.zig
parent020105d0dde614538a5839ede697e63a43bf6aa6 (diff)
downloadzig-321961d860b03967358b5602e0e7832364e1e11c.tar.gz
zig-321961d860b03967358b5602e0e7832364e1e11c.zip
AstGen: add result location analysis pass
The main motivation for this change is eliminating the `block_ptr` result location and corresponding `store_to_block_ptr` ZIR instruction. This is achieved through a simple pass over the AST before AstGen which determines, for AST nodes which have a choice on whether to provide a result location, which choice to make, based on whether the result pointer is consumed non-trivially. This eliminates so much logic from AstGen that we almost break even on line count! AstGen no longer has to worry about instruction rewriting based on whether or not a result location was consumed: it always knows what to do ahead of time, which simplifies a *lot* of logic. This also incidentally fixes a few random AstGen bugs related to result location handling, leading to the changes in `test/` and `lib/std/`. This opens the door to future RLS improvements by making them much easier to implement correctly, and fixes many bugs. Most ZIR is made more compact after this commit, mainly due to not having redundant `store_to_block_ptr` instructions lying around, but also due to a few bugs in the old system which are implicitly fixed here.
Diffstat (limited to 'src/Module.zig')
0 files changed, 0 insertions, 0 deletions