From ae845a33c04fb287ae5a7445743c2b570e40ca1f Mon Sep 17 00:00:00 2001 From: mlugg Date: Fri, 19 Jan 2024 01:56:45 +0000 Subject: Zir: represent declarations via an instruction This commit changes how declarations (`const`, `fn`, `usingnamespace`, etc) are represented in ZIR. Previously, these were represented in the container type's extra data (e.g. as trailing data on a `struct_decl`). However, this introduced the complexity of the ZIR mapping logic having to also correlate some ZIR extra data indices. That isn't really a problem today, but it's tricky for the introduction of `TrackedInst` in the commit following this one. Instead, these type declarations now simply contain a trailing list of ZIR indices to `declaration` instructions, which directly encode all data related to the declaration (including containing the declaration's body). Additionally, the ZIR for `align` etc have been split out into their own bodies. This is not strictly necessary, but it's much simpler to understand for an insignificant cost in bytes, and will simplify the resolution of #131 (where we may need to evaluate the pointer type, including align etc, without immediately evaluating the value body). --- src/InternPool.zig | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/InternPool.zig') diff --git a/src/InternPool.zig b/src/InternPool.zig index 0844e0f7a5..1c5703b055 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -6186,8 +6186,6 @@ fn finishFuncInstance( .generation = generation, .is_pub = fn_owner_decl.is_pub, .is_exported = fn_owner_decl.is_exported, - .has_linksection_or_addrspace = fn_owner_decl.has_linksection_or_addrspace, - .has_align = fn_owner_decl.has_align, .alive = true, .kind = .anon, }); -- cgit v1.2.3