-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[RISC-V] Use common CodeGen::genHomeRegisterParams #101288
Merged
Merged
Changes from 8 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
25ab569
Code review from #101114
tomeksowi 6c01d95
Use common genHomeRegisterParams on RISC-V
tomeksowi 5423299
Make passSlot integer-only because we know hardware floating-point ca…
tomeksowi 06e9d65
Repurpose genHomeSwiftStructParameters for reassembling structs on RI…
tomeksowi 85c2217
Code review
tomeksowi 2a97285
Merge branch 'main' into use-new-abi-classifiers
tomeksowi 5a0aede
genHome(Reassembled=>Stack)Parameters rename
tomeksowi 4806478
Call genHomeStackParams(true) in prolog generation for RISC-V to avoi…
tomeksowi 123fcee
Leave Swift codes alone
tomeksowi 9c565ac
Make a RISC-V specific routine for homing stack parts of split parame…
tomeksowi c86cb09
Move genHomeStackPartOfSplitParameter out of genHomeSwiftStructParame…
tomeksowi 7989c18
Merge branch 'main' into use-new-abi-classifiers
tomeksowi 5225a43
fix x64 build
tomeksowi f7b0bcc
format
tomeksowi bfaf9ce
review
tomeksowi 2d2717e
remove comment
tomeksowi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2802,7 +2802,6 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | ||
*/ | ||
|
||
#if !defined(TARGET_RISCV64) | ||
struct RegNode; | ||
|
||
struct RegNodeEdge | ||
|
@@ -3346,8 +3345,6 @@ void CodeGen::genHomeRegisterParams(regNumber initReg, bool* initRegStillZeroed) | |
} | ||
} | ||
|
||
#endif | ||
|
||
// ----------------------------------------------------------------------------- | ||
// genGetParameterHomingTempRegisterCandidates: Get the registers that are | ||
// usable during register homing. | ||
|
@@ -4122,32 +4119,34 @@ void CodeGen::genEnregisterOSRArgsAndLocals() | |
} | ||
} | ||
|
||
#ifdef SWIFT_SUPPORT | ||
#if defined(SWIFT_SUPPORT) || defined(TARGET_RISCV64) | ||
|
||
//----------------------------------------------------------------------------- | ||
// genHomeSwiftStructParameters: | ||
// Reassemble Swift struct parameters if necessary. | ||
// genHomeStackParams: | ||
// Reassemble parameters if necessary. | ||
// | ||
// Parameters: | ||
// handleStack - If true, reassemble the segments that were passed on the stack. | ||
// If false, reassemble the segments that were passed in registers. | ||
// | ||
void CodeGen::genHomeSwiftStructParameters(bool handleStack) | ||
void CodeGen::genHomeStackParams(bool handleStack) | ||
{ | ||
for (unsigned lclNum = 0; lclNum < compiler->info.compArgsCount; lclNum++) | ||
{ | ||
#ifdef SWIFT_SUPPORT | ||
if (lclNum == compiler->lvaSwiftSelfArg) | ||
{ | ||
continue; | ||
} | ||
#endif | ||
|
||
LclVarDsc* dsc = compiler->lvaGetDesc(lclNum); | ||
if ((dsc->TypeGet() != TYP_STRUCT) || compiler->lvaIsImplicitByRefLocal(lclNum) || !dsc->lvOnFrame) | ||
{ | ||
continue; | ||
} | ||
|
||
JITDUMP("Homing Swift parameter V%02u: ", lclNum); | ||
JITDUMP("Homing reassembled parameter V%02u: ", lclNum); | ||
const ABIPassingInformation& abiInfo = compiler->lvaGetParameterABIInfo(lclNum); | ||
DBEXEC(VERBOSE, abiInfo.Dump()); | ||
|
||
|
@@ -4185,9 +4184,13 @@ void CodeGen::genHomeSwiftStructParameters(bool handleStack) | |
case 2: | ||
loadType = TYP_USHORT; | ||
break; | ||
case 3: | ||
case 4: | ||
loadType = TYP_INT; | ||
break; | ||
case 5: | ||
case 6: | ||
case 7: | ||
case 8: | ||
loadType = TYP_LONG; | ||
break; | ||
|
@@ -4224,7 +4227,7 @@ void CodeGen::genHomeSwiftStructParameters(bool handleStack) | |
} | ||
} | ||
} | ||
#endif | ||
#endif // defined(SWIFT_SUPPORT) || defined(TARGET_RISCV64) | ||
|
||
/*----------------------------------------------------------------------------- | ||
* | ||
|
@@ -5516,7 +5519,7 @@ void CodeGen::genFnProlog() | |
intRegState.rsCalleeRegArgMaskLiveIn &= ~RBM_SWIFT_ERROR; | ||
} | ||
|
||
genHomeSwiftStructParameters(/* handleStack */ false); | ||
genHomeStackParams(/* handleStack */ false); | ||
} | ||
#endif | ||
|
||
|
@@ -5552,6 +5555,13 @@ void CodeGen::genFnProlog() | |
genEnregisterIncomingStackArgs(); | ||
} | ||
|
||
#ifdef TARGET_RISCV64 | ||
if (compiler->fgFirstBBisScratch() && compiler->lvaHasAnyStackParamToReassemble()) | ||
{ | ||
genHomeStackParams(/* handleStack */ true); | ||
} | ||
#endif | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The scratch BB is not necessary when it happens during the prolog. I think it would be better to do this before you home register parameters (in the non-OSR case above), and passing |
||
|
||
/* Initialize any must-init registers variables now */ | ||
|
||
if (initRegs) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Isn't this going to result in a lot of extra stack stores for RISCV?
At this point it seems like just factoring parts of this helper out and calling it from the same place as
genHomeRegisterParams
on the split stack segment will end up being a simpler change overall.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.
It didn't make unnecessary stores from what I examined the diffs but you're right, a RISC-V specific routine (I tried to phrase it so LoongArch can also reuse) turned out much handier.