aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-05-29 17:54:16 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-05-30 12:03:53 -0700
commit9da3a058d82573efeaf12fe61ab6a312649175ec (patch)
treeb86f6f08761289b95c46e10879e476da455de218 /lib
parentf846dc420fff629572caa1175bfa64e5fcffaeb5 (diff)
downloadzig-9da3a058d82573efeaf12fe61ab6a312649175ec.tar.gz
zig-9da3a058d82573efeaf12fe61ab6a312649175ec.zip
stage2: add missing data to ZIR encoding of functions
The main purpose of this commit is to prepare to implement support for callconv(), align(), linksection(), and addrspace() annotations on generic functions where the provided expression depends on comptime parameters (making the function generic). It's a rather involved change, so this commit only makes the necessary changes to AstGen without regressing any behavior, and a follow-up commit can finish the task by making the enhancements to Sema. By my quick estimation, the new encoding for functions is a negligible improvement - along the lines of 0.005% fewer total ZIR bytes on average. Still, it's nice that this commit, while adding more data into ZIR, actually ends up reducing the storage size thanks to a slightly more sophisticated encoding. Zir.Inst.ExtendedFunc is renamed to Zir.Inst.FuncFancy to eliminate confusion about it being an extended instruction (it used to be but is no longer). The encoding for this instruction is completely reworked. The encoding for Zir.Inst.Func is also changed slightly - when the return type body length is 1, then only a Zir.Inst.Ref is provided; not a full body. linksection() and addrspace() are now communicated via func_fancy ZIR instruction rather than as part of the corresponding decl. This allows their expressions to observe comptime parameters.
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions