[Mlir-commits] [mlir] [OpenMP][Flang] Add "IsolatedFromAbove" trait to omp.target (PR #67164)
Akash Banerjee
llvmlistbot at llvm.org
Mon Oct 23 10:52:14 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);
----------------
TIFitis wrote:
@kiranchandramohan I am getting the following error for CharBoxTypes on this statement. Any idea why?
`character buffer should be in CharBoxValue`
https://github.com/llvm/llvm-project/pull/67164
More information about the Mlir-commits
mailing list