Implement the "moffset" encoding size optimization in emitOutputAM
#62896
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.
The x86 encoding for direct addressing modes permits a short form for the case of
mov eax, [addr]
,mov [addr], eax
, without the ModR/M byte. We were already taking advantage of it when emitting statics (inemitOutputCV
). This change ports that optimization toemitOutputAM
(the "general" method handling all address modes, not justM
ones).There is an unfortunate part to this change and that is the fact it consists of essentially copying code (verbatim, to signify that). I don't know what is the intention behind the
CV/AM
split (they emit the same code on x64, and on x86, except for this special case), and I do not have the expertise necessary to refactor this with confidence, so that is why that is.There is a fortunate part to this change too though, and that is the fact it has some nice diffs attached to it. For unclear reasons, SPMI in CI did not capture them, so here is my locally obtained version: diffs.
As one would guess, this is another step in the direction of deleting
CLS_VAR
.