mie: ir: replace mie_module ir object with a builtin generic "module" op
the builtin.module op behaves exactly like any other op, and is designed to be a container for other ops of any type. it can be used as the top-level container for other ops (other top-level containers can be used instead). this also changes the file format. now, an ir file can only contain a single top-level op. any other ops in the ir must be contained directly or indirectly by this top-level op.
This commit is contained in:
@@ -84,6 +84,7 @@ struct mie_attribute *mie_ctx_get_index(struct mie_ctx *ctx, size_t val)
|
||||
MIE_DIALECT_BEGIN(mie_builtin, struct builtin_dialect, "builtin")
|
||||
MIE_DIALECT_INIT(init);
|
||||
MIE_DIALECT_CLEANUP(cleanup);
|
||||
MIE_DIALECT_ADD_OP(mie_builtin_module);
|
||||
MIE_DIALECT_ADD_TYPE(mie_builtin_string);
|
||||
MIE_DIALECT_ADD_TYPE(mie_builtin_int);
|
||||
MIE_DIALECT_ADD_TYPE(mie_builtin_float);
|
||||
|
||||
20
mie/dialect/builtin/op/module.c
Normal file
20
mie/dialect/builtin/op/module.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/ir/op-definition.h>
|
||||
#include <mie/ir/op.h>
|
||||
#include <mie/macros.h>
|
||||
#include <mie/print/printer.h>
|
||||
|
||||
static enum mie_status print(struct mie_printer *printer, const struct mie_op *op)
|
||||
{
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
static enum mie_status parse(struct mie_parser *parser, struct mie_op *out)
|
||||
{
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
MIE_OP_DEFINITION_BEGIN(mie_builtin_module, "module")
|
||||
MIE_OP_DEFINITION_PRINT(print);
|
||||
MIE_OP_DEFINITION_PARSE(parse);
|
||||
MIE_OP_DEFINITION_END()
|
||||
Reference in New Issue
Block a user