diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-07-15 12:41:51 -0400 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-09-15 23:01:28 -0400 |
commit | 17e48f5221d0a17d91700e89cfc8ef5a72fda1f5 (patch) | |
tree | b23f8c063841c53a068d5afb2465842615a05889 /lisc/lisc.h | |
parent | 065565be8394c663e7cd7a5e8fddbefedef05feb (diff) | |
download | roux-17e48f5221d0a17d91700e89cfc8ef5a72fda1f5.tar.gz |
change Ref to a struct
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, |