…e target link
This PR attempts to fix common block mapping for regular mapping of these types as
well as when they have been marked as "declare target link". This PR should allow correct
mapping of both the members of a common block and the full common block via its
block symbol.
The main changes were some adjustments to the Fortran OpenMP lowering to HLFIR/FIR,
the lowering of the LLVM+OpenMP dialect to LLVM-IR and adjustments to the way the
we handle target kernel map argument rebinding inside of the OMPIRBuilder.
For the Fortran OpenMP lowering were two changes, one to prevent the implicit capture
of common block members when the common block symbol itself has been marked and
the other creates intermediate member access inside of the target region to be used
in-place of those external to the target region, this prevents external usages breaking the
IsolatedFromAbove pact.
In the latter case, there was an adjustment to the size calculation for types to better
handle cases where we pass an array as the type of a map (as opposed to the
bounds and the type of the element), which occurs in the case of common blocks. There
is also some adjustment to how handleDeclareTargetMapVar handles renaming of declare
target symbols in the module to the reference pointer, now it will only apply to those
within the kernel that is currently being generated and we also perform a modification
to replace constants with instructions as necessary as we cannot replace these with our
reference pointer (non-constant and constants do not mix nicely).
In the case of the OpenMPIRBuilder some changes were mde to defer global symbol
rebinding to kernel arguments until all other arguments have been rebound. This
makes sure we do not replace uses that may refer to the global (e.g. a GEP) but are
themselves actually a separate argument that needs bound.
Currently "declare target to" still needs some work, but this may be the case for all
types in conjunction with "declare target to" at the moment.