This is an archive of the discontinued LLVM Phabricator instance.

[flang][openacc] Use TableGen to generate the clause parser
ClosedPublic

Authored by clementval on Jul 28 2021, 8:10 AM.

Details

Summary

This patch introduce an automatic generation of the clause parser from the TableGen
information.

New information can be stored directly in the TableGen file:

  • The different aliases that a clause support.
  • prefix before a value.
  • whether a prefix is optional or not.

Makes it easier to add new clauses and also avoid some error (write clause incorrect until now).

This patch is updating only the OpenACC part. A patch with a modification of the OpenMP clause parser will follow.

Diff Detail

Event Timeline

clementval created this revision.Jul 28 2021, 8:10 AM
clementval requested review of this revision.Jul 28 2021, 8:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 28 2021, 8:10 AM
clementval edited the summary of this revision. (Show Details)Jul 28 2021, 8:16 AM
clementval added a project: Restricted Project.
clementval edited the summary of this revision. (Show Details)Jul 28 2021, 8:22 AM
clementval updated this revision to Diff 443224.Jul 8 2022, 5:46 AM
clementval edited the summary of this revision. (Show Details)

Rebase

Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 8 2022, 5:46 AM
clementval edited the summary of this revision. (Show Details)Jul 8 2022, 5:46 AM
clementval edited reviewers, added: PeteSteinfeld, jeanPerier; removed: jdoerfert, SouraVX, kiranktp.

All builds and tests correctly and looks good. But I don't understand this code very well. Someone with relevant expertise should approve.

LGTM.

I have a Nit and a question.

flang/lib/Parser/openacc-parsers.cpp
25–27

Nit: Can you expand the comment to briefly describe what is the kind of clauses for which parsers can be autogenerated? Or alternatively, what kind of clause parsers are not autogenerated?

llvm/utils/TableGen/DirectiveEmitter.cpp
774

I see that this is autogenerating clause parsers for OpenMP as well. Will you be creating a patch for enabling it or would you like one of us to do it?

This revision is now accepted and ready to land.Jul 12 2022, 3:56 PM
llvm/utils/TableGen/DirectiveEmitter.cpp
774

I see that you have covered this in the summary. Thanks.

This revision was landed with ongoing or failed builds.Jul 18 2022, 12:27 AM
This revision was automatically updated to reflect the committed changes.
clementval marked 3 inline comments as done.
clementval added inline comments.Jul 18 2022, 12:28 AM
llvm/utils/TableGen/DirectiveEmitter.cpp
774

I'm not sure when I can work on that but it's on my todo list.