frontend: remove references to old mie api

This commit is contained in:
2026-03-16 15:08:59 +00:00
parent 8816a13a25
commit 247f29ca62
6 changed files with 68 additions and 43 deletions

View File

@@ -1,11 +1,10 @@
#include "../debug.h"
#include "cmd.h"
#include "mie/select/builder.h"
#include <errno.h>
#include <fx/cmd.h>
#include <fx/core/error.h>
#include <fx/term.h>
#include <errno.h>
#include <ivy/asm/mie.h>
#include <ivy/diag.h>
#include <ivy/file.h>
@@ -15,11 +14,6 @@
#include <ivy/lang/lex.h>
#include <mie/ctx.h>
#include <mie/ir/block.h>
#include <mie/ir/convert.h>
#include <mie/ir/func.h>
#include <mie/ir/module.h>
#include <mie/select/builder.h>
#include <mie/select/graph.h>
#include <stdio.h>
enum {
@@ -51,7 +45,6 @@ struct compile_ctx {
struct ivy_codegen *codegen;
struct mie_ctx *mie_ctx;
struct mie_select_builder *select;
struct mie_module *mod;
};
@@ -92,8 +85,10 @@ static fx_result compile_ctx_init(struct compile_ctx *ctx, const fx_arglist *arg
ivy_status = ivy_lexer_create(&ctx->lex);
ivy_status = ivy_parser_create(&ctx->parser);
ivy_status = ivy_codegen_create(ctx->mie_ctx, &ctx->codegen);
#if 0
ctx->select
= mie_select_builder_create(ctx->mie_ctx, ivy_asm_mie_target());
#endif
ivy_lang_diag_ctx_init(ctx->diag);
ivy_diag_stream_init_tty(&ctx->diag_stream, fx_stdtty);
@@ -105,9 +100,11 @@ static fx_result compile_ctx_init(struct compile_ctx *ctx, const fx_arglist *arg
static fx_result compile_ctx_cleanup(struct compile_ctx *ctx)
{
#if 0
if (ctx->mod) {
mie_value_destroy(MIE_VALUE(ctx->mod));
}
#endif
if (ctx->src) {
ivy_diag_ctx_set_line_source(ctx->diag, NULL);
@@ -115,9 +112,11 @@ static fx_result compile_ctx_cleanup(struct compile_ctx *ctx)
ivy_file_close(ctx->src);
}
#if 0
if (ctx->select) {
mie_select_builder_destroy(ctx->select);
}
#endif
if (ctx->codegen) {
ivy_codegen_destroy(ctx->codegen);
@@ -135,9 +134,11 @@ static fx_result compile_ctx_cleanup(struct compile_ctx *ctx)
ivy_diag_ctx_destroy(ctx->diag);
}
#if 0
if (ctx->mie_ctx) {
mie_ctx_destroy(ctx->mie_ctx);
}
#endif
return FX_RESULT_SUCCESS;
}
@@ -226,6 +227,7 @@ static fx_result generate_mie_ir(struct compile_ctx *ctx)
return FX_RESULT_SUCCESS;
}
#if 0
static fx_result build_block_isel_graph(
struct compile_ctx *ctx, struct mie_func *func, struct mie_block *block)
{
@@ -307,6 +309,7 @@ static fx_result build_isel_graph(struct compile_ctx *ctx)
return FX_RESULT_SUCCESS;
}
#endif
static fx_result dump_ast(struct compile_ctx *ctx)
{
@@ -323,6 +326,7 @@ static fx_result dump_ast(struct compile_ctx *ctx)
static fx_result dump_ir(struct compile_ctx *ctx)
{
#if 0
struct mie_ir_converter *convert
= mie_ir_converter_create(ctx->mie_ctx, MIE_IR_MEM, MIE_IR_TEXT);
mie_ir_converter_set_src_value(convert, MIE_VALUE(ctx->mod));
@@ -330,21 +334,22 @@ static fx_result dump_ir(struct compile_ctx *ctx)
mie_ir_converter_process(convert);
mie_ir_converter_destroy(convert);
#endif
return FX_RESULT_SUCCESS;
}
static int compile_file(const char *path, const fx_arglist *args)
{
#define THROW_AND_RETURN(result, error_code) \
do { \
#define THROW_AND_RETURN(result, error_code) \
do { \
if (fx_result_is(result, IVY_ERROR_VENDOR, IVY_ERR_BAD_SYNTAX)) { \
return error_code; \
} \
return error_code; \
} \
if (fx_result_is_error(result)) { \
fx_throw(result); \
return error_code; \
} \
return error_code; \
} \
} while (0)
struct compile_ctx ctx;
@@ -383,12 +388,14 @@ static int compile_file(const char *path, const fx_arglist *args)
return 0;
}
#if 0
result = build_isel_graph(&ctx);
THROW_AND_RETURN(result, -1);
if (progress == 3) {
return 0;
}
#endif
end:
compile_ctx_cleanup(&ctx);
@@ -416,7 +423,7 @@ static int compile(const fx_command *cmd, const fx_arglist *args, const fx_array
return 0;
}
B_COMMAND(CMD_COMPILE, CMD_ROOT)
FX_COMMAND(CMD_COMPILE, CMD_ROOT)
{
FX_COMMAND_NAME("compile");
FX_COMMAND_SHORT_NAME('C');