This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][OMPIRBuilder] Add a configuration class to captures flags/attributes that affect codegen
ClosedPublic

Authored by jsjodin on Nov 17 2022, 9:12 AM.

Details

Summary

This patch introudces the OpenMPIRBuilderConfig class which contains various
flags that are needed to lower OMP constructs to LLVM-IR. The purpose is to
keep the flags in one place so they do not have to be passed in every time.
The flags can be set optionally since some uses cases don't rely on functions
that depend on these flags.

Diff Detail

Event Timeline

jsjodin created this revision.Nov 17 2022, 9:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 17 2022, 9:12 AM
jsjodin requested review of this revision.Nov 17 2022, 9:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 17 2022, 9:12 AM

Optional<bool> is an odd data structure. I would use enums instead to describe the different states.

llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
83

compilation

Optional<bool> is an odd data structure. I would use enums instead to describe the different states.

It is the standard data structure used in LLVM to encode optional data. Why would using an enum be better?

jsjodin added inline comments.Nov 17 2022, 11:19 AM
llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
83

Thanks for catching that. I will fix it.

jdoerfert accepted this revision.Nov 18 2022, 1:52 PM

LG. I think the Optional<bool> are fine, otherwise we have 3 enums for each of them which is even more boilerplate. @tschuett, OK with this?

This revision is now accepted and ready to land.Nov 18 2022, 1:52 PM
jsjodin updated this revision to Diff 476893.Nov 21 2022, 7:00 AM

Fix typo in comment.

jsjodin marked an inline comment as done.Nov 21 2022, 7:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 22 2022, 6:28 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript