@@ -186,4 +186,34 @@ public int ApproximateArgStackAreaSize(List<TypeEx> parameters)
186186 return size ;
187187 }
188188 }
189+
190+ internal class Riscv64Abi : IAbi
191+ {
192+ // For Riscv64 structs larger than 16 bytes are passed by-ref and will
193+ // inhibit tailcalls, so we exclude those.
194+ public Type [ ] TailCalleeCandidateArgTypes { get ; } =
195+ new [ ]
196+ {
197+ typeof ( byte ) , typeof ( short ) , typeof ( int ) , typeof ( long ) ,
198+ typeof ( float ) , typeof ( double ) , typeof ( Int128 ) ,
199+ typeof ( Vector < int > ) , typeof ( Vector128 < int > ) ,
200+ typeof ( S1P ) , typeof ( S2P ) , typeof ( S2U ) , typeof ( S3U ) ,
201+ typeof ( S4P ) , typeof ( S4U ) , typeof ( S5U ) , typeof ( S6U ) ,
202+ typeof ( S7U ) , typeof ( S8P ) , typeof ( S8U ) , typeof ( S9U ) ,
203+ typeof ( S10U ) , typeof ( S11U ) , typeof ( S12U ) , typeof ( S13U ) ,
204+ typeof ( S14U ) , typeof ( S15U ) , typeof ( S16U ) ,
205+ typeof ( Hfa1 ) , typeof ( I128_1 )
206+ } ;
207+
208+ public CallingConvention [ ] PInvokeConventions { get ; } = { CallingConvention . Cdecl } ;
209+
210+ public int ApproximateArgStackAreaSize ( List < TypeEx > parameters )
211+ {
212+ int size = 0 ;
213+ foreach ( TypeEx pm in parameters )
214+ size += Util . RoundUp ( pm . Size , 8 ) ;
215+
216+ return size ;
217+ }
218+ }
189219}
0 commit comments