File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
compiler/rustc_target/src/abi/call Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ use crate::spec::HasTargetSpec;
1010enum ABI {
1111 ELFv1 , // original ABI used for powerpc64 (big-endian)
1212 ELFv2 , // newer ABI used for powerpc64le and musl (both endians)
13+ AIX , // used by AIX OS, big-endian only
1314}
1415use ABI :: * ;
1516
2324 C : HasDataLayout ,
2425{
2526 arg. layout . homogeneous_aggregate ( cx) . ok ( ) . and_then ( |ha| ha. unit ( ) ) . and_then ( |unit| {
26- // ELFv1 only passes one-member aggregates transparently.
27+ // ELFv1 and AIX only passes one-member aggregates transparently.
2728 // ELFv2 passes up to eight uniquely addressable members.
28- if ( abi == ELFv1 && arg. layout . size > unit. size )
29+ if ( ( abi == ELFv1 || abi == AIX ) && arg. layout . size > unit. size )
2930 || arg. layout . size > unit. size . checked_mul ( 8 , cx) . unwrap ( )
3031 {
3132 return None ;
5556 return ;
5657 }
5758
59+ // See https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/Targets/PPC.cpp.
60+ if !is_ret && abi == AIX {
61+ arg. make_indirect_byval ( None ) ;
62+ return ;
63+ }
64+
5865 // The ELFv1 ABI doesn't return aggregates in registers
59- if is_ret && abi == ELFv1 {
66+ if is_ret && ( abi == ELFv1 || abi == AIX ) {
6067 arg. make_indirect ( ) ;
6168 return ;
6269 }
93100{
94101 let abi = if cx. target_spec ( ) . env == "musl" {
95102 ELFv2
103+ } else if cx. target_spec ( ) . os == "aix" {
104+ AIX
96105 } else {
97106 match cx. data_layout ( ) . endian {
98107 Endian :: Big => ELFv1 ,
You can’t perform that action at this time.
0 commit comments