mie: func: add return op
This commit is contained in:
@@ -4,4 +4,5 @@
|
|||||||
|
|
||||||
MIE_DIALECT_BEGIN(mie_func, struct mie_dialect, "func")
|
MIE_DIALECT_BEGIN(mie_func, struct mie_dialect, "func")
|
||||||
MIE_DIALECT_ADD_OP(mie_func_func);
|
MIE_DIALECT_ADD_OP(mie_func_func);
|
||||||
|
MIE_DIALECT_ADD_OP(mie_func_return);
|
||||||
MIE_DIALECT_END()
|
MIE_DIALECT_END()
|
||||||
|
|||||||
49
mie/dialect/func/op/return.c
Normal file
49
mie/dialect/func/op/return.c
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
#include <mie/attribute/attribute-map.h>
|
||||||
|
#include <mie/ctx.h>
|
||||||
|
#include <mie/dialect/builtin.h>
|
||||||
|
#include <mie/dialect/dialect.h>
|
||||||
|
#include <mie/interface/interface-definition.h>
|
||||||
|
#include <mie/interface/interface.h>
|
||||||
|
#include <mie/ir/block.h>
|
||||||
|
#include <mie/ir/op-definition.h>
|
||||||
|
#include <mie/ir/op.h>
|
||||||
|
#include <mie/ir/region.h>
|
||||||
|
#include <mie/macros.h>
|
||||||
|
#include <mie/print/printer.h>
|
||||||
|
#include <mie/type/function.h>
|
||||||
|
|
||||||
|
static enum mie_status print(struct mie_printer *printer, const struct mie_op *op)
|
||||||
|
{
|
||||||
|
b_stream_write_char(printer->p_stream, ' ');
|
||||||
|
|
||||||
|
for (size_t i = 0; i < MIE_VECTOR_COUNT(op->op_args); i++) {
|
||||||
|
if (i > 0) {
|
||||||
|
b_stream_write_string(printer->p_stream, ", ", NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
mie_printer_print_op_arg(printer, &op->op_args.items[i], false);
|
||||||
|
}
|
||||||
|
|
||||||
|
b_stream_write_string(printer->p_stream, " : ", NULL);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < MIE_VECTOR_COUNT(op->op_args); i++) {
|
||||||
|
if (i > 0) {
|
||||||
|
b_stream_write_string(printer->p_stream, ", ", NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
mie_printer_print_type(
|
||||||
|
printer, mie_op_arg_get_type(&op->op_args.items[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
return MIE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static enum mie_status parse(struct mie_parser *parser, struct mie_op *out)
|
||||||
|
{
|
||||||
|
return MIE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
MIE_OP_DEFINITION_BEGIN(mie_func_return, "return")
|
||||||
|
MIE_OP_DEFINITION_PRINT(print);
|
||||||
|
MIE_OP_DEFINITION_PARSE(parse);
|
||||||
|
MIE_OP_DEFINITION_END()
|
||||||
Reference in New Issue
Block a user