What is the default print function for self defined operation for printing assembly format?

Hi I’m a new leaner of mlir and wanna ask for some user defined operation.

I wanna to understand of how addOperands(), addTypes() and addAttributes method will be printed.

I found that I can actually define the printing format in *.td files, but what if I do not define it, what it would be looks like??

Thanks a lot for anyone who would help!!!

The explanation of the generic operation printing is at MLIR Language Reference - MLIR. In short, an operation will be printed like "dialect.op"(%operand0, %operand1) {attribute_name = "value"}: (<operand_type>, <operand_type>) -> (<result_type>, <result_type>)

I don’t understand what you mean by this question exactly. These are methods on OperationState

Hi, thank you for answering. These are method used when creating the operation, I would like to find the link between *.td format and the actual assembly format printed.

It seems like that for arguments in *.td, it will use addOperands() for type:$name format and addAttributes() for *Attr:$name format. For results in *.td, it will use addTypes() method.

I do not know that it is 100% right, but it looks like the link.

Thus I asked in that way… And it seems I got my answer from you, thanks a lot!!

You can run mlir-tblgen -gen-op-defs <filename.td> -I<path/to/mlir/include> and inspect the print/parse methods in the generated code. This is the code that is actually executed.