[Mlir-commits] [mlir] [OpenMP][Flang] Add "IsolatedFromAbove" trait to omp.target (PR #67164)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Oct 26 08:35:03 PDT 2023
================
@@ -2400,6 +2417,76 @@ genEnterExitDataOp(Fortran::lower::AbstractConverter &converter,
deviceOperand, nowaitAttr, mapOperands);
}
+static void genBodyOfTargetOp(
+ Fortran::lower::AbstractConverter &converter, mlir::omp::TargetOp &targetOp,
+ const llvm::SmallVector<mlir::Type> &mapSymTypes,
+ const llvm::SmallVector<mlir::Location> &mapSymLocs,
+ const llvm::SmallVector<const Fortran::semantics::Symbol *> &mapSymbols,
+ const mlir::Location ¤tLocation) {
+ assert(mapSymTypes.size() == mapSymLocs.size());
+
+ fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder();
+ mlir::Region ®ion = targetOp.getRegion();
+
+ firOpBuilder.createBlock(®ion, {}, mapSymTypes, mapSymLocs);
+ firOpBuilder.create<mlir::omp::TerminatorOp>(currentLocation);
+ firOpBuilder.setInsertionPointToStart(®ion.front());
+
+ unsigned argIndex = 0;
+ unsigned blockArgsIndex = mapSymbols.size();
+
+ auto extractBoundArgs = [&](auto n) {
+ llvm::SmallVector<mlir::Value> argExtents;
+ while (n--) {
+ argExtents.push_back(fir::getBase(region.getArgument(blockArgsIndex)));
+ blockArgsIndex++;
+ }
+ return argExtents;
+ };
+
+ for (const Fortran::semantics::Symbol *sym : mapSymbols) {
+ const mlir::BlockArgument &arg = region.getArgument(argIndex);
+ fir::ExtendedValue extVal = converter.getSymbolExtendedValue(*sym);
+ mlir::Value val = fir::getBase(arg);
----------------
jeanPerier wrote:
The update to use getSymbolExtendedValue and the fir::ExtendedValue and looks good to me.
https://github.com/llvm/llvm-project/pull/67164
More information about the Mlir-commits
mailing list