Mercurial > hg > CbC > old > device
diff mc.h @ 164:1c2a9232ea93
mc.h generation
author | kono |
---|---|
date | Mon, 24 Nov 2003 09:29:06 +0900 (2003-11-24) |
parents | 0c604d2ff585 |
children | 6409ff6bc219 |
line wrap: on
line diff
--- a/mc.h Mon Nov 24 00:52:18 2003 +0900 +++ b/mc.h Mon Nov 24 09:29:06 2003 +0900 @@ -11,6 +11,8 @@ #define SIZE_INT 4 +/* reserved word start */ + #define INT (-1) #define UNSIGNED (-2) #define CHAR (-3) @@ -38,38 +40,40 @@ #define TAG (-24) #define FIELD (-25) #define IDENT (-26) -#define STRING (-27) -#define MACRO (-28) -#define BLABEL (-29) -#define FLABEL (-30) -#define TYPEDEF (-31) -#define SIZEOF (-32) -#define TYPE (-33) -#define LONG (-34) -#define ULONG (-35) -#define SHORT (-36) -#define USHORT (-37) -#define EXTRN (-38) -#define EXTRN1 (-39) -#define VOID (-40) -#define REGISTER (-41) -#define CODE (-42) -#define ENVIRONMENT (-43) -#define DEFINED (-44) -#define KONST (-45) -#define FMACRO (-46) -#define LMACRO (-47) -#define DOTS (-49) +#define MACRO (-27) +#define BLABEL (-28) +#define FLABEL (-29) +#define TYPEDEF (-30) +#define SIZEOF (-31) +#define TYPE (-32) +#define LONG (-33) +#define ULONG (-34) +#define SHORT (-35) +#define USHORT (-36) +#define EXTRN (-37) +#define EXTRN1 (-38) +#define VOID (-39) +#define REGISTER (-40) +#define CODE (-41) +#define ENVIRONMENT (-42) +#define DEFINED (-43) +#define KONST (-44) +#define FMACRO (-45) +#define LMACRO (-46) +#define DOTS (-47) -#define FLOAT (-50) -#define DOUBLE (-51) -#define FREGISTER (-52) -#define DREGISTER (-53) -#define LONGLONG (-54) -#define ULONGLONG (-55) +#define FLOAT (-48) +#define DOUBLE (-49) +#define FREGISTER (-50) +#define DREGISTER (-51) +#define LONGLONG (-52) +#define ULONGLONG (-53) + +/* reserved word end */ #define EMPTY (-99) +/* mode start */ #define TOP 0 #define GDECL 1 #define GSDECL 2 @@ -84,6 +88,20 @@ #define LTDECL 11 #define IFDEF 12 #define MDECL 13 +/* mode end */ + +#define US 1 +#define AS 1000 +#define SOP 200 +#define DOP 400 +#define FOP 600 +#define LOP 800 + +/* tree node tags start */ + +#define LIST_ARGS(i) (i==FUNCTION||i==CODE) + +/* nullary argments */ #define GVAR 1 #define RGVAR 2 @@ -93,77 +111,121 @@ #define RLVAR 6 #define CRLVAR 7 #define CURLVAR 8 +#define FRGVAR (FOP+RGVAR) +#define FRLVAR (FOP+RLVAR) +#define DRGVAR (DOP+RGVAR) +#define DRLVAR (DOP+RLVAR) +#define SRGVAR (SOP+RGVAR) +#define SRLVAR (SOP+RLVAR) +#define SURGVAR (SOP+CURGVAR) +#define SURLVAR (SOP+CURLVAR) +#define LRGVAR (LOP+RGVAR) +#define LRLVAR (LOP+RLVAR) +#define LURGVAR (LOP+CURGVAR) +#define LURLVAR (LOP+CURLVAR) + #define CONST 9 -#define FNAME 10 -#define INDIRECT 11 -#define RINDIRECT 12 -#define CRINDIRECT 13 -#define CURINDIRECT 14 -#define ADDRESS 15 -#define MINUS 16 -#define LNOT 17 -#define BNOT 18 -#define INC 19 -#define POSTINC 20 -#define PREINC 21 -#define CPOSTINC 22 -#define CPREINC 23 +#define DCONST (DOP+CONST) +#define FCONST (FOP+CONST) +#define LCONST (LOP+CONST) +#define STRING 10 +#define FNAME 11 + +#define NULLARY_ARGS(i) (GVAR<=(i%SOP)&&(i%SOP)<=FNAME) + +/* unary argments */ + +#define ADDRESS 12 +#define MINUS 13 +#define LNOT 14 +#define BNOT 15 +#define INC 16 +#define POSTINC 17 +#define PREINC 18 +#define DEC 19 +#define CPOSTINC 20 +#define CPREINC 21 +#define CPOSTDEC 22 +#define CPREDEC 23 #define CUPOSTINC 24 -#define CUPREINC 25 -#define DEC 26 -#define CPOSTDEC 27 -#define CPREDEC 28 -#define CUPOSTDEC 29 -#define CUPREDEC 30 -#define MUL 31 -#define UMUL 32 -#define DIV 33 -#define UDIV 34 -#define MOD 35 -#define UMOD 36 -#define ADD 37 -#define SUB 38 -#define CMP 39 -#define RSHIFT 40 -#define URSHIFT 41 -#define LSHIFT 42 -#define ULSHIFT 43 -#define GT 44 -#define UGT 45 -#define GE 46 -#define UGE 47 -#define LT 48 -#define ULT 49 -#define LE 50 -#define ULE 51 -#define EQ 52 -#define NEQ 53 -#define BAND 54 -#define EOR 55 -#define BOR 56 -#define LAND 57 -#define LOR 58 -#define COND 59 -#define ASS 60 -#define CASS 61 -#define ASSOP 62 -#define CASSOP 63 -#define CUASSOP 64 +#define CUPREINC 25 +#define CUPOSTDEC 26 +#define CUPREDEC 27 +#define SPOSTINC (SOP+CPOSTINC) +#define SPREINC (SOP+CPREINC) +#define SPOSTDEC (SOP+CPOSTDEC) +#define SPREDEC (SOP+CPREDEC) +#define SUPOSTINC (SOP+CUPOSTINC) +#define SUPREINC (SOP+CUPREINC) +#define SUPOSTDEC (SOP+CUPOSTDEC) +#define SUPREDEC (SOP+CUPREDEC) +#define FPOSTINC (FOP+POSTINC) +#define FPREINC (FOP+PREINC) +#define DPOSTINC (DOP+POSTINC) +#define DPREINC (DOP+PREINC) +#define LPOSTINC (LOP+POSTINC) +#define LPREINC (LOP+PREINC) +#define LUPOSTINC (LOP+CUPOSTINC) +#define LUPREINC (LOP+CUPREINC) +#define INDIRECT 28 +#define RINDIRECT 29 +#define CRINDIRECT 30 +#define CURINDIRECT 31 +#define SRINDIRECT (SOP+CRINDIRECT) +#define SURINDIRECT (SOP+CURINDIRECT) +#define FRINDIRECT (FOP+RINDIRECT) +#define DRINDIRECT (DOP+RINDIRECT) +#define LRINDIRECT (DOP+RINDIRECT) +#define RSTRUCT 32 +#define CONV 33 + +#define UNARY_ARGS(i) (ADDRESS<=(i%SOP)&&(i%SOP)<=CONV) + +/* binary argments */ + +#define MUL 34 +#define UMUL 35 +#define DIV 36 +#define UDIV 37 +#define MOD 38 +#define UMOD 39 +#define ADD 40 +#define SUB 41 +#define CMP 42 +#define RSHIFT 43 +#define URSHIFT 44 +#define LSHIFT 45 +#define ULSHIFT 46 +#define GT 47 +#define UGT 48 +#define GE 49 +#define UGE 50 +#define LT 51 +#define ULT 52 +#define LE 53 +#define ULE 54 +#define EQ 55 +#define NEQ 56 +#define BAND 57 +#define EOR 58 +#define BOR 59 +#define LAND 60 +#define LOR 61 +#define ASS 62 +#define CMPGE 63 +#define ASSOP 64 #define COMMA 65 -#define LPAR 66 -#define RPAR 67 -#define LBRA 68 -#define RBRA 69 -#define LC 70 -#define RC 71 -#define COLON 72 -#define SM 73 -#define PERIOD 74 -#define ARROW 75 -#define CNAME 76 -#define SASS 77 -#define RSTRUCT 78 + +#define CASS 66 +#define CASSOP 67 +#define CUASSOP 68 +#define SASS (SOP+ASS) +#define SASSOP (SOP+CASSOP) +#define SUASSOP (SOP+CUASSOP) + +#define DASS (DOP+ASS) +#define DCMPGE (DOP+CMPGE) #define DASSOP (DOP+ASSOP) #define DCMP (DOP+CMP) #define DMINUS (DOP+MINUS) @@ -171,6 +233,9 @@ #define DDIV (DOP+DIV) #define DADD (DOP+ADD) #define DSUB (DOP+SUB) + +#define FASS (FOP+ASS) +#define FCMPGE (FOP+CMPGE) #define FASSOP (FOP+ASSOP) #define FCMP (FOP+CMP) #define FMINUS (FOP+MINUS) @@ -178,53 +243,60 @@ #define FDIV (FOP+DIV) #define FADD (FOP+ADD) #define FSUB (FOP+SUB) -#define CMPGE 79 -#define DCMPGE (DOP+CMPGE) -#define FCMPGE (FOP+CMPGE) -#define LMUL 80 -#define LDIV 81 -#define LADD 82 -#define LSUB 83 -#define FRGVAR 84 -#define FRLVAR 85 -#define FRINDIRECT 86 -#define DRGVAR 87 -#define DRLVAR 88 -#define DRINDIRECT 90 -#define LRGVAR 91 -#define LRLVAR 92 -#define LRINDIRECT 93 -#define DCONST (DOP+CONST) -#define FCONST (FOP+CONST) -#define LCONST 94 -#define DASS 95 -#define FASS 96 -#define LASS 97 -#define SHASS 98 +#define LASS (LOP+ASS) +#define LCMPGE (LOP+CMPGE) +#define LASSOP (LOP+CASSOP) +#define LUASSOP (LOP+CUASSOP) +#define LMUL (LOP+MUL) +#define LDIV (LOP+DIV) +#define LUMUL (LOP+UMUL) +#define LUDIV (LOP+UDIV) +#define LADD (LOP+ADD) +#define LSUB (LOP+SUB) -#define I2D 99 -#define D2I 100 -#define U2D 101 -#define D2U 102 -#define F2D 103 -#define D2F 104 -#define I2F 105 -#define F2I 106 -#define U2F 107 -#define F2U 108 -#define FPOSTINC (FOP+POSTINC) -#define DPOSTINC (DOP+POSTINC) -#define FPREINC (FOP+PREINC) -#define DPREINC (DOP+PREINC) +#define STASS 69 + +#define BINARY_ARGS(i) (MUL<=(i%SOP)&&(i%SOP)<=STASS) + +/* tarnary argments */ + +#define COND 70 +#define SCOND (SOP+COND) #define DCOND (DOP+COND) #define FCOND (FOP+COND) -#define CONV 109 +#define LCOND (LOP+COND) + +#define TARNARY_ARGS(i) (COND==(i%SOP)) + +/* not appeared as tags */ -#define US 1 -#define AS 200 -#define DOP 400 -#define FOP 600 +#define I2D 71 +#define D2I 72 +#define U2D 73 +#define D2U 74 +#define F2D 75 +#define D2F 76 +#define I2F 77 +#define F2I 78 +#define U2F 79 +#define F2U 80 + +#define LPAR 81 +#define RPAR 82 +#define LBRA 83 +#define RBRA 84 +#define LC 85 +#define RC 86 +#define COLON 87 +#define SM 88 +#define PERIOD 89 +#define ARROW 90 +#define CNAME 91 + +/* tree node tags end */ + +/* error number start */ #define FILERR 1 #define DCERR 2 @@ -247,6 +319,7 @@ #define REG_ERR 19 #define CODE_ERR 20 #define MSERR 21 +/* error number end */ #define GSYMS 9000 #define LSYMS 500