Since the OpenACC atomics specification is a subset of OpenMP atomics,
the same lowering implementation can be used. This change extracts out
the necessary pieces from the OpenMP lowering and puts them in a shared
spot. The shared spot is a header file (in the lib directory) so that
each implementation can template specialize directly.
After putting the OpenMP implementation in a common spot, the following
changes were needed to make it work for OpenACC:
- Ensure parsing works correctly by avoiding hardcoded offsets.
- Templatize based on atomic type.
- The checking whether it is OpenMP or OpenACC is done by checking
for OmpAtomicClauseList (OpenACC does not implement this so we just
templatize with void). It was preferable to check this instead of atomic
type because in some cases, like atomic capture, the read/write/update
implementations are called - and we want compile time evaluation of
these conditional parts.
- The memory order and hint are used only for OpenMP.
- Generate acc dialect operations instead of omp dialect operations.
Depends on D158768