self-hosted: remove unused externally_managed prong for Decls code

This commit is contained in:
Jakub Konka 2023-01-25 10:10:50 +01:00
parent e675af0698
commit 4983da40d0
12 changed files with 49 additions and 139 deletions

View file

@ -24,7 +24,7 @@ const log = std.log.scoped(.codegen);
const build_options = @import("build_options");
const GenerateSymbolError = codegen.GenerateSymbolError;
const FnResult = codegen.FnResult;
const Result = codegen.Result;
const DebugInfoOutput = codegen.DebugInfoOutput;
const bits = @import("bits.zig");
@ -349,7 +349,7 @@ pub fn generate(
liveness: Liveness,
code: *std.ArrayList(u8),
debug_output: DebugInfoOutput,
) GenerateSymbolError!FnResult {
) GenerateSymbolError!Result {
if (build_options.skip_non_native and builtin.cpu.arch != bin_file.options.target.cpu.arch) {
@panic("Attempted to compile for architecture that was disabled by build configuration");
}
@ -392,8 +392,8 @@ pub fn generate(
defer function.dbg_info_relocs.deinit(bin_file.allocator);
var call_info = function.resolveCallingConventionValues(fn_type) catch |err| switch (err) {
error.CodegenFail => return FnResult{ .fail = function.err_msg.? },
error.OutOfRegisters => return FnResult{
error.CodegenFail => return Result{ .fail = function.err_msg.? },
error.OutOfRegisters => return Result{
.fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}),
},
else => |e| return e,
@ -406,8 +406,8 @@ pub fn generate(
function.max_end_stack = call_info.stack_byte_count;
function.gen() catch |err| switch (err) {
error.CodegenFail => return FnResult{ .fail = function.err_msg.? },
error.OutOfRegisters => return FnResult{
error.CodegenFail => return Result{ .fail = function.err_msg.? },
error.OutOfRegisters => return Result{
.fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}),
},
else => |e| return e,
@ -439,14 +439,14 @@ pub fn generate(
defer emit.deinit();
emit.emitMir() catch |err| switch (err) {
error.EmitFail => return FnResult{ .fail = emit.err_msg.? },
error.EmitFail => return Result{ .fail = emit.err_msg.? },
else => |e| return e,
};
if (function.err_msg) |em| {
return FnResult{ .fail = em };
return Result{ .fail = em };
} else {
return FnResult{ .appended = {} };
return Result{ .appended = {} };
}
}

View file

@ -23,7 +23,7 @@ const leb128 = std.leb;
const log = std.log.scoped(.codegen);
const build_options = @import("build_options");
const FnResult = codegen.FnResult;
const Result = codegen.Result;
const GenerateSymbolError = codegen.GenerateSymbolError;
const DebugInfoOutput = codegen.DebugInfoOutput;
@ -356,7 +356,7 @@ pub fn generate(
liveness: Liveness,
code: *std.ArrayList(u8),
debug_output: DebugInfoOutput,
) GenerateSymbolError!FnResult {
) GenerateSymbolError!Result {
if (build_options.skip_non_native and builtin.cpu.arch != bin_file.options.target.cpu.arch) {
@panic("Attempted to compile for architecture that was disabled by build configuration");
}
@ -399,8 +399,8 @@ pub fn generate(
defer function.dbg_info_relocs.deinit(bin_file.allocator);
var call_info = function.resolveCallingConventionValues(fn_type) catch |err| switch (err) {
error.CodegenFail => return FnResult{ .fail = function.err_msg.? },
error.OutOfRegisters => return FnResult{
error.CodegenFail => return Result{ .fail = function.err_msg.? },
error.OutOfRegisters => return Result{
.fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}),
},
else => |e| return e,
@ -413,8 +413,8 @@ pub fn generate(
function.max_end_stack = call_info.stack_byte_count;
function.gen() catch |err| switch (err) {
error.CodegenFail => return FnResult{ .fail = function.err_msg.? },
error.OutOfRegisters => return FnResult{
error.CodegenFail => return Result{ .fail = function.err_msg.? },
error.OutOfRegisters => return Result{
.fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}),
},
else => |e| return e,
@ -446,14 +446,14 @@ pub fn generate(
defer emit.deinit();
emit.emitMir() catch |err| switch (err) {
error.EmitFail => return FnResult{ .fail = emit.err_msg.? },
error.EmitFail => return Result{ .fail = emit.err_msg.? },
else => |e| return e,
};
if (function.err_msg) |em| {
return FnResult{ .fail = em };
return Result{ .fail = em };
} else {
return FnResult{ .appended = {} };
return Result{ .appended = {} };
}
}

View file

@ -22,7 +22,7 @@ const leb128 = std.leb;
const log = std.log.scoped(.codegen);
const build_options = @import("build_options");
const FnResult = @import("../../codegen.zig").FnResult;
const Result = @import("../../codegen.zig").Result;
const GenerateSymbolError = @import("../../codegen.zig").GenerateSymbolError;
const DebugInfoOutput = @import("../../codegen.zig").DebugInfoOutput;
@ -225,7 +225,7 @@ pub fn generate(
liveness: Liveness,
code: *std.ArrayList(u8),
debug_output: DebugInfoOutput,
) GenerateSymbolError!FnResult {
) GenerateSymbolError!Result {
if (build_options.skip_non_native and builtin.cpu.arch != bin_file.options.target.cpu.arch) {
@panic("Attempted to compile for architecture that was disabled by build configuration");
}
@ -268,8 +268,8 @@ pub fn generate(
defer function.exitlude_jump_relocs.deinit(bin_file.allocator);
var call_info = function.resolveCallingConventionValues(fn_type) catch |err| switch (err) {
error.CodegenFail => return FnResult{ .fail = function.err_msg.? },
error.OutOfRegisters => return FnResult{
error.CodegenFail => return Result{ .fail = function.err_msg.? },
error.OutOfRegisters => return Result{
.fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}),
},
else => |e| return e,
@ -282,8 +282,8 @@ pub fn generate(
function.max_end_stack = call_info.stack_byte_count;
function.gen() catch |err| switch (err) {
error.CodegenFail => return FnResult{ .fail = function.err_msg.? },
error.OutOfRegisters => return FnResult{
error.CodegenFail => return Result{ .fail = function.err_msg.? },
error.OutOfRegisters => return Result{
.fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}),
},
else => |e| return e,
@ -309,14 +309,14 @@ pub fn generate(
defer emit.deinit();
emit.emitMir() catch |err| switch (err) {
error.EmitFail => return FnResult{ .fail = emit.err_msg.? },
error.EmitFail => return Result{ .fail = emit.err_msg.? },
else => |e| return e,
};
if (function.err_msg) |em| {
return FnResult{ .fail = em };
return Result{ .fail = em };
} else {
return FnResult{ .appended = {} };
return Result{ .appended = {} };
}
}

View file

@ -20,7 +20,7 @@ const Emit = @import("Emit.zig");
const Liveness = @import("../../Liveness.zig");
const Type = @import("../../type.zig").Type;
const GenerateSymbolError = @import("../../codegen.zig").GenerateSymbolError;
const FnResult = @import("../../codegen.zig").FnResult;
const Result = @import("../../codegen.zig").Result;
const DebugInfoOutput = @import("../../codegen.zig").DebugInfoOutput;
const build_options = @import("build_options");
@ -265,7 +265,7 @@ pub fn generate(
liveness: Liveness,
code: *std.ArrayList(u8),
debug_output: DebugInfoOutput,
) GenerateSymbolError!FnResult {
) GenerateSymbolError!Result {
if (build_options.skip_non_native and builtin.cpu.arch != bin_file.options.target.cpu.arch) {
@panic("Attempted to compile for architecture that was disabled by build configuration");
}
@ -310,8 +310,8 @@ pub fn generate(
defer function.exitlude_jump_relocs.deinit(bin_file.allocator);
var call_info = function.resolveCallingConventionValues(fn_type, .callee) catch |err| switch (err) {
error.CodegenFail => return FnResult{ .fail = function.err_msg.? },
error.OutOfRegisters => return FnResult{
error.CodegenFail => return Result{ .fail = function.err_msg.? },
error.OutOfRegisters => return Result{
.fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}),
},
else => |e| return e,
@ -324,8 +324,8 @@ pub fn generate(
function.max_end_stack = call_info.stack_byte_count;
function.gen() catch |err| switch (err) {
error.CodegenFail => return FnResult{ .fail = function.err_msg.? },
error.OutOfRegisters => return FnResult{
error.CodegenFail => return Result{ .fail = function.err_msg.? },
error.OutOfRegisters => return Result{
.fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}),
},
else => |e| return e,
@ -351,14 +351,14 @@ pub fn generate(
defer emit.deinit();
emit.emitMir() catch |err| switch (err) {
error.EmitFail => return FnResult{ .fail = emit.err_msg.? },
error.EmitFail => return Result{ .fail = emit.err_msg.? },
else => |e| return e,
};
if (function.err_msg) |em| {
return FnResult{ .fail = em };
return Result{ .fail = em };
} else {
return FnResult{ .appended = {} };
return Result{ .appended = {} };
}
}

View file

@ -627,13 +627,6 @@ test "Wasm - buildOpcode" {
try testing.expectEqual(@as(wasm.Opcode, .f64_reinterpret_i64), f64_reinterpret_i64);
}
pub const Result = union(enum) {
/// The codegen bytes have been appended to `Context.code`
appended: void,
/// The data is managed externally and are part of the `Result`
externally_managed: []const u8,
};
/// Hashmap to store generated `WValue` for each `Air.Inst.Ref`
pub const ValueTable = std.AutoArrayHashMapUnmanaged(Air.Inst.Ref, WValue);
@ -1171,7 +1164,7 @@ pub fn generate(
liveness: Liveness,
code: *std.ArrayList(u8),
debug_output: codegen.DebugInfoOutput,
) codegen.GenerateSymbolError!codegen.FnResult {
) codegen.GenerateSymbolError!codegen.Result {
_ = src_loc;
var code_gen: CodeGen = .{
.gpa = bin_file.allocator,
@ -1190,11 +1183,11 @@ pub fn generate(
defer code_gen.deinit();
genFunc(&code_gen) catch |err| switch (err) {
error.CodegenFail => return codegen.FnResult{ .fail = code_gen.err_msg },
error.CodegenFail => return codegen.Result{ .fail = code_gen.err_msg },
else => |e| return e,
};
return codegen.FnResult{ .appended = {} };
return codegen.Result{ .appended = {} };
}
fn genFunc(func: *CodeGen) InnerError!void {

View file

@ -16,7 +16,7 @@ const Compilation = @import("../../Compilation.zig");
const DebugInfoOutput = codegen.DebugInfoOutput;
const DW = std.dwarf;
const ErrorMsg = Module.ErrorMsg;
const FnResult = codegen.FnResult;
const Result = codegen.Result;
const GenerateSymbolError = codegen.GenerateSymbolError;
const Emit = @import("Emit.zig");
const Liveness = @import("../../Liveness.zig");
@ -257,7 +257,7 @@ pub fn generate(
liveness: Liveness,
code: *std.ArrayList(u8),
debug_output: DebugInfoOutput,
) GenerateSymbolError!FnResult {
) GenerateSymbolError!Result {
if (build_options.skip_non_native and builtin.cpu.arch != bin_file.options.target.cpu.arch) {
@panic("Attempted to compile for architecture that was disabled by build configuration");
}
@ -305,8 +305,8 @@ pub fn generate(
defer if (builtin.mode == .Debug) function.mir_to_air_map.deinit();
var call_info = function.resolveCallingConventionValues(fn_type) catch |err| switch (err) {
error.CodegenFail => return FnResult{ .fail = function.err_msg.? },
error.OutOfRegisters => return FnResult{
error.CodegenFail => return Result{ .fail = function.err_msg.? },
error.OutOfRegisters => return Result{
.fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}),
},
else => |e| return e,
@ -319,8 +319,8 @@ pub fn generate(
function.max_end_stack = call_info.stack_byte_count;
function.gen() catch |err| switch (err) {
error.CodegenFail => return FnResult{ .fail = function.err_msg.? },
error.OutOfRegisters => return FnResult{
error.CodegenFail => return Result{ .fail = function.err_msg.? },
error.OutOfRegisters => return Result{
.fail = try ErrorMsg.create(bin_file.allocator, src_loc, "CodeGen ran out of registers. This is a bug in the Zig compiler.", .{}),
},
else => |e| return e,
@ -345,14 +345,14 @@ pub fn generate(
};
defer emit.deinit();
emit.lowerMir() catch |err| switch (err) {
error.EmitFail => return FnResult{ .fail = emit.err_msg.? },
error.EmitFail => return Result{ .fail = emit.err_msg.? },
else => |e| return e,
};
if (function.err_msg) |em| {
return FnResult{ .fail = em };
return Result{ .fail = em };
} else {
return FnResult{ .appended = {} };
return Result{ .appended = {} };
}
}

View file

@ -21,16 +21,9 @@ const TypedValue = @import("TypedValue.zig");
const Value = @import("value.zig").Value;
const Zir = @import("Zir.zig");
pub const FnResult = union(enum) {
/// The `code` parameter passed to `generateSymbol` has the value appended.
appended: void,
fail: *ErrorMsg,
};
pub const Result = union(enum) {
/// The `code` parameter passed to `generateSymbol` has the value appended.
appended: void,
/// The value is available externally, `code` is unused.
externally_managed: []const u8,
fail: *ErrorMsg,
};
@ -89,7 +82,7 @@ pub fn generateFunction(
liveness: Liveness,
code: *std.ArrayList(u8),
debug_output: DebugInfoOutput,
) GenerateSymbolError!FnResult {
) GenerateSymbolError!Result {
switch (bin_file.options.target.cpu.arch) {
.arm,
.armeb,
@ -209,9 +202,6 @@ pub fn generateSymbol(
.val = elem_val,
}, code, debug_output, reloc_info)) {
.appended => {},
.externally_managed => |slice| {
code.appendSliceAssumeCapacity(slice);
},
.fail => |em| return Result{ .fail = em },
}
}
@ -230,9 +220,6 @@ pub fn generateSymbol(
.val = array,
}, code, debug_output, reloc_info)) {
.appended => {},
.externally_managed => |slice| {
code.appendSliceAssumeCapacity(slice);
},
.fail => |em| return Result{ .fail = em },
}
}
@ -243,9 +230,6 @@ pub fn generateSymbol(
.val = sentinel_val,
}, code, debug_output, reloc_info)) {
.appended => {},
.externally_managed => |slice| {
code.appendSliceAssumeCapacity(slice);
},
.fail => |em| return Result{ .fail = em },
}
}
@ -260,9 +244,6 @@ pub fn generateSymbol(
.val = sentinel_val,
}, code, debug_output, reloc_info)) {
.appended => {},
.externally_managed => |slice| {
code.appendSliceAssumeCapacity(slice);
},
.fail => |em| return Result{ .fail = em },
}
return Result{ .appended = {} };
@ -310,9 +291,6 @@ pub fn generateSymbol(
.val = slice.ptr,
}, code, debug_output, reloc_info)) {
.appended => {},
.externally_managed => |external_slice| {
code.appendSliceAssumeCapacity(external_slice);
},
.fail => |em| return Result{ .fail = em },
}
@ -322,9 +300,6 @@ pub fn generateSymbol(
.val = slice.len,
}, code, debug_output, reloc_info)) {
.appended => {},
.externally_managed => |external_slice| {
code.appendSliceAssumeCapacity(external_slice);
},
.fail => |em| return Result{ .fail = em },
}
@ -376,9 +351,6 @@ pub fn generateSymbol(
.val = container_ptr,
}, code, debug_output, reloc_info)) {
.appended => {},
.externally_managed => |external_slice| {
code.appendSliceAssumeCapacity(external_slice);
},
.fail => |em| return Result{ .fail = em },
}
return Result{ .appended = {} };
@ -552,9 +524,6 @@ pub fn generateSymbol(
.appended => {
mem.copy(u8, code.items[current_pos..], tmp_list.items);
},
.externally_managed => |external_slice| {
mem.copy(u8, code.items[current_pos..], external_slice);
},
.fail => |em| return Result{ .fail = em },
}
} else {
@ -577,9 +546,6 @@ pub fn generateSymbol(
.val = field_val,
}, code, debug_output, reloc_info)) {
.appended => {},
.externally_managed => |external_slice| {
code.appendSliceAssumeCapacity(external_slice);
},
.fail => |em| return Result{ .fail = em },
}
const unpadded_field_end = code.items.len - struct_begin;
@ -613,9 +579,6 @@ pub fn generateSymbol(
.val = union_obj.tag,
}, code, debug_output, reloc_info)) {
.appended => {},
.externally_managed => |external_slice| {
code.appendSliceAssumeCapacity(external_slice);
},
.fail => |em| return Result{ .fail = em },
}
}
@ -633,9 +596,6 @@ pub fn generateSymbol(
.val = union_obj.val,
}, code, debug_output, reloc_info)) {
.appended => {},
.externally_managed => |external_slice| {
code.appendSliceAssumeCapacity(external_slice);
},
.fail => |em| return Result{ .fail = em },
}
@ -651,9 +611,6 @@ pub fn generateSymbol(
.val = union_obj.tag,
}, code, debug_output, reloc_info)) {
.appended => {},
.externally_managed => |external_slice| {
code.appendSliceAssumeCapacity(external_slice);
},
.fail => |em| return Result{ .fail = em },
}
}
@ -679,9 +636,6 @@ pub fn generateSymbol(
.val = payload.data,
}, code, debug_output, reloc_info)) {
.appended => {},
.externally_managed => |external_slice| {
code.appendSliceAssumeCapacity(external_slice);
},
.fail => |em| return Result{ .fail = em },
}
} else if (!typed_value.val.isNull()) {
@ -690,9 +644,6 @@ pub fn generateSymbol(
.val = typed_value.val,
}, code, debug_output, reloc_info)) {
.appended => {},
.externally_managed => |external_slice| {
code.appendSliceAssumeCapacity(external_slice);
},
.fail => |em| return Result{ .fail = em },
}
} else {
@ -709,9 +660,6 @@ pub fn generateSymbol(
.val = value,
}, code, debug_output, reloc_info)) {
.appended => {},
.externally_managed => |external_slice| {
code.appendSliceAssumeCapacity(external_slice);
},
.fail => |em| return Result{ .fail = em },
}
@ -741,9 +689,6 @@ pub fn generateSymbol(
.val = if (is_payload) Value.initTag(.zero) else typed_value.val,
}, code, debug_output, reloc_info)) {
.appended => {},
.externally_managed => |external_slice| {
code.appendSliceAssumeCapacity(external_slice);
},
.fail => |em| return Result{ .fail = em },
}
}
@ -757,9 +702,6 @@ pub fn generateSymbol(
.val = payload_val,
}, code, debug_output, reloc_info)) {
.appended => {},
.externally_managed => |external_slice| {
code.appendSliceAssumeCapacity(external_slice);
},
.fail => |em| return Result{ .fail = em },
}
const unpadded_end = code.items.len - begin;
@ -779,9 +721,6 @@ pub fn generateSymbol(
.val = if (is_payload) Value.initTag(.zero) else typed_value.val,
}, code, debug_output, reloc_info)) {
.appended => {},
.externally_managed => |external_slice| {
code.appendSliceAssumeCapacity(external_slice);
},
.fail => |em| return Result{ .fail = em },
}
const unpadded_end = code.items.len - begin;
@ -826,9 +765,6 @@ pub fn generateSymbol(
.val = elem_val,
}, code, debug_output, reloc_info)) {
.appended => {},
.externally_managed => |slice| {
code.appendSliceAssumeCapacity(slice);
},
.fail => |em| return Result{ .fail = em },
}
}
@ -846,9 +782,6 @@ pub fn generateSymbol(
.val = array,
}, code, debug_output, reloc_info)) {
.appended => {},
.externally_managed => |slice| {
code.appendSliceAssumeCapacity(slice);
},
.fail => |em| return Result{ .fail = em },
}
}
@ -902,9 +835,6 @@ fn lowerDeclRef(
.val = typed_value.val,
}, code, debug_output, reloc_info)) {
.appended => {},
.externally_managed => |external_slice| {
code.appendSliceAssumeCapacity(external_slice);
},
.fail => |em| return Result{ .fail = em },
}
@ -918,9 +848,6 @@ fn lowerDeclRef(
.val = Value.initPayload(&slice_len.base),
}, code, debug_output, reloc_info)) {
.appended => {},
.externally_managed => |external_slice| {
code.appendSliceAssumeCapacity(external_slice);
},
.fail => |em| return Result{ .fail = em },
}

