1: /*	@(#)c1.h	2.2	SCCS id keyword	*/
   2: /*
   3:  * C code generator header
   4:  */
   5: 
   6: #include <stdio.h>
   7: #include <whoami.h>
   8: 
   9: #define LTYPE   long    /* change to int for no long consts */
  10: #define NCPS    8
  11: #define NULL    0
  12: 
  13: /*
  14:  *  Tree node for unary and binary
  15:  */
  16: struct  tnode {
  17:     int op;
  18:     int type;
  19:     int degree;
  20:     struct  tnode *tr1, *tr2;
  21: };
  22: 
  23: /*
  24:  * tree names for locals
  25:  */
  26: struct  tname {
  27:     int op;
  28:     int type;
  29:     char    class;
  30:     char    regno;
  31:     int offset;
  32:     int nloc;
  33: };
  34: 
  35: /*
  36:  * tree names for externals
  37:  */
  38: struct  xtname {
  39:     int op;
  40:     int type;
  41:     char    class;
  42:     char    regno;
  43:     int offset;
  44:     char    name[NCPS];
  45: };
  46: 
  47: struct  tconst {
  48:     int op;
  49:     int type;
  50:     int value;
  51: };
  52: 
  53: /*
  54:  * long constants
  55:  */
  56: struct  lconst {
  57:     int op;
  58:     int type;
  59:     LTYPE   lvalue;
  60: };
  61: 
  62: struct  ftconst {
  63:     int op;
  64:     int type;
  65:     int value;
  66:     double  fvalue;
  67: };
  68: 
  69: /*
  70:  * Node used for field assignemnts
  71:  */
  72: struct  fasgn {
  73:     int op;
  74:     int type;
  75:     int degree;
  76:     struct  tnode *tr1, *tr2;
  77:     int mask;
  78: };
  79: 
  80: struct  optab {
  81:     char    tabdeg1;
  82:     char    tabtyp1;
  83:     char    tabdeg2;
  84:     char    tabtyp2;
  85:     char    *tabstring;
  86: };
  87: 
  88: struct  table {
  89:     int tabop;
  90:     struct  optab *tabp;
  91: };
  92: 
  93: struct  instab {
  94:     int iop;
  95:     char    *str1;
  96:     char    *str2;
  97: };
  98: 
  99: struct  swtab {
 100:     int swlab;
 101:     int swval;
 102: };
 103: 
 104: char    maprel[];
 105: char    notrel[];
 106: int nreg;
 107: int isn;
 108: int namsiz;
 109: int line;
 110: int nerror;
 111: struct  table   cctab[];
 112: struct  table   efftab[];
 113: struct  table   regtab[];
 114: struct  table   sptab[];
 115: struct  table   lsptab[1];
 116: struct  instab  instab[];
 117: struct  instab  branchtab[];
 118: int opdope[];
 119: char    *opntab[];
 120: int nstack;
 121: int nfloat;
 122: struct  tname   sfuncr;
 123: char    *funcbase;
 124: char    *curbase;
 125: char    *coremax;
 126: struct tconst czero, cone;
 127: struct  ftconst fczero;
 128: long    totspace;
 129: #ifdef MENLO_OVLY
 130: int ovlyflag;
 131: #endif
 132: /*
 133:  * Some special stuff for long comparisons
 134:  */
 135: int xlab1, xlab2, xop, xzero;
 136: 
 137: /*
 138: 	operators
 139: */
 140: #define EOFC    0
 141: #define SEMI    1
 142: #define LBRACE  2
 143: #define RBRACE  3
 144: #define LBRACK  4
 145: #define RBRACK  5
 146: #define LPARN   6
 147: #define RPARN   7
 148: #define COLON   8
 149: #define COMMA   9
 150: #define FSEL    10
 151: #define FSELR   11
 152: #define FSELT   12
 153: #define FSELA   16
 154: #define ULSH    17
 155: #define ASULSH  18
 156: 
 157: #define KEYW    19
 158: #define NAME    20
 159: #define CON 21
 160: #define STRING  22
 161: #define FCON    23
 162: #define SFCON   24
 163: #define LCON    25
 164: #define SLCON   26
 165: 
 166: #define AUTOI   27
 167: #define AUTOD   28
 168: #define INCBEF  30
 169: #define DECBEF  31
 170: #define INCAFT  32
 171: #define DECAFT  33
 172: #define EXCLA   34
 173: #define AMPER   35
 174: #define STAR    36
 175: #define NEG 37
 176: #define COMPL   38
 177: 
 178: #define DOT 39
 179: #define PLUS    40
 180: #define MINUS   41
 181: #define TIMES   42
 182: #define DIVIDE  43
 183: #define MOD 44
 184: #define RSHIFT  45
 185: #define LSHIFT  46
 186: #define AND 47
 187: #define ANDN    55
 188: #define OR  48
 189: #define EXOR    49
 190: #define ARROW   50
 191: #define ITOF    51
 192: #define FTOI    52
 193: #define LOGAND  53
 194: #define LOGOR   54
 195: #define FTOL    56
 196: #define LTOF    57
 197: #define ITOL    58
 198: #define LTOI    59
 199: #define ITOP    13
 200: #define PTOI    14
 201: #define LTOP    15
 202: 
 203: #define EQUAL   60
 204: #define NEQUAL  61
 205: #define LESSEQ  62
 206: #define LESS    63
 207: #define GREATEQ 64
 208: #define GREAT   65
 209: #define LESSEQP 66
 210: #define LESSP   67
 211: #define GREATQP 68
 212: #define GREATP  69
 213: 
 214: #define ASPLUS  70
 215: #define ASMINUS 71
 216: #define ASTIMES 72
 217: #define ASDIV   73
 218: #define ASMOD   74
 219: #define ASRSH   75
 220: #define ASLSH   76
 221: #define ASAND   77
 222: #define ASOR    78
 223: #define ASXOR   79
 224: #define ASSIGN  80
 225: #define TAND    81
 226: #define LTIMES  82
 227: #define LDIV    83
 228: #define LMOD    84
 229: #define ASANDN  85
 230: #define LASTIMES 86
 231: #define LASDIV  87
 232: #define LASMOD  88
 233: 
 234: #define QUEST   90
 235: #define MAX 93
 236: #define MAXP    94
 237: #define MIN 95
 238: #define MINP    96
 239: #define LLSHIFT 91
 240: #define ASLSHL  92
 241: #define SEQNC   97
 242: #define CALL1   98
 243: #define CALL2   99
 244: #define CALL    100
 245: #define MCALL   101
 246: #define JUMP    102
 247: #define CBRANCH 103
 248: #define INIT    104
 249: #define SETREG  105
 250: #define LOAD    106
 251: #define ITOC    109
 252: #define RFORCE  110
 253: 
 254: /*
 255:  * Intermediate code operators
 256:  */
 257: #define BRANCH  111
 258: #define LABEL   112
 259: #define NLABEL  113
 260: #define RLABEL  114
 261: #define STRASG  115
 262: #define STRSET  116
 263: #define BDATA   200
 264: #define PROG    202
 265: #define DATA    203
 266: #define BSS 204
 267: #define CSPACE  205
 268: #define SSPACE  206
 269: #define SYMDEF  207
 270: #define SAVE    208
 271: #define RETRN   209
 272: #define EVEN    210
 273: #define PROFIL  212
 274: #define SWIT    213
 275: #define EXPR    214
 276: #define SNAME   215
 277: #define RNAME   216
 278: #define ANAME   217
 279: #define NULLOP  218
 280: #define SETSTK  219
 281: #define SINIT   220
 282: #define GLOBAL  221
 283: #define C3BRANCH    222
 284: 
 285: /*
 286:  *	types
 287:  */
 288: #define INT 0
 289: #define CHAR    1
 290: #define FLOAT   2
 291: #define DOUBLE  3
 292: #define STRUCT  4
 293: #define RSTRUCT 5
 294: #define LONG    6
 295: #define UNSIGN  7
 296: 
 297: #define TYLEN   2
 298: #define TYPE    07
 299: #define XTYPE   (03<<3)
 300: #define PTR 010
 301: #define FUNC    020
 302: #define ARRAY   030
 303: 
 304: /*
 305: 	storage	classes
 306: */
 307: #define KEYWC   1
 308: #define MOS 10
 309: #define AUTO    11
 310: #define EXTERN  12
 311: #define STATIC  13
 312: #define REG 14
 313: #define STRTAG  15
 314: #define ARG 16
 315: #define OFFS    20
 316: #define XOFFS   21
 317: #define SOFFS   22
 318: 
 319: /*
 320: 	Flag	bits
 321: */
 322: 
 323: #define BINARY  01
 324: #define LVALUE  02
 325: #define RELAT   04
 326: #define ASSGOP  010
 327: #define LWORD   020
 328: #define RWORD   040
 329: #define COMMUTE 0100
 330: #define RASSOC  0200
 331: #define LEAF    0400
 332: #define CNVRT   01000

