commit 9ecfdf63340c167a243cd479534110b34737e80b
parent 77bdb3ae9e925c9063f10ff9e1e5cf8ac66538ce
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date: Fri, 17 Jul 2015 16:54:01 -0400
cosmetics
Diffstat:
2 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/lisc/lisc.h b/lisc/lisc.h
@@ -1,10 +1,10 @@
#include <assert.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef unsigned int uint;
-typedef unsigned short ushort;
typedef unsigned char uchar;
typedef unsigned long long ullong;
@@ -39,27 +39,29 @@ struct Bits {
#define BCLR(b, n) ((b).t[n/NBit] &= ~((ullong)1<<(n%NBit)))
struct Ref {
- ushort type:1;
- ushort val:15;
+ uint16_t type:1;
+ uint16_t val:15;
};
-#define R (Ref){0, 0} // Invalid reference
-
-static inline int
-req(Ref a, Ref b)
-{
- return a.type == b.type && a.val == b.val;
-}
-
enum {
RSym = 0,
RConst = 1,
NRef = (1<<15) - 1
};
+#define R (Ref){0, 0}
#define SYM(x) (Ref){RSym, x}
#define CONST(x) (Ref){RConst, x}
+static inline int req(Ref a, Ref b)
+{
+ return a.type == b.type && a.val == b.val;
+}
+static inline int rtype(Ref r)
+{
+ return req(r, R) ? -1 : r.type;
+}
+
enum {
OXXX = 0,
OAdd,
diff --git a/lisc/live.c b/lisc/live.c
@@ -1,9 +1,9 @@
#include "lisc.h"
static inline void
-symadd(Bits *b, Ref r)
+bset(Bits *b, Ref r)
{
- if (!req(r, R) && r.type == RSym)
+ if (rtype(r) == RSym)
BSET(*b, r.val);
}
@@ -32,15 +32,15 @@ filllive(Fn *f)
u = &use[b->id];
for (p=b->phi; p; p=p->link) {
for (a=0; a<p->narg; a++)
- symadd(&p->blk[a]->out, p->arg[a]);
- symadd(k, p->to);
+ bset(&p->blk[a]->out, p->arg[a]);
+ bset(k, p->to);
}
for (i=b->ins; i-b->ins < b->nins; i++) {
- symadd(k, i->to);
- symadd(u, i->arg[0]);
- symadd(u, i->arg[1]);
+ bset(k, i->to);
+ bset(u, i->arg[0]);
+ bset(u, i->arg[1]);
}
- symadd(u, b->jmp.arg);
+ bset(u, b->jmp.arg);
}
Again:
chg = 0;