diff options
Diffstat (limited to 'lisc/lisc.h')
-rw-r--r-- | lisc/lisc.h | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/lisc/lisc.h b/lisc/lisc.h index a6d4ead..f49aa6f 100644 --- a/lisc/lisc.h +++ b/lisc/lisc.h @@ -7,7 +7,6 @@ typedef unsigned short ushort; typedef unsigned char uchar; enum { - R = 0, /* invalid reference */ NReg = 32, Tmp0 = NReg+1, NString = 32, @@ -22,19 +21,29 @@ typedef struct Phi Phi; typedef struct Blk Blk; typedef struct Sym Sym; typedef struct Fn Fn; -typedef ushort Ref; +typedef struct Ref Ref; + +struct Ref { + ushort type:1; + ushort val:15; +}; + +static inline int +req(Ref a, Ref b) +{ + return a.type == b.type && a.val == b.val; +} + +#define R (Ref){0, 0} // Invalid reference enum { RSym = 0, RConst = 1, - - RMask = 1, - RShift = 1, - NRef = ((ushort)-1)>>RShift, + NRef = ((ushort)-1)>>1, }; -#define SYM(x) (((x)<<RShift) | RSym) -#define CONST(x) (((x)<<RShift) | RConst) +#define SYM(x) (Ref){ RSym, x } +#define CONST(x) (Ref){ RConst, x } enum { OXXX, |