[flang][NFC] Move the rest of ops creation to new APIs (#152079)
This commit is contained in:
parent
908ef45606
commit
3847620ba9
@ -549,8 +549,9 @@ public:
|
||||
}
|
||||
|
||||
mlir::Value genNot(mlir::Location loc, mlir::Value boolean) {
|
||||
return create<mlir::arith::CmpIOp>(loc, mlir::arith::CmpIPredicate::eq,
|
||||
boolean, createBool(loc, false));
|
||||
return mlir::arith::CmpIOp::create(*this, loc,
|
||||
mlir::arith::CmpIPredicate::eq, boolean,
|
||||
createBool(loc, false));
|
||||
}
|
||||
|
||||
/// Generate code testing \p addr is not a null address.
|
||||
@ -641,7 +642,7 @@ public:
|
||||
mlir::Value createUnsigned(mlir::Location loc, mlir::Type resultType,
|
||||
mlir::Value left, mlir::Value right) {
|
||||
if (!resultType.isIntOrFloat())
|
||||
return create<OpTy>(loc, resultType, left, right);
|
||||
return OpTy::create(*this, loc, resultType, left, right);
|
||||
mlir::Type signlessType = mlir::IntegerType::get(
|
||||
getContext(), resultType.getIntOrFloatBitWidth(),
|
||||
mlir::IntegerType::SignednessSemantics::Signless);
|
||||
@ -654,7 +655,7 @@ public:
|
||||
right = createConvert(loc, signlessType, right);
|
||||
opResType = signlessType;
|
||||
}
|
||||
mlir::Value result = create<OpTy>(loc, opResType, left, right);
|
||||
mlir::Value result = OpTy::create(*this, loc, opResType, left, right);
|
||||
if (resultType.isUnsignedInteger())
|
||||
result = createConvert(loc, resultType, result);
|
||||
return result;
|
||||
@ -666,7 +667,7 @@ public:
|
||||
mlir::Value ptr1, mlir::Value ptr2) {
|
||||
ptr1 = createConvert(loc, getIndexType(), ptr1);
|
||||
ptr2 = createConvert(loc, getIndexType(), ptr2);
|
||||
return create<mlir::arith::CmpIOp>(loc, predicate, ptr1, ptr2);
|
||||
return mlir::arith::CmpIOp::create(*this, loc, predicate, ptr1, ptr2);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -53,8 +53,8 @@ void genCharacterCopy(mlir::Value src, mlir::Value srcLen, mlir::Value dst,
|
||||
fir::StoreOp::create(builder, loc, load, dst);
|
||||
return;
|
||||
}
|
||||
auto zero = builder.template create<mlir::arith::ConstantIndexOp>(loc, 0);
|
||||
auto one = builder.template create<mlir::arith::ConstantIndexOp>(loc, 1);
|
||||
auto zero = mlir::arith::ConstantIndexOp::create(builder, loc, 0);
|
||||
auto one = mlir::arith::ConstantIndexOp::create(builder, loc, 1);
|
||||
auto toArrayTy = [&](fir::CharacterType ty) {
|
||||
return fir::ReferenceType::get(fir::SequenceType::get(
|
||||
fir::SequenceType::ShapeRef{fir::SequenceType::getUnknownExtent()},
|
||||
@ -68,8 +68,8 @@ void genCharacterCopy(mlir::Value src, mlir::Value srcLen, mlir::Value dst,
|
||||
return fir::ReferenceType::get(toEleTy(ty));
|
||||
};
|
||||
if (!srcLen && !dstLen && srcTy.getLen() >= dstTy.getLen()) {
|
||||
auto upper = builder.template create<mlir::arith::ConstantIndexOp>(
|
||||
loc, dstTy.getLen() - 1);
|
||||
auto upper =
|
||||
mlir::arith::ConstantIndexOp::create(builder, loc, dstTy.getLen() - 1);
|
||||
auto loop = fir::DoLoopOp::create(builder, loc, zero, upper, one);
|
||||
auto insPt = builder.saveInsertionPoint();
|
||||
builder.setInsertionPointToStart(loop.getBody());
|
||||
@ -92,26 +92,26 @@ void genCharacterCopy(mlir::Value src, mlir::Value srcLen, mlir::Value dst,
|
||||
return;
|
||||
}
|
||||
auto minusOne = [&](mlir::Value v) -> mlir::Value {
|
||||
return builder.template create<mlir::arith::SubIOp>(
|
||||
loc, fir::ConvertOp::create(builder, loc, one.getType(), v), one);
|
||||
return mlir::arith::SubIOp::create(
|
||||
builder, loc, fir::ConvertOp::create(builder, loc, one.getType(), v),
|
||||
one);
|
||||
};
|
||||
mlir::Value len = dstLen ? minusOne(dstLen)
|
||||
: builder
|
||||
.template create<mlir::arith::ConstantIndexOp>(
|
||||
loc, dstTy.getLen() - 1)
|
||||
: mlir::arith::ConstantIndexOp::create(
|
||||
builder, loc, dstTy.getLen() - 1)
|
||||
.getResult();
|
||||
auto loop = fir::DoLoopOp::create(builder, loc, zero, len, one);
|
||||
auto insPt = builder.saveInsertionPoint();
|
||||
builder.setInsertionPointToStart(loop.getBody());
|
||||
mlir::Value slen =
|
||||
srcLen ? fir::ConvertOp::create(builder, loc, one.getType(), srcLen)
|
||||
.getResult()
|
||||
: builder
|
||||
.template create<mlir::arith::ConstantIndexOp>(
|
||||
loc, srcTy.getLen())
|
||||
.getResult();
|
||||
auto cond = builder.template create<mlir::arith::CmpIOp>(
|
||||
loc, mlir::arith::CmpIPredicate::slt, loop.getInductionVar(), slen);
|
||||
srcLen
|
||||
? fir::ConvertOp::create(builder, loc, one.getType(), srcLen)
|
||||
.getResult()
|
||||
: mlir::arith::ConstantIndexOp::create(builder, loc, srcTy.getLen())
|
||||
.getResult();
|
||||
auto cond =
|
||||
mlir::arith::CmpIOp::create(builder, loc, mlir::arith::CmpIPredicate::slt,
|
||||
loop.getInductionVar(), slen);
|
||||
auto ifOp = fir::IfOp::create(builder, loc, cond, /*withElse=*/true);
|
||||
builder.setInsertionPointToStart(&ifOp.getThenRegion().front());
|
||||
auto csrcTy = toArrayTy(srcTy);
|
||||
@ -189,7 +189,7 @@ originateIndices(mlir::Location loc, B &builder, mlir::Type memTy,
|
||||
auto ty = fir::dyn_cast_ptrOrBoxEleTy(memTy);
|
||||
assert(ty && mlir::isa<fir::SequenceType>(ty));
|
||||
auto seqTy = mlir::cast<fir::SequenceType>(ty);
|
||||
auto one = builder.template create<mlir::arith::ConstantIndexOp>(loc, 1);
|
||||
auto one = mlir::arith::ConstantIndexOp::create(builder, loc, 1);
|
||||
const auto dimension = seqTy.getDimension();
|
||||
if (shapeVal) {
|
||||
assert(dimension == mlir::cast<fir::ShapeOp>(shapeVal.getDefiningOp())
|
||||
@ -200,7 +200,7 @@ originateIndices(mlir::Location loc, B &builder, mlir::Type memTy,
|
||||
if (i.index() < dimension) {
|
||||
assert(fir::isa_integer(i.value().getType()));
|
||||
result.push_back(
|
||||
builder.template create<mlir::arith::AddIOp>(loc, i.value(), one));
|
||||
mlir::arith::AddIOp::create(builder, loc, i.value(), one));
|
||||
} else {
|
||||
result.push_back(i.value());
|
||||
}
|
||||
@ -211,8 +211,8 @@ originateIndices(mlir::Location loc, B &builder, mlir::Type memTy,
|
||||
unsigned origOff = 0;
|
||||
for (auto i : llvm::enumerate(indices)) {
|
||||
if (i.index() < dimension)
|
||||
result.push_back(builder.template create<mlir::arith::AddIOp>(
|
||||
loc, i.value(), origins[origOff++]));
|
||||
result.push_back(mlir::arith::AddIOp::create(builder, loc, i.value(),
|
||||
origins[origOff++]));
|
||||
else
|
||||
result.push_back(i.value());
|
||||
}
|
||||
|
@ -105,8 +105,8 @@ def CombineConvertTruncOptPattern
|
||||
(IntPred $arg, $irm), (SmallerWidthPred $arg, $irm)]>;
|
||||
|
||||
def createConstantOp
|
||||
: NativeCodeCall<"$_builder.create<mlir::arith::ConstantOp>"
|
||||
"($_loc, $_builder.getIndexType(), "
|
||||
: NativeCodeCall<"mlir::arith::ConstantOp::create"
|
||||
"($_builder, $_loc, $_builder.getIndexType(), "
|
||||
"rewriter.getIndexAttr("
|
||||
"mlir::dyn_cast<mlir::IntegerAttr>($1).getInt()))">;
|
||||
|
||||
|
@ -1458,7 +1458,7 @@ private:
|
||||
|
||||
void genBranch(mlir::Block *targetBlock) {
|
||||
assert(targetBlock && "missing unconditional target block");
|
||||
builder->create<mlir::cf::BranchOp>(toLocation(), targetBlock);
|
||||
mlir::cf::BranchOp::create(*builder, toLocation(), targetBlock);
|
||||
}
|
||||
|
||||
void genConditionalBranch(mlir::Value cond, mlir::Block *trueTarget,
|
||||
@ -1467,9 +1467,9 @@ private:
|
||||
assert(falseTarget && "missing conditional branch false block");
|
||||
mlir::Location loc = toLocation();
|
||||
mlir::Value bcc = builder->createConvert(loc, builder->getI1Type(), cond);
|
||||
builder->create<mlir::cf::CondBranchOp>(loc, bcc, trueTarget,
|
||||
mlir::ValueRange{}, falseTarget,
|
||||
mlir::ValueRange{});
|
||||
mlir::cf::CondBranchOp::create(*builder, loc, bcc, trueTarget,
|
||||
mlir::ValueRange{}, falseTarget,
|
||||
mlir::ValueRange{});
|
||||
}
|
||||
void genConditionalBranch(mlir::Value cond,
|
||||
Fortran::lower::pft::Evaluation *trueTarget,
|
||||
@ -1637,28 +1637,28 @@ private:
|
||||
assert((inArithmeticIfContext || !realSelector) && "invalid selector type");
|
||||
mlir::Value zero;
|
||||
if (inArithmeticIfContext)
|
||||
zero =
|
||||
realSelector
|
||||
? builder->create<mlir::arith::ConstantOp>(
|
||||
loc, selectorType, builder->getFloatAttr(selectorType, 0.0))
|
||||
: builder->createIntegerConstant(loc, selectorType, 0);
|
||||
zero = realSelector
|
||||
? mlir::arith::ConstantOp::create(
|
||||
*builder, loc, selectorType,
|
||||
builder->getFloatAttr(selectorType, 0.0))
|
||||
: builder->createIntegerConstant(loc, selectorType, 0);
|
||||
for (auto label : llvm::enumerate(labelList)) {
|
||||
mlir::Value cond;
|
||||
if (realSelector) // inArithmeticIfContext
|
||||
cond = builder->create<mlir::arith::CmpFOp>(
|
||||
loc,
|
||||
cond = mlir::arith::CmpFOp::create(
|
||||
*builder, loc,
|
||||
label.index() == 0 ? mlir::arith::CmpFPredicate::OLT
|
||||
: mlir::arith::CmpFPredicate::OGT,
|
||||
selector, zero);
|
||||
else if (inArithmeticIfContext) // INTEGER selector
|
||||
cond = builder->create<mlir::arith::CmpIOp>(
|
||||
loc,
|
||||
cond = mlir::arith::CmpIOp::create(
|
||||
*builder, loc,
|
||||
label.index() == 0 ? mlir::arith::CmpIPredicate::slt
|
||||
: mlir::arith::CmpIPredicate::sgt,
|
||||
selector, zero);
|
||||
else // A value of 0 is an IO ERR branch: invert comparison.
|
||||
cond = builder->create<mlir::arith::CmpIOp>(
|
||||
loc,
|
||||
cond = mlir::arith::CmpIOp::create(
|
||||
*builder, loc,
|
||||
valueList[label.index()] == 0 ? mlir::arith::CmpIPredicate::ne
|
||||
: mlir::arith::CmpIPredicate::eq,
|
||||
selector,
|
||||
@ -1715,7 +1715,7 @@ private:
|
||||
if (blockIsUnterminated()) {
|
||||
bridge.openAccCtx().finalizeAndKeep();
|
||||
bridge.fctCtx().finalizeAndKeep();
|
||||
builder->create<mlir::func::ReturnOp>(toLocation(), retval);
|
||||
mlir::func::ReturnOp::create(*builder, toLocation(), retval);
|
||||
}
|
||||
if (!earlyReturn) {
|
||||
bridge.openAccCtx().pop();
|
||||
@ -1801,7 +1801,7 @@ private:
|
||||
if (mlir::Block *finalBlock = funit.finalBlock) {
|
||||
// The current block must end with a terminator.
|
||||
if (blockIsUnterminated())
|
||||
builder->create<mlir::cf::BranchOp>(toLocation(), finalBlock);
|
||||
mlir::cf::BranchOp::create(*builder, toLocation(), finalBlock);
|
||||
// Set insertion point to final block.
|
||||
builder->setInsertionPoint(finalBlock, finalBlock->end());
|
||||
}
|
||||
@ -1834,8 +1834,9 @@ private:
|
||||
mlir::Value cond =
|
||||
builder->createConvert(loc, builder->getI1Type(), condExpr);
|
||||
if (negate)
|
||||
cond = builder->create<mlir::arith::XOrIOp>(
|
||||
loc, cond, builder->createIntegerConstant(loc, cond.getType(), 1));
|
||||
cond = mlir::arith::XOrIOp::create(
|
||||
*builder, loc, cond,
|
||||
builder->createIntegerConstant(loc, cond.getType(), 1));
|
||||
return cond;
|
||||
}
|
||||
|
||||
@ -1918,7 +1919,7 @@ private:
|
||||
stmtCtx.finalizeAndReset();
|
||||
// Raise an exception if REAL expr is a NaN.
|
||||
if (mlir::isa<mlir::FloatType>(expr.getType()))
|
||||
expr = builder->create<mlir::arith::AddFOp>(toLocation(), expr, expr);
|
||||
expr = mlir::arith::AddFOp::create(*builder, toLocation(), expr, expr);
|
||||
// An empty valueList indicates to genMultiwayBranch that the branch is
|
||||
// an ArithmeticIfStmt that has two branches on value 0 or 0.0.
|
||||
llvm::SmallVector<int64_t> valueList;
|
||||
@ -2523,27 +2524,28 @@ private:
|
||||
mlir::Value tripCount;
|
||||
if (info.hasRealControl) {
|
||||
auto diff1 =
|
||||
builder->create<mlir::arith::SubFOp>(loc, upperValue, lowerValue);
|
||||
mlir::arith::SubFOp::create(*builder, loc, upperValue, lowerValue);
|
||||
auto diff2 =
|
||||
builder->create<mlir::arith::AddFOp>(loc, diff1, stepValue);
|
||||
tripCount = builder->create<mlir::arith::DivFOp>(loc, diff2, stepValue);
|
||||
mlir::arith::AddFOp::create(*builder, loc, diff1, stepValue);
|
||||
tripCount =
|
||||
mlir::arith::DivFOp::create(*builder, loc, diff2, stepValue);
|
||||
tripCount =
|
||||
builder->createConvert(loc, builder->getIndexType(), tripCount);
|
||||
} else {
|
||||
auto diff1 =
|
||||
builder->create<mlir::arith::SubIOp>(loc, upperValue, lowerValue);
|
||||
mlir::arith::SubIOp::create(*builder, loc, upperValue, lowerValue);
|
||||
auto diff2 =
|
||||
builder->create<mlir::arith::AddIOp>(loc, diff1, stepValue);
|
||||
mlir::arith::AddIOp::create(*builder, loc, diff1, stepValue);
|
||||
tripCount =
|
||||
builder->create<mlir::arith::DivSIOp>(loc, diff2, stepValue);
|
||||
mlir::arith::DivSIOp::create(*builder, loc, diff2, stepValue);
|
||||
}
|
||||
if (forceLoopToExecuteOnce) { // minimum tripCount is 1
|
||||
mlir::Value one =
|
||||
builder->createIntegerConstant(loc, tripCount.getType(), 1);
|
||||
auto cond = builder->create<mlir::arith::CmpIOp>(
|
||||
loc, mlir::arith::CmpIPredicate::slt, tripCount, one);
|
||||
auto cond = mlir::arith::CmpIOp::create(
|
||||
*builder, loc, mlir::arith::CmpIPredicate::slt, tripCount, one);
|
||||
tripCount =
|
||||
builder->create<mlir::arith::SelectOp>(loc, cond, one, tripCount);
|
||||
mlir::arith::SelectOp::create(*builder, loc, cond, one, tripCount);
|
||||
}
|
||||
info.tripVariable = builder->createTemporary(loc, tripCount.getType());
|
||||
fir::StoreOp::create(*builder, loc, tripCount, info.tripVariable);
|
||||
@ -2555,8 +2557,8 @@ private:
|
||||
tripCount = fir::LoadOp::create(*builder, loc, info.tripVariable);
|
||||
mlir::Value zero =
|
||||
builder->createIntegerConstant(loc, tripCount.getType(), 0);
|
||||
auto cond = builder->create<mlir::arith::CmpIOp>(
|
||||
loc, mlir::arith::CmpIPredicate::sgt, tripCount, zero);
|
||||
auto cond = mlir::arith::CmpIOp::create(
|
||||
*builder, loc, mlir::arith::CmpIPredicate::sgt, tripCount, zero);
|
||||
if (info.maskExpr) {
|
||||
genConditionalBranch(cond, info.maskBlock, info.exitBlock);
|
||||
startBlock(info.maskBlock);
|
||||
@ -2659,8 +2661,9 @@ private:
|
||||
auto doLoopOp = mlir::cast<fir::DoLoopOp>(info.loopOp);
|
||||
builder->setInsertionPointToEnd(doLoopOp.getBody());
|
||||
llvm::SmallVector<mlir::Value, 2> results;
|
||||
results.push_back(builder->create<mlir::arith::AddIOp>(
|
||||
loc, doLoopOp.getInductionVar(), doLoopOp.getStep(), iofAttr));
|
||||
results.push_back(mlir::arith::AddIOp::create(
|
||||
*builder, loc, doLoopOp.getInductionVar(), doLoopOp.getStep(),
|
||||
iofAttr));
|
||||
// Step loopVariable to help optimizations such as vectorization.
|
||||
// Induction variable elimination will clean up as necessary.
|
||||
mlir::Value step = builder->createConvert(
|
||||
@ -2668,7 +2671,7 @@ private:
|
||||
mlir::Value loopVar =
|
||||
fir::LoadOp::create(*builder, loc, info.loopVariable);
|
||||
results.push_back(
|
||||
builder->create<mlir::arith::AddIOp>(loc, loopVar, step, iofAttr));
|
||||
mlir::arith::AddIOp::create(*builder, loc, loopVar, step, iofAttr));
|
||||
fir::ResultOp::create(*builder, loc, results);
|
||||
builder->setInsertionPointAfter(doLoopOp);
|
||||
// The loop control variable may be used after the loop.
|
||||
@ -2682,7 +2685,7 @@ private:
|
||||
fir::LoadOp::create(*builder, loc, info.tripVariable);
|
||||
mlir::Value one =
|
||||
builder->createIntegerConstant(loc, tripCount.getType(), 1);
|
||||
tripCount = builder->create<mlir::arith::SubIOp>(loc, tripCount, one);
|
||||
tripCount = mlir::arith::SubIOp::create(*builder, loc, tripCount, one);
|
||||
fir::StoreOp::create(*builder, loc, tripCount, info.tripVariable);
|
||||
mlir::Value value = fir::LoadOp::create(*builder, loc, info.loopVariable);
|
||||
mlir::Value step;
|
||||
@ -2691,9 +2694,10 @@ private:
|
||||
else
|
||||
step = genControlValue(info.stepExpr, info);
|
||||
if (info.hasRealControl)
|
||||
value = builder->create<mlir::arith::AddFOp>(loc, value, step);
|
||||
value = mlir::arith::AddFOp::create(*builder, loc, value, step);
|
||||
else
|
||||
value = builder->create<mlir::arith::AddIOp>(loc, value, step, iofAttr);
|
||||
value =
|
||||
mlir::arith::AddIOp::create(*builder, loc, value, step, iofAttr);
|
||||
fir::StoreOp::create(*builder, loc, value, info.loopVariable);
|
||||
|
||||
genBranch(info.headerBlock);
|
||||
@ -3190,8 +3194,8 @@ private:
|
||||
assert(funit && "not inside main program, function or subroutine");
|
||||
mlir::Block *continueBlock =
|
||||
builder->getBlock()->splitBlock(builder->getBlock()->end());
|
||||
builder->create<mlir::cf::CondBranchOp>(toLocation(), exitCond,
|
||||
funit->finalBlock, continueBlock);
|
||||
mlir::cf::CondBranchOp::create(*builder, toLocation(), exitCond,
|
||||
funit->finalBlock, continueBlock);
|
||||
builder->setInsertionPointToEnd(continueBlock);
|
||||
}
|
||||
}
|
||||
@ -3359,8 +3363,8 @@ private:
|
||||
step = fir::getBase(
|
||||
genExprValue(*Fortran::semantics::GetExpr(*expr), stmtCtx));
|
||||
else
|
||||
step = builder->create<mlir::arith::ConstantIndexOp>(
|
||||
loc, 1); // Use index type directly
|
||||
step = mlir::arith::ConstantIndexOp::create(
|
||||
*builder, loc, 1); // Use index type directly
|
||||
|
||||
// Ensure lb, ub, and step are of index type using fir.convert
|
||||
lb = fir::ConvertOp::create(*builder, loc, idxTy, lb);
|
||||
@ -3631,7 +3635,8 @@ private:
|
||||
auto genCond = [&](mlir::Value rhs,
|
||||
mlir::arith::CmpIPredicate pred) -> mlir::Value {
|
||||
if (!isCharSelector)
|
||||
return builder->create<mlir::arith::CmpIOp>(loc, pred, selector, rhs);
|
||||
return mlir::arith::CmpIOp::create(*builder, loc, pred, selector,
|
||||
rhs);
|
||||
fir::factory::CharacterExprHelper charHelper{*builder, loc};
|
||||
std::pair<mlir::Value, mlir::Value> lhsVal =
|
||||
charHelper.createUnboxChar(selector);
|
||||
@ -3846,9 +3851,9 @@ private:
|
||||
mlir::Block *selectCaseBlock = insertBlock(blockList[0]);
|
||||
mlir::Block *assumedSizeBlock =
|
||||
rankStarBlock ? rankStarBlock : defaultBlock;
|
||||
builder->create<mlir::cf::CondBranchOp>(
|
||||
loc, isAssumedSize, assumedSizeBlock, mlir::ValueRange{},
|
||||
selectCaseBlock, mlir::ValueRange{});
|
||||
mlir::cf::CondBranchOp::create(*builder, loc, isAssumedSize,
|
||||
assumedSizeBlock, mlir::ValueRange{},
|
||||
selectCaseBlock, mlir::ValueRange{});
|
||||
startBlock(selectCaseBlock);
|
||||
}
|
||||
// Create fir.select_case for the other rank cases.
|
||||
@ -5637,7 +5642,7 @@ private:
|
||||
if (Fortran::lower::isInOpenACCLoop(*builder))
|
||||
Fortran::lower::genEarlyReturnInOpenACCLoop(*builder, loc);
|
||||
else
|
||||
builder->create<mlir::cf::BranchOp>(loc, funit->finalBlock);
|
||||
mlir::cf::BranchOp::create(*builder, loc, funit->finalBlock);
|
||||
}
|
||||
|
||||
void genFIR(const Fortran::parser::CycleStmt &) {
|
||||
|
@ -1566,8 +1566,8 @@ template <typename OpTy, typename... Args>
|
||||
static OpTy genOpWithBody(const OpWithBodyGenInfo &info,
|
||||
const ConstructQueue &queue,
|
||||
ConstructQueue::const_iterator item, Args &&...args) {
|
||||
auto op = info.converter.getFirOpBuilder().create<OpTy>(
|
||||
info.loc, std::forward<Args>(args)...);
|
||||
auto op = OpTy::create(info.converter.getFirOpBuilder(), info.loc,
|
||||
std::forward<Args>(args)...);
|
||||
createBodyOfOp(*op, info, queue, item);
|
||||
return op;
|
||||
}
|
||||
@ -1948,7 +1948,7 @@ genBarrierOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
|
||||
semantics::SemanticsContext &semaCtx, lower::pft::Evaluation &eval,
|
||||
mlir::Location loc, const ConstructQueue &queue,
|
||||
ConstructQueue::const_iterator item) {
|
||||
return converter.getFirOpBuilder().create<mlir::omp::BarrierOp>(loc);
|
||||
return mlir::omp::BarrierOp::create(converter.getFirOpBuilder(), loc);
|
||||
}
|
||||
|
||||
static mlir::omp::CancelOp genCancelOp(lower::AbstractConverter &converter,
|
||||
@ -1960,8 +1960,8 @@ static mlir::omp::CancelOp genCancelOp(lower::AbstractConverter &converter,
|
||||
mlir::omp::CancelOperands clauseOps;
|
||||
genCancelClauses(converter, semaCtx, item->clauses, loc, clauseOps);
|
||||
|
||||
return converter.getFirOpBuilder().create<mlir::omp::CancelOp>(loc,
|
||||
clauseOps);
|
||||
return mlir::omp::CancelOp::create(converter.getFirOpBuilder(), loc,
|
||||
clauseOps);
|
||||
}
|
||||
|
||||
static mlir::omp::CancellationPointOp genCancellationPointOp(
|
||||
@ -1972,8 +1972,8 @@ static mlir::omp::CancellationPointOp genCancellationPointOp(
|
||||
genCancellationPointClauses(converter, semaCtx, item->clauses, loc,
|
||||
clauseOps);
|
||||
|
||||
return converter.getFirOpBuilder().create<mlir::omp::CancellationPointOp>(
|
||||
loc, clauseOps);
|
||||
return mlir::omp::CancellationPointOp::create(converter.getFirOpBuilder(),
|
||||
loc, clauseOps);
|
||||
}
|
||||
|
||||
static mlir::omp::CriticalOp
|
||||
@ -2016,8 +2016,9 @@ genFlushOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
|
||||
genFlushClauses(converter, semaCtx, objects, item->clauses, loc,
|
||||
operandRange);
|
||||
|
||||
return converter.getFirOpBuilder().create<mlir::omp::FlushOp>(
|
||||
converter.getCurrentLocation(), operandRange);
|
||||
return mlir::omp::FlushOp::create(converter.getFirOpBuilder(),
|
||||
converter.getCurrentLocation(),
|
||||
operandRange);
|
||||
}
|
||||
|
||||
static mlir::omp::LoopNestOp genLoopNestOp(
|
||||
@ -2135,36 +2136,37 @@ genCanonicalLoopOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
|
||||
// Start lowering
|
||||
mlir::Value zero = firOpBuilder.createIntegerConstant(loc, loopVarType, 0);
|
||||
mlir::Value one = firOpBuilder.createIntegerConstant(loc, loopVarType, 1);
|
||||
mlir::Value isDownwards = firOpBuilder.create<mlir::arith::CmpIOp>(
|
||||
loc, mlir::arith::CmpIPredicate::slt, loopStepVar, zero);
|
||||
mlir::Value isDownwards = mlir::arith::CmpIOp::create(
|
||||
firOpBuilder, loc, mlir::arith::CmpIPredicate::slt, loopStepVar, zero);
|
||||
|
||||
// Ensure we are counting upwards. If not, negate step and swap lb and ub.
|
||||
mlir::Value negStep =
|
||||
firOpBuilder.create<mlir::arith::SubIOp>(loc, zero, loopStepVar);
|
||||
mlir::Value incr = firOpBuilder.create<mlir::arith::SelectOp>(
|
||||
loc, isDownwards, negStep, loopStepVar);
|
||||
mlir::Value lb = firOpBuilder.create<mlir::arith::SelectOp>(
|
||||
loc, isDownwards, loopUBVar, loopLBVar);
|
||||
mlir::Value ub = firOpBuilder.create<mlir::arith::SelectOp>(
|
||||
loc, isDownwards, loopLBVar, loopUBVar);
|
||||
mlir::arith::SubIOp::create(firOpBuilder, loc, zero, loopStepVar);
|
||||
mlir::Value incr = mlir::arith::SelectOp::create(
|
||||
firOpBuilder, loc, isDownwards, negStep, loopStepVar);
|
||||
mlir::Value lb = mlir::arith::SelectOp::create(firOpBuilder, loc, isDownwards,
|
||||
loopUBVar, loopLBVar);
|
||||
mlir::Value ub = mlir::arith::SelectOp::create(firOpBuilder, loc, isDownwards,
|
||||
loopLBVar, loopUBVar);
|
||||
|
||||
// Compute the trip count assuming lb <= ub. This guarantees that the result
|
||||
// is non-negative and we can use unsigned arithmetic.
|
||||
mlir::Value span = firOpBuilder.create<mlir::arith::SubIOp>(
|
||||
loc, ub, lb, ::mlir::arith::IntegerOverflowFlags::nuw);
|
||||
mlir::Value span = mlir::arith::SubIOp::create(
|
||||
firOpBuilder, loc, ub, lb, ::mlir::arith::IntegerOverflowFlags::nuw);
|
||||
mlir::Value tcMinusOne =
|
||||
firOpBuilder.create<mlir::arith::DivUIOp>(loc, span, incr);
|
||||
mlir::Value tcIfLooping = firOpBuilder.create<mlir::arith::AddIOp>(
|
||||
loc, tcMinusOne, one, ::mlir::arith::IntegerOverflowFlags::nuw);
|
||||
mlir::arith::DivUIOp::create(firOpBuilder, loc, span, incr);
|
||||
mlir::Value tcIfLooping =
|
||||
mlir::arith::AddIOp::create(firOpBuilder, loc, tcMinusOne, one,
|
||||
::mlir::arith::IntegerOverflowFlags::nuw);
|
||||
|
||||
// Fall back to 0 if lb > ub
|
||||
mlir::Value isZeroTC = firOpBuilder.create<mlir::arith::CmpIOp>(
|
||||
loc, mlir::arith::CmpIPredicate::slt, ub, lb);
|
||||
mlir::Value tripcount = firOpBuilder.create<mlir::arith::SelectOp>(
|
||||
loc, isZeroTC, zero, tcIfLooping);
|
||||
mlir::Value isZeroTC = mlir::arith::CmpIOp::create(
|
||||
firOpBuilder, loc, mlir::arith::CmpIPredicate::slt, ub, lb);
|
||||
mlir::Value tripcount = mlir::arith::SelectOp::create(
|
||||
firOpBuilder, loc, isZeroTC, zero, tcIfLooping);
|
||||
|
||||
// Create the CLI handle.
|
||||
auto newcli = firOpBuilder.create<mlir::omp::NewCliOp>(loc);
|
||||
auto newcli = mlir::omp::NewCliOp::create(firOpBuilder, loc);
|
||||
mlir::Value cli = newcli.getResult();
|
||||
|
||||
auto ivCallback = [&](mlir::Operation *op)
|
||||
@ -2177,9 +2179,9 @@ genCanonicalLoopOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
|
||||
// Compute the value of the loop variable from the logical iteration number.
|
||||
mlir::Value natIterNum = fir::getBase(region.front().getArgument(0));
|
||||
mlir::Value scaled =
|
||||
firOpBuilder.create<mlir::arith::MulIOp>(loc, natIterNum, loopStepVar);
|
||||
mlir::arith::MulIOp::create(firOpBuilder, loc, natIterNum, loopStepVar);
|
||||
mlir::Value userVal =
|
||||
firOpBuilder.create<mlir::arith::AddIOp>(loc, loopLBVar, scaled);
|
||||
mlir::arith::AddIOp::create(firOpBuilder, loc, loopLBVar, scaled);
|
||||
|
||||
// Write loop value to loop variable
|
||||
mlir::Operation *storeOp = setLoopVar(converter, loc, userVal, iv);
|
||||
@ -2226,7 +2228,7 @@ static void genUnrollOp(Fortran::lower::AbstractConverter &converter,
|
||||
|
||||
// Apply unrolling to it
|
||||
auto cli = canonLoop.getCli();
|
||||
firOpBuilder.create<mlir::omp::UnrollHeuristicOp>(loc, cli);
|
||||
mlir::omp::UnrollHeuristicOp::create(firOpBuilder, loc, cli);
|
||||
}
|
||||
|
||||
static mlir::omp::MaskedOp
|
||||
@ -2310,8 +2312,8 @@ genScanOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
|
||||
const ConstructQueue &queue, ConstructQueue::const_iterator item) {
|
||||
mlir::omp::ScanOperands clauseOps;
|
||||
genScanClauses(converter, semaCtx, item->clauses, loc, clauseOps);
|
||||
return converter.getFirOpBuilder().create<mlir::omp::ScanOp>(
|
||||
converter.getCurrentLocation(), clauseOps);
|
||||
return mlir::omp::ScanOp::create(converter.getFirOpBuilder(),
|
||||
converter.getCurrentLocation(), clauseOps);
|
||||
}
|
||||
|
||||
static mlir::omp::SectionsOp
|
||||
@ -2647,9 +2649,8 @@ static mlir::omp::TargetDataOp genTargetDataOp(
|
||||
genTargetDataClauses(converter, semaCtx, stmtCtx, item->clauses, loc,
|
||||
clauseOps, useDeviceAddrSyms, useDevicePtrSyms);
|
||||
|
||||
auto targetDataOp =
|
||||
converter.getFirOpBuilder().create<mlir::omp::TargetDataOp>(loc,
|
||||
clauseOps);
|
||||
auto targetDataOp = mlir::omp::TargetDataOp::create(
|
||||
converter.getFirOpBuilder(), loc, clauseOps);
|
||||
|
||||
llvm::SmallVector<mlir::Value> useDeviceAddrBaseValues,
|
||||
useDevicePtrBaseValues;
|
||||
@ -2763,8 +2764,8 @@ genTaskwaitOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
|
||||
ConstructQueue::const_iterator item) {
|
||||
mlir::omp::TaskwaitOperands clauseOps;
|
||||
genTaskwaitClauses(converter, semaCtx, item->clauses, loc, clauseOps);
|
||||
return converter.getFirOpBuilder().create<mlir::omp::TaskwaitOp>(loc,
|
||||
clauseOps);
|
||||
return mlir::omp::TaskwaitOp::create(converter.getFirOpBuilder(), loc,
|
||||
clauseOps);
|
||||
}
|
||||
|
||||
static mlir::omp::TaskyieldOp
|
||||
@ -2773,7 +2774,7 @@ genTaskyieldOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
|
||||
lower::pft::Evaluation &eval, mlir::Location loc,
|
||||
const ConstructQueue &queue,
|
||||
ConstructQueue::const_iterator item) {
|
||||
return converter.getFirOpBuilder().create<mlir::omp::TaskyieldOp>(loc);
|
||||
return mlir::omp::TaskyieldOp::create(converter.getFirOpBuilder(), loc);
|
||||
}
|
||||
|
||||
static mlir::omp::WorkshareOp genWorkshareOp(
|
||||
|
@ -147,7 +147,8 @@ mlir::Value fir::FirOpBuilder::createIntegerConstant(mlir::Location loc,
|
||||
assert((cst >= 0 || mlir::isa<mlir::IndexType>(ty) ||
|
||||
mlir::cast<mlir::IntegerType>(ty).getWidth() <= 64) &&
|
||||
"must use APint");
|
||||
return create<mlir::arith::ConstantOp>(loc, ty, getIntegerAttr(ty, cst));
|
||||
return mlir::arith::ConstantOp::create(*this, loc, ty,
|
||||
getIntegerAttr(ty, cst));
|
||||
}
|
||||
|
||||
mlir::Value fir::FirOpBuilder::createAllOnesInteger(mlir::Location loc,
|
||||
@ -156,7 +157,8 @@ mlir::Value fir::FirOpBuilder::createAllOnesInteger(mlir::Location loc,
|
||||
return createIntegerConstant(loc, ty, -1);
|
||||
llvm::APInt allOnes =
|
||||
llvm::APInt::getAllOnes(mlir::cast<mlir::IntegerType>(ty).getWidth());
|
||||
return create<mlir::arith::ConstantOp>(loc, ty, getIntegerAttr(ty, allOnes));
|
||||
return mlir::arith::ConstantOp::create(*this, loc, ty,
|
||||
getIntegerAttr(ty, allOnes));
|
||||
}
|
||||
|
||||
mlir::Value
|
||||
@ -185,7 +187,7 @@ mlir::Value fir::FirOpBuilder::createRealConstant(mlir::Location loc,
|
||||
const llvm::APFloat &value) {
|
||||
if (mlir::isa<mlir::FloatType>(fltTy)) {
|
||||
auto attr = getFloatAttr(fltTy, value);
|
||||
return create<mlir::arith::ConstantOp>(loc, fltTy, attr);
|
||||
return mlir::arith::ConstantOp::create(*this, loc, fltTy, attr);
|
||||
}
|
||||
llvm_unreachable("should use builtin floating-point type");
|
||||
}
|
||||
@ -418,12 +420,12 @@ mlir::Value fir::FirOpBuilder::genTempDeclareOp(
|
||||
mlir::Value fir::FirOpBuilder::genStackSave(mlir::Location loc) {
|
||||
mlir::Type voidPtr = mlir::LLVM::LLVMPointerType::get(
|
||||
getContext(), fir::factory::getAllocaAddressSpace(&getDataLayout()));
|
||||
return create<mlir::LLVM::StackSaveOp>(loc, voidPtr);
|
||||
return mlir::LLVM::StackSaveOp::create(*this, loc, voidPtr);
|
||||
}
|
||||
|
||||
void fir::FirOpBuilder::genStackRestore(mlir::Location loc,
|
||||
mlir::Value stackPointer) {
|
||||
create<mlir::LLVM::StackRestoreOp>(loc, stackPointer);
|
||||
mlir::LLVM::StackRestoreOp::create(*this, loc, stackPointer);
|
||||
}
|
||||
|
||||
/// Create a global variable in the (read-only) data section. A global variable
|
||||
@ -701,8 +703,8 @@ mlir::Value fir::FirOpBuilder::createSlice(mlir::Location loc,
|
||||
for (auto [lbnd, extent] : llvm::zip(lbounds, extents)) {
|
||||
auto lb = createConvert(loc, idxTy, lbnd);
|
||||
auto ext = createConvert(loc, idxTy, extent);
|
||||
auto shift = create<mlir::arith::SubIOp>(loc, lb, one);
|
||||
auto ub = create<mlir::arith::AddIOp>(loc, ext, shift);
|
||||
auto shift = mlir::arith::SubIOp::create(*this, loc, lb, one);
|
||||
auto ub = mlir::arith::AddIOp::create(*this, loc, ext, shift);
|
||||
trips.push_back(lb);
|
||||
trips.push_back(ub);
|
||||
trips.push_back(one);
|
||||
@ -852,12 +854,12 @@ mlir::Value fir::FirOpBuilder::genExtentFromTriplet(mlir::Location loc,
|
||||
lb = createConvert(loc, type, lb);
|
||||
ub = createConvert(loc, type, ub);
|
||||
step = createConvert(loc, type, step);
|
||||
auto diff = create<mlir::arith::SubIOp>(loc, ub, lb);
|
||||
auto add = create<mlir::arith::AddIOp>(loc, diff, step);
|
||||
auto div = create<mlir::arith::DivSIOp>(loc, add, step);
|
||||
auto cmp = create<mlir::arith::CmpIOp>(loc, mlir::arith::CmpIPredicate::sgt,
|
||||
div, zero);
|
||||
return create<mlir::arith::SelectOp>(loc, cmp, div, zero);
|
||||
auto diff = mlir::arith::SubIOp::create(*this, loc, ub, lb);
|
||||
auto add = mlir::arith::AddIOp::create(*this, loc, diff, step);
|
||||
auto div = mlir::arith::DivSIOp::create(*this, loc, add, step);
|
||||
auto cmp = mlir::arith::CmpIOp::create(
|
||||
*this, loc, mlir::arith::CmpIPredicate::sgt, div, zero);
|
||||
return mlir::arith::SelectOp::create(*this, loc, cmp, div, zero);
|
||||
}
|
||||
|
||||
mlir::Value fir::FirOpBuilder::genAbsentOp(mlir::Location loc,
|
||||
|
@ -2413,14 +2413,14 @@ mlir::func::FuncOp IntrinsicLibrary::getWrapper(GeneratorType generator,
|
||||
|
||||
if constexpr (std::is_same_v<GeneratorType, SubroutineGenerator>) {
|
||||
localLib.invokeGenerator(generator, localArguments);
|
||||
localBuilder->create<mlir::func::ReturnOp>(localLoc);
|
||||
mlir::func::ReturnOp::create(*localBuilder, localLoc);
|
||||
} else {
|
||||
assert(funcType.getNumResults() == 1 &&
|
||||
"expect one result for intrinsic function wrapper type");
|
||||
mlir::Type resultType = funcType.getResult(0);
|
||||
auto result =
|
||||
localLib.invokeGenerator(generator, resultType, localArguments);
|
||||
localBuilder->create<mlir::func::ReturnOp>(localLoc, result);
|
||||
mlir::func::ReturnOp::create(*localBuilder, localLoc, result);
|
||||
}
|
||||
} else {
|
||||
// Wrapper was already built, ensure it has the sought type
|
||||
@ -6662,9 +6662,8 @@ IntrinsicLibrary::genMatchAllSync(mlir::Type resultType,
|
||||
mlir::Type retTy =
|
||||
mlir::LLVM::LLVMStructType::getLiteral(context, {resultType, i1Ty});
|
||||
auto match =
|
||||
builder
|
||||
.create<mlir::NVVM::MatchSyncOp>(loc, retTy, args[0], arg1,
|
||||
mlir::NVVM::MatchSyncKind::all)
|
||||
mlir::NVVM::MatchSyncOp::create(builder, loc, retTy, args[0], arg1,
|
||||
mlir::NVVM::MatchSyncKind::all)
|
||||
.getResult();
|
||||
auto value = mlir::LLVM::ExtractValueOp::create(builder, loc, match, 0);
|
||||
auto pred = mlir::LLVM::ExtractValueOp::create(builder, loc, match, 1);
|
||||
@ -6701,9 +6700,8 @@ IntrinsicLibrary::genMatchAnySync(mlir::Type resultType,
|
||||
arg1 = fir::ConvertOp::create(
|
||||
builder, loc, is32 ? builder.getI32Type() : builder.getI64Type(), arg1);
|
||||
|
||||
return builder
|
||||
.create<mlir::NVVM::MatchSyncOp>(loc, resultType, args[0], arg1,
|
||||
mlir::NVVM::MatchSyncKind::any)
|
||||
return mlir::NVVM::MatchSyncOp::create(builder, loc, resultType, args[0],
|
||||
arg1, mlir::NVVM::MatchSyncKind::any)
|
||||
.getResult();
|
||||
}
|
||||
|
||||
@ -8142,7 +8140,7 @@ mlir::Value IntrinsicLibrary::genSinpi(mlir::Type resultType,
|
||||
mlir::Value dfactor =
|
||||
builder.createRealConstant(loc, mlir::Float64Type::get(context), pi);
|
||||
mlir::Value factor = builder.createConvert(loc, args[0].getType(), dfactor);
|
||||
mlir::Value arg = builder.create<mlir::arith::MulFOp>(loc, args[0], factor);
|
||||
mlir::Value arg = mlir::arith::MulFOp::create(builder, loc, args[0], factor);
|
||||
return getRuntimeCallGenerator("sin", ftype)(builder, loc, {arg});
|
||||
}
|
||||
|
||||
@ -8239,7 +8237,7 @@ mlir::Value IntrinsicLibrary::genTanpi(mlir::Type resultType,
|
||||
mlir::Value dfactor =
|
||||
builder.createRealConstant(loc, mlir::Float64Type::get(context), pi);
|
||||
mlir::Value factor = builder.createConvert(loc, args[0].getType(), dfactor);
|
||||
mlir::Value arg = builder.create<mlir::arith::MulFOp>(loc, args[0], factor);
|
||||
mlir::Value arg = mlir::arith::MulFOp::create(builder, loc, args[0], factor);
|
||||
return getRuntimeCallGenerator("tan", ftype)(builder, loc, {arg});
|
||||
}
|
||||
|
||||
|
@ -1335,19 +1335,19 @@ genCUFAllocDescriptor(mlir::Location loc,
|
||||
RTNAME_STRING(CUFAllocDescriptor));
|
||||
auto funcFunc =
|
||||
mod.lookupSymbol<mlir::func::FuncOp>(RTNAME_STRING(CUFAllocDescriptor));
|
||||
if (!llvmFunc && !funcFunc)
|
||||
mlir::OpBuilder::atBlockEnd(mod.getBody())
|
||||
.create<mlir::LLVM::LLVMFuncOp>(loc, RTNAME_STRING(CUFAllocDescriptor),
|
||||
fctTy);
|
||||
if (!llvmFunc && !funcFunc) {
|
||||
auto builder = mlir::OpBuilder::atBlockEnd(mod.getBody());
|
||||
mlir::LLVM::LLVMFuncOp::create(builder, loc,
|
||||
RTNAME_STRING(CUFAllocDescriptor), fctTy);
|
||||
}
|
||||
|
||||
mlir::Type structTy = typeConverter.convertBoxTypeAsStruct(boxTy);
|
||||
std::size_t boxSize = dl->getTypeSizeInBits(structTy) / 8;
|
||||
mlir::Value sizeInBytes =
|
||||
genConstantIndex(loc, llvmIntPtrType, rewriter, boxSize);
|
||||
llvm::SmallVector args = {sizeInBytes, sourceFile, sourceLine};
|
||||
return rewriter
|
||||
.create<mlir::LLVM::CallOp>(loc, fctTy, RTNAME_STRING(CUFAllocDescriptor),
|
||||
args)
|
||||
return mlir::LLVM::CallOp::create(rewriter, loc, fctTy,
|
||||
RTNAME_STRING(CUFAllocDescriptor), args)
|
||||
.getResult();
|
||||
}
|
||||
|
||||
|
@ -520,10 +520,10 @@ public:
|
||||
llvm::SmallVector<mlir::Value, 1> newCallResults;
|
||||
// TODO propagate/update call argument and result attributes.
|
||||
if constexpr (std::is_same_v<std::decay_t<A>, mlir::gpu::LaunchFuncOp>) {
|
||||
auto newCall = rewriter->create<A>(
|
||||
loc, callOp.getKernel(), callOp.getGridSizeOperandValues(),
|
||||
callOp.getBlockSizeOperandValues(),
|
||||
callOp.getDynamicSharedMemorySize(), newOpers);
|
||||
auto newCall = A::create(*rewriter, loc, callOp.getKernel(),
|
||||
callOp.getGridSizeOperandValues(),
|
||||
callOp.getBlockSizeOperandValues(),
|
||||
callOp.getDynamicSharedMemorySize(), newOpers);
|
||||
if (callOp.getClusterSizeX())
|
||||
newCall.getClusterSizeXMutable().assign(callOp.getClusterSizeX());
|
||||
if (callOp.getClusterSizeY())
|
||||
@ -585,9 +585,10 @@ public:
|
||||
else
|
||||
newCallResults.append(newCall.result_begin(), newCall.result_end());
|
||||
} else {
|
||||
fir::DispatchOp dispatchOp = rewriter->create<A>(
|
||||
loc, newResTys, rewriter->getStringAttr(callOp.getMethod()),
|
||||
callOp.getOperands()[0], newOpers,
|
||||
fir::DispatchOp dispatchOp = A::create(
|
||||
*rewriter, loc, newResTys,
|
||||
rewriter->getStringAttr(callOp.getMethod()), callOp.getOperands()[0],
|
||||
newOpers,
|
||||
rewriter->getI32IntegerAttr(*callOp.getPassArgPos() + passArgShift),
|
||||
/*arg_attrs=*/nullptr, /*res_attrs=*/nullptr,
|
||||
callOp.getProcedureAttrsAttr());
|
||||
@ -1056,7 +1057,7 @@ public:
|
||||
auto cast =
|
||||
fir::ConvertOp::create(*rewriter, loc, oldOperTy, newArg);
|
||||
fir::StoreOp::create(*rewriter, loc, oldOper, cast);
|
||||
rewriter->create<ReturnOpTy>(loc);
|
||||
ReturnOpTy::create(*rewriter, loc);
|
||||
ret.erase();
|
||||
});
|
||||
} break;
|
||||
@ -1069,7 +1070,7 @@ public:
|
||||
mlir::Value bitcast =
|
||||
convertValueInMemory(loc, oldOper, newResTys[fixup.index],
|
||||
/*inputMayBeBigger=*/false);
|
||||
rewriter->create<ReturnOpTy>(loc, bitcast);
|
||||
ReturnOpTy::create(*rewriter, loc, bitcast);
|
||||
ret.erase();
|
||||
});
|
||||
} break;
|
||||
|
@ -43,8 +43,8 @@ public:
|
||||
|
||||
mlir::Value createConstant(std::int64_t cst) {
|
||||
mlir::Type indexType = firBuilder->getIndexType();
|
||||
return firBuilder->create<mlir::arith::ConstantOp>(
|
||||
getLoc(), indexType, firBuilder->getIntegerAttr(indexType, cst));
|
||||
return mlir::arith::ConstantOp::create(*firBuilder, getLoc(), indexType,
|
||||
firBuilder->getIntegerAttr(indexType, cst));
|
||||
}
|
||||
|
||||
mlir::Location getLoc() { return firBuilder->getUnknownLoc(); }
|
||||
|
@ -19,10 +19,10 @@ public:
|
||||
|
||||
// Set up a Module with a dummy function operation inside.
|
||||
// Set the insertion point in the function entry block.
|
||||
moduleOp = builder->create<mlir::ModuleOp>(loc);
|
||||
moduleOp = mlir::ModuleOp::create(*builder, loc);
|
||||
builder->setInsertionPointToStart(moduleOp->getBody());
|
||||
mlir::func::FuncOp func = builder->create<mlir::func::FuncOp>(
|
||||
loc, "fortran_variable_tests", builder->getFunctionType({}, {}));
|
||||
mlir::func::FuncOp func = mlir::func::FuncOp::create(*builder, loc,
|
||||
"fortran_variable_tests", builder->getFunctionType({}, {}));
|
||||
auto *entryBlock = func.addEntryBlock();
|
||||
builder->setInsertionPointToStart(entryBlock);
|
||||
}
|
||||
@ -30,8 +30,8 @@ public:
|
||||
mlir::Location getLoc() { return builder->getUnknownLoc(); }
|
||||
mlir::Value createConstant(std::int64_t cst) {
|
||||
mlir::Type indexType = builder->getIndexType();
|
||||
return builder->create<mlir::arith::ConstantOp>(
|
||||
getLoc(), indexType, builder->getIntegerAttr(indexType, cst));
|
||||
return mlir::arith::ConstantOp::create(
|
||||
*builder, getLoc(), indexType, builder->getIntegerAttr(indexType, cst));
|
||||
}
|
||||
|
||||
mlir::Value createShape(llvm::ArrayRef<mlir::Value> extents) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user