Lines Matching defs:embox

60 /// Convert fir.embox to the extended form where necessary.
62 /// The embox operation can take arguments that specify multidimensional array
70 /// %3 = fir.embox %0 (%1) [%2] : (!fir.ref<!fir.array<?xi32>>,
84 matchAndRewrite(fir::EmboxOp embox,
86 // If the embox does not include a shape, then do not convert it
87 if (auto shapeVal = embox.getShape())
88 return rewriteDynamicShape(embox, rewriter, shapeVal);
89 if (mlir::isa<fir::ClassType>(embox.getType()))
90 TODO(embox.getLoc(), "embox conversion for fir.class type");
91 if (auto boxTy = mlir::dyn_cast<fir::BoxType>(embox.getType()))
94 return rewriteStaticShape(embox, rewriter, seqTy);
98 llvm::LogicalResult rewriteStaticShape(fir::EmboxOp embox,
101 auto loc = embox.getLoc();
110 loc, embox.getType(), embox.getMemref(), shapeOpers, std::nullopt,
111 std::nullopt, std::nullopt, std::nullopt, embox.getTypeparams(),
112 embox.getSourceBox(), embox.getAllocatorIdxAttr());
113 LLVM_DEBUG(llvm::dbgs() << "rewriting " << embox << " to " << xbox << '\n');
114 rewriter.replaceOp(embox, xbox.getOperation()->getResults());
118 llvm::LogicalResult rewriteDynamicShape(fir::EmboxOp embox,
121 auto loc = embox.getLoc();
135 if (auto s = embox.getSlice())
146 loc, embox.getType(), embox.getMemref(), shapeOpers, shiftOpers,
147 sliceOpers, subcompOpers, substrOpers, embox.getTypeparams(),
148 embox.getSourceBox(), embox.getAllocatorIdxAttr());
149 LLVM_DEBUG(llvm::dbgs() << "rewriting " << embox << " to " << xbox << '\n');
150 rewriter.replaceOp(embox, xbox.getOperation()->getResults());
362 target.addDynamicallyLegalOp<fir::EmboxOp>([](fir::EmboxOp embox) {
363 return !(embox.getShape() ||
365 mlir::cast<fir::BaseBoxType>(embox.getType()).getEleTy()));