This is an archive of the discontinued LLVM Phabricator instance.

[LoongArch] Add custom parser for atomic instructions' memory operand
ClosedPublic

Authored by wangleiat on Dec 5 2022, 2:01 AM.

Details

Summary

In order to be compatible with the form of the atomic instruction in
GAS that accepts the fourth operand as 0 (i.e. am* $rd, $rk, $rj, 0),
we need to treat $rj, 0 as one operand, but only print $rj.

For this, the number of result operands of inline assembly memory
operand ZB constraint is modified to 2 (reg + 0).

Restrictions on register usage in am* instructions have also been
adjusted. When $rd is equal to $r0, the instruction must be
considered legal, because of some special usage like PseudoUNIMP.

Diff Detail

Event Timeline

wangleiat created this revision.Dec 5 2022, 2:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 5 2022, 2:01 AM
wangleiat requested review of this revision.Dec 5 2022, 2:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 5 2022, 2:01 AM
SixWeining accepted this revision.Dec 7 2022, 2:00 AM

LGTM but let's wait for others.

llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchInstPrinter.cpp
64

Seems this line is useless.

This revision is now accepted and ready to land.Dec 7 2022, 2:00 AM
xen0n accepted this revision.Dec 7 2022, 10:39 PM
xen0n edited the summary of this revision. (Show Details)

LGTM, thanks!

I've fixed the formatting of the summary for you (the ordered lists can't be used to write Chinese-style paragraphs) while at it.

LGTM, thanks!

I've fixed the formatting of the summary for you (the ordered lists can't be used to write Chinese-style paragraphs) while at it.

Thank you very much!

llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchInstPrinter.cpp
64

Thanks, i'll remove it.

wangleiat updated this revision to Diff 481202.Dec 8 2022, 1:56 AM

Address @SixWeining's comment.

This revision was landed with ongoing or failed builds.Dec 12 2022, 7:47 PM
This revision was automatically updated to reflect the committed changes.