[flang] fix AArch64 PCS for struct following pointer (#127802)
Pointers are already handled as taking up a register in the ABI handling, but the handling for structs was not taking this into account. This patch changes the struct handling to acknowledge that pointer arguments take up an integer register. Fixes #123075
This commit is contained in:
parent
00637b7dfb
commit
449f84fea6
@ -930,6 +930,13 @@ struct TargetAArch64 : public GenericTarget<TargetAArch64> {
|
||||
.Case<fir::VectorType>([&](auto) {
|
||||
TODO(loc, "passing vector argument to C by value is not supported");
|
||||
return NRegs{};
|
||||
})
|
||||
.Default([&](auto ty) {
|
||||
if (fir::conformsWithPassByRef(ty))
|
||||
return NRegs{1, false}; // Pointers take 1 integer register
|
||||
TODO(loc, "unsupported component type for BIND(C), VALUE derived "
|
||||
"type argument");
|
||||
return NRegs{};
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -71,3 +71,17 @@ func.func private @too_many_hfa(!fir.type<hfa_max{i:f128,j:f128,k:f128,l:f128}>,
|
||||
|
||||
// CHECK-LABEL: func.func private @too_big(!fir.ref<!fir.type<too_big{i:!fir.array<5xi32>}>> {{{.*}}, llvm.byval = !fir.type<too_big{i:!fir.array<5xi32>}>})
|
||||
func.func private @too_big(!fir.type<too_big{i:!fir.array<5xi32>}>)
|
||||
|
||||
// CHECK-LABEL: func.func private @pointer_type(!fir.ref<i64>, !fir.array<1xi64>)
|
||||
func.func private @pointer_type(!fir.ref<i64>, !fir.type<pointer_type{i:i64}>)
|
||||
|
||||
// CHECK-LABEL: func.func private @pointer_type_too_many_int(!fir.ref<i64>,
|
||||
// CHECK-SAME: !fir.array<2xi64>,
|
||||
// CHECK-SAME: !fir.array<2xi64>,
|
||||
// CHECK-SAME: !fir.array<2xi64>,
|
||||
// CHECK-SAME: !fir.ref<!fir.type<int_max{i:i64,j:i64}>> {{{.*}}, llvm.byval = !fir.type<int_max{i:i64,j:i64}>})
|
||||
func.func private @pointer_type_too_many_int(!fir.ref<i64>,
|
||||
!fir.type<int_max{i:i64,j:i64}>,
|
||||
!fir.type<int_max{i:i64,j:i64}>,
|
||||
!fir.type<int_max{i:i64,j:i64}>,
|
||||
!fir.type<int_max{i:i64,j:i64}>)
|
||||
|
Loading…
x
Reference in New Issue
Block a user