Skip to content

Commit

Permalink
[LoongArch64] add new ABI classifier. (#101224)
Browse files Browse the repository at this point in the history
* add new ABI classifier.

* share `CodeGen::genHomeRegisterParams` with XARCH-ARMARCH.
  • Loading branch information
shushanhf authored and pull[bot] committed Jul 15, 2024
1 parent 861e44d commit 53fd801
Show file tree
Hide file tree
Showing 5 changed files with 234 additions and 544 deletions.
22 changes: 21 additions & 1 deletion src/coreclr/jit/abi.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ struct ABIPassingInformation
// multiple register segments and a struct segment.
// - On Windows x64, all parameters always fit into one stack slot or
// register, and thus always have NumSegments == 1
// - On RISC-V, structs can be split out over 2 segments, each can be an integer/float register or a stack slot
// - On loongarch64/riscv64, structs can be passed in two registers or
// can be split out over register and stack, giving
// multiple register segments and a struct segment.
unsigned NumSegments = 0;
ABIPassingSegment* Segments = nullptr;

Expand Down Expand Up @@ -202,6 +204,22 @@ class RiscV64Classifier
WellKnownArg wellKnownParam);
};

class LoongArch64Classifier
{
const ClassifierInfo& m_info;
RegisterQueue m_intRegs;
RegisterQueue m_floatRegs;
unsigned m_stackArgSize = 0;

public:
LoongArch64Classifier(const ClassifierInfo& info);

ABIPassingInformation Classify(Compiler* comp,
var_types type,
ClassLayout* structLayout,
WellKnownArg wellKnownParam);
};

#if defined(TARGET_X86)
typedef X86Classifier PlatformClassifier;
#elif defined(WINDOWS_AMD64_ABI)
Expand All @@ -214,6 +232,8 @@ typedef Arm64Classifier PlatformClassifier;
typedef Arm32Classifier PlatformClassifier;
#elif defined(TARGET_RISCV64)
typedef RiscV64Classifier PlatformClassifier;
#elif defined(TARGET_LOONGARCH64)
typedef LoongArch64Classifier PlatformClassifier;
#endif

#ifdef SWIFT_SUPPORT
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2802,7 +2802,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
*/

#if !defined(TARGET_LOONGARCH64) && !defined(TARGET_RISCV64)
#if !defined(TARGET_RISCV64)
struct RegNode;

struct RegNodeEdge
Expand Down
Loading

0 comments on commit 53fd801

Please sign in to comment.