mie: arith: implement op printer callbacks
This commit is contained in:
@@ -6,9 +6,19 @@
|
|||||||
|
|
||||||
static enum mie_status print(struct mie_printer *printer, const struct mie_op *op)
|
static enum mie_status print(struct mie_printer *printer, const struct mie_op *op)
|
||||||
{
|
{
|
||||||
const struct mie_attribute *sym_name
|
if (MIE_VECTOR_COUNT(op->op_args) != 2) {
|
||||||
= mie_attribute_map_get(&op->op_attrib, "sym_name");
|
return MIE_SUCCESS;
|
||||||
b_stream_write_fmt(printer->p_stream, NULL, " @%s", NULL);
|
}
|
||||||
|
|
||||||
|
const struct mie_op_arg *left = &op->op_args.items[0];
|
||||||
|
const struct mie_op_arg *right = &op->op_args.items[1];
|
||||||
|
|
||||||
|
b_stream_write_char(printer->p_stream, ' ');
|
||||||
|
mie_printer_print_op_arg(printer, left, false);
|
||||||
|
b_stream_write_string(printer->p_stream, ", ", NULL);
|
||||||
|
mie_printer_print_op_arg(printer, right, false);
|
||||||
|
b_stream_write_string(printer->p_stream, " : ", NULL);
|
||||||
|
mie_printer_print_type(printer, mie_op_arg_get_type(left));
|
||||||
|
|
||||||
return MIE_SUCCESS;
|
return MIE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,25 @@
|
|||||||
#include <mie/dialect/dialect.h>
|
#include <mie/dialect/dialect.h>
|
||||||
#include <mie/ir/op-definition.h>
|
#include <mie/ir/op-definition.h>
|
||||||
|
#include <mie/ir/op.h>
|
||||||
#include <mie/macros.h>
|
#include <mie/macros.h>
|
||||||
|
#include <mie/print/printer.h>
|
||||||
|
|
||||||
static enum mie_status print(struct mie_printer *printer, const struct mie_op *op)
|
static enum mie_status print(struct mie_printer *printer, const struct mie_op *op)
|
||||||
{
|
{
|
||||||
|
if (MIE_VECTOR_COUNT(op->op_args) != 2) {
|
||||||
|
return MIE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
const struct mie_op_arg *left = &op->op_args.items[0];
|
||||||
|
const struct mie_op_arg *right = &op->op_args.items[1];
|
||||||
|
|
||||||
|
b_stream_write_char(printer->p_stream, ' ');
|
||||||
|
mie_printer_print_op_arg(printer, left, false);
|
||||||
|
b_stream_write_string(printer->p_stream, ", ", NULL);
|
||||||
|
mie_printer_print_op_arg(printer, right, false);
|
||||||
|
b_stream_write_string(printer->p_stream, " : ", NULL);
|
||||||
|
mie_printer_print_type(printer, mie_op_arg_get_type(left));
|
||||||
|
|
||||||
return MIE_SUCCESS;
|
return MIE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user