-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LSRA: Make genRegMask() return regMaskTP
#102783
Conversation
…ffect on non-LSRA code
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
@shushanhf @dotnet/samsung |
@dotnet/jit-contrib @jakobbotsch PTAL |
// TODO: Populate regMaskTP based on reg | ||
return genSingleTypeRegMask(reg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even with predicate registers I would expect us to end up with basically the same logic as before, i.e. something like regMaskTP(1) << reg
, probably encapsulating that operation inside regMaskTP
. That is, we leave the regNumber
mappings for predicate registers to just follow the float registers so that all reg numbers are unique.
Of course LSRA is going to need slightly different logic to map SingleTypeRegSet
to regMaskTP
which ends up requiring additional context about the type of set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, we basically will use the old logic of genRegMask()
and use that value to set appropriate field of regMaskTP
.
#ifdef TARGET_AMD64 | ||
return RBM_FLT_CALLEE_TRASH.GetFloatRegSet(); | ||
#else | ||
return RBM_FLT_CALLEE_TRASH; | ||
#endif // TARGET_AMD64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the ifdef necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, for amd64, RBM_FLT_CALLEE_TRASH
maps to get_RBM_FLT_CALLEE_TRASH()
which returns regMaskTP
but for other platforms, it is just uint64_t
or SingleTypeRegSet
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will see if I can unify this in future as this work evolves.
#ifdef TARGET_AMD64 | ||
availableFloatRegs = RBM_ALLFLOAT.GetFloatRegSet(); | ||
availableDoubleRegs = RBM_ALLDOUBLE.GetFloatRegSet(); | ||
#else | ||
availableFloatRegs = RBM_ALLFLOAT; | ||
availableDoubleRegs = RBM_ALLDOUBLE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question, can this use the AMD64 logic for everyone?
#ifdef TARGET_XARCH | ||
freeRegs &= RBM_CALLEE_TRASH.GetRegSetForType(type); | ||
#else | ||
freeRegs &= RBM_CALLEE_TRASH; | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM. A few minor questions/general comments on future design.
/ba-g failures are dotnet/dnceng#2378 and #102773 |
* 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
Address feedback in #102592 (comment)
genRegMask()
fromSingleTypeRegSet
toregMaskTP
rbmAllFloat
fromSingleTypeRegSet
toregMaskTP
genSingleTypeRegMask()
that will be used in LSRA whenever we want to map a register number to the maskgenRegMask()
will continue to returnregMaskTP
that will be used in non-LSRA code base.