|
24 | 24 | #include <flang/Parser/parse-tree.h> |
25 | 25 | #include <flang/Parser/tools.h> |
26 | 26 | #include <flang/Semantics/tools.h> |
| 27 | +#include <flang/Utils/OpenMP.h> |
27 | 28 | #include <llvm/Support/CommandLine.h> |
28 | 29 |
|
29 | 30 | #include <iterator> |
@@ -108,38 +109,6 @@ void gatherFuncAndVarSyms( |
108 | 109 | symbolAndClause.emplace_back(clause, *object.sym(), automap); |
109 | 110 | } |
110 | 111 |
|
111 | | -mlir::omp::MapInfoOp |
112 | | -createMapInfoOp(fir::FirOpBuilder &builder, mlir::Location loc, |
113 | | - mlir::Value baseAddr, mlir::Value varPtrPtr, |
114 | | - llvm::StringRef name, llvm::ArrayRef<mlir::Value> bounds, |
115 | | - llvm::ArrayRef<mlir::Value> members, |
116 | | - mlir::ArrayAttr membersIndex, uint64_t mapType, |
117 | | - mlir::omp::VariableCaptureKind mapCaptureType, mlir::Type retTy, |
118 | | - bool partialMap, mlir::FlatSymbolRefAttr mapperId) { |
119 | | - if (auto boxTy = llvm::dyn_cast<fir::BaseBoxType>(baseAddr.getType())) { |
120 | | - baseAddr = fir::BoxAddrOp::create(builder, loc, baseAddr); |
121 | | - retTy = baseAddr.getType(); |
122 | | - } |
123 | | - |
124 | | - mlir::TypeAttr varType = mlir::TypeAttr::get( |
125 | | - llvm::cast<mlir::omp::PointerLikeType>(retTy).getElementType()); |
126 | | - |
127 | | - // For types with unknown extents such as <2x?xi32> we discard the incomplete |
128 | | - // type info and only retain the base type. The correct dimensions are later |
129 | | - // recovered through the bounds info. |
130 | | - if (auto seqType = llvm::dyn_cast<fir::SequenceType>(varType.getValue())) |
131 | | - if (seqType.hasDynamicExtents()) |
132 | | - varType = mlir::TypeAttr::get(seqType.getEleTy()); |
133 | | - |
134 | | - mlir::omp::MapInfoOp op = mlir::omp::MapInfoOp::create( |
135 | | - builder, loc, retTy, baseAddr, varType, |
136 | | - builder.getIntegerAttr(builder.getIntegerType(64, false), mapType), |
137 | | - builder.getAttr<mlir::omp::VariableCaptureKindAttr>(mapCaptureType), |
138 | | - varPtrPtr, members, membersIndex, bounds, mapperId, |
139 | | - builder.getStringAttr(name), builder.getBoolAttr(partialMap)); |
140 | | - return op; |
141 | | -} |
142 | | - |
143 | 112 | // This function gathers the individual omp::Object's that make up a |
144 | 113 | // larger omp::Object symbol. |
145 | 114 | // |
@@ -403,7 +372,7 @@ mlir::Value createParentSymAndGenIntermediateMaps( |
403 | 372 |
|
404 | 373 | // Create a map for the intermediate member and insert it and it's |
405 | 374 | // indices into the parentMemberIndices list to track it. |
406 | | - mlir::omp::MapInfoOp mapOp = createMapInfoOp( |
| 375 | + mlir::omp::MapInfoOp mapOp = utils::openmp::createMapInfoOp( |
407 | 376 | firOpBuilder, clauseLocation, curValue, |
408 | 377 | /*varPtrPtr=*/mlir::Value{}, asFortran, |
409 | 378 | /*bounds=*/interimBounds, |
@@ -563,7 +532,7 @@ void insertChildMapInfoIntoParent( |
563 | 532 | converter.getCurrentLocation(), asFortran, bounds, |
564 | 533 | treatIndexAsSection); |
565 | 534 |
|
566 | | - mlir::omp::MapInfoOp mapOp = createMapInfoOp( |
| 535 | + mlir::omp::MapInfoOp mapOp = utils::openmp::createMapInfoOp( |
567 | 536 | firOpBuilder, info.rawInput.getLoc(), info.rawInput, |
568 | 537 | /*varPtrPtr=*/mlir::Value(), asFortran.str(), bounds, members, |
569 | 538 | firOpBuilder.create2DI64ArrayAttr( |
|
0 commit comments