diff --git a/src/compiler.bbb b/src/compiler.bbb index 6154c9f..b3edf10 100644 --- a/src/compiler.bbb +++ b/src/compiler.bbb @@ -7054,7 +7054,8 @@ abi_system_v_classify_type = fn (type: &Type, options: AbiSystemVClassifyArgumen if (gt_16 or padding) { result[0] = .memory; - #trap(); + result = abi_system_v_classify_post_merge(byte_size, result); + return result; } >member_classes = abi_system_v_classify_type(member_type, { @@ -7391,6 +7392,42 @@ abi_system_v_get_indirect_result = fn (module: &Module, type: &Type, free_gpr: u } } +NaturalAlignIndirect = struct +{ + semantic_type: &Type, + padding_type: &Type, + not_by_value: u1, // by_value = true by default + realign: u1, +} + +abi_system_v_get_natural_align_indirect = fn (natural: NaturalAlignIndirect) AbiInformation +{ + >alignment = get_byte_alignment(natural.semantic_type); + + return abi_system_v_get_indirect({ + .semantic_type = natural.semantic_type, + .padding_type = natural.padding_type, + .alignment = alignment, + .not_by_value = natural.not_by_value, + .realign = natural.realign, + }); +} + +abi_system_v_get_indirect_return_result = fn (type: &Type) AbiInformation +{ + if (type_is_aggregate_type_for_abi(type)) + { + return abi_system_v_get_natural_align_indirect({ + .semantic_type = type, + zero, + }); + } + else + { + #trap(); + } +} + abi_system_v_classify_return_type = fn (module: &Module, semantic_return_type: &Type) AbiInformation { >classes = abi_system_v_classify_type(semantic_return_type, zero); @@ -7428,6 +7465,10 @@ abi_system_v_classify_return_type = fn (module: &Module, semantic_return_type: & } } }, + .memory => + { + return abi_system_v_get_indirect_return_result(semantic_return_type); + }, else => { #trap(); @@ -12613,7 +12654,8 @@ compile_file = fn (arena: &Arena, compile_options: CompileFile) []u8 return output_executable_path; } -names: [_][]u8 = [ +names: [_][]u8 = +[ "minimal", "comments", "constant_add", @@ -12662,6 +12704,9 @@ names: [_][]u8 = [ "bits_zero", "comparison", "global_struct", + "if_no_else", + "if_no_else_void", + "indirect", ]; [export] main = fn [cc(c)] (argument_count: u32, argv: &&u8, envp: &&u8) s32