This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU][MC] Refactored parsing of dpp ctrl
ClosedPublic

Authored by dp on Jan 15 2021, 6:43 AM.

Details

Summary

Summary of changes:

  • simplified code to improve maintainability;
  • replaced lex() with higher level parser functions;
  • improved errors handling.

Diff Detail

Event Timeline

dp created this revision.Jan 15 2021, 6:43 AM
dp requested review of this revision.Jan 15 2021, 6:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 15 2021, 6:43 AM
dp added inline comments.Jan 15 2021, 6:46 AM
llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
7349

Operands are required for future extensions.

rampitec added inline comments.Jan 15 2021, 10:53 AM
llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
7405

getLoc()? Loc is a single use variable.

dp added inline comments.Jan 15 2021, 11:32 AM
llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
7405

If the expression value is out of bounds, and we call getLoc() later, we will refer an incorrect error position (the next token after the expression).

In the following test

v_mov_b32_dpp v5, v1 quad_perm:[3,2,1,4] row_mask:0x0 bank_mask:0x0

assembler wil point to ']', rather than the offending '4'.

This revision is now accepted and ready to land.Jan 15 2021, 11:34 AM
This revision was automatically updated to reflect the committed changes.