Skip to content
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

AArch64: Implement large offset path for loadaddrEvaluator() #4718

Merged
merged 1 commit into from
Feb 27, 2020

Conversation

knn-k
Copy link
Contributor

@knn-k knn-k commented Jan 14, 2020

This commit implements the path in AArch64 OMRMemoryReference for
handling offsets wider than 12 bits.
It is used by loadaddrEvaluator().

Signed-off-by: KONNO Kazuhiro konno@jp.ibm.com

@knn-k
Copy link
Contributor Author

knn-k commented Jan 17, 2020

Need to consider the case where the target register and the base register of loadaddr are the same real register.

This commit implements the path in AArch64 OMRMemoryReference for
handling offsets wider than 12 bits.
It is used by loadaddrEvaluator().

Signed-off-by: KONNO Kazuhiro <konno@jp.ibm.com>
@knn-k knn-k changed the title WIP: AArch64: Implement large offset path for loadaddrEvaluator() AArch64: Implement large offset path for loadaddrEvaluator() Feb 3, 2020
if (needSpill)
{
immreg = cg->machine()->getRealRegister(
(base->getRegisterNumber() == TR::RealRegister::x12) ? TR::RealRegister::x11 : TR::RealRegister::x12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there some significance to these particular registers, or are they just arbitrarily chosen?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No particular reason. I chose them from volatile registers that are not used for method arguments.

cursor += ARM64_INSTRUCTION_LENGTH;
}
else
{
TR_ASSERT_FATAL(false, "Offset is too large for specified instruction.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see this as a temporary solution to get something to work, but I'm a bit hesitant to call this the long-term solution. This code appears to make an arbitrary spilling decision without considering the actual availability of the register being spilled. Given the number of registers available on this architecture, there's probably a good chance that in many cases the register is already free in which case the spill is unneeded.

This is a problem faced by the other code generators too (realizing that a register needs to be used after register allocation/assignment has occurred) and each solves the problem differently depending on the context. In this particular situation, one way to solve it might be that when this memory reference is register assigned and it knows that there is the possibility that a register might be needed during binary encoding, it could ask the machine for the current register state and record one of the free registers just in case it might be needed. The binary encoding would use that free register without a spill, or arbitrarily spill some register if there were none available.

This PR is probably OK as an initial contribution, but I would like an issue opened to track the work to implement something that makes more careful use of registers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you open an issue as I requested above so that we can move this along please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened Issue #4862 for this.

@knn-k
Copy link
Contributor Author

knn-k commented Feb 25, 2020

@genie-omr build aarch64

@0xdaryl 0xdaryl merged commit 64aaf51 into eclipse-omr:master Feb 27, 2020
@knn-k knn-k deleted the aarch64memref15 branch February 27, 2020 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants