mie: implement block dominance calculation using lengauer-tarjan algorithm

This commit is contained in:
2026-02-01 10:33:36 +00:00
parent 870b2bfbac
commit 6abdf8f993
18 changed files with 885 additions and 11 deletions

View File

@@ -11,9 +11,13 @@ void mie_printer_print_op_arg(
enum mie_register_flags arg_flags = 0;
const char *arg_name = NULL;
const struct mie_type *arg_type = NULL;
bool resolved = false;
if (MIE_TEST_FLAGS(arg->arg_flags, MIE_OP_F_ARG_RESOLVED)) {
resolved = true;
if (!arg->arg_value.u_reg) {
/* this should only be caused by an internal parser/rewriter bug */
arg_flags = 0;
arg_name = "<NULL>";
arg_type = NULL;
@@ -36,6 +40,12 @@ void mie_printer_print_op_arg(
b_stream_write_string(printer->p_stream, arg_name, NULL);
if (!resolved
&& MIE_TEST_FLAGS(
printer->p_flags, MIE_PRINT_F_MARK_UNRESOLVED_ELEMENTS)) {
b_stream_write_char(printer->p_stream, '?');
}
if (!include_type || !arg_type) {
return;
}
@@ -50,14 +60,23 @@ void mie_printer_print_op_successor(
bool compact)
{
b_stream_write_char(printer->p_stream, '^');
bool resolved = false;
if (successor->s_flags & MIE_OP_F_SUCCESSOR_RESOLVED) {
b_stream_write_string(
printer->p_stream, successor->s_block->b_name.n_str, NULL);
resolved = true;
} else {
b_stream_write_string(
printer->p_stream, successor->s_block_name, NULL);
}
if (!resolved
&& MIE_TEST_FLAGS(
printer->p_flags, MIE_PRINT_F_MARK_UNRESOLVED_ELEMENTS)) {
b_stream_write_char(printer->p_stream, '?');
}
if (MIE_VECTOR_COUNT(successor->s_args) == 0) {
return;
}
@@ -210,6 +229,11 @@ static void print_generic_op(struct mie_printer *printer, const struct mie_op *o
op->op_info->op_parent->d_name, op->op_info->op_name);
} else {
b_stream_write_string(printer->p_stream, op->op_name, NULL);
if (MIE_TEST_FLAGS(
printer->p_flags, MIE_PRINT_F_MARK_UNRESOLVED_ELEMENTS)) {
b_stream_write_char(printer->p_stream, '?');
}
}
b_stream_write_char(printer->p_stream, '(');