Skip to content

Commit

Permalink
LSRA: Make genRegMask() return regMaskTP (#102783)
Browse files Browse the repository at this point in the history
* genRegMask

* Make genRegMask() return regMaskTP, introduce genSingleTypeRegMask() for LSRA

* Make allFloat,allMask regMaskTP instead of `SingleTypeRegSet` so no affect on non-LSRA code

* jit format

* fix build errors

* fix loongarch and risc

* fix a typo

* move more `genSingleTypeRegMask()`

* jit format

* Make genRegMask() use genSingleType*()

* fix build errors

* jit format
  • Loading branch information
kunalspathak authored May 29, 2024
1 parent d9bc680 commit 23e15a5
Show file tree
Hide file tree
Showing 14 changed files with 254 additions and 162 deletions.
16 changes: 8 additions & 8 deletions src/coreclr/jit/codegeninterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,31 +75,31 @@ class CodeGenInterface
}

#if defined(TARGET_AMD64)
SingleTypeRegSet rbmAllFloat;
SingleTypeRegSet rbmFltCalleeTrash;
regMaskTP rbmAllFloat;
regMaskTP rbmFltCalleeTrash;

FORCEINLINE SingleTypeRegSet get_RBM_ALLFLOAT() const
FORCEINLINE regMaskTP get_RBM_ALLFLOAT() const
{
return this->rbmAllFloat;
}
FORCEINLINE SingleTypeRegSet get_RBM_FLT_CALLEE_TRASH() const
FORCEINLINE regMaskTP get_RBM_FLT_CALLEE_TRASH() const
{
return this->rbmFltCalleeTrash;
}
#endif // TARGET_AMD64

#if defined(TARGET_XARCH)
SingleTypeRegSet rbmAllMask;
SingleTypeRegSet rbmMskCalleeTrash;
regMaskTP rbmAllMask;
regMaskTP rbmMskCalleeTrash;

// Call this function after the equivalent fields in Compiler have been initialized.
void CopyRegisterInfo();

FORCEINLINE SingleTypeRegSet get_RBM_ALLMASK() const
FORCEINLINE regMaskTP get_RBM_ALLMASK() const
{
return this->rbmAllMask;
}
FORCEINLINE SingleTypeRegSet get_RBM_MSK_CALLEE_TRASH() const
FORCEINLINE regMaskTP get_RBM_MSK_CALLEE_TRASH() const
{
return this->rbmMskCalleeTrash;
}
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3485,12 +3485,12 @@ void Compiler::compInitOptions(JitFlags* jitFlags)
// Make sure we copy the register info and initialize the
// trash regs after the underlying fields are initialized

const SingleTypeRegSet vtCalleeTrashRegs[TYP_COUNT]{
const regMaskTP vtCalleeTrashRegs[TYP_COUNT]{
#define DEF_TP(tn, nm, jitType, sz, sze, asze, st, al, regTyp, regFld, csr, ctr, tf) ctr,
#include "typelist.h"
#undef DEF_TP
};
memcpy(varTypeCalleeTrashRegs, vtCalleeTrashRegs, sizeof(SingleTypeRegSet) * TYP_COUNT);
memcpy(varTypeCalleeTrashRegs, vtCalleeTrashRegs, sizeof(regMaskTP) * TYP_COUNT);

codeGen->CopyRegisterInfo();
#endif // TARGET_XARCH
Expand Down
30 changes: 15 additions & 15 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -11246,8 +11246,8 @@ class Compiler
//
// Users of these values need to define four accessor functions:
//
// SingleTypeRegSet get_RBM_ALLFLOAT();
// SingleTypeRegSet get_RBM_FLT_CALLEE_TRASH();
// regMaskTP get_RBM_ALLFLOAT();
// regMaskTP get_RBM_FLT_CALLEE_TRASH();
// unsigned get_CNT_CALLEE_TRASH_FLOAT();
// unsigned get_AVAILABLE_REG_COUNT();
//
Expand All @@ -11256,16 +11256,16 @@ class Compiler
// This was done to avoid polluting all `targetXXX.h` macro definitions with a compiler parameter, where only
// TARGET_AMD64 requires one.
//
SingleTypeRegSet rbmAllFloat;
SingleTypeRegSet rbmFltCalleeTrash;
unsigned cntCalleeTrashFloat;
regMaskTP rbmAllFloat;
regMaskTP rbmFltCalleeTrash;
unsigned cntCalleeTrashFloat;

public:
FORCEINLINE SingleTypeRegSet get_RBM_ALLFLOAT() const
FORCEINLINE regMaskTP get_RBM_ALLFLOAT() const
{
return this->rbmAllFloat;
}
FORCEINLINE SingleTypeRegSet get_RBM_FLT_CALLEE_TRASH() const
FORCEINLINE regMaskTP get_RBM_FLT_CALLEE_TRASH() const
{
return this->rbmFltCalleeTrash;
}
Expand All @@ -11284,8 +11284,8 @@ class Compiler
//
// Users of these values need to define four accessor functions:
//
// SingleTypeRegSet get_RBM_ALLMASK();
// SingleTypeRegSet get_RBM_MSK_CALLEE_TRASH();
// regMaskTP get_RBM_ALLMASK();
// regMaskTP get_RBM_MSK_CALLEE_TRASH();
// unsigned get_CNT_CALLEE_TRASH_MASK();
// unsigned get_AVAILABLE_REG_COUNT();
//
Expand All @@ -11294,17 +11294,17 @@ class Compiler
// This was done to avoid polluting all `targetXXX.h` macro definitions with a compiler parameter, where only
// TARGET_XARCH requires one.
//
SingleTypeRegSet rbmAllMask;
SingleTypeRegSet rbmMskCalleeTrash;
unsigned cntCalleeTrashMask;
SingleTypeRegSet varTypeCalleeTrashRegs[TYP_COUNT];
regMaskTP rbmAllMask;
regMaskTP rbmMskCalleeTrash;
unsigned cntCalleeTrashMask;
regMaskTP varTypeCalleeTrashRegs[TYP_COUNT];

public:
FORCEINLINE SingleTypeRegSet get_RBM_ALLMASK() const
FORCEINLINE regMaskTP get_RBM_ALLMASK() const
{
return this->rbmAllMask;
}
FORCEINLINE SingleTypeRegSet get_RBM_MSK_CALLEE_TRASH() const
FORCEINLINE regMaskTP get_RBM_MSK_CALLEE_TRASH() const
{
return this->rbmMskCalleeTrash;
}
Expand Down
Loading

0 comments on commit 23e15a5

Please sign in to comment.