Defined variables

branchtab defined in line 117; used 1 times
cctab defined in line 111; used 17 times
cone defined in line 126; used 2 times
coremax defined in line 125; used 3 times
curbase defined in line 124; used 6 times
czero defined in line 126; used 2 times
efftab defined in line 112; used 14 times
fczero defined in line 127; never used
funcbase defined in line 123; used 5 times
instab defined in line 116; used 1 times
isn defined in line 107; used 25 times
line defined in line 109; used 3 times
lsptab defined in line 115; used 6 times
maprel defined in line 104; used 2 times
namsiz defined in line 108; never used
nerror defined in line 110; used 3 times
nfloat defined in line 121; used 2 times
notrel defined in line 105; used 3 times
nreg defined in line 106; used 8 times
nstack defined in line 120; used 13 times
opdope defined in line 118; used 31 times
opntab defined in line 119; used 3 times
ovlyflag defined in line 130; used 1 times
regtab defined in line 113; used 14 times
sfuncr defined in line 122; used 6 times
sptab defined in line 114; used 7 times
totspace defined in line 128; used 2 times
xlab1 defined in line 135; used 6 times
xlab2 defined in line 135; used 7 times
xop defined in line 135; used 4 times
xzero defined in line 135; used 7 times

Defined struct's

fasgn defined in line 72; used 6 times
ftconst defined in line 62; used 6 times
instab defined in line 93; used 12 times
lconst defined in line 56; used 10 times
optab defined in line 80; used 4 times
swtab defined in line 99; used 10 times
table defined in line 88; used 26 times
tconst defined in line 47; used 8 times
tname defined in line 26; used 10 times
tnode defined in line 16; used 166 times
xtname defined in line 38; used 2 times

