This is an archive of the discontinued LLVM Phabricator instance.

[openmp][openacc][NFC] Add wrapper for records in DirectiveEmitter
ClosedPublic

Authored by clementval on Jul 26 2020, 5:30 PM.

Details

Summary

Add wrapper classes to to access record's fields. This makes it easier to
pass record information to the diverse functions for code generation.

Diff Detail

Event Timeline

clementval created this revision.Jul 26 2020, 5:30 PM

Fix clang-tidy wanrings

Are you following an existing TableGen emitter as a precedent for this kind of thin wrapper design?

llvm/include/llvm/Frontend/OpenACC/ACC.td
604 ↗(On Diff #280991)

This change doesn't appear to be relevant to this patch and can be committed without review anyway.

llvm/utils/TableGen/DirectiveEmitter.cpp
53

function -> functions

place -> placed

58

To the enums or the enumerators within them? I'm comparing to your comments in DirectiveBase.td.

64

Likewise

69

This documentation effectively defers to documentation in DirectiveBase.td. Other getter documentation here duplicates parts of the field documentation in DirectiveBase.td instead.

I'm not sure which is better, but the documentation should be consistent. Duplication is obviously bad for maintenance, but does it improve readability here? An alternative would be to just write one comment that encloses all getters and that defers to DirectiveBase.td.

130

onced -> once

156

clanmg -> clang

Is the fact that this is optional important to callers? Likewise for getFlangClass.

167

This conflates isImplicit and isDefault.

171

Should this comment be different than the one on Clause?

340

I think the above would be easier to read if VerClause.getClause().getFormattedName() were stored in a local variable instead of repeated.

clementval marked an inline comment as done.Jul 28 2020, 11:11 AM

Are you following an existing TableGen emitter as a precedent for this kind of thin wrapper design?

I'm following the way it is done with MLIR table gen usage. You can find a bunch of them in mlir/include/mlir/TableGen.

Thanks for your comments. I'll update the patch today.

llvm/include/llvm/Frontend/OpenACC/ACC.td
604 ↗(On Diff #280991)

Right. Look like it was edited by me editor and made its way in the review ... I'll remove it from this patch.

llvm/utils/TableGen/DirectiveEmitter.cpp
69

Agreed. I'll update that.

156

Yeah as it might be null. Will update the comment.

clementval marked 10 inline comments as done.

Address review comments

Just updated the patch.

llvm/utils/TableGen/DirectiveEmitter.cpp
69

I have removed the comments in the wrapper since they do not provide more information than the one in DirectiveBase.td. I point to this file for more information.

167

Fixed that.

171

Yes. I just fixed it.

340

Agreed. I updated it.

jdenny accepted this revision.Jul 28 2020, 1:45 PM

Should this patch be marked NFC?

Except for some tiny fixes, LGTM. Thanks for the changes and the pointer to MLIR.

llvm/utils/TableGen/DirectiveEmitter.cpp
44

them -> it. "information" is singular. Likewise in other comments below.

133

Clase -> Clause

This revision is now accepted and ready to land.Jul 28 2020, 1:45 PM

Should this patch be marked NFC?

Except for some tiny fixes, LGTM. Thanks for the changes and the pointer to MLIR.

Right, I'll flag it as NFC.

llvm/utils/TableGen/DirectiveEmitter.cpp
44

Thanks pointer. Sorry for my broken English. I'll update that.

133

Good catch!

clementval retitled this revision from [openmp][openacc] Add wrapper for records in DirectiveEmitter to [openmp][openacc][NFC] Add wrapper for records in DirectiveEmitter.Jul 28 2020, 4:46 PM
clementval marked an inline comment as done.

Fix some typo

clementval marked an inline comment as done.Jul 28 2020, 5:44 PM
This revision was landed with ongoing or failed builds.Jul 28 2020, 5:47 PM
This revision was automatically updated to reflect the committed changes.