For a block of Fortran code like this:
FUNCTION FUNC() RESULT(X) !$omp declare target INTEGER :: X X = 1 END FUNCTION FUNC
A target.declare operation of the following form would be created:
omp.target.declare to([@_QPfunc]) device_type(devicetypehost)
Where @_QPfunc is an MLIR symbol reference to the created MLIR FuncOp.
This patch includes an MLIR OpenMP Dialect operation added to OpenMPOps.td which takes 3 arguments representing the directives clauses.
Added a custom verifier which currently just checks that at least a To or Link argument has been populated.
Added a test case to ops.mlir to verify the appropriate syntax for the operation, for the moment it only checks functions, Declare Target also supports global variables, this will need some further testing, I am currently focusing on the use of functions with Declare Target.
Of note is that this currently does not factor in the C++ syntax begin and end region which does not exist in Fortran, however, in the current implementation, they could likely all be squished from the begin and end directives into a single operation packaging everything contained within (including the clauses).