Cranelift: Utilize AMode::RegScaled on aarch64#6743
Conversation
|
@alexcrichton or @cfallin, could you take a look at this? |
|
Sure yeah I can help review. Looking over this I can't help but personally feel that a bit of a refactor is in order (preexisting issue, not a new one) as I find it a bit odd to follow. This feels similar to the addressing that historically happened in x64 but I changed awhile back where it was recursive and walked thorugh an entire Instead I liked the idea in the x64 backend where you start with an Now I realize though that the refactoring may be a bit bigger than desired though on this PR. I bring this up though because this PR has a few bugs I'll list below. I think the bugs stem from the fact that currently the only pattern matched is "a bunch of adds" and the pattern matching add here should only match a single shift in a very specific location as opposed to any location. Multiple shifted operands yields: A single shifted operand yields: Shift not actually taken into account yields: (note that processing of There's also a number of other cases here where Those are some examples which are currently incorrect with this PR, and at least personally I don't see an "easy fix" with a small piece of handling here-or-there to fix these issues. That's why I think that it may be best to refactor this amode computation to be a bit simpler than before (probably in ISLE rather than Rust) and then I think it might be less brittle to add a special case. For example a I could very well be wrong though and there may be an easy fix to these issues. |
|
I appreciate your detailed comment. I totally agree that we need to refactor this amode computation, since I thought so when I first read the code... Also the bugs you mentioned are really helpful (and I should have tested on such cases). I plan on adding ISLE rules that replaces the existing amode computation. |
|
I tried adding ISLE rules that replace existing |
|
I've made a first attempt in #6805 to move |
Summary
AMode::RegScaledon aarch64 #6742lower_addressshould be rewritten in ISLE in the future.