[flang] Explicitly map host associated symbols

Explicitly map host associated symbols in DoConcurrent with shared
locality-spec, clauses in OpenMP/OpenACC. The mapping of host-assoc
symbols is set to their parent SymbolBox. This is achieved through
a new interface function in the AbstractConverter.

This was already upstream for OpenMP.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D128518

Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
This commit is contained in:
Valentin Clement 2022-06-24 21:03:00 +02:00
parent 7eba5cdf9c
commit d45d707434
No known key found for this signature in database
GPG Key ID: 086D54783C928776
1 changed files with 23 additions and 13 deletions

View File

@ -35,20 +35,30 @@ getDesignatorNameIfDataRef(const Fortran::parser::Designator &designator) {
static void genObjectList(const Fortran::parser::AccObjectList &objectList,
Fortran::lower::AbstractConverter &converter,
llvm::SmallVectorImpl<mlir::Value> &operands) {
auto addOperands = [&](Fortran::lower::SymbolRef sym) {
const auto variable = converter.getSymbolAddress(sym);
// TODO: Might need revisiting to handle for non-shared clauses
if (variable) {
operands.push_back(variable);
} else {
if (const auto *details =
sym->detailsIf<Fortran::semantics::HostAssocDetails>())
operands.push_back(converter.getSymbolAddress(details->symbol()));
}
};
for (const auto &accObject : objectList.v) {
std::visit(
Fortran::common::visitors{
[&](const Fortran::parser::Designator &designator) {
if (const auto *name = getDesignatorNameIfDataRef(designator)) {
const auto variable = converter.getSymbolAddress(*name->symbol);
operands.push_back(variable);
}
},
[&](const Fortran::parser::Name &name) {
const auto variable = converter.getSymbolAddress(*name.symbol);
operands.push_back(variable);
}},
accObject.u);
std::visit(Fortran::common::visitors{
[&](const Fortran::parser::Designator &designator) {
if (const auto *name =
getDesignatorNameIfDataRef(designator)) {
addOperands(*name->symbol);
}
},
[&](const Fortran::parser::Name &name) {
addOperands(*name.symbol);
}},
accObject.u);
}
}