static void
mme_tu104_start_cf(struct mme_builder *b,
- enum mme_tu104_cf_type type,
+ enum mme_cf_type type,
enum mme_tu104_alu_op op,
struct mme_value x,
struct mme_value y,
uint16_t ip = tb->inst_count - 1;
assert(tb->insts[ip].alu[0].op == op);
- tb->cf_stack[tb->cf_depth++] = (struct mme_tu104_cf) {
+ tb->cf_stack[tb->cf_depth++] = (struct mme_cf) {
.type = type,
.start_ip = ip,
};
mme_tu104_new_inst(tb);
}
-static struct mme_tu104_cf
-mme_tu104_end_cf(struct mme_builder *b, enum mme_tu104_cf_type type)
+static struct mme_cf
+mme_tu104_end_cf(struct mme_builder *b, enum mme_cf_type type)
{
struct mme_tu104_builder *tb = &b->tu104;
mme_tu104_new_inst(tb);
assert(tb->cf_depth > 0);
- struct mme_tu104_cf cf = tb->cf_stack[--tb->cf_depth];
+ struct mme_cf cf = tb->cf_stack[--tb->cf_depth];
assert(cf.type == type);
int delta = tb->inst_count - cf.start_ip - 1;
{
struct mme_tu104_builder *tb = &b->tu104;
- struct mme_tu104_cf cf = mme_tu104_end_cf(b, MME_CF_TYPE_WHILE);
+ struct mme_cf cf = mme_tu104_end_cf(b, MME_CF_TYPE_WHILE);
int delta = tb->inst_count - cf.start_ip - 2;
uint16_t control = (-delta & BITFIELD_MASK(13)) |
#define MME_TU104_BUILDER_MAX_INSTS 128
-enum mme_tu104_cf_type {
- MME_CF_TYPE_IF,
- MME_CF_TYPE_LOOP,
- MME_CF_TYPE_WHILE,
-};
-
-struct mme_tu104_cf {
- enum mme_tu104_cf_type type;
- uint16_t start_ip;
-};
-
struct mme_tu104_builder {
uint32_t inst_count;
struct mme_tu104_inst insts[MME_TU104_BUILDER_MAX_INSTS];
enum mme_tu104_instr_parts inst_parts;
uint32_t cf_depth;
- struct mme_tu104_cf cf_stack[8];
+ struct mme_cf cf_stack[8];
};
void mme_tu104_builder_init(struct mme_builder *b);