mie: add null IR value

This commit is contained in:
2025-09-08 15:33:25 +01:00
parent 71fe8bd5b0
commit e44af45bc3
4 changed files with 28 additions and 2 deletions

View File

@@ -259,11 +259,14 @@ static b_status write_operand(
struct mie_ir_converter *converter, struct mie_value *value, int flags)
{
if (!value) {
write_string(converter, "<null>");
write_string(converter, "<NULL VALUE PTR>");
return B_SUCCESS;
}
switch (value->v_type->t_id) {
case MIE_VALUE_NONE:
write_string(converter, "null");
return B_SUCCESS;
case MIE_VALUE_CONST:
return write_operand_const(converter, value, flags);
case MIE_VALUE_INSTR:

View File

@@ -2,6 +2,10 @@
#include <mie/ir/value.h>
#include <stdlib.h>
const struct mie_value_type null_value_type = {
.t_id = MIE_VALUE_NONE,
};
extern const struct mie_value_type module_value_type;
extern const struct mie_value_type record_value_type;
extern const struct mie_value_type func_value_type;
@@ -12,7 +16,7 @@ extern const struct mie_value_type const_value_type;
extern const struct mie_value_type data_value_type;
static const struct mie_value_type *value_types[] = {
[MIE_VALUE_NONE] = NULL,
[MIE_VALUE_NONE] = &null_value_type,
[MIE_VALUE_MODULE] = &module_value_type,
[MIE_VALUE_RECORD] = &record_value_type,
[MIE_VALUE_FUNC] = &func_value_type,