View file

@ -981,7 +981,6 @@ pub fn lowerUnnamedConst(self: *Coff, tv: TypedValue, decl_index: Module.Decl.In
.parent_atom_index = atom.sym_index,
});
const code = switch (res) {
.externally_managed => |x| x,
.appended => code_buffer.items,
.fail => |em| {
decl.analysis = .codegen_failure;
@ -1042,7 +1041,6 @@ pub fn updateDecl(self: *Coff, module: *Module, decl_index: Module.Decl.Index) !
.parent_atom_index = decl.link.coff.sym_index,
});
const code = switch (res) {
.externally_managed => |x| x,
.appended => code_buffer.items,
.fail => |em| {
decl.analysis = .codegen_failure;

View file

@ -2553,7 +2553,6 @@ pub fn updateDecl(self: *Elf, module: *Module, decl_index: Module.Decl.Index) !v
});
const code = switch (res) {
.externally_managed => |x| x,
.appended => code_buffer.items,
.fail => |em| {
decl.analysis = .codegen_failure;
@ -2618,7 +2617,6 @@ pub fn lowerUnnamedConst(self: *Elf, typed_value: TypedValue, decl_index: Module
.parent_atom_index = atom.local_sym_index,
});
const code = switch (res) {
.externally_managed => |x| x,
.appended => code_buffer.items,
.fail => |em| {
decl.analysis = .codegen_failure;

View file

@ -2082,7 +2082,6 @@ pub fn lowerUnnamedConst(self: *MachO, typed_value: TypedValue, decl_index: Modu
.parent_atom_index = atom.sym_index,
});
const code = switch (res) {
.externally_managed => |x| x,
.appended => code_buffer.items,
.fail => |em| {
decl.analysis = .codegen_failure;
@ -2167,7 +2166,6 @@ pub fn updateDecl(self: *MachO, module: *Module, decl_index: Module.Decl.Index)
});
const code = switch (res) {
.externally_managed => |x| x,
.appended => code_buffer.items,
.fail => |em| {
decl.analysis = .codegen_failure;

View file

@ -358,7 +358,6 @@ pub fn lowerUnnamedConst(self: *Plan9, tv: TypedValue, decl_index: Module.Decl.I
.parent_atom_index = @enumToInt(decl_index),
});
const code = switch (res) {
.externally_managed => |x| x,
.appended => code_buffer.items,
.fail => |em| {
decl.analysis = .codegen_failure;
@ -403,7 +402,6 @@ pub fn updateDecl(self: *Plan9, module: *Module, decl_index: Module.Decl.Index)
.parent_atom_index = @enumToInt(decl_index),
});
const code = switch (res) {
.externally_managed => |x| x,
.appended => code_buffer.items,
.fail => |em| {
decl.analysis = .codegen_failure;

View file

@ -1113,7 +1113,6 @@ pub fn updateDecl(wasm: *Wasm, mod: *Module, decl_index: Module.Decl.Index) !voi
);
const code = switch (res) {
.externally_managed => |x| x,
.appended => code_writer.items,
.fail => |em| {
decl.analysis = .codegen_failure;
@ -1250,7 +1249,6 @@ pub fn lowerUnnamedConst(wasm: *Wasm, tv: TypedValue, decl_index: Module.Decl.In
},
);
const code = switch (result) {
.externally_managed => |x| x,
.appended => value_bytes.items,
.fail => |em| {
decl.analysis = .codegen_failure;