@@ -53,7 +53,7 @@ class LLVM_IntArithmeticOp<string mnemonic, string instName,
5353 LLVM_ArithmeticOpBase<AnySignlessInteger, mnemonic, instName, traits> {
5454 let arguments = commonArgs;
5555 string mlirBuilder = [{
56- $res = $_builder.create<$ _qualCppClassName>( $_location, $lhs, $rhs);
56+ $res = $_qualCppClassName::create($_builder, $_location, $lhs, $rhs);
5757 }];
5858}
5959class LLVM_IntArithmeticOpWithOverflowFlag<string mnemonic, string instName,
@@ -64,7 +64,7 @@ class LLVM_IntArithmeticOpWithOverflowFlag<string mnemonic, string instName,
6464 let arguments = !con(commonArgs, iofArg);
6565
6666 string mlirBuilder = [{
67- auto op = $_builder.create<$ _qualCppClassName>( $_location, $lhs, $rhs);
67+ auto op = $_qualCppClassName::create($_builder, $_location, $lhs, $rhs);
6868 moduleImport.setIntegerOverflowFlags(inst, op);
6969 $res = op;
7070 }];
@@ -82,7 +82,7 @@ class LLVM_IntArithmeticOpWithExactFlag<string mnemonic, string instName,
8282 let arguments = !con(commonArgs, (ins UnitAttr:$isExact));
8383
8484 string mlirBuilder = [{
85- auto op = $_builder.create<$ _qualCppClassName>( $_location, $lhs, $rhs);
85+ auto op = $_qualCppClassName::create($_builder, $_location, $lhs, $rhs);
8686 moduleImport.setExactFlag(inst, op);
8787 $res = op;
8888 }];
@@ -100,7 +100,7 @@ class LLVM_IntArithmeticOpWithDisjointFlag<string mnemonic, string instName,
100100 let arguments = !con(commonArgs, (ins UnitAttr:$isDisjoint));
101101
102102 string mlirBuilder = [{
103- auto op = $_builder.create<$ _qualCppClassName>( $_location, $lhs, $rhs);
103+ auto op = $_qualCppClassName::create($_builder, $_location, $lhs, $rhs);
104104 moduleImport.setDisjointFlag(inst, op);
105105 $res = op;
106106 }];
@@ -121,7 +121,7 @@ class LLVM_FloatArithmeticOp<string mnemonic, string instName,
121121 ins DefaultValuedAttr<LLVM_FastmathFlagsAttr, "{}">:$fastmathFlags);
122122 let arguments = !con(commonArgs, fmfArg);
123123 string mlirBuilder = [{
124- auto op = $_builder.create<$ _qualCppClassName>( $_location, $lhs, $rhs);
124+ auto op = $_qualCppClassName::create($_builder, $_location, $lhs, $rhs);
125125 moduleImport.setFastmathFlagsAttr(inst, op);
126126 $res = op;
127127 }];
@@ -141,7 +141,7 @@ class LLVM_UnaryFloatArithmeticOp<Type type, string mnemonic,
141141 let assemblyFormat = "$operand attr-dict `:` type($res)";
142142 string llvmInstName = instName;
143143 string mlirBuilder = [{
144- auto op = $_builder.create<$ _qualCppClassName>( $_location, $operand);
144+ auto op = $_qualCppClassName::create($_builder, $_location, $operand);
145145 moduleImport.setFastmathFlagsAttr(inst, op);
146146 $res = op;
147147 }];
@@ -193,7 +193,7 @@ def LLVM_ICmpOp : LLVM_ArithmeticCmpOp<"icmp", [Pure]> {
193193 }];
194194 string mlirBuilder = [{
195195 auto *iCmpInst = cast<llvm::ICmpInst>(inst);
196- $res = $_builder.create<$ _qualCppClassName>( $_location,
196+ $res = $_qualCppClassName::create($_builder, $_location,
197197 convertICmpPredicateFromLLVM(iCmpInst->getPredicate()), $lhs, $rhs);
198198 }];
199199 // Set the $predicate index to -1 to indicate there is no matching operand
@@ -217,7 +217,7 @@ def LLVM_FCmpOp : LLVM_ArithmeticCmpOp<"fcmp", [
217217 }];
218218 string mlirBuilder = [{
219219 auto *fCmpInst = cast<llvm::FCmpInst>(inst);
220- auto op = $_builder.create<$ _qualCppClassName>(
220+ auto op = $_qualCppClassName::create($_builder,
221221 $_location, convertFCmpPredicateFromLLVM(fCmpInst->getPredicate()), $lhs, $rhs);
222222 moduleImport.setFastmathFlagsAttr(inst, op);
223223 $res = op;
@@ -261,7 +261,7 @@ def LLVM_AllocaOp : LLVM_Op<"alloca",
261261 Type allocatedType =
262262 moduleImport.convertType(allocaInst->getAllocatedType());
263263 unsigned alignment = allocaInst->getAlign().value();
264- $res = $_builder.create< LLVM::AllocaOp>(
264+ $res = LLVM::AllocaOp::create($_builder,
265265 $_location, $_resultType, $arraySize,
266266 alignment == 0 ? IntegerAttr() : $_builder.getI64IntegerAttr(alignment),
267267 allocatedType, allocaInst->isUsedWithInAlloca());
@@ -440,7 +440,7 @@ def LLVM_LoadOp : LLVM_MemAccessOpBase<"load",
440440 string mlirBuilder = [{
441441 auto *loadInst = cast<llvm::LoadInst>(inst);
442442 unsigned alignment = loadInst->getAlign().value();
443- $res = $_builder.create< LLVM::LoadOp>( $_location, $_resultType, $addr,
443+ $res = LLVM::LoadOp::create($_builder, $_location, $_resultType, $addr,
444444 alignment, loadInst->isVolatile(),
445445 loadInst->hasMetadata(llvm::LLVMContext::MD_nontemporal),
446446 loadInst->hasMetadata(llvm::LLVMContext::MD_invariant_load),
@@ -518,7 +518,7 @@ def LLVM_StoreOp : LLVM_MemAccessOpBase<"store",
518518 string mlirBuilder = [{
519519 auto *storeInst = cast<llvm::StoreInst>(inst);
520520 unsigned alignment = storeInst->getAlign().value();
521- $_op = $_builder.create< LLVM::StoreOp>( $_location, $value, $addr,
521+ $_op = LLVM::StoreOp::create($_builder, $_location, $value, $addr,
522522 alignment, storeInst->isVolatile(),
523523 storeInst->hasMetadata(llvm::LLVMContext::MD_nontemporal),
524524 storeInst->hasMetadata(llvm::LLVMContext::MD_invariant_group),
@@ -547,7 +547,7 @@ class LLVM_CastOp<string mnemonic, string instName, Type type,
547547 let assemblyFormat = "$arg attr-dict `:` type($arg) `to` type($res)";
548548 string llvmInstName = instName;
549549 string mlirBuilder = [{
550- $res = $_builder.create<$ _qualCppClassName>(
550+ $res = $_qualCppClassName::create($_builder,
551551 $_location, $_resultType, $arg);
552552 }];
553553}
@@ -561,7 +561,7 @@ class LLVM_CastOpWithNNegFlag<string mnemonic, string instName, Type type,
561561 let assemblyFormat = "(`nneg` $nonNeg^)? $arg attr-dict `:` type($arg) `to` type($res)";
562562 string llvmInstName = instName;
563563 string mlirBuilder = [{
564- auto op = $_builder.create<$ _qualCppClassName>(
564+ auto op = $_qualCppClassName::create($_builder,
565565 $_location, $_resultType, $arg);
566566 moduleImport.setNonNegFlag(inst, op);
567567 $res = op;
@@ -578,7 +578,7 @@ class LLVM_CastOpWithOverflowFlag<string mnemonic, string instName, Type type,
578578 let assemblyFormat = "$arg ($overflowFlags^)? attr-dict `:` type($arg) `to` type($res)";
579579 string llvmInstName = instName;
580580 string mlirBuilder = [{
581- auto op = $_builder.create<$ _qualCppClassName>(
581+ auto op = $_qualCppClassName::create($_builder,
582582 $_location, $_resultType, $arg);
583583 moduleImport.setIntegerOverflowFlags(inst, op);
584584 $res = op;
@@ -602,7 +602,7 @@ class LLVM_DereferenceableCastOp<string mnemonic, string instName, Type type,
602602 }
603603 }];
604604 string mlirBuilder = [{
605- auto op = $_builder.create<$ _qualCppClassName>(
605+ auto op = $_qualCppClassName::create($_builder,
606606 $_location, $_resultType, $arg);
607607 $res = op;
608608 }];
@@ -725,7 +725,7 @@ def LLVM_VaArgOp : LLVM_Op<"va_arg"> {
725725
726726 string llvmInstName = "VAArg";
727727 string mlirBuilder = [{
728- $res = $_builder.create< mlir::LLVM::VaArgOp>(
728+ $res = mlir::LLVM::VaArgOp::create($_builder,
729729 $_location, $_resultType, $arg);
730730 }];
731731}
@@ -847,7 +847,7 @@ def LLVM_ExtractElementOp : LLVM_Op<"extractelement", [Pure,
847847 $res = builder.CreateExtractElement($vector, $position);
848848 }];
849849 string mlirBuilder = [{
850- $res = $_builder.create< LLVM::ExtractElementOp>(
850+ $res = LLVM::ExtractElementOp::create($_builder,
851851 $_location, $vector, $position);
852852 }];
853853}
@@ -881,7 +881,7 @@ def LLVM_ExtractValueOp : LLVM_Op<"extractvalue", [Pure]> {
881881 }];
882882 string mlirBuilder = [{
883883 auto *evInst = cast<llvm::ExtractValueInst>(inst);
884- $res = $_builder.create< LLVM::ExtractValueOp>( $_location,
884+ $res = LLVM::ExtractValueOp::create($_builder, $_location,
885885 $container, getPositionFromIndices(evInst->getIndices()));
886886 }];
887887}
@@ -913,7 +913,7 @@ def LLVM_InsertElementOp : LLVM_Op<"insertelement", [Pure,
913913 $res = builder.CreateInsertElement($vector, $value, $position);
914914 }];
915915 string mlirBuilder = [{
916- $res = $_builder.create< LLVM::InsertElementOp>(
916+ $res = LLVM::InsertElementOp::create($_builder,
917917 $_location, $vector, $value, $position);
918918 }];
919919}
@@ -945,7 +945,7 @@ def LLVM_InsertValueOp : LLVM_Op<
945945 }];
946946 string mlirBuilder = [{
947947 auto *ivInst = cast<llvm::InsertValueInst>(inst);
948- $res = $_builder.create< LLVM::InsertValueOp>( $_location,
948+ $res = LLVM::InsertValueOp::create($_builder, $_location,
949949 $container, $value, getPositionFromIndices(ivInst->getIndices()));
950950 }];
951951}
@@ -982,7 +982,7 @@ def LLVM_ShuffleVectorOp : LLVM_Op<"shufflevector",
982982 string mlirBuilder = [{
983983 auto *svInst = cast<llvm::ShuffleVectorInst>(inst);
984984 SmallVector<int32_t> mask(svInst->getShuffleMask());
985- $res = $_builder.create< LLVM::ShuffleVectorOp>(
985+ $res = LLVM::ShuffleVectorOp::create($_builder,
986986 $_location, $v1, $v2, mask);
987987 }];
988988}
@@ -1003,7 +1003,7 @@ def LLVM_SelectOp
10031003 let assemblyFormat = "operands attr-dict `:` type($condition) `,` type($res)";
10041004 string llvmInstName = "Select";
10051005 string mlirBuilder = [{
1006- auto op = $_builder.create< LLVM::SelectOp>(
1006+ auto op = LLVM::SelectOp::create($_builder,
10071007 $_location, $_resultType, $condition, $trueValue, $falseValue);
10081008 moduleImport.setFastmathFlagsAttr(inst, op);
10091009 $res = op;
@@ -1017,7 +1017,7 @@ def LLVM_FreezeOp : LLVM_Op<"freeze", [Pure, SameOperandsAndResultType]> {
10171017 string llvmInstName = "Freeze";
10181018 string llvmBuilder = "$res = builder.CreateFreeze($val);";
10191019 string mlirBuilder = [{
1020- $res = $_builder.create< LLVM::FreezeOp>( $_location, $val);
1020+ $res = LLVM::FreezeOp::create($_builder, $_location, $val);
10211021 }];
10221022}
10231023
@@ -1108,7 +1108,7 @@ def LLVM_ReturnOp : LLVM_TerminatorOp<"return", [Pure, ReturnLike]> {
11081108 moduleImport.convertValues(llvmOperands);
11091109 if (failed(mlirOperands))
11101110 return failure();
1111- $_op = $_builder.create< LLVM::ReturnOp>( $_location, *mlirOperands);
1111+ $_op = LLVM::ReturnOp::create($_builder, $_location, *mlirOperands);
11121112 }];
11131113}
11141114
@@ -1120,15 +1120,15 @@ def LLVM_ResumeOp : LLVM_TerminatorOp<"resume"> {
11201120 string llvmInstName = "Resume";
11211121 string llvmBuilder = [{ builder.CreateResume($value); }];
11221122 string mlirBuilder = [{
1123- $_op = $_builder.create< LLVM::ResumeOp>( $_location, $value);
1123+ $_op = LLVM::ResumeOp::create($_builder, $_location, $value);
11241124 }];
11251125}
11261126def LLVM_UnreachableOp : LLVM_TerminatorOp<"unreachable"> {
11271127 let assemblyFormat = "attr-dict";
11281128 string llvmInstName = "Unreachable";
11291129 string llvmBuilder = [{ builder.CreateUnreachable(); }];
11301130 string mlirBuilder = [{
1131- $_op = $_builder.create< LLVM::UnreachableOp>( $_location);
1131+ $_op = LLVM::UnreachableOp::create($_builder, $_location);
11321132 }];
11331133}
11341134
@@ -2256,7 +2256,7 @@ def LLVM_AtomicRMWOp : LLVM_MemAccessOpBase<"atomicrmw", [
22562256 string mlirBuilder = [{
22572257 auto *atomicInst = cast<llvm::AtomicRMWInst>(inst);
22582258 unsigned alignment = atomicInst->getAlign().value();
2259- $res = $_builder.create< LLVM::AtomicRMWOp>( $_location,
2259+ $res = LLVM::AtomicRMWOp::create($_builder, $_location,
22602260 convertAtomicBinOpFromLLVM(atomicInst->getOperation()), $ptr, $val,
22612261 convertAtomicOrderingFromLLVM(atomicInst->getOrdering()),
22622262 getLLVMSyncScope(atomicInst), alignment, atomicInst->isVolatile());
@@ -2311,7 +2311,7 @@ def LLVM_AtomicCmpXchgOp : LLVM_MemAccessOpBase<"cmpxchg", [
23112311 string mlirBuilder = [{
23122312 auto *cmpXchgInst = cast<llvm::AtomicCmpXchgInst>(inst);
23132313 unsigned alignment = cmpXchgInst->getAlign().value();
2314- $res = $_builder.create< LLVM::AtomicCmpXchgOp>(
2314+ $res = LLVM::AtomicCmpXchgOp::create($_builder,
23152315 $_location, $ptr, $cmp, $val,
23162316 convertAtomicOrderingFromLLVM(cmpXchgInst->getSuccessOrdering()),
23172317 convertAtomicOrderingFromLLVM(cmpXchgInst->getFailureOrdering()),
@@ -2340,7 +2340,7 @@ def LLVM_FenceOp : LLVM_Op<"fence">, LLVM_MemOpPatterns {
23402340 }] # setSyncScopeCode;
23412341 string mlirBuilder = [{
23422342 llvm::FenceInst *fenceInst = cast<llvm::FenceInst>(inst);
2343- $_op = $_builder.create< LLVM::FenceOp>(
2343+ $_op = LLVM::FenceOp::create($_builder,
23442344 $_location,
23452345 convertAtomicOrderingFromLLVM(fenceInst->getOrdering()),
23462346 getLLVMSyncScope(fenceInst));
0 commit comments