Defined macros

AMPER defined in line 173; used 13 times
ANAME defined in line 278; never used
AND defined in line 186; used 6 times
ANDN defined in line 187; used 4 times
ARG defined in line 314; never used
ARRAY defined in line 302; never used
ARROW defined in line 190; never used
ASAND defined in line 221; used 2 times
ASANDN defined in line 229; used 2 times
ASDIV defined in line 217; used 3 times
ASLSH defined in line 220; used 6 times
ASLSHL defined in line 240; used 2 times
ASMINUS defined in line 215; used 1 times
ASMOD defined in line 218; used 3 times
ASOR defined in line 222; used 2 times
ASPLUS defined in line 214; used 3 times
ASRSH defined in line 219; used 2 times
ASSGOP defined in line 326; never used
ASSIGN defined in line 224; used 6 times
ASTIMES defined in line 216; used 2 times
ASULSH defined in line 155; used 4 times
ASXOR defined in line 223; used 1 times
AUTO defined in line 309; used 1 times
AUTOD defined in line 167; used 3 times
AUTOI defined in line 166; used 3 times
BDATA defined in line 263; never used
BINARY defined in line 323; used 8 times
BRANCH defined in line 257; never used
BSS defined in line 266; never used
C3BRANCH defined in line 283; never used
CALL defined in line 244; used 2 times
CALL1 defined in line 242; used 2 times
CALL2 defined in line 243; used 2 times
CBRANCH defined in line 247; used 1 times
CHAR defined in line 289; used 18 times
CNVRT defined in line 332; used 4 times
COLON defined in line 148; never used
COMMA defined in line 149; used 3 times
COMMUTE defined in line 329; used 1 times
COMPL defined in line 176; used 5 times
CON defined in line 159; used 50 times
CSPACE defined in line 267; never used
DATA defined in line 265; never used
DECAFT defined in line 171; used 4 times
DECBEF defined in line 169; used 2 times
DIVIDE defined in line 182; used 4 times
DOT defined in line 178; never used
DOUBLE defined in line 291; used 7 times
EOFC defined in line 140; never used
EQUAL defined in line 203; used 17 times
EVEN defined in line 272; never used
EXCLA defined in line 172; used 1 times
EXOR defined in line 189; used 2 times
EXPR defined in line 275; used 1 times
EXTERN defined in line 310; used 4 times
FCON defined in line 161; used 10 times
FLOAT defined in line 290; used 5 times
FSEL defined in line 150; used 3 times
FSELA defined in line 153; used 1 times
FSELR defined in line 151; used 1 times
FSELT defined in line 152; used 2 times
FTOI defined in line 192; used 1 times
FTOL defined in line 195; used 2 times
FUNC defined in line 301; never used
GLOBAL defined in line 282; never used
GREAT defined in line 208; used 12 times
GREATEQ defined in line 207; used 6 times
GREATP defined in line 212; used 6 times
GREATQP defined in line 211; used 6 times
INCAFT defined in line 170; used 6 times
INCBEF defined in line 168; used 1 times
INIT defined in line 248; never used
INT defined in line 288; used 27 times
ITOC defined in line 251; never used
ITOF defined in line 191; used 1 times
ITOL defined in line 197; used 18 times
ITOP defined in line 199; used 1 times
JUMP defined in line 246; never used
KEYW defined in line 157; never used
KEYWC defined in line 307; never used
LABEL defined in line 258; never used
LASDIV defined in line 231; used 1 times
LASMOD defined in line 232; used 1 times
LASTIMES defined in line 230; used 2 times
LBRACE defined in line 142; never used
LBRACK defined in line 144; never used
LCON defined in line 163; used 16 times
LDIV defined in line 227; used 1 times
LEAF defined in line 331; used 10 times
LESS defined in line 206; used 12 times
LESSEQ defined in line 205; used 7 times
LESSEQP defined in line 209; used 7 times
LESSP defined in line 210; used 6 times
LLSHIFT defined in line 239; used 2 times
LMOD defined in line 228; used 1 times
LOAD defined in line 250; used 5 times
LOGAND defined in line 193; used 3 times
LOGOR defined in line 194; used 3 times
LONG defined in line 294; used 38 times
LPARN defined in line 146; never used
LSHIFT defined in line 185; used 7 times
LTIMES defined in line 226; used 2 times
LTOF defined in line 196; used 2 times
LTOI defined in line 198; used 8 times
LTOP defined in line 201; never used
LTYPE defined in line 9; used 1 times
  • in line 59
