@@ -121,8 +121,8 @@ class MLIRGenImpl {
121121 llvm::SmallVector<mlir::Type, 4 > argTypes (proto.getArgs ().size (),
122122 getType (VarType{}));
123123 auto funcType = builder.getFunctionType (argTypes, {});
124- return builder. create < mlir::toy::FuncOp>( location, proto.getName (),
125- funcType);
124+ return mlir::toy::FuncOp::create (builder, location, proto.getName (),
125+ funcType);
126126 }
127127
128128 // / Emit a new function and add it to the MLIR module.
@@ -166,7 +166,7 @@ class MLIRGenImpl {
166166 if (!entryBlock.empty ())
167167 returnOp = dyn_cast<ReturnOp>(entryBlock.back ());
168168 if (!returnOp) {
169- builder. create < ReturnOp>( loc (funcAST.getProto ()->loc ()));
169+ ReturnOp::create (builder, loc (funcAST.getProto ()->loc ()));
170170 } else if (returnOp.hasOperand ()) {
171171 // Otherwise, if this return operation has an operand then add a result to
172172 // the function.
@@ -202,9 +202,9 @@ class MLIRGenImpl {
202202 // support '+' and '*'.
203203 switch (binop.getOp ()) {
204204 case ' +' :
205- return builder. create < AddOp>( location, lhs, rhs);
205+ return AddOp::create (builder, location, lhs, rhs);
206206 case ' *' :
207- return builder. create < MulOp>( location, lhs, rhs);
207+ return MulOp::create (builder, location, lhs, rhs);
208208 }
209209
210210 emitError (location, " invalid binary operator '" ) << binop.getOp () << " '" ;
@@ -235,8 +235,8 @@ class MLIRGenImpl {
235235 }
236236
237237 // Otherwise, this return operation has zero operands.
238- builder. create < ReturnOp>( location,
239- expr ? ArrayRef (expr) : ArrayRef<mlir::Value>());
238+ ReturnOp::create (builder, location,
239+ expr ? ArrayRef (expr) : ArrayRef<mlir::Value>());
240240 return mlir::success ();
241241 }
242242
@@ -280,7 +280,7 @@ class MLIRGenImpl {
280280
281281 // Build the MLIR op `toy.constant`. This invokes the `ConstantOp::build`
282282 // method.
283- return builder. create < ConstantOp>( loc (lit.loc ()), type, dataAttribute);
283+ return ConstantOp::create (builder, loc (lit.loc ()), type, dataAttribute);
284284 }
285285
286286 // / Recursive helper function to accumulate the data that compose an array
@@ -325,13 +325,13 @@ class MLIRGenImpl {
325325 " does not accept multiple arguments" );
326326 return nullptr ;
327327 }
328- return builder. create < TransposeOp>( location, operands[0 ]);
328+ return TransposeOp::create (builder, location, operands[0 ]);
329329 }
330330
331331 // Otherwise this is a call to a user-defined function. Calls to
332332 // user-defined functions are mapped to a custom call that takes the callee
333333 // name as an attribute.
334- return builder. create < GenericCallOp>( location, callee, operands);
334+ return GenericCallOp::create (builder, location, callee, operands);
335335 }
336336
337337 // / Emit a print expression. It emits specific operations for two builtins:
@@ -341,13 +341,13 @@ class MLIRGenImpl {
341341 if (!arg)
342342 return mlir::failure ();
343343
344- builder. create < PrintOp>( loc (call.loc ()), arg);
344+ PrintOp::create (builder, loc (call.loc ()), arg);
345345 return mlir::success ();
346346 }
347347
348348 // / Emit a constant for a single number (FIXME: semantic? broadcast?)
349349 mlir::Value mlirGen (NumberExprAST &num) {
350- return builder. create < ConstantOp>( loc (num.loc ()), num.getValue ());
350+ return ConstantOp::create (builder, loc (num.loc ()), num.getValue ());
351351 }
352352
353353 // / Dispatch codegen for the right expression subclass using RTTI.
@@ -391,8 +391,8 @@ class MLIRGenImpl {
391391 // with specific shape, we emit a "reshape" operation. It will get
392392 // optimized out later as needed.
393393 if (!vardecl.getType ().shape .empty ()) {
394- value = builder. create < ReshapeOp>( loc (vardecl.loc ()),
395- getType (vardecl.getType ()), value);
394+ value = ReshapeOp::create (builder, loc (vardecl.loc ()),
395+ getType (vardecl.getType ()), value);
396396 }
397397
398398 // Register the value in the symbol table.
0 commit comments