[Flang][OpenMP][MLIR] Add declare target attribute set and interface for the OpenMP...
authorAndrew Gozillon <Andrew.Gozillon@amd.com>
Mon, 22 May 2023 10:40:16 +0000 (05:40 -0500)
committerAndrew Gozillon <Andrew.Gozillon@amd.com>
Mon, 22 May 2023 10:41:06 +0000 (05:41 -0500)
commit95b0b867b0d19919133693b8e75b170fd25a9cec
tree860685d424714dab10477a8bcb7e0960648af77f
parent38140255113297fe3e7926d311cd45004928779e
[Flang][OpenMP][MLIR] Add declare target attribute set and interface for the OpenMP dialect

This attribute represents the OpenMP declare target directive, it marks a function
or global as declare target by being present but also contains information on
the device_type and capture clause (link or to). It being an attribute allows it to
mark existing constructs and be converted trivially on lowering from the OpenMP
dialect to MLIR using amendOperation.

An interface has been made for the declare target attribute, with several helper
methods for managing the attribute, this interface can be applied to MLIR
operations that are allowed to be marked as declare target (as an example, it
is by default applied to func.func, LLVMFunc, fir.GlobalOps and LLVMGlobalOps).

Reviewers: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D150328
flang/include/flang/Optimizer/Dialect/FIRDialect.h
flang/lib/Optimizer/Dialect/FIRDialect.cpp
flang/lib/Optimizer/Dialect/FIROps.cpp
flang/test/Fir/omp-declare-target-data.fir [new file with mode: 0644]
mlir/include/mlir/Dialect/OpenMP/OpenMPInterfaces.h
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
mlir/include/mlir/Dialect/OpenMP/OpenMPOpsInterfaces.td
mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
mlir/test/Dialect/OpenMP/attr.mlir