7 static int block_id
= 0;
10 static const char *icop_strs
[] = {
17 void icblock_create(struct icblock
*bl
)
19 bl
->o_first
= bl
->o_last
= NULL
;
23 void icblock_destroy(struct icblock
*bl
)
25 struct icop
*op
, *op_next
;
34 static void icop_dump(struct icop
*op
)
37 printf(" %d %s", op
->id
, icop_strs
[op
->op
]);
40 printf("%s%d", (i
==0)?" ":",", op
->operands
[i
]->id
);
46 void icblock_dump(struct icblock
*bl
)
48 struct icop
*op
= bl
->o_first
;
49 printf("block%d:\n", bl
->id
);
56 static struct icop
*icop_create(void)
58 // TODO: create a pool of these?
59 struct icop
*op
= emalloc(sizeof *op
);
60 memset(op
, 0, sizeof *op
);
65 struct icop
*icblock_append(struct icblock
*bl
)
67 struct icop
*op
= icop_create();
68 op
->prev
= bl
->o_last
;
70 *(bl
->o_last
? &bl
->o_last
->next
: &bl
->o_first
) = op
;