Skip to content

Commit 39ad067

Browse files
committed
[Heavy] Add multiple arguments to nbdl_gen::VisitOp
1 parent f5d68c6 commit 39ad067

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

heavy/include/nbdl_gen/Nbdl.td

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,12 @@ def Nbdl_GetOp : Nbdl_Op<"get", []> {
141141
let results = (outs Nbdl_Type:$result);
142142
}
143143

144-
def VisitOp : Nbdl_Op<"visit", [Terminator]> {
144+
def Nbdl_VisitOp : Nbdl_Op<"visit", [Terminator]> {
145145
let description = [{
146-
Visit a single result with a function object.
147-
VisitOp is a simplification of MatchOp for leaf nodes.
146+
Visit matched results with a function object.
148147
}];
149148

150-
let arguments = (ins Nbdl_Type:$fn, Nbdl_Type:$arg);
149+
let arguments = (ins Nbdl_Type:$fn, Variadic<Nbdl_Type>:$args);
151150
let results = (outs);
152151
}
153152

heavy/lib/Nbdl/NbdlWriter.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,10 @@ class FuncWriter : public NbdlWriter<FuncWriter> {
351351
void Visit(VisitOp Op) {
352352
WriteForwardedExpr(Op.getFn());
353353
OS << '(';
354-
WriteForwardedExpr(Op.getArg());
354+
llvm::interleave(Op.getArgs(), OS,
355+
[&](mlir::Value V) {
356+
WriteForwardedExpr(V);
357+
}, ",\n");
355358
OS << ");\n";
356359
}
357360

0 commit comments

Comments
 (0)