@@ -121,8 +121,8 @@ class MLIRGenImpl {
121
121
llvm::SmallVector<mlir::Type, 4 > argTypes (proto.getArgs ().size (),
122
122
getType (VarType{}));
123
123
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);
126
126
}
127
127
128
128
// / Emit a new function and add it to the MLIR module.
@@ -166,7 +166,7 @@ class MLIRGenImpl {
166
166
if (!entryBlock.empty ())
167
167
returnOp = dyn_cast<ReturnOp>(entryBlock.back ());
168
168
if (!returnOp) {
169
- builder. create < ReturnOp>( loc (funcAST.getProto ()->loc ()));
169
+ ReturnOp::create (builder, loc (funcAST.getProto ()->loc ()));
170
170
} else if (returnOp.hasOperand ()) {
171
171
// Otherwise, if this return operation has an operand then add a result to
172
172
// the function.
@@ -202,9 +202,9 @@ class MLIRGenImpl {
202
202
// support '+' and '*'.
203
203
switch (binop.getOp ()) {
204
204
case ' +' :
205
- return builder. create < AddOp>( location, lhs, rhs);
205
+ return AddOp::create (builder, location, lhs, rhs);
206
206
case ' *' :
207
- return builder. create < MulOp>( location, lhs, rhs);
207
+ return MulOp::create (builder, location, lhs, rhs);
208
208
}
209
209
210
210
emitError (location, " invalid binary operator '" ) << binop.getOp () << " '" ;
@@ -235,8 +235,8 @@ class MLIRGenImpl {
235
235
}
236
236
237
237
// 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>());
240
240
return mlir::success ();
241
241
}
242
242
@@ -280,7 +280,7 @@ class MLIRGenImpl {
280
280
281
281
// Build the MLIR op `toy.constant`. This invokes the `ConstantOp::build`
282
282
// method.
283
- return builder. create < ConstantOp>( loc (lit.loc ()), type, dataAttribute);
283
+ return ConstantOp::create (builder, loc (lit.loc ()), type, dataAttribute);
284
284
}
285
285
286
286
// / Recursive helper function to accumulate the data that compose an array
@@ -325,13 +325,13 @@ class MLIRGenImpl {
325
325
" does not accept multiple arguments" );
326
326
return nullptr ;
327
327
}
328
- return builder. create < TransposeOp>( location, operands[0 ]);
328
+ return TransposeOp::create (builder, location, operands[0 ]);
329
329
}
330
330
331
331
// Otherwise this is a call to a user-defined function. Calls to
332
332
// user-defined functions are mapped to a custom call that takes the callee
333
333
// name as an attribute.
334
- return builder. create < GenericCallOp>( location, callee, operands);
334
+ return GenericCallOp::create (builder, location, callee, operands);
335
335
}
336
336
337
337
// / Emit a print expression. It emits specific operations for two builtins:
@@ -341,13 +341,13 @@ class MLIRGenImpl {
341
341
if (!arg)
342
342
return mlir::failure ();
343
343
344
- builder. create < PrintOp>( loc (call.loc ()), arg);
344
+ PrintOp::create (builder, loc (call.loc ()), arg);
345
345
return mlir::success ();
346
346
}
347
347
348
348
// / Emit a constant for a single number (FIXME: semantic? broadcast?)
349
349
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 ());
351
351
}
352
352
353
353
// / Dispatch codegen for the right expression subclass using RTTI.
@@ -391,8 +391,8 @@ class MLIRGenImpl {
391
391
// with specific shape, we emit a "reshape" operation. It will get
392
392
// optimized out later as needed.
393
393
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);
396
396
}
397
397
398
398
// Register the value in the symbol table.
0 commit comments