@@ -48,7 +48,9 @@ struct ABIPassingInformation
48
48
// multiple register segments and a struct segment.
49
49
// - On Windows x64, all parameters always fit into one stack slot or
50
50
// register, and thus always have NumSegments == 1
51
- // - On RISC-V, structs can be split out over 2 segments, each can be an integer/float register or a stack slot
51
+ // - On loongarch64/riscv64, structs can be passed in two registers or
52
+ // can be split out over register and stack, giving
53
+ // multiple register segments and a struct segment.
52
54
unsigned NumSegments = 0 ;
53
55
ABIPassingSegment* Segments = nullptr ;
54
56
@@ -202,6 +204,22 @@ class RiscV64Classifier
202
204
WellKnownArg wellKnownParam);
203
205
};
204
206
207
+ class LoongArch64Classifier
208
+ {
209
+ const ClassifierInfo& m_info;
210
+ RegisterQueue m_intRegs;
211
+ RegisterQueue m_floatRegs;
212
+ unsigned m_stackArgSize = 0 ;
213
+
214
+ public:
215
+ LoongArch64Classifier (const ClassifierInfo& info);
216
+
217
+ ABIPassingInformation Classify (Compiler* comp,
218
+ var_types type,
219
+ ClassLayout* structLayout,
220
+ WellKnownArg wellKnownParam);
221
+ };
222
+
205
223
#if defined(TARGET_X86)
206
224
typedef X86Classifier PlatformClassifier;
207
225
#elif defined(WINDOWS_AMD64_ABI)
@@ -214,6 +232,8 @@ typedef Arm64Classifier PlatformClassifier;
214
232
typedef Arm32Classifier PlatformClassifier;
215
233
#elif defined(TARGET_RISCV64)
216
234
typedef RiscV64Classifier PlatformClassifier;
235
+ #elif defined(TARGET_LOONGARCH64)
236
+ typedef LoongArch64Classifier PlatformClassifier;
217
237
#endif
218
238
219
239
#ifdef SWIFT_SUPPORT
0 commit comments