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:
@@ -1,28 +0,0 @@
|
||||
#include <mie/ir/module.h>
|
||||
#include <mie/ir/op.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
struct mie_module *mie_module_create(void)
|
||||
{
|
||||
struct mie_module *out = malloc(sizeof *out);
|
||||
if (!out) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(out, 0x0, sizeof *out);
|
||||
|
||||
out->m_names = mie_name_map_create(NULL);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
void mie_module_destroy(struct mie_module *mod)
|
||||
{
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
struct mie_op *mie_module_add_op(struct mie_module *mod)
|
||||
{
|
||||
return mie_vector_emplace_back(mod->m_ops);
|
||||
}
|
||||
32
mie/ir/op.c
Normal file
32
mie/ir/op.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#include <mie/ir/op.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
struct mie_op *mie_op_create(void)
|
||||
{
|
||||
struct mie_op *out = malloc(sizeof *out);
|
||||
if (!out) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mie_op_init(out);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
void mie_op_destroy(struct mie_op *op)
|
||||
{
|
||||
mie_op_cleanup(op);
|
||||
free(op);
|
||||
}
|
||||
|
||||
void mie_op_init(struct mie_op *op)
|
||||
{
|
||||
memset(op, 0x0, sizeof *op);
|
||||
|
||||
mie_attribute_map_init(&op->op_attrib);
|
||||
}
|
||||
|
||||
void mie_op_cleanup(struct mie_op *op)
|
||||
{
|
||||
/* TODO */
|
||||
}
|
||||
Reference in New Issue
Block a user