@@ -39,16 +39,20 @@ class AArch64ABIInfo : public ABIInfo {
39
39
40
40
private:
41
41
AArch64ABIKind getABIKind () const { return Kind; }
42
+ bool isDarwinPCS () const { return Kind == AArch64ABIKind::DarwinPCS; }
42
43
43
44
ABIArgInfo classifyReturnType (Type RetTy, bool IsVariadic) const ;
45
+ ABIArgInfo classifyArgumentType (Type RetTy, bool IsVariadic,
46
+ unsigned CallingConvention) const ;
44
47
45
48
void computeInfo (LowerFunctionInfo &FI) const override {
46
49
if (!::mlir::cir::classifyReturnType (getCXXABI (), FI, *this ))
47
50
FI.getReturnInfo () =
48
51
classifyReturnType (FI.getReturnType (), FI.isVariadic ());
49
52
50
- for (auto &_ : FI.arguments ())
51
- llvm_unreachable (" NYI" );
53
+ for (auto &it : FI.arguments ())
54
+ it.info = classifyArgumentType (it.type , FI.isVariadic (),
55
+ FI.getCallingConvention ());
52
56
}
53
57
};
54
58
@@ -67,6 +71,48 @@ ABIArgInfo AArch64ABIInfo::classifyReturnType(Type RetTy,
67
71
if (isa<VoidType>(RetTy))
68
72
return ABIArgInfo::getIgnore ();
69
73
74
+ if (const auto _ = dyn_cast<VectorType>(RetTy)) {
75
+ llvm_unreachable (" NYI" );
76
+ }
77
+
78
+ // Large vector types should be returned via memory.
79
+ if (isa<VectorType>(RetTy) && getContext ().getTypeSize (RetTy) > 128 )
80
+ llvm_unreachable (" NYI" );
81
+
82
+ if (!isAggregateTypeForABI (RetTy)) {
83
+ // NOTE(cir): Skip enum handling.
84
+
85
+ if (MissingFeature::fixedSizeIntType ())
86
+ llvm_unreachable (" NYI" );
87
+
88
+ return (isPromotableIntegerTypeForABI (RetTy) && isDarwinPCS ()
89
+ ? ABIArgInfo::getExtend (RetTy)
90
+ : ABIArgInfo::getDirect ());
91
+ }
92
+
93
+ llvm_unreachable (" NYI" );
94
+ }
95
+
96
+ ABIArgInfo
97
+ AArch64ABIInfo::classifyArgumentType (Type Ty, bool IsVariadic,
98
+ unsigned CallingConvention) const {
99
+ Ty = useFirstFieldIfTransparentUnion (Ty);
100
+
101
+ // TODO(cir): check for illegal vector types.
102
+ if (MissingFeature::vectorType ())
103
+ llvm_unreachable (" NYI" );
104
+
105
+ if (!isAggregateTypeForABI (Ty)) {
106
+ // NOTE(cir): Enum is IntType in CIR. Skip enum handling here.
107
+
108
+ if (MissingFeature::fixedSizeIntType ())
109
+ llvm_unreachable (" NYI" );
110
+
111
+ return (isPromotableIntegerTypeForABI (Ty) && isDarwinPCS ()
112
+ ? ABIArgInfo::getExtend (Ty)
113
+ : ABIArgInfo::getDirect ());
114
+ }
115
+
70
116
llvm_unreachable (" NYI" );
71
117
}
72
118
0 commit comments