-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Adding additional 8 eGPR. #113988
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
Adding additional 8 eGPR. #113988
Changes from 4 commits
fd5fb2f
3bb0a4e
5363283
963c341
cb20541
3c38b92
4c6e85a
93bc1dd
cca23f8
247a89c
bee91d4
1be98c6
163478e
3f07022
374f85b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,7 +43,7 @@ inline static bool isHighGPReg(regNumber reg) | |
| #ifdef TARGET_AMD64 | ||
| // TODO-apx: the definition here is incorrect, we will need to revisit this after we extend the register definition. | ||
| // for now, we can simply use REX2 as REX. | ||
|
||
| return ((reg >= REG_R16) && (reg <= REG_R23)); | ||
| return ((reg >= REG_R16) && (reg <= REG_R31)); | ||
| #else | ||
| // X86 JIT operates in 32-bit mode and hence extended regs are not available. | ||
| return false; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -521,6 +521,7 @@ class RegRecord : public Referenceable | |
| } | ||
| #endif // FEATURE_MASKED_HW_INTRINSICS | ||
| regNum = reg; | ||
| nextRegNum = REG_NEXT(regNum); | ||
| isCalleeSave = ((RBM_CALLEE_SAVED & genRegMask(reg)) != 0); | ||
| } | ||
|
|
||
|
|
@@ -544,6 +545,7 @@ class RegRecord : public Referenceable | |
| Interval* previousInterval; | ||
|
|
||
| regNumber regNum; | ||
| regNumber nextRegNum; // the next active register. | ||
|
||
| bool isCalleeSave; | ||
| unsigned char regOrder; | ||
| }; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1936,6 +1936,10 @@ void LinearScan::buildPhysRegRecords() | |
| RegRecord* curr = &physRegs[reg]; | ||
| curr->init(reg); | ||
| } | ||
| #if defined(TARGET_AMD64) | ||
|
||
| RegRecord* lastInt = &physRegs[get_REG_INT_LAST()]; | ||
| lastInt->nextRegNum = REG_FP_FIRST; | ||
| #endif // TARGET_AMD64 | ||
| for (unsigned int i = 0; i < lsraRegOrderSize; i++) | ||
| { | ||
| regNumber reg = lsraRegOrder[i]; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -239,6 +239,10 @@ typedef uint64_t regMaskSmall; | |
| #define HAS_MORE_THAN_64_REGISTERS 1 | ||
| #endif // TARGET_ARM64 | ||
|
|
||
| #ifdef TARGET_AMD64 | ||
|
||
| #define HAS_MORE_THAN_64_REGISTERS 1 | ||
| #endif // TARGET_AMD64 | ||
|
|
||
| #define REG_LOW_BASE 0 | ||
| #ifdef HAS_MORE_THAN_64_REGISTERS | ||
| #define REG_HIGH_BASE 64 | ||
|
|
||
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.
Why did you move this only for x64?
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.
The "Space taken up to here" comment, below, is now wrong and needs to be updated, as do the "Space taken up to here" comments that follow.
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's a bit of a weird problem.
REGNUM_BITSchanging from6to7results in_idReg1and_idReg2taking up an extra bit each. This throws off theinstrDescsize forx64and increases it significantly due to padding. My solution was to move around the position of_idReg1and_idReg2to a position forx64which did not cause addition of as many padding bits.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 wonder why it matters where
_idReg1/_idReg2are placed to determine padding. All type types here have a base type ofunsignedwhich means that bitfields of them should all be able bit packable. It might make sense for performance reasons to avoid splitting_idReg1/_idReg2across 32-bit (or maybe even byte) boundaries, but that's not why you did it.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.
For reference
In main with no changes

If I just add new registers with no change in order for x64

With the change highlighted by you in the PR

Uh oh!
There was an error while loading. Please reload this page.
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.
If i leave it as was, _idReg1 cannot stay within 32 bit boundary since it starts at Byte 3, Bit 2(It was not a problem earlier when it was 6 bits). So, it gets moved to Byte 4, Bit 0
Edit - that's my interpretation
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.
Oh, I see: a bit field can't extend beyond the limit of the base type (here,
unsigned).btw, is the tool your using to show field offsets public?
Uh oh!
There was an error while loading. Please reload this page.
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.
The screenshot I used here is from Visual Studio. Click on memory layout from below
The memory viewer in Visual Studio Code isn't as intuitive
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 have updated the "Space taken up to here" comments