This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Add Missing Custom Target Operands
ClosedPublic

Authored by lenary on Mar 22 2023, 7:15 AM.

Details

Summary

I noticed, when examining the generated Asm Matcher table, that some of
these custom immediate operands are missing, and so we are not parsing
some hint aliases into the correct MCInst.

Where this becomes apparent is when you parse e.g. hint #7 into an
MCInst - without these cases, it becomes the MCInst (HINT 17), which
will always be printed as hint #17. With these cases, it becomes the
MCInst XPACLRI, which will be printed as xpaclri with pauth, or
hint #17 without, matching how xpaclri is parsed.

We only handle some specific hint aliases in this manner, usually where
these hints have specific effects that need to be modelled for accurate
code-generation. Otherwise, we just use the normal InstAlias system
to have the aliases parsed into a (HINT N) MCInst.

Diff Detail

Event Timeline

lenary created this revision.Mar 22 2023, 7:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 22 2023, 7:15 AM
lenary requested review of this revision.Mar 22 2023, 7:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 22 2023, 7:15 AM

To clarify the changes to the tests: they check that we can parse both hint #N and the mnemonic, and when printed they both print out exactly the same way, based on features (the mnemonic if you have pauth, or as hint #n otherwise).

This change should probably be marked [NFC] - because the disassembly output won't change in either case, and nor will the result of assembling into an object - the only difference in behaviour is if you parse assembly and then immediately print it again (like these tests do).

tmatheson accepted this revision.Mar 23 2023, 3:38 AM

LGTM

llvm/test/MC/AArch64/armv8.3a-signed-pointer.s
176

These could do with being reordered numerically

This revision is now accepted and ready to land.Mar 23 2023, 3:38 AM
lenary added inline comments.Mar 23 2023, 3:47 AM
llvm/test/MC/AArch64/armv8.3a-signed-pointer.s
176

They could, I might do that in a separate NFC change so the history is clearer.

This revision was landed with ongoing or failed builds.Mar 23 2023, 8:15 AM
This revision was automatically updated to reflect the committed changes.