Jit64: Clean up ExtractWithByteOffset #12672
Merged
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.
RCOpArg::ExtractWithByteOffset
is only used in one place: a special case ofrlwinmx
.ExtractWithByteOffset
first stores the value of the specified register intom_ppc_state
(unless it's already there), and then returns an offset intom_ppc_state
. Our use of this function has two undesirable properties (except in the trivial caseoffset == 0
):ExtractWithByteOffset
callsStoreFromRegister
without going through any of the usual functions. This violated an assumption I made when working on my constant propagation PR and led to a hard-to-find bug.ExtractWithByteOffset
will store its value tom_ppc_state
even when it's unnecessary. In particular, this always happens whenrlwinmx
uses the same register as input and output, sincerlwinmx
always allocates a host register for the output and marks it as dirty.Since
ExtractWithByteOffset
is only used in one place, I figure we might as well inline it there. This commit does that, and also altersrlwinmx
's logic so the special case code is only triggered when the input is already inm_ppc_state
.Input in
m_ppc_state
, before (11 bytes):Input in
m_ppc_state
, after (5 bytes):Input in host register, before (8 bytes):
Input in host register, after (3 bytes):