LVALUE defined in line 324; used 1 times
LWORD defined in line 327; never used
MAX defined in line 235; never used
MAXP defined in line 236; never used
MCALL defined in line 245; never used
MIN defined in line 237; never used
MINP defined in line 238; never used
MINUS defined in line 180; used 3 times
MOD defined in line 183; used 3 times
MOS defined in line 308; never used
NAME defined in line 158; used 25 times
NCPS defined in line 10; used 1 times
  • in line 44
NEG defined in line 175; used 2 times
NEQUAL defined in line 204; used 14 times
NLABEL defined in line 259; never used
NULL defined in line 11; never used
NULLOP defined in line 279; never used
OFFS defined in line 315; used 5 times
OR defined in line 188; used 2 times
PLUS defined in line 179; used 24 times
PROFIL defined in line 273; never used
PROG defined in line 264; never used
PTOI defined in line 200; used 3 times
PTR defined in line 300; used 13 times
QUEST defined in line 234; used 1 times
RASSOC defined in line 330; never used
RBRACE defined in line 143; never used
RBRACK defined in line 145; never used
REG defined in line 312; used 11 times
RELAT defined in line 325; used 14 times
RETRN defined in line 271; never used
RFORCE defined in line 252; used 3 times
RLABEL defined in line 260; never used
RNAME defined in line 277; never used
RPARN defined in line 147; never used
RSHIFT defined in line 184; used 3 times
RSTRUCT defined in line 293; never used
RWORD defined in line 328; never used
SAVE defined in line 270; never used
SEMI defined in line 141; never used
SEQNC defined in line 241; never used
SETREG defined in line 249; never used
SETSTK defined in line 280; never used
SFCON defined in line 162; used 8 times
SINIT defined in line 281; never used
SLCON defined in line 164; never used
SNAME defined in line 276; never used
SOFFS defined in line 317; used 1 times
SSPACE defined in line 268; never used
STAR defined in line 174; used 16 times
STATIC defined in line 311; used 2 times
STRASG defined in line 261; used 2 times
STRING defined in line 160; never used
STRSET defined in line 262; used 1 times
STRTAG defined in line 313; never used
STRUCT defined in line 292; used 11 times
SWIT defined in line 274; never used
SYMDEF defined in line 269; never used
TAND defined in line 225; used 3 times
TIMES defined in line 181; used 12 times
TYLEN defined in line 297; used 2 times
TYPE defined in line 298; used 8 times
ULSH defined in line 154; used 3 times
UNSIGN defined in line 295; used 26 times
XOFFS defined in line 316; used 1 times
XTYPE defined in line 299; used 6 times

Usage of this include

Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2214
Valid CSS Valid XHTML 1.0 Strict