pass small non-recursive tag unions via registers (like records)

This commit is contained in:
Folkert 2023-10-02 19:51:37 +02:00
parent 68dc7108bf
commit 905dc8cd59
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C

View file

@ -793,7 +793,7 @@ impl AArch64CallLoadArgs {
sym,
lambda_set.runtime_representation(),
),
LayoutRepr::Struct { .. } => {
LayoutRepr::Struct { .. } | LayoutRepr::Union(UnionLayout::NonRecursive(_)) => {
if stack_size <= 8 {
self.load_arg_general_64bit(
buf,
@ -814,11 +814,6 @@ impl AArch64CallLoadArgs {
unreachable!("covered by an earlier branch")
}
}
LayoutRepr::Union(UnionLayout::NonRecursive(_)) => {
// for now, just also store this on the stack
storage_manager.complex_stack_arg(&sym, self.argument_offset, stack_size);
self.argument_offset += stack_size as i32;
}
_ => {
todo!(
"Loading args with layout {:?}",
@ -979,7 +974,7 @@ impl AArch64CallStoreArgs {
sym,
lambda_set.runtime_representation(),
),
LayoutRepr::Struct { .. } => {
LayoutRepr::Struct { .. } | LayoutRepr::Union(UnionLayout::NonRecursive(_)) => {
let stack_size = layout_interner.stack_size(in_layout);
if stack_size <= 8 {
self.store_arg_64bit(buf, storage_manager, sym);
@ -989,19 +984,6 @@ impl AArch64CallStoreArgs {
unreachable!("covered by earlier branch");
}
}
LayoutRepr::Union(UnionLayout::NonRecursive(_)) => {
let stack_offset = self.tmp_stack_offset;
let size = copy_symbol_to_stack_offset::<CC>(
buf,
storage_manager,
sym,
tmp_reg,
stack_offset,
);
self.tmp_stack_offset += size as i32;
}
_ => {
todo!(
"calling with arg type, {:?}",