mie: move op and type definition from dialect/ to ir/ and type/ respectively
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/op.h>
|
||||
#include <mie/ir/op-definition.h>
|
||||
#include <mie/macros.h>
|
||||
|
||||
static enum mie_status print(const struct mie_op *op, b_stream *out)
|
||||
@@ -12,7 +12,7 @@ static enum mie_status parse(struct mie_parser *parser, struct mie_op *out)
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
MIE_DIALECT_OP_BEGIN(mie_arith_addf, "addf")
|
||||
MIE_DIALECT_OP_PRINT(print);
|
||||
MIE_DIALECT_OP_PARSE(parse);
|
||||
MIE_DIALECT_OP_END()
|
||||
MIE_OP_DEFINITION_BEGIN(mie_arith_addf, "addf")
|
||||
MIE_OP_DEFINITION_PRINT(print);
|
||||
MIE_OP_DEFINITION_PARSE(parse);
|
||||
MIE_OP_DEFINITION_END()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/op.h>
|
||||
#include <mie/ir/op-definition.h>
|
||||
#include <mie/macros.h>
|
||||
|
||||
static enum mie_status print(const struct mie_op *op, b_stream *out)
|
||||
@@ -12,7 +12,7 @@ static enum mie_status parse(struct mie_parser *parser, struct mie_op *out)
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
MIE_DIALECT_OP_BEGIN(mie_arith_addi, "addi")
|
||||
MIE_DIALECT_OP_PRINT(print);
|
||||
MIE_DIALECT_OP_PARSE(parse);
|
||||
MIE_DIALECT_OP_END()
|
||||
MIE_OP_DEFINITION_BEGIN(mie_arith_addi, "addi")
|
||||
MIE_OP_DEFINITION_PRINT(print);
|
||||
MIE_OP_DEFINITION_PARSE(parse);
|
||||
MIE_OP_DEFINITION_END()
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
#include <mie/ctx.h>
|
||||
#include <mie/dialect/arith.h>
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/type.h>
|
||||
#include <mie/macros.h>
|
||||
#include <mie/type/type-definition.h>
|
||||
#include <mie/type/type.h>
|
||||
#include <mie/value.h>
|
||||
|
||||
@@ -12,7 +12,7 @@ struct float_type {
|
||||
size_t f_width;
|
||||
};
|
||||
|
||||
static void value_print(
|
||||
static enum mie_status value_print(
|
||||
const struct mie_type *ty, const struct mie_value *value, b_stream *out)
|
||||
{
|
||||
struct float_type *float_ty = (struct float_type *)ty;
|
||||
@@ -32,12 +32,14 @@ static void value_print(
|
||||
b_stream_write_fmt(out, NULL, "NaN : f%zu", float_ty->f_width);
|
||||
break;
|
||||
}
|
||||
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
struct mie_type *mie_arith_float_get_type(struct mie_ctx *ctx, size_t bit_width)
|
||||
{
|
||||
struct mie_dialect_type *type_info
|
||||
= mie_ctx_get_dialect_type(ctx, "arith", "float");
|
||||
struct mie_type_definition *type_info
|
||||
= mie_ctx_get_type_definition(ctx, "arith", "float");
|
||||
if (!type_info) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -68,22 +70,23 @@ struct mie_type *mie_arith_float_get_type(struct mie_ctx *ctx, size_t bit_width)
|
||||
}
|
||||
|
||||
static enum mie_status print(
|
||||
const struct mie_dialect_type *def, const struct mie_type *ty, b_stream *out)
|
||||
const struct mie_type_definition *def, const struct mie_type *ty,
|
||||
b_stream *out)
|
||||
{
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
static enum mie_status parse(
|
||||
const struct mie_dialect_type *def, struct mie_parser *parser,
|
||||
const struct mie_type_definition *def, struct mie_parser *parser,
|
||||
struct mie_type **out)
|
||||
{
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
MIE_DIALECT_TYPE_BEGIN(mie_arith_float, "float")
|
||||
// MIE_DIALECT_TYPE_FLAGS(MIE_DIALECT_TYPE_PARAMETISED);
|
||||
MIE_DIALECT_TYPE_STRUCT(struct float_type);
|
||||
MIE_DIALECT_TYPE_PRINT(print);
|
||||
MIE_DIALECT_TYPE_PARSE(parse);
|
||||
MIE_DIALECT_TYPE_VALUE_PRINT(value_print);
|
||||
MIE_DIALECT_TYPE_END()
|
||||
MIE_TYPE_DEFINITION_BEGIN(mie_arith_float, "float")
|
||||
// MIE_TYPE_DEFINITION_FLAGS(MIE_TYPE_DEFINITION_PARAMETISED);
|
||||
MIE_TYPE_DEFINITION_STRUCT(struct float_type);
|
||||
MIE_TYPE_DEFINITION_PRINT(print);
|
||||
MIE_TYPE_DEFINITION_PARSE(parse);
|
||||
MIE_TYPE_DEFINITION_VALUE_PRINT(value_print);
|
||||
MIE_TYPE_DEFINITION_END()
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
#include <mie/ctx.h>
|
||||
#include <mie/dialect/arith.h>
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/type.h>
|
||||
#include <mie/macros.h>
|
||||
#include <mie/type/type-definition.h>
|
||||
#include <mie/type/type.h>
|
||||
#include <mie/value.h>
|
||||
|
||||
@@ -12,7 +12,7 @@ struct int_type {
|
||||
size_t i_width;
|
||||
};
|
||||
|
||||
static void value_print(
|
||||
static enum mie_status value_print(
|
||||
const struct mie_type *ty, const struct mie_value *value, b_stream *out)
|
||||
{
|
||||
struct int_type *int_ty = (struct int_type *)ty;
|
||||
@@ -24,12 +24,14 @@ static void value_print(
|
||||
} else {
|
||||
b_stream_write_fmt(out, NULL, "INF : i%zu", int_ty->i_width);
|
||||
}
|
||||
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
struct mie_type *mie_arith_int_get_type(struct mie_ctx *ctx, size_t bit_width)
|
||||
{
|
||||
struct mie_dialect_type *type_info
|
||||
= mie_ctx_get_dialect_type(ctx, "arith", "int");
|
||||
struct mie_type_definition *type_info
|
||||
= mie_ctx_get_type_definition(ctx, "arith", "int");
|
||||
if (!type_info) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -60,22 +62,23 @@ struct mie_type *mie_arith_int_get_type(struct mie_ctx *ctx, size_t bit_width)
|
||||
}
|
||||
|
||||
static enum mie_status print(
|
||||
const struct mie_dialect_type *def, const struct mie_type *ty, b_stream *out)
|
||||
const struct mie_type_definition *def, const struct mie_type *ty,
|
||||
b_stream *out)
|
||||
{
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
static enum mie_status parse(
|
||||
const struct mie_dialect_type *def, struct mie_parser *parser,
|
||||
const struct mie_type_definition *def, struct mie_parser *parser,
|
||||
struct mie_type **out)
|
||||
{
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
MIE_DIALECT_TYPE_BEGIN(mie_arith_int, "int")
|
||||
// MIE_DIALECT_TYPE_FLAGS(MIE_DIALECT_TYPE_PARAMETISED);
|
||||
MIE_DIALECT_TYPE_STRUCT(struct int_type);
|
||||
MIE_DIALECT_TYPE_PRINT(print);
|
||||
MIE_DIALECT_TYPE_PARSE(parse);
|
||||
MIE_DIALECT_TYPE_VALUE_PRINT(value_print);
|
||||
MIE_DIALECT_TYPE_END()
|
||||
MIE_TYPE_DEFINITION_BEGIN(mie_arith_int, "int")
|
||||
// MIE_TYPE_DEFINITION_FLAGS(MIE_TYPE_DEFINITION_PARAMETISED);
|
||||
MIE_TYPE_DEFINITION_STRUCT(struct int_type);
|
||||
MIE_TYPE_DEFINITION_PRINT(print);
|
||||
MIE_TYPE_DEFINITION_PARSE(parse);
|
||||
MIE_TYPE_DEFINITION_VALUE_PRINT(value_print);
|
||||
MIE_TYPE_DEFINITION_END()
|
||||
|
||||
@@ -2,40 +2,43 @@
|
||||
#include <mie/ctx.h>
|
||||
#include <mie/dialect/builtin.h>
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/type.h>
|
||||
#include <mie/macros.h>
|
||||
#include <mie/type/type-definition.h>
|
||||
#include <mie/type/type.h>
|
||||
#include <mie/value.h>
|
||||
|
||||
static void value_print(
|
||||
static enum mie_status value_print(
|
||||
const struct mie_type *ty, const struct mie_value *value, b_stream *out)
|
||||
{
|
||||
const struct mie_string *str = (const struct mie_string *)value;
|
||||
b_stream_write_fmt(out, NULL, "\"%s\"", str->str_val);
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
static void type_init(const struct mie_dialect_type *type_info, struct mie_type *type)
|
||||
static void type_init(
|
||||
const struct mie_type_definition *type_info, struct mie_type *type)
|
||||
{
|
||||
type->ty_instance_size = sizeof(struct mie_string);
|
||||
}
|
||||
|
||||
static enum mie_status print(
|
||||
const struct mie_dialect_type *def, const struct mie_type *ty, b_stream *out)
|
||||
const struct mie_type_definition *def, const struct mie_type *ty,
|
||||
b_stream *out)
|
||||
{
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
static enum mie_status parse(
|
||||
const struct mie_dialect_type *def, struct mie_parser *parser,
|
||||
const struct mie_type_definition *def, struct mie_parser *parser,
|
||||
struct mie_type **out)
|
||||
{
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
MIE_DIALECT_TYPE_BEGIN(mie_builtin_string, "string")
|
||||
MIE_DIALECT_TYPE_STRUCT(struct mie_type);
|
||||
MIE_DIALECT_TYPE_INIT(type_init);
|
||||
MIE_DIALECT_TYPE_PRINT(print);
|
||||
MIE_DIALECT_TYPE_PARSE(parse);
|
||||
MIE_DIALECT_TYPE_VALUE_PRINT(value_print);
|
||||
MIE_DIALECT_TYPE_END()
|
||||
MIE_TYPE_DEFINITION_BEGIN(mie_builtin_string, "string")
|
||||
MIE_TYPE_DEFINITION_STRUCT(struct mie_type);
|
||||
MIE_TYPE_DEFINITION_INIT(type_init);
|
||||
MIE_TYPE_DEFINITION_PRINT(print);
|
||||
MIE_TYPE_DEFINITION_PARSE(parse);
|
||||
MIE_TYPE_DEFINITION_VALUE_PRINT(value_print);
|
||||
MIE_TYPE_DEFINITION_END()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/op.h>
|
||||
#include <mie/ir/op-definition.h>
|
||||
#include <mie/macros.h>
|
||||
|
||||
static enum mie_status print(const struct mie_op *op, b_stream *out)
|
||||
@@ -12,7 +12,7 @@ static enum mie_status parse(struct mie_parser *parser, struct mie_op *out)
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
MIE_DIALECT_OP_BEGIN(mie_cf_br_cond, "br-cond")
|
||||
MIE_DIALECT_OP_PRINT(print);
|
||||
MIE_DIALECT_OP_PARSE(parse);
|
||||
MIE_DIALECT_OP_END()
|
||||
MIE_OP_DEFINITION_BEGIN(mie_cf_br_cond, "br-cond")
|
||||
MIE_OP_DEFINITION_PRINT(print);
|
||||
MIE_OP_DEFINITION_PARSE(parse);
|
||||
MIE_OP_DEFINITION_END()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/op.h>
|
||||
#include <mie/ir/op-definition.h>
|
||||
#include <mie/macros.h>
|
||||
|
||||
static enum mie_status print(const struct mie_op *op, b_stream *out)
|
||||
@@ -12,7 +12,7 @@ static enum mie_status parse(struct mie_parser *parser, struct mie_op *out)
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
MIE_DIALECT_OP_BEGIN(mie_cf_br, "br")
|
||||
MIE_DIALECT_OP_PRINT(print);
|
||||
MIE_DIALECT_OP_PARSE(parse);
|
||||
MIE_DIALECT_OP_END()
|
||||
MIE_OP_DEFINITION_BEGIN(mie_cf_br, "br")
|
||||
MIE_OP_DEFINITION_PRINT(print);
|
||||
MIE_OP_DEFINITION_PARSE(parse);
|
||||
MIE_OP_DEFINITION_END()
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include <blue/ds/string.h>
|
||||
#include <mie/ctx.h>
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/op.h>
|
||||
#include <mie/dialect/type.h>
|
||||
#include <mie/ir/op-definition.h>
|
||||
#include <mie/type/type-definition.h>
|
||||
|
||||
#define TYPE_NS_ID \
|
||||
MIE_ID(0xe4, 0x99, 0x42, 0x58, 0x2b, 0xdb, 0x45, 0xa3, 0xbd, 0x4b, \
|
||||
@@ -38,7 +38,7 @@ struct mie_dialect *mie_dialect_create(struct mie_ctx *ctx, const char *name)
|
||||
return out;
|
||||
}
|
||||
|
||||
const struct mie_dialect_op *mie_dialect_get_op(
|
||||
const struct mie_op_definition *mie_dialect_get_op(
|
||||
const struct mie_dialect *dialect, const char *name)
|
||||
{
|
||||
b_rope name_rope = B_ROPE_CSTR(name);
|
||||
@@ -46,10 +46,10 @@ const struct mie_dialect_op *mie_dialect_get_op(
|
||||
mie_id_init_ns(&id, mie_id_map_get_ns(&dialect->d_ops), &name_rope);
|
||||
|
||||
mie_id *target = mie_id_map_get(&dialect->d_ops, &id);
|
||||
return b_unbox(struct mie_dialect_op, target, op_id);
|
||||
return b_unbox(struct mie_op_definition, target, op_id);
|
||||
}
|
||||
|
||||
const struct mie_dialect_type *mie_dialect_get_type(
|
||||
const struct mie_type_definition *mie_dialect_get_type(
|
||||
const struct mie_dialect *dialect, const char *name)
|
||||
{
|
||||
b_rope name_rope = B_ROPE_CSTR(name);
|
||||
@@ -57,5 +57,5 @@ const struct mie_dialect_type *mie_dialect_get_type(
|
||||
mie_id_init_ns(&id, mie_id_map_get_ns(&dialect->d_types), &name_rope);
|
||||
|
||||
mie_id *target = mie_id_map_get(&dialect->d_types, &id);
|
||||
return b_unbox(struct mie_dialect_type, target, ty_id);
|
||||
return b_unbox(struct mie_type_definition, target, ty_id);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/op.h>
|
||||
#include <mie/ir/op-definition.h>
|
||||
#include <mie/macros.h>
|
||||
|
||||
static enum mie_status print(const struct mie_op *op, b_stream *out)
|
||||
@@ -12,10 +12,10 @@ static enum mie_status parse(struct mie_parser *parser, struct mie_op *out)
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
MIE_DIALECT_OP_BEGIN(mie_func_func, "func")
|
||||
MIE_DIALECT_OP_PRINT(print);
|
||||
MIE_DIALECT_OP_PARSE(parse);
|
||||
MIE_DIALECT_OP_END()
|
||||
MIE_OP_DEFINITION_BEGIN(mie_func_func, "func")
|
||||
MIE_OP_DEFINITION_PRINT(print);
|
||||
MIE_OP_DEFINITION_PARSE(parse);
|
||||
MIE_OP_DEFINITION_END()
|
||||
|
||||
MIE_DIALECT_BEGIN(mie_func, "func")
|
||||
MIE_DIALECT_ADD_OP(mie_func_func);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/index.h>
|
||||
#include <mie/dialect/type.h>
|
||||
#include <mie/macros.h>
|
||||
#include <mie/type/type-definition.h>
|
||||
#include <mie/type/type.h>
|
||||
#include <mie/value.h>
|
||||
|
||||
@@ -9,7 +9,7 @@ struct index_type {
|
||||
struct mie_type i_base;
|
||||
};
|
||||
|
||||
static void value_print(
|
||||
static enum mie_status value_print(
|
||||
const struct mie_type *ty, const struct mie_value *value, b_stream *out)
|
||||
{
|
||||
struct index_type *index_ty = (struct index_type *)ty;
|
||||
@@ -17,33 +17,36 @@ static void value_print(
|
||||
b_stream_write_fmt(
|
||||
out, NULL, "%zu : %s", index_val->i_value,
|
||||
index_ty->i_base.ty_def->ty_name);
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
static void type_init(const struct mie_dialect_type *type_info, struct mie_type *type)
|
||||
static void type_init(
|
||||
const struct mie_type_definition *type_info, struct mie_type *type)
|
||||
{
|
||||
type->ty_instance_size = sizeof(struct mie_index);
|
||||
}
|
||||
|
||||
static enum mie_status print(
|
||||
const struct mie_dialect_type *def, const struct mie_type *ty, b_stream *out)
|
||||
const struct mie_type_definition *def, const struct mie_type *ty,
|
||||
b_stream *out)
|
||||
{
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
static enum mie_status parse(
|
||||
const struct mie_dialect_type *def, struct mie_parser *parser,
|
||||
const struct mie_type_definition *def, struct mie_parser *parser,
|
||||
struct mie_type **out)
|
||||
{
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
MIE_DIALECT_TYPE_BEGIN(mie_index_index, "index")
|
||||
MIE_DIALECT_TYPE_STRUCT(struct index_type);
|
||||
MIE_DIALECT_TYPE_INIT(type_init);
|
||||
MIE_DIALECT_TYPE_PRINT(print);
|
||||
MIE_DIALECT_TYPE_PARSE(parse);
|
||||
MIE_DIALECT_TYPE_VALUE_PRINT(value_print);
|
||||
MIE_DIALECT_TYPE_END()
|
||||
MIE_TYPE_DEFINITION_BEGIN(mie_index_index, "index")
|
||||
MIE_TYPE_DEFINITION_STRUCT(struct index_type);
|
||||
MIE_TYPE_DEFINITION_INIT(type_init);
|
||||
MIE_TYPE_DEFINITION_PRINT(print);
|
||||
MIE_TYPE_DEFINITION_PARSE(parse);
|
||||
MIE_TYPE_DEFINITION_VALUE_PRINT(value_print);
|
||||
MIE_TYPE_DEFINITION_END()
|
||||
|
||||
MIE_DIALECT_BEGIN(mie_index, "index")
|
||||
MIE_DIALECT_ADD_TYPE(mie_index_index);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/op.h>
|
||||
#include <mie/ir/op-definition.h>
|
||||
#include <mie/macros.h>
|
||||
|
||||
static enum mie_status print(const struct mie_op *op, b_stream *out)
|
||||
@@ -12,7 +12,7 @@ static enum mie_status parse(struct mie_parser *parser, struct mie_op *out)
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
MIE_DIALECT_OP_BEGIN(mie_meta_source_filename, "source-filename")
|
||||
MIE_DIALECT_OP_PRINT(print);
|
||||
MIE_DIALECT_OP_PARSE(parse);
|
||||
MIE_DIALECT_OP_END()
|
||||
MIE_OP_DEFINITION_BEGIN(mie_meta_source_filename, "source-filename")
|
||||
MIE_OP_DEFINITION_PRINT(print);
|
||||
MIE_OP_DEFINITION_PARSE(parse);
|
||||
MIE_OP_DEFINITION_END()
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#include <blue/ds/string.h>
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/op.h>
|
||||
|
||||
struct mie_dialect_op *mie_dialect_op_create(
|
||||
struct mie_dialect *parent, const char *name)
|
||||
{
|
||||
struct mie_dialect_op *out = malloc(sizeof *out);
|
||||
if (!out) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
out->op_name = b_strdup(name);
|
||||
if (!out->op_name) {
|
||||
free(out);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
out->op_parent = parent;
|
||||
|
||||
b_rope name_rope = B_ROPE_CSTR(name);
|
||||
mie_id_map_put(&parent->d_ops, &out->op_id, &name_rope);
|
||||
|
||||
return out;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/op.h>
|
||||
#include <mie/ir/op-definition.h>
|
||||
#include <mie/macros.h>
|
||||
|
||||
static enum mie_status print(const struct mie_op *op, b_stream *out)
|
||||
@@ -12,7 +12,7 @@ static enum mie_status parse(struct mie_parser *parser, struct mie_op *out)
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
MIE_DIALECT_OP_BEGIN(mie_ptr_load, "load")
|
||||
MIE_DIALECT_OP_PRINT(print);
|
||||
MIE_DIALECT_OP_PARSE(parse);
|
||||
MIE_DIALECT_OP_END()
|
||||
MIE_OP_DEFINITION_BEGIN(mie_ptr_load, "load")
|
||||
MIE_OP_DEFINITION_PRINT(print);
|
||||
MIE_OP_DEFINITION_PARSE(parse);
|
||||
MIE_OP_DEFINITION_END()
|
||||
|
||||
@@ -1,29 +1,30 @@
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/type.h>
|
||||
#include <mie/macros.h>
|
||||
#include <mie/type/type-definition.h>
|
||||
|
||||
struct ptr_type {
|
||||
struct mie_dialect_type ptr_base;
|
||||
struct mie_type_definition ptr_base;
|
||||
};
|
||||
|
||||
static enum mie_status print(
|
||||
const struct mie_dialect_type *def, const struct mie_type *ty, b_stream *out)
|
||||
const struct mie_type_definition *def, const struct mie_type *ty,
|
||||
b_stream *out)
|
||||
{
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
static enum mie_status parse(
|
||||
const struct mie_dialect_type *def, struct mie_parser *parser,
|
||||
const struct mie_type_definition *def, struct mie_parser *parser,
|
||||
struct mie_type **out)
|
||||
{
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
MIE_DIALECT_TYPE_BEGIN(mie_ptr_ptr, "ptr")
|
||||
MIE_DIALECT_TYPE_STRUCT(struct ptr_type);
|
||||
MIE_DIALECT_TYPE_PRINT(print);
|
||||
MIE_DIALECT_TYPE_PARSE(parse);
|
||||
MIE_DIALECT_TYPE_END()
|
||||
MIE_TYPE_DEFINITION_BEGIN(mie_ptr_ptr, "ptr")
|
||||
MIE_TYPE_DEFINITION_STRUCT(struct ptr_type);
|
||||
MIE_TYPE_DEFINITION_PRINT(print);
|
||||
MIE_TYPE_DEFINITION_PARSE(parse);
|
||||
MIE_TYPE_DEFINITION_END()
|
||||
|
||||
MIE_DIALECT_BEGIN(mie_ptr, "ptr")
|
||||
MIE_DIALECT_ADD_OP(mie_ptr_load);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/op.h>
|
||||
#include <mie/ir/op-definition.h>
|
||||
#include <mie/macros.h>
|
||||
|
||||
static enum mie_status print(const struct mie_op *op, b_stream *out)
|
||||
@@ -12,7 +12,7 @@ static enum mie_status parse(struct mie_parser *parser, struct mie_op *out)
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
MIE_DIALECT_OP_BEGIN(mie_ptr_store, "store")
|
||||
MIE_DIALECT_OP_PRINT(print);
|
||||
MIE_DIALECT_OP_PARSE(parse);
|
||||
MIE_DIALECT_OP_END()
|
||||
MIE_OP_DEFINITION_BEGIN(mie_ptr_store, "store")
|
||||
MIE_OP_DEFINITION_PRINT(print);
|
||||
MIE_OP_DEFINITION_PARSE(parse);
|
||||
MIE_OP_DEFINITION_END()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/op.h>
|
||||
#include <mie/ir/op-definition.h>
|
||||
#include <mie/macros.h>
|
||||
|
||||
static enum mie_status print(const struct mie_op *op, b_stream *out)
|
||||
@@ -12,7 +12,7 @@ static enum mie_status parse(struct mie_parser *parser, struct mie_op *out)
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
MIE_DIALECT_OP_BEGIN(mie_scf_for, "for")
|
||||
MIE_DIALECT_OP_PRINT(print);
|
||||
MIE_DIALECT_OP_PARSE(parse);
|
||||
MIE_DIALECT_OP_END()
|
||||
MIE_OP_DEFINITION_BEGIN(mie_scf_for, "for")
|
||||
MIE_OP_DEFINITION_PRINT(print);
|
||||
MIE_OP_DEFINITION_PARSE(parse);
|
||||
MIE_OP_DEFINITION_END()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/op.h>
|
||||
#include <mie/ir/op-definition.h>
|
||||
#include <mie/macros.h>
|
||||
|
||||
static enum mie_status print(const struct mie_op *op, b_stream *out)
|
||||
@@ -12,7 +12,7 @@ static enum mie_status parse(struct mie_parser *parser, struct mie_op *out)
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
MIE_DIALECT_OP_BEGIN(mie_scf_if, "if")
|
||||
MIE_DIALECT_OP_PRINT(print);
|
||||
MIE_DIALECT_OP_PARSE(parse);
|
||||
MIE_DIALECT_OP_END()
|
||||
MIE_OP_DEFINITION_BEGIN(mie_scf_if, "if")
|
||||
MIE_OP_DEFINITION_PRINT(print);
|
||||
MIE_OP_DEFINITION_PARSE(parse);
|
||||
MIE_OP_DEFINITION_END()
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#include "scf.h"
|
||||
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/macros.h>
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#ifndef MIE_DIALECT_SCF_H_
|
||||
#define MIE_DIALECT_SCF_H_
|
||||
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/op.h>
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/op.h>
|
||||
#include <mie/ir/op-definition.h>
|
||||
#include <mie/macros.h>
|
||||
|
||||
static enum mie_status print(const struct mie_op *op, b_stream *out)
|
||||
@@ -12,7 +12,7 @@ static enum mie_status parse(struct mie_parser *parser, struct mie_op *out)
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
MIE_DIALECT_OP_BEGIN(mie_scf_yield, "yield")
|
||||
MIE_DIALECT_OP_PRINT(print);
|
||||
MIE_DIALECT_OP_PARSE(parse);
|
||||
MIE_DIALECT_OP_END()
|
||||
MIE_OP_DEFINITION_BEGIN(mie_scf_yield, "yield")
|
||||
MIE_OP_DEFINITION_PRINT(print);
|
||||
MIE_OP_DEFINITION_PARSE(parse);
|
||||
MIE_OP_DEFINITION_END()
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#include <blue/ds/string.h>
|
||||
#include <mie/dialect/dialect.h>
|
||||
#include <mie/dialect/type.h>
|
||||
|
||||
struct mie_dialect_type *mie_dialect_type_create(
|
||||
struct mie_dialect *parent, const char *name)
|
||||
{
|
||||
struct mie_dialect_type *out = malloc(sizeof *out);
|
||||
if (!out) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
out->ty_name = b_strdup(name);
|
||||
if (!out->ty_name) {
|
||||
free(out);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
out->ty_parent = parent;
|
||||
|
||||
b_rope name_rope = B_ROPE_CSTR(name);
|
||||
mie_id_map_put(&parent->d_types, &out->ty_id, &name_rope);
|
||||
|
||||
return out;
|
||||
}
|
||||
Reference in New Issue
Block a user