factor some utility functions/data in util.c

This commit is contained in:
Quentin Carbonneaux 2015-10-05 17:23:54 -04:00
parent cb4d738c36
commit e30fab31e1
7 changed files with 97 additions and 101 deletions

View file

@ -13,16 +13,6 @@
* constant allocX in the first basic block)
*/
extern Ins insb[NIns], *curi; /* shared work buffer */
static void
emit(int op, int w, Ref to, Ref arg0, Ref arg1)
{
if (curi == insb)
diag("isel: too many instructions");
*--curi = (Ins){op, w, to, {arg0, arg1}};
}
static Ref
newtmp(Fn *fn)
{
@ -190,7 +180,7 @@ sel(Ins i, Fn *fn)
}
n = 0;
Emit:
emit(i.op, w, i.to, i.arg[0], i.arg[1]);
emiti(i);
while (n--) {
/* load constants that do not fit in
* a 32bit signed integer into a