This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][bbc][flang] Add _OPENMP macro definition
ClosedPublic

Authored by domada on May 22 2023, 5:46 AM.

Details

Summary

OpenMP standard (section 3.3 for OpenMP 5.2) requires that _OPENMP macro contains release date of given OpenMP standard version.

Diff Detail

Event Timeline

domada created this revision.May 22 2023, 5:46 AM
domada requested review of this revision.May 22 2023, 5:46 AM
flang/lib/Frontend/CompilerInvocation.cpp
1003–1038

Can this code be shared with bbc?

I am assuming it is not possible to share the code with the clang driver.

domada updated this revision to Diff 527344.Jun 1 2023, 3:04 AM

Scope of changes:

  1. Create one function common for bbc and Flang frontend to set _OPENMP macro
  2. Use setOpenMPmacro function inside Flang frontend and bbc source code.

Function is placed in flang/include/flang/Common/OpenMP-features.h header file. flang/include/flang/Common is directory which is shared between bbc and flang frontend.

domada added inline comments.Jun 1 2023, 3:11 AM
flang/lib/Frontend/CompilerInvocation.cpp
1003–1038

Hi Kiran,
thank you for your feedback.

You are right, that the possibility of code sharing between bbc and clang driver is limited.

I observed that both tools use header files from directory`flang/include/flang/Common`. That's why I decided to create another header and place there function for setting _OPENMP macro.

This revision is now accepted and ready to land.Jun 2 2023, 9:49 AM
This revision was automatically updated to reflect the committed changes.