mie: implement more ir building functionality

This commit is contained in:
2025-04-13 18:34:02 +01:00
parent 7f0d8b87c5
commit deb1232bf9
21 changed files with 694 additions and 132 deletions

View File

@@ -2,25 +2,13 @@
#include <stdlib.h>
#include <string.h>
void mie_int_init(struct mie_int *out, long long val, unsigned int nr_bits)
static struct mie_type *get_type(struct mie_value *v)
{
memset(out, 0x0, sizeof *out);
mie_value_init(&out->i_base.c_base, MIE_VALUE_CONST);
out->i_base.c_type = MIE_CONST_INT;
out->i_value = val;
out->i_width = nr_bits;
struct mie_const *c = MIE_CONST(v);
return c->c_type;
}
struct mie_int *mie_int_create(long long val, unsigned int nr_bits)
{
struct mie_int *out = malloc(sizeof *out);
if (!out) {
return NULL;
}
mie_int_init(out, val, nr_bits);
return out;
}
const struct mie_value_type const_value_type = {
.t_id = MIE_VALUE_CONST,
.t_get_type = get_type,
};