Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions clang/lib/CIR/CodeGen/CIRGenAsm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ mlir::LogicalResult CIRGenFunction::emitAsmStmt(const AsmStmt &s) {

bool hasSideEffect = s.isVolatile() || s.getNumOutputs() == 0;

cir::InlineAsmOp ia = builder.create<cir::InlineAsmOp>(
getLoc(s.getAsmLoc()), resultType, operands, asmString, constraints,
hasSideEffect, inferFlavor(cgm, s), mlir::ArrayAttr());
cir::InlineAsmOp ia = cir::InlineAsmOp::create(
builder, getLoc(s.getAsmLoc()), resultType, operands, asmString,
constraints, hasSideEffect, inferFlavor(cgm, s), mlir::ArrayAttr());

if (isGCCAsmGoto) {
assert(!cir::MissingFeatures::asmGoto());
Expand Down
20 changes: 10 additions & 10 deletions clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ static RValue emitBuiltinBitOp(CIRGenFunction &cgf, const CallExpr *e,
Op op;
if constexpr (std::is_same_v<Op, cir::BitClzOp> ||
std::is_same_v<Op, cir::BitCtzOp>)
op = builder.create<Op>(cgf.getLoc(e->getSourceRange()), arg, poisonZero);
op = Op::create(builder, cgf.getLoc(e->getSourceRange()), arg, poisonZero);
else
op = builder.create<Op>(cgf.getLoc(e->getSourceRange()), arg);
op = Op::create(builder, cgf.getLoc(e->getSourceRange()), arg);

mlir::Value result = op.getResult();
mlir::Type exprTy = cgf.convertType(e->getType());
Expand All @@ -67,8 +67,8 @@ RValue CIRGenFunction::emitRotate(const CallExpr *e, bool isRotateLeft) {
// to the type of input when necessary.
assert(!cir::MissingFeatures::msvcBuiltins());

auto r = builder.create<cir::RotateOp>(getLoc(e->getSourceRange()), input,
amount, isRotateLeft);
auto r = cir::RotateOp::create(builder, getLoc(e->getSourceRange()), input,
amount, isRotateLeft);
return RValue::get(r);
}

Expand Down Expand Up @@ -227,14 +227,14 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
return RValue::get(nullptr);

mlir::Value argValue = emitCheckedArgForAssume(e->getArg(0));
builder.create<cir::AssumeOp>(loc, argValue);
cir::AssumeOp::create(builder, loc, argValue);
return RValue::get(nullptr);
}

case Builtin::BI__builtin_assume_separate_storage: {
mlir::Value value0 = emitScalarExpr(e->getArg(0));
mlir::Value value1 = emitScalarExpr(e->getArg(1));
builder.create<cir::AssumeSepStorageOp>(loc, value0, value1);
cir::AssumeSepStorageOp::create(builder, loc, value0, value1);
return RValue::get(nullptr);
}

Expand Down Expand Up @@ -363,8 +363,8 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
probability);
}

auto result = builder.create<cir::ExpectOp>(
loc, argValue.getType(), argValue, expectedValue, probAttr);
auto result = cir::ExpectOp::create(builder, loc, argValue.getType(),
argValue, expectedValue, probAttr);
return RValue::get(result);
}

Expand All @@ -375,15 +375,15 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
case Builtin::BI_byteswap_ulong:
case Builtin::BI_byteswap_uint64: {
mlir::Value arg = emitScalarExpr(e->getArg(0));
return RValue::get(builder.create<cir::ByteSwapOp>(loc, arg));
return RValue::get(cir::ByteSwapOp::create(builder, loc, arg));
}

case Builtin::BI__builtin_bitreverse8:
case Builtin::BI__builtin_bitreverse16:
case Builtin::BI__builtin_bitreverse32:
case Builtin::BI__builtin_bitreverse64: {
mlir::Value arg = emitScalarExpr(e->getArg(0));
return RValue::get(builder.create<cir::BitReverseOp>(loc, arg));
return RValue::get(cir::BitReverseOp::create(builder, loc, arg));
}

case Builtin::BI__builtin_rotateleft8:
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CIR/CodeGen/CIRGenCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ static void emitDeclDestroy(CIRGenFunction &cgf, const VarDecl *vd,
// Don't confuse lexical cleanup.
builder.clearInsertionPoint();
} else {
builder.create<cir::YieldOp>(addr.getLoc());
cir::YieldOp::create(builder, addr.getLoc());
}
}

