aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2024-03-26 04:06:39 +0000
committermlugg <mlugg@mlugg.co.uk>2024-03-26 13:48:06 +0000
commit26a94e8481385619ae049143dd67e551f333fa3f (patch)
tree2106272eed6fb7b15a8309c6fc5137e6fec93234 /src/codegen
parent152a2ceaf738301cd59165a4f17d915391321bdc (diff)
downloadzig-26a94e8481385619ae049143dd67e551f333fa3f.tar.gz
zig-26a94e8481385619ae049143dd67e551f333fa3f.zip
Zcu: eliminate `Decl.alive` field
Legacy anon decls now have three uses: * Type owner decls * Function owner decls * `@export` and `@extern` Therefore, there are no longer any cases where we wish to explicitly omit legacy anon decls from the binary. This means we can remove the concept of an "alive" vs "dead" `Decl`, which also allows us to remove the separate `anon_work_queue` in `Compilation`.
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/c.zig1
-rw-r--r--src/codegen/llvm.zig7
-rw-r--r--src/codegen/spirv.zig1
3 files changed, 0 insertions, 9 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig
index d1575feaba..ed506cfdfe 100644
--- a/src/codegen/c.zig
+++ b/src/codegen/c.zig
@@ -2010,7 +2010,6 @@ pub const DeclGen = struct {
fn renderDeclName(dg: *DeclGen, writer: anytype, decl_index: InternPool.DeclIndex, export_index: u32) !void {
const mod = dg.module;
const decl = mod.declPtr(decl_index);
- try mod.markDeclAlive(decl);
if (mod.decl_exports.get(decl_index)) |exports| {
try writer.print("{ }", .{
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 7bbe4e715a..421c767bd8 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -3722,15 +3722,11 @@ pub const Object = struct {
=> unreachable, // non-runtime values
.extern_func => |extern_func| {
const fn_decl_index = extern_func.decl;
- const fn_decl = mod.declPtr(fn_decl_index);
- try mod.markDeclAlive(fn_decl);
const function_index = try o.resolveLlvmFunction(fn_decl_index);
return function_index.ptrConst(&o.builder).global.toConst();
},
.func => |func| {
const fn_decl_index = func.owner_decl;
- const fn_decl = mod.declPtr(fn_decl_index);
- try mod.markDeclAlive(fn_decl);
const function_index = try o.resolveLlvmFunction(fn_decl_index);
return function_index.ptrConst(&o.builder).global.toConst();
},
@@ -4262,7 +4258,6 @@ pub const Object = struct {
fn lowerParentPtrDecl(o: *Object, decl_index: InternPool.DeclIndex) Allocator.Error!Builder.Constant {
const mod = o.module;
const decl = mod.declPtr(decl_index);
- try mod.markDeclAlive(decl);
const ptr_ty = try mod.singleMutPtrType(decl.typeOf(mod));
return o.lowerDeclRefValue(ptr_ty, decl_index);
}
@@ -4455,8 +4450,6 @@ pub const Object = struct {
if ((!is_fn_body and !decl_ty.hasRuntimeBits(mod)) or
(is_fn_body and mod.typeToFunc(decl_ty).?.is_generic)) return o.lowerPtrToVoid(ty);
- try mod.markDeclAlive(decl);
-
const llvm_global = if (is_fn_body)
(try o.resolveLlvmFunction(decl_index)).ptrConst(&o.builder).global
else
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig
index 17b44806e2..3e560b0918 100644
--- a/src/codegen/spirv.zig
+++ b/src/codegen/spirv.zig
@@ -255,7 +255,6 @@ pub const Object = struct {
pub fn resolveDecl(self: *Object, mod: *Module, decl_index: InternPool.DeclIndex) !SpvModule.Decl.Index {
const decl = mod.declPtr(decl_index);
assert(decl.has_tv); // TODO: Do we need to handle a situation where this is false?
- try mod.markDeclAlive(decl);
const entry = try self.decl_link.getOrPut(self.gpa, decl_index);
if (!entry.found_existing) {