Skip to content

Commit

Permalink
jit format
Browse files Browse the repository at this point in the history
  • Loading branch information
kunalspathak committed May 29, 2024
1 parent e56dc9b commit b2d9b1c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 31 deletions.
13 changes: 8 additions & 5 deletions src/coreclr/jit/lsra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9175,7 +9175,8 @@ void LinearScan::handleOutgoingCriticalEdges(BasicBlock* block)
// live only at another target), and we can't copy another lclVar into that reg in this block.
regMaskTP sameToRegMask =
genRegMask(sameToReg, getIntervalForLocalVar(outResolutionSetVarIndex)->registerType);
if (maybeSameLivePaths && (liveOutRegs.IsRegNumInMask(sameToReg ARM_ARG(outVarRegType)) || sameWriteRegs.IsRegNumInMask(sameToReg ARM_ARG(outVarRegType))))
if (maybeSameLivePaths && (liveOutRegs.IsRegNumInMask(sameToReg ARM_ARG(outVarRegType)) ||
sameWriteRegs.IsRegNumInMask(sameToReg ARM_ARG(outVarRegType))))
{
sameToReg = REG_NA;
}
Expand Down Expand Up @@ -9217,7 +9218,8 @@ void LinearScan::handleOutgoingCriticalEdges(BasicBlock* block)
VarSetOps::AddElemD(compiler, diffResolutionSet, outResolutionSetVarIndex);
if (fromReg != REG_STK)
{
diffReadRegs.AddRegNumInMask(fromReg ARM_ARG(getIntervalForLocalVar(outResolutionSetVarIndex)->registerType));
diffReadRegs.AddRegNumInMask(
fromReg ARM_ARG(getIntervalForLocalVar(outResolutionSetVarIndex)->registerType));
}
}
else if (sameToReg != fromReg)
Expand All @@ -9226,7 +9228,8 @@ void LinearScan::handleOutgoingCriticalEdges(BasicBlock* block)
setVarReg(sameVarToRegMap, outResolutionSetVarIndex, sameToReg);
if (sameToReg != REG_STK)
{
sameWriteRegs.AddRegNumInMask(sameToReg ARM_ARG(getIntervalForLocalVar(outResolutionSetVarIndex)->registerType));
sameWriteRegs.AddRegNumInMask(
sameToReg ARM_ARG(getIntervalForLocalVar(outResolutionSetVarIndex)->registerType));
}
}
}
Expand Down Expand Up @@ -9749,7 +9752,7 @@ void LinearScan::resolveEdge(BasicBlock* fromBlock,
regMaskTP targetCandidates = targetRegsToDo;
while (targetCandidates.IsNonEmpty())
{
regNumber targetReg = genFirstRegNumFromMask(targetCandidates);
regNumber targetReg = genFirstRegNumFromMask(targetCandidates);
targetCandidates ^= targetReg;
if (location[targetReg] == REG_NA)
{
Expand Down Expand Up @@ -9779,7 +9782,7 @@ void LinearScan::resolveEdge(BasicBlock* fromBlock,
{
while (targetRegsReady.IsNonEmpty())
{
regNumber targetReg = genFirstRegNumFromMask(targetRegsReady);
regNumber targetReg = genFirstRegNumFromMask(targetRegsReady);
targetRegsToDo ^= targetReg;
targetRegsReady ^= targetReg;
assert(location[targetReg] != targetReg);
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/regMaskTPOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void regMaskTP::AddGprRegs(SingleTypeRegSet gprRegs)
// AddRegNum: This is similar to AddRegNumInMask(reg, regType) for all platforms
// except Arm. For Arm, it calls getRegMask() instead of genRegMask()
// to create a mask that needs to be added.
//
//
// Parameters:
// reg - Register to check
// type - type of register
Expand Down Expand Up @@ -130,7 +130,7 @@ void regMaskTP::AddRegsetForType(SingleTypeRegSet regsToAdd, var_types type)
// type - type of register
//
// Return: The register set of given type
//
//
SingleTypeRegSet regMaskTP::GetRegSetForType(var_types type) const
{
#ifdef HAS_MORE_THAN_64_REGISTERS
Expand Down
47 changes: 23 additions & 24 deletions src/coreclr/jit/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ inline bool compUnixX86Abi()
enum _regNumber_enum : unsigned
{
#define REGDEF(name, rnum, mask, sname, regTypeTag) REG_##name = rnum,
#define REGALIAS(alias, realname) REG_##alias = REG_##realname,
#define REGALIAS(alias, realname) REG_##alias = REG_##realname,
#include "register.h"

REG_COUNT,
Expand All @@ -122,7 +122,7 @@ enum _regMask_enum : uint64_t
{
RBM_NONE = 0,
#define REGDEF(name, rnum, mask, sname, regTypeTag) RBM_##name = mask,
#define REGALIAS(alias, realname) RBM_##alias = RBM_##realname,
#define REGALIAS(alias, realname) RBM_##alias = RBM_##realname,
#include "register.h"
};

Expand All @@ -131,7 +131,7 @@ enum _regMask_enum : uint64_t
enum _regNumber_enum : unsigned
{
#define REGDEF(name, rnum, mask, xname, wname, regTypeTag) REG_##name = rnum,
#define REGALIAS(alias, realname) REG_##alias = REG_##realname,
#define REGALIAS(alias, realname) REG_##alias = REG_##realname,
#include "register.h"

REG_COUNT,
Expand All @@ -143,7 +143,7 @@ enum _regMask_enum : uint64_t
{
RBM_NONE = 0,
#define REGDEF(name, rnum, mask, xname, wname, regTypeTag) RBM_##name = mask,
#define REGALIAS(alias, realname) RBM_##alias = RBM_##realname,
#define REGALIAS(alias, realname) RBM_##alias = RBM_##realname,
#include "register.h"
};

Expand All @@ -152,7 +152,7 @@ enum _regMask_enum : uint64_t
enum _regNumber_enum : unsigned
{
#define REGDEF(name, rnum, mask, sname, regTypeTag) REG_##name = rnum,
#define REGALIAS(alias, realname) REG_##alias = REG_##realname,
#define REGALIAS(alias, realname) REG_##alias = REG_##realname,
#include "register.h"

REG_COUNT,
Expand All @@ -165,7 +165,7 @@ enum _regMask_enum : uint64_t
RBM_NONE = 0,

#define REGDEF(name, rnum, mask, sname, regTypeTag) RBM_##name = mask,
#define REGALIAS(alias, realname) RBM_##alias = RBM_##realname,
#define REGALIAS(alias, realname) RBM_##alias = RBM_##realname,
#include "register.h"
};

Expand All @@ -174,7 +174,7 @@ enum _regMask_enum : uint64_t
enum _regNumber_enum : unsigned
{
#define REGDEF(name, rnum, mask, sname, regTypeTag) REG_##name = rnum,
#define REGALIAS(alias, realname) REG_##alias = REG_##realname,
#define REGALIAS(alias, realname) REG_##alias = REG_##realname,
#include "register.h"

REG_COUNT,
Expand All @@ -187,7 +187,7 @@ enum _regMask_enum : unsigned
RBM_NONE = 0,

#define REGDEF(name, rnum, mask, sname, regTypeTag) RBM_##name = mask,
#define REGALIAS(alias, realname) RBM_##alias = RBM_##realname,
#define REGALIAS(alias, realname) RBM_##alias = RBM_##realname,
#include "register.h"
};

Expand Down Expand Up @@ -230,15 +230,15 @@ typedef uint64_t regMaskSmall;
#endif

#ifdef TARGET_ARM64
#define HAS_MORE_THAN_64_REGISTERS 1
#define MORE_THAN_64_REGISTERS_ARG(x) , x
#define HAS_MORE_THAN_64_REGISTERS 1
#define MORE_THAN_64_REGISTERS_ARG(x) , x
#else
#define MORE_THAN_64_REGISTERS_ARG(x)
#endif // TARGET_ARM64

//TODO: Rename regMaskSmall as RegSet64 (at least for 64-bit)
// TODO: Rename regMaskSmall as RegSet64 (at least for 64-bit)
typedef regMaskSmall SingleTypeRegSet;
typedef unsigned RegSet32;
typedef unsigned RegSet32;
inline SingleTypeRegSet genSingleTypeRegMask(regNumber reg);

struct regMaskTP
Expand Down Expand Up @@ -270,9 +270,9 @@ struct regMaskTP
#endif

FORCEINLINE static int mapRegNumToRegTypeIndex(regNumber reg);
template<class T>
FORCEINLINE static int mapTypeToRegTypeIndex(T type);
FORCEINLINE static RegSet32 encodeForRegisterIndex(int index, regMaskSmall value);
template <class T>
FORCEINLINE static int mapTypeToRegTypeIndex(T type);
FORCEINLINE static RegSet32 encodeForRegisterIndex(int index, regMaskSmall value);
FORCEINLINE static regMaskSmall decodeForRegisterIndex(int index, RegSet32 value);

public:
Expand All @@ -282,17 +282,16 @@ struct regMaskTP
void RemoveRegNumFromMask(regNumber reg, var_types type);
bool IsRegNumInMask(regNumber reg, var_types type) const;
#endif
void AddGprRegs(SingleTypeRegSet gprRegs);
void AddRegNum(regNumber reg, var_types type);
void AddRegNumInMask(regNumber reg);
void AddRegsetForType(SingleTypeRegSet regsToAdd, var_types type);
void AddGprRegs(SingleTypeRegSet gprRegs);
void AddRegNum(regNumber reg, var_types type);
void AddRegNumInMask(regNumber reg);
void AddRegsetForType(SingleTypeRegSet regsToAdd, var_types type);
SingleTypeRegSet GetRegSetForType(var_types type) const;
bool IsRegNumInMask(regNumber reg) const;
bool IsRegNumPresent(regNumber reg, var_types type) const;
void RemoveRegNum(regNumber reg, var_types type);
void RemoveRegNumFromMask(regNumber reg);
void RemoveRegNum(regNumber reg, var_types type);
void RemoveRegNumFromMask(regNumber reg);
void RemoveRegsetForType(SingleTypeRegSet regsToRemove, var_types type);


regMaskTP(regMaskSmall lowMask, RegSet32 highMask)
: low(lowMask)
Expand Down Expand Up @@ -446,7 +445,7 @@ static bool operator==(const regMaskTP& first, const regMaskTP& second)
#ifdef HAS_MORE_THAN_64_REGISTERS
&& (first.getHigh() == second.getHigh())
#endif
;
;
}

static bool operator!=(const regMaskTP& first, const regMaskTP& second)
Expand Down Expand Up @@ -497,7 +496,7 @@ static uint32_t PopCount(const regMaskTP& value)
#ifdef HAS_MORE_THAN_64_REGISTERS
+ BitOperations::PopCount(value.getHigh())
#endif
;
;
}

static uint32_t BitScanForward(const regMaskTP& mask)
Expand Down

0 comments on commit b2d9b1c

Please sign in to comment.