diff options
Diffstat (limited to 'flang/lib/Lower/ConvertExprToHLFIR.cpp')
-rw-r--r-- | flang/lib/Lower/ConvertExprToHLFIR.cpp | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/flang/lib/Lower/ConvertExprToHLFIR.cpp b/flang/lib/Lower/ConvertExprToHLFIR.cpp index 7de433d..46be111 100644 --- a/flang/lib/Lower/ConvertExprToHLFIR.cpp +++ b/flang/lib/Lower/ConvertExprToHLFIR.cpp @@ -167,7 +167,7 @@ public: extents.push_back(builder.createIntegerConstant(loc, idxTy, extent)); } if (!mayHaveNonDefaultLowerBounds(componentSym)) - return builder.create<fir::ShapeOp>(loc, extents); + return fir::ShapeOp::create(builder, loc, extents); llvm::SmallVector<mlir::Value> lbounds; if (const auto *objDetails = @@ -312,8 +312,8 @@ private: // hlfir.elemental_addr. if (auto elementalAddrOp = getVectorSubscriptElementAddrOp()) builder.setInsertionPointToEnd(&elementalAddrOp->getBody().front()); - auto designate = builder.create<hlfir::DesignateOp>( - getLoc(), designatorType, partInfo.base.value().getBase(), + auto designate = hlfir::DesignateOp::create( + builder, getLoc(), designatorType, partInfo.base.value().getBase(), partInfo.componentName, partInfo.componentShape, partInfo.subscripts, partInfo.substring, partInfo.complexPart, partInfo.resultShape, partInfo.typeParams, attributes); @@ -344,7 +344,7 @@ private: mlir::Type refPtrType = builder.getRefType( fir::PointerType::get(fir::dyn_cast_ptrEleTy(ptrAddr.getType()))); mlir::Value cast = builder.createConvert(loc, refPtrType, ptrAddr); - mlir::Value ptrVal = builder.create<fir::LoadOp>(loc, cast); + mlir::Value ptrVal = fir::LoadOp::create(builder, loc, cast); // Update the base_addr to the value of the Cray pointer. // This is a hacky way to do the update, and it may harm @@ -442,9 +442,9 @@ private: } else { // Compute "len = max(ub-lb+1,0)" (Fortran 2018 9.4.1). mlir::Value one = builder.createIntegerConstant(loc, idxTy, 1); - auto boundsDiff = builder.create<mlir::arith::SubIOp>( - loc, partInfo.substring[1], partInfo.substring[0]); - auto rawLen = builder.create<mlir::arith::AddIOp>(loc, boundsDiff, one); + auto boundsDiff = mlir::arith::SubIOp::create( + builder, loc, partInfo.substring[1], partInfo.substring[0]); + auto rawLen = mlir::arith::AddIOp::create(builder, loc, boundsDiff, one); partInfo.typeParams[0] = fir::factory::genMaxWithZero(builder, loc, rawLen); } @@ -803,10 +803,10 @@ private: mlir::Value one = builder.createIntegerConstant(loc, idxTy, 1); oneBasedIndex = builder.createConvert(loc, idxTy, oneBasedIndex); mlir::Value zeroBased = - builder.create<mlir::arith::SubIOp>(loc, oneBasedIndex, one); + mlir::arith::SubIOp::create(builder, loc, oneBasedIndex, one); mlir::Value offset = - builder.create<mlir::arith::MulIOp>(loc, zeroBased, step); - return builder.create<mlir::arith::AddIOp>(loc, lb, offset); + mlir::arith::MulIOp::create(builder, loc, zeroBased, step); + return mlir::arith::AddIOp::create(builder, loc, lb, offset); } /// Create an hlfir.element_addr operation to deal with vector subscripted @@ -836,8 +836,8 @@ private: assert(partInfo.base.has_value() && "vector subscripted part must have a base"); mlir::Value mold = *partInfo.base; - auto elementalAddrOp = builder.create<hlfir::ElementalAddrOp>( - loc, shape, mold, mlir::ValueRange{}, + auto elementalAddrOp = hlfir::ElementalAddrOp::create( + builder, loc, shape, mold, mlir::ValueRange{}, /*isUnordered=*/true); setVectorSubscriptElementAddrOp(elementalAddrOp); builder.setInsertionPointToEnd(&elementalAddrOp.getBody().front()); @@ -881,7 +881,7 @@ private: builder.setInsertionPointToEnd(&elementalAddrOp.getBody().front()); if (!elementAddr.isPolymorphic()) elementalAddrOp.getMoldMutable().clear(); - builder.create<hlfir::YieldOp>(loc, elementAddr); + hlfir::YieldOp::create(builder, loc, elementAddr); builder.setInsertionPointAfter(elementalAddrOp); } @@ -1001,7 +1001,7 @@ HlfirDesignatorBuilder::convertVectorSubscriptedExprToElementalAddr( elementalAddrOp.getMoldMutable().clear(); // Create the hlfir.yield terminator inside the hlfir.elemental_body. builder.setInsertionPointToEnd(&elementalAddrOp.getBody().front()); - builder.create<hlfir::YieldOp>(loc, elementAddrEntity); + hlfir::YieldOp::create(builder, loc, elementAddrEntity); builder.setInsertionPointAfter(elementalAddrOp); // Reset the HlfirDesignatorBuilder state, in case it is used on a new // designator. @@ -1034,7 +1034,7 @@ struct BinaryOp {}; rhs)}; \ } else { \ return hlfir::EntityWithAttributes{ \ - builder.create<GenBinFirOp>(loc, lhs, rhs)}; \ + GenBinFirOp::create(builder, loc, lhs, rhs)}; \ } \ } \ }; @@ -1075,7 +1075,7 @@ struct BinaryOp<Fortran::evaluate::Divide< fir::genDivC(builder, loc, ty, lhs, rhs)}; } else { return hlfir::EntityWithAttributes{ - builder.create<mlir::complex::DivOp>(loc, lhs, rhs)}; + mlir::complex::DivOp::create(builder, loc, lhs, rhs)}; } } }; @@ -1219,8 +1219,8 @@ struct BinaryOp<Fortran::evaluate::Relational< fir::FirOpBuilder &builder, const Op &op, hlfir::Entity lhs, hlfir::Entity rhs) { - auto cmp = builder.create<mlir::arith::CmpIOp>( - loc, translateSignedRelational(op.opr), lhs, rhs); + auto cmp = mlir::arith::CmpIOp::create( + builder, loc, translateSignedRelational(op.opr), lhs, rhs); return hlfir::EntityWithAttributes{cmp}; } }; @@ -1241,8 +1241,8 @@ struct BinaryOp<Fortran::evaluate::Relational< mlir::IntegerType::SignednessSemantics::Signless); mlir::Value lhsSL = builder.createConvert(loc, signlessType, lhs); mlir::Value rhsSL = builder.createConvert(loc, signlessType, rhs); - auto cmp = builder.create<mlir::arith::CmpIOp>( - loc, translateUnsignedRelational(op.opr), lhsSL, rhsSL); + auto cmp = mlir::arith::CmpIOp::create( + builder, loc, translateUnsignedRelational(op.opr), lhsSL, rhsSL); return hlfir::EntityWithAttributes{cmp}; } }; @@ -1256,8 +1256,8 @@ struct BinaryOp<Fortran::evaluate::Relational< fir::FirOpBuilder &builder, const Op &op, hlfir::Entity lhs, hlfir::Entity rhs) { - auto cmp = builder.create<mlir::arith::CmpFOp>( - loc, translateFloatRelational(op.opr), lhs, rhs); + auto cmp = mlir::arith::CmpFOp::create( + builder, loc, translateFloatRelational(op.opr), lhs, rhs); return hlfir::EntityWithAttributes{cmp}; } }; @@ -1271,8 +1271,8 @@ struct BinaryOp<Fortran::evaluate::Relational< fir::FirOpBuilder &builder, const Op &op, hlfir::Entity lhs, hlfir::Entity rhs) { - auto cmp = builder.create<fir::CmpcOp>( - loc, translateFloatRelational(op.opr), lhs, rhs); + auto cmp = fir::CmpcOp::create(builder, loc, + translateFloatRelational(op.opr), lhs, rhs); return hlfir::EntityWithAttributes{cmp}; } }; @@ -1313,16 +1313,16 @@ struct BinaryOp<Fortran::evaluate::LogicalOperation<KIND>> { switch (op.logicalOperator) { case Fortran::evaluate::LogicalOperator::And: return hlfir::EntityWithAttributes{ - builder.create<mlir::arith::AndIOp>(loc, i1Lhs, i1Rhs)}; + mlir::arith::AndIOp::create(builder, loc, i1Lhs, i1Rhs)}; case Fortran::evaluate::LogicalOperator::Or: return hlfir::EntityWithAttributes{ - builder.create<mlir::arith::OrIOp>(loc, i1Lhs, i1Rhs)}; + mlir::arith::OrIOp::create(builder, loc, i1Lhs, i1Rhs)}; case Fortran::evaluate::LogicalOperator::Eqv: - return hlfir::EntityWithAttributes{builder.create<mlir::arith::CmpIOp>( - loc, mlir::arith::CmpIPredicate::eq, i1Lhs, i1Rhs)}; + return hlfir::EntityWithAttributes{mlir::arith::CmpIOp::create( + builder, loc, mlir::arith::CmpIPredicate::eq, i1Lhs, i1Rhs)}; case Fortran::evaluate::LogicalOperator::Neqv: - return hlfir::EntityWithAttributes{builder.create<mlir::arith::CmpIOp>( - loc, mlir::arith::CmpIPredicate::ne, i1Lhs, i1Rhs)}; + return hlfir::EntityWithAttributes{mlir::arith::CmpIOp::create( + builder, loc, mlir::arith::CmpIPredicate::ne, i1Lhs, i1Rhs)}; case Fortran::evaluate::LogicalOperator::Not: // lib/evaluate expression for .NOT. is Fortran::evaluate::Not<KIND>. llvm_unreachable(".NOT. is not a binary operator"); @@ -1354,7 +1354,7 @@ struct BinaryOp<Fortran::evaluate::SetLength<KIND>> { // Fortran 2018 7.4.4.2 point 5. mlir::Value safeLength = fir::factory::genMaxWithZero(builder, loc, length); return hlfir::EntityWithAttributes{ - builder.create<hlfir::SetLengthOp>(loc, string, safeLength)}; + hlfir::SetLengthOp::create(builder, loc, string, safeLength)}; } static void genResultTypeParams(mlir::Location, fir::FirOpBuilder &, hlfir::Entity, @@ -1372,7 +1372,7 @@ struct BinaryOp<Fortran::evaluate::Concat<KIND>> { hlfir::Entity lhs, hlfir::Entity rhs) { assert(len && "genResultTypeParams must have been called"); auto concat = - builder.create<hlfir::ConcatOp>(loc, mlir::ValueRange{lhs, rhs}, len); + hlfir::ConcatOp::create(builder, loc, mlir::ValueRange{lhs, rhs}, len); return hlfir::EntityWithAttributes{concat.getResult()}; } void @@ -1386,7 +1386,7 @@ struct BinaryOp<Fortran::evaluate::Concat<KIND>> { mlir::Type idxType = builder.getIndexType(); mlir::Value lhsLen = builder.createConvert(loc, idxType, lengths[0]); mlir::Value rhsLen = builder.createConvert(loc, idxType, lengths[1]); - len = builder.create<mlir::arith::AddIOp>(loc, lhsLen, rhsLen); + len = mlir::arith::AddIOp::create(builder, loc, lhsLen, rhsLen); resultTypeParams.push_back(len); } @@ -1410,7 +1410,7 @@ struct UnaryOp<Fortran::evaluate::Not<KIND>> { mlir::Value one = builder.createBool(loc, true); mlir::Value val = builder.createConvert(loc, builder.getI1Type(), lhs); return hlfir::EntityWithAttributes{ - builder.create<mlir::arith::XOrIOp>(loc, val, one)}; + mlir::arith::XOrIOp::create(builder, loc, val, one)}; } }; @@ -1428,7 +1428,7 @@ struct UnaryOp<Fortran::evaluate::Negate< /*params=*/{}); mlir::Value zero = builder.createIntegerConstant(loc, type, 0); return hlfir::EntityWithAttributes{ - builder.create<mlir::arith::SubIOp>(loc, zero, lhs)}; + mlir::arith::SubIOp::create(builder, loc, zero, lhs)}; } }; @@ -1448,7 +1448,7 @@ struct UnaryOp<Fortran::evaluate::Negate< mlir::Value zero = builder.createIntegerConstant(loc, signlessType, 0); mlir::Value signless = builder.createConvert(loc, signlessType, lhs); mlir::Value negated = - builder.create<mlir::arith::SubIOp>(loc, zero, signless); + mlir::arith::SubIOp::create(builder, loc, zero, signless); return hlfir::EntityWithAttributes( builder.createConvert(loc, lhs.getType(), negated)); } @@ -1463,7 +1463,7 @@ struct UnaryOp<Fortran::evaluate::Negate< fir::FirOpBuilder &builder, const Op &, hlfir::Entity lhs) { return hlfir::EntityWithAttributes{ - builder.create<mlir::arith::NegFOp>(loc, lhs)}; + mlir::arith::NegFOp::create(builder, loc, lhs)}; } }; @@ -1475,7 +1475,7 @@ struct UnaryOp<Fortran::evaluate::Negate< static hlfir::EntityWithAttributes gen(mlir::Location loc, fir::FirOpBuilder &builder, const Op &, hlfir::Entity lhs) { - return hlfir::EntityWithAttributes{builder.create<fir::NegcOp>(loc, lhs)}; + return hlfir::EntityWithAttributes{fir::NegcOp::create(builder, loc, lhs)}; } }; @@ -1499,9 +1499,9 @@ struct UnaryOp<Fortran::evaluate::Parentheses<T>> { const Op &op, hlfir::Entity lhs) { if (lhs.isVariable()) return hlfir::EntityWithAttributes{ - builder.create<hlfir::AsExprOp>(loc, lhs)}; + hlfir::AsExprOp::create(builder, loc, lhs)}; return hlfir::EntityWithAttributes{ - builder.create<hlfir::NoReassocOp>(loc, lhs.getType(), lhs)}; + hlfir::NoReassocOp::create(builder, loc, lhs.getType(), lhs)}; } static void @@ -1822,8 +1822,8 @@ private: // Allocate scalar temporary that will be initialized // with the values specified by the constructor. mlir::Value storagePtr = builder.createTemporary(loc, recTy); - auto varOp = hlfir::EntityWithAttributes{builder.create<hlfir::DeclareOp>( - loc, storagePtr, "ctor.temp", /*shape=*/nullptr, + auto varOp = hlfir::EntityWithAttributes{hlfir::DeclareOp::create( + builder, loc, storagePtr, "ctor.temp", /*shape=*/nullptr, /*typeparams=*/mlir::ValueRange{}, /*dummy_scope=*/nullptr, fir::FortranVariableFlagsAttr{})}; @@ -1855,8 +1855,8 @@ private: auto parentCompType = baseRecTy.getType(parentName); assert(parentCompType && "failed to retrieve parent component type"); mlir::Type designatorType = builder.getRefType(parentCompType); - mlir::Value newParent = builder.create<hlfir::DesignateOp>( - loc, designatorType, currentParent, parentName, + mlir::Value newParent = hlfir::DesignateOp::create( + builder, loc, designatorType, currentParent, parentName, /*compShape=*/mlir::Value{}, hlfir::DesignateOp::Subscripts{}, /*substring=*/mlir::ValueRange{}, /*complexPart=*/std::nullopt, @@ -1912,8 +1912,8 @@ private: extraAttributeFlags); // Get the component designator. - auto lhs = builder.create<hlfir::DesignateOp>( - loc, designatorType, baseOp, name, compShape, + auto lhs = hlfir::DesignateOp::create( + builder, loc, designatorType, baseOp, name, compShape, hlfir::DesignateOp::Subscripts{}, /*substring=*/mlir::ValueRange{}, /*complexPart=*/std::nullopt, @@ -1997,10 +1997,10 @@ private: auto rhsCastAndCleanup = hlfir::genTypeAndKindConvert(loc, builder, rhs, lhs.getType(), /*preserveLowerBounds=*/allowRealloc); - builder.create<hlfir::AssignOp>(loc, rhsCastAndCleanup.first, lhs, - allowRealloc, - allowRealloc ? keepLhsLength : false, - /*temporary_lhs=*/true); + hlfir::AssignOp::create(builder, loc, rhsCastAndCleanup.first, lhs, + allowRealloc, + allowRealloc ? keepLhsLength : false, + /*temporary_lhs=*/true); if (rhsCastAndCleanup.second) (*rhsCastAndCleanup.second)(); }; |