This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU][MC][NFC] Parser refactoring
ClosedPublic

Authored by dp on Dec 18 2020, 8:53 AM.

Details

Summary

Minimized use of Parser.Lex() by using higher-level parse functions.
For example, a commonly used pattern

if (getLexer().isNot(Tok)) { return err; } Parser.Lex();

may be replaced with the following code:

if (!trySkipToken(Tok)) { return err; }

Diff Detail

Event Timeline

dp created this revision.Dec 18 2020, 8:53 AM
dp requested review of this revision.Dec 18 2020, 8:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 18 2020, 8:53 AM
dp added inline comments.Dec 18 2020, 8:59 AM
llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
5144

After this change callers of parseStringWithPrefix no longer need to call lex()

7352

Looks like this call is no longer necessary.

rampitec accepted this revision.Dec 18 2020, 12:22 PM
This revision is now accepted and ready to land.Dec 18 2020, 12:22 PM
This revision was automatically updated to reflect the committed changes.