This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU][AsmParser][NFC] Refine immediate operand definitions.
ClosedPublic

Authored by kosarev on Feb 28 2023, 5:28 AM.

Diff Detail

Event Timeline

kosarev created this revision.Feb 28 2023, 5:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 28 2023, 5:28 AM
kosarev requested review of this revision.Feb 28 2023, 5:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 28 2023, 5:28 AM
kosarev updated this revision to Diff 501107.Feb 28 2023, 5:33 AM

Rework smrd_literal_offset as well.

dp added inline comments.Mar 23 2023, 5:40 AM
llvm/lib/Target/AMDGPU/AMDGPUInstructions.td
137

This redefinition is unnecessary, 'let' would suffice.

llvm/lib/Target/AMDGPU/SMInstructions.td
750

Shouldn't this operand be optional?

kosarev added inline comments.Mar 29 2023, 9:28 AM
llvm/lib/Target/AMDGPU/AMDGPUInstructions.td
137

Can you elaborate? I'm not sure I understand the suggestion.

llvm/lib/Target/AMDGPU/SMInstructions.td
750

Nope, isSMRDLiteralOffset() doesn't accept zeroes.

dp added inline comments.Mar 29 2023, 9:38 AM
llvm/lib/Target/AMDGPU/AMDGPUInstructions.td
137

It looks like the code

AsmOperandClass ParserMatchClass = ImmOperandClass<name, optional>;

may be simplified as follows:

let ParserMatchClass = ImmOperandClass<name, optional>;
llvm/lib/Target/AMDGPU/SMInstructions.td
750

Oh I see, thanks.

kosarev updated this revision to Diff 509423.Mar 29 2023, 11:08 AM

The redefinition fixed.

dp accepted this revision.Mar 29 2023, 11:30 AM

LGTM

This revision is now accepted and ready to land.Mar 29 2023, 11:30 AM
This revision was landed with ongoing or failed builds.Mar 30 2023, 7:16 AM
This revision was automatically updated to reflect the committed changes.