Expand Down
7 changes: 4 additions & 3 deletions clang/lib/CIR/CodeGen/CIRGenClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -725,8 +725,9 @@ void CIRGenFunction::emitCXXAggrConstructorCall(
// Emit the constructor call that will execute for every array element.
mlir::Value arrayOp =
builder.createPtrBitcast(arrayBase.getPointer(), arrayTy);
builder.create<cir::ArrayCtor>(
*currSrcLoc, arrayOp, [&](mlir::OpBuilder &b, mlir::Location loc) {
cir::ArrayCtor::create(
builder, *currSrcLoc, arrayOp,
[&](mlir::OpBuilder &b, mlir::Location loc) {
mlir::BlockArgument arg =
b.getInsertionBlock()->addArgument(ptrToElmType, loc);
Address curAddr = Address(arg, elementType, eltAlignment);
Expand All @@ -738,7 +739,7 @@ void CIRGenFunction::emitCXXAggrConstructorCall(
emitCXXConstructorCall(ctor, Ctor_Complete,
/*ForVirtualBase=*/false,
/*Delegating=*/false, currAVS, e);
builder.create<cir::YieldOp>(loc);
cir::YieldOp::create(builder, loc);
});
}
}
Expand Down
30 changes: 15 additions & 15 deletions clang/lib/CIR/CodeGen/CIRGenExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ void CIRGenFunction::emitStoreThroughLValue(RValue src, LValue dst,
const mlir::Location loc = dst.getVectorPointer().getLoc();
const mlir::Value vector =
builder.createLoad(loc, dst.getVectorAddress());
const mlir::Value newVector = builder.create<cir::VecInsertOp>(
loc, vector, src.getValue(), dst.getVectorIdx());
const mlir::Value newVector = cir::VecInsertOp::create(
builder, loc, vector, src.getValue(), dst.getVectorIdx());
builder.createStore(loc, newVector, dst.getVectorAddress());
return;
}
Expand Down Expand Up @@ -615,8 +615,8 @@ RValue CIRGenFunction::emitLoadOfLValue(LValue lv, SourceLocation loc) {
if (lv.isVectorElt()) {
const mlir::Value load =
builder.createLoad(getLoc(loc), lv.getVectorAddress());
return RValue::get(builder.create<cir::VecExtractOp>(getLoc(loc), load,
lv.getVectorIdx()));
return RValue::get(cir::VecExtractOp::create(builder, getLoc(loc), load,
lv.getVectorIdx()));
}

cgm.errorNYI(loc, "emitLoadOfLValue");
Expand Down Expand Up @@ -1685,8 +1685,8 @@ CIRGenCallee CIRGenFunction::emitDirectCallee(const GlobalDecl &gd) {
mlir::OpBuilder::InsertionGuard guard(builder);
builder.setInsertionPointToStart(cgm.getModule().getBody());

clone = builder.create<cir::FuncOp>(calleeFunc.getLoc(), fdInlineName,
calleeFunc.getFunctionType());
clone = cir::FuncOp::create(builder, calleeFunc.getLoc(), fdInlineName,
calleeFunc.getFunctionType());
clone.setLinkageAttr(cir::GlobalLinkageKindAttr::get(
&cgm.getMLIRContext(), cir::GlobalLinkageKind::InternalLinkage));
clone.setSymVisibility("private");
Expand Down Expand Up @@ -1778,8 +1778,8 @@ RValue CIRGenFunction::emitCall(clang::QualType calleeTy,
mlir::Operation *fn = callee.getFunctionPointer();
mlir::Value addr;
if (auto funcOp = mlir::dyn_cast<cir::FuncOp>(fn)) {
addr = builder.create<cir::GetGlobalOp>(
getLoc(e->getSourceRange()),
addr = cir::GetGlobalOp::create(
builder, getLoc(e->getSourceRange()),
cir::PointerType::get(funcOp.getFunctionType()), funcOp.getSymName());
} else {
addr = fn->getResult(0);
Expand Down Expand Up @@ -1996,9 +1996,9 @@ cir::IfOp CIRGenFunction::emitIfOnBoolExpr(

// Emit the code with the fully general case.
mlir::Value condV = emitOpOnBoolExpr(loc, cond);
return builder.create<cir::IfOp>(loc, condV, elseLoc.has_value(),
/*thenBuilder=*/thenBuilder,
/*elseBuilder=*/elseBuilder);
return cir::IfOp::create(builder, loc, condV, elseLoc.has_value(),
/*thenBuilder=*/thenBuilder,
/*elseBuilder=*/elseBuilder);
}

/// TODO(cir): see EmitBranchOnBoolExpr for extra ideas).
Expand All @@ -2025,12 +2025,12 @@ mlir::Value CIRGenFunction::emitOpOnBoolExpr(mlir::Location loc,
loc, condV, /*thenBuilder=*/
[this, trueExpr](mlir::OpBuilder &b, mlir::Location loc) {
mlir::Value lhs = emitScalarExpr(trueExpr);
b.create<cir::YieldOp>(loc, lhs);
cir::YieldOp::create(b, loc, lhs);
},
/*elseBuilder=*/
[this, falseExpr](mlir::OpBuilder &b, mlir::Location loc) {
mlir::Value rhs = emitScalarExpr(falseExpr);
b.create<cir::YieldOp>(loc, rhs);
cir::YieldOp::create(b, loc, rhs);
})
.getResult();

Expand Down Expand Up @@ -2211,8 +2211,8 @@ Address CIRGenFunction::emitLoadOfReference(LValue refLVal, mlir::Location loc,
cgm.errorNYI(loc, "load of volatile reference");

cir::LoadOp load =
builder.create<cir::LoadOp>(loc, refLVal.getAddress().getElementType(),
refLVal.getAddress().getPointer());
cir::LoadOp::create(builder, loc, refLVal.getAddress().getElementType(),
refLVal.getAddress().getPointer());

assert(!cir::MissingFeatures::opTBAA());

Expand Down
13 changes: 7 additions & 6 deletions clang/lib/CIR/CodeGen/CIRGenExprComplex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ ComplexExprEmitter::VisitImaginaryLiteral(const ImaginaryLiteral *il) {
}

auto complexAttr = cir::ConstComplexAttr::get(realValueAttr, imagValueAttr);
return builder.create<cir::ConstantOp>(loc, complexAttr);
return cir::ConstantOp::create(builder, loc, complexAttr);
}

mlir::Value ComplexExprEmitter::VisitCallExpr(const CallExpr *e) {
Expand Down Expand Up @@ -601,7 +601,7 @@ mlir::Value ComplexExprEmitter::emitBinAdd(const BinOpInfo &op) {

if (mlir::isa<cir::ComplexType>(op.lhs.getType()) &&
mlir::isa<cir::ComplexType>(op.rhs.getType()))
return builder.create<cir::ComplexAddOp>(op.loc, op.lhs, op.rhs);
return cir::ComplexAddOp::create(builder, op.loc, op.lhs, op.rhs);

if (mlir::isa<cir::ComplexType>(op.lhs.getType())) {
mlir::Value real = builder.createComplexReal(op.loc, op.lhs);
Expand All @@ -623,7 +623,7 @@ mlir::Value ComplexExprEmitter::emitBinSub(const BinOpInfo &op) {

if (mlir::isa<cir::ComplexType>(op.lhs.getType()) &&
mlir::isa<cir::ComplexType>(op.rhs.getType()))
return builder.create<cir::ComplexSubOp>(op.loc, op.lhs, op.rhs);
return cir::ComplexSubOp::create(builder, op.loc, op.lhs, op.rhs);

if (mlir::isa<cir::ComplexType>(op.lhs.getType())) {
mlir::Value real = builder.createComplexReal(op.loc, op.lhs);
Expand Down Expand Up @@ -664,7 +664,8 @@ mlir::Value ComplexExprEmitter::emitBinMul(const BinOpInfo &op) {
mlir::isa<cir::ComplexType>(op.rhs.getType())) {
cir::ComplexRangeKind rangeKind =
getComplexRangeAttr(op.fpFeatures.getComplexRange());
return builder.create<cir::ComplexMulOp>(op.loc, op.lhs, op.rhs, rangeKind);
return cir::ComplexMulOp::create(builder, op.loc, op.lhs, op.rhs,
rangeKind);
}

if (mlir::isa<cir::ComplexType>(op.lhs.getType())) {
Expand Down Expand Up @@ -975,14 +976,14 @@ mlir::Value ComplexExprEmitter::VisitAbstractConditionalOperator(
[&](mlir::OpBuilder &b, mlir::Location loc) {
eval.beginEvaluation();
mlir::Value trueValue = Visit(e->getTrueExpr());
b.create<cir::YieldOp>(loc, trueValue);
cir::YieldOp::create(b, loc, trueValue);
eval.endEvaluation();
},
/*elseBuilder=*/
[&](mlir::OpBuilder &b, mlir::Location loc) {
eval.beginEvaluation();
mlir::Value falseValue = Visit(e->getFalseExpr());
b.create<cir::YieldOp>(loc, falseValue);
cir::YieldOp::create(b, loc, falseValue);
eval.endEvaluation();
})
.getResult();
Expand Down
Loading
Loading