|
|
1.1 ! root 1: # include "macdefs" ! 2: # include "mac2defs" ! 3: # include "manifest" ! 4: ! 5: # ifdef ONEPASS ! 6: ! 7: /* bunch of stuff for putting the passes together... */ ! 8: # define crslab crs2lab ! 9: # define where where2 ! 10: # define xdebug x2debug ! 11: # define tdebug t2debug ! 12: # define deflab def2lab ! 13: # define edebug e2debug ! 14: # define eprint e2print ! 15: # define getlab get2lab ! 16: # define filename ftitle ! 17: # endif ! 18: ! 19: /* cookies, used as arguments to codgen */ ! 20: ! 21: # define FOREFF 01 /* compute for effects only */ ! 22: # define INAREG 02 /* compute into a register */ ! 23: # define INTAREG 04 /* compute into a scratch register */ ! 24: # define INBREG 010 /* compute into a lvalue register */ ! 25: # define INTBREG 020 /* compute into a scratch lvalue register */ ! 26: # define FORCC 040 /* compute for condition codes only */ ! 27: # define INTEMP 010000 /* compute into a temporary location */ ! 28: # define FORARG 020000 /* compute for an argument of a function */ ! 29: # define FORREW 040000 /* search the table, looking for a rewrite rule */ ! 30: ! 31: /* OP descriptors */ ! 32: /* the ASG operator may be used on some of these */ ! 33: ! 34: # define OPSIMP 010000 /* +, -, &, |, ^ */ ! 35: # define OPCOMM 010002 /* +, &, |, ^ */ ! 36: # define OPMUL 010004 /* *, / */ ! 37: # define OPDIV 010006 /* /, % */ ! 38: # define OPUNARY 010010 /* unary ops */ ! 39: # define OPLEAF 010012 /* leaves */ ! 40: # define OPANY 010014 /* any op... */ ! 41: # define OPLOG 010016 /* logical ops */ ! 42: # define OPFLOAT 010020 /* +, -, *, or / (for floats) */ ! 43: # define OPSHFT 010022 /* <<, >> */ ! 44: # define OPLTYPE 010024 /* leaf type nodes (e.g, NAME, ICON, etc. ) */ ! 45: ! 46: /* match returns */ ! 47: ! 48: # define MNOPE 010000 ! 49: # define MDONE 010001 ! 50: ! 51: /* shapes */ ! 52: ! 53: # define SANY 01 /* same as FOREFF */ ! 54: # define SAREG 02 /* same as INAREG */ ! 55: # define STAREG 04 /* same as INTAREG */ ! 56: # define SBREG 010 /* same as INBREG */ ! 57: # define STBREG 020 /* same as INTBREG */ ! 58: # define SCC 040 /* same as FORCC */ ! 59: # define SNAME 0100 ! 60: # define SCON 0200 ! 61: # define SFLD 0400 ! 62: # define SOREG 01000 ! 63: /* indirection or wild card shapes */ ! 64: # ifndef WCARD1 ! 65: # define STARNM 02000 ! 66: # endif ! 67: # ifndef WCARD2 ! 68: # define STARREG 04000 ! 69: # endif ! 70: # define SWADD 040000 ! 71: # define SPECIAL 0100000 ! 72: # define SZERO SPECIAL ! 73: # define SONE (SPECIAL|1) ! 74: # define SMONE (SPECIAL|2) ! 75: # define SCCON (SPECIAL|3) /* -256 <= constant < 256 */ ! 76: # define SSCON (SPECIAL|4) /* -32768 <= constant < 32768 */ ! 77: # define SSOREG (SPECIAL|5) /* non-indexed OREG */ ! 78: ! 79: /* FORARG and INTEMP are carefully not conflicting with shapes */ ! 80: ! 81: /* types */ ! 82: ! 83: # define TCHAR 01 ! 84: # define TSHORT 02 ! 85: # define TINT 04 ! 86: # define TLONG 010 ! 87: # define TFLOAT 020 ! 88: # define TDOUBLE 040 ! 89: # define TPOINT 0100 ! 90: # define TUCHAR 0200 ! 91: # define TUSHORT 0400 ! 92: # define TUNSIGNED 01000 ! 93: # define TULONG 02000 ! 94: # define TPTRTO 04000 /* pointer to one of the above */ ! 95: # define TANY 010000 /* matches anything within reason */ ! 96: # define TSTRUCT 020000 /* structure or union */ ! 97: ! 98: /* reclamation cookies */ ! 99: ! 100: # define RNULL 0 /* clobber result */ ! 101: # define RLEFT 01 ! 102: # define RRIGHT 02 ! 103: # define RESC1 04 ! 104: # define RESC2 010 ! 105: # define RESC3 020 ! 106: # define RESCC 04000 ! 107: # define RNOP 010000 /* DANGER: can cause loops.. */ ! 108: ! 109: /* needs */ ! 110: ! 111: # define NAREG 01 ! 112: # define NACOUNT 03 ! 113: # define NAMASK 017 ! 114: # define NASL 04 /* share left register */ ! 115: # define NASR 010 /* share right register */ ! 116: # define NBREG 020 ! 117: # define NBCOUNT 060 ! 118: # define NBMASK 0360 ! 119: # define NBSL 0100 ! 120: # define NBSR 0200 ! 121: # define NTEMP 0400 ! 122: # define NTMASK 07400 ! 123: # define REWRITE 010000 ! 124: # define EITHER 040000 /* "either" modifier for needs */ ! 125: ! 126: ! 127: # define MUSTDO 010000 /* force register requirements */ ! 128: # define NOPREF 020000 /* no preference for register assignment */ ! 129: # define NEVEN 0100000 /* even register required */ ! 130: ! 131: ! 132: /* register allocation */ ! 133: ! 134: extern int rstatus[]; ! 135: extern int busy[]; ! 136: ! 137: extern struct respref { int cform; int mform; } respref[]; ! 138: ! 139: # define isbreg(r) (rstatus[r]&SBREG) ! 140: # define istreg(r) (rstatus[r]&(STBREG|STAREG)) ! 141: # define istnode(p) (p->in.op==REG && istreg(p->tn.rval)) ! 142: ! 143: # define TBUSY 01000 ! 144: # define REGLOOP(i) for(i=0;i<REGSZ;++i) ! 145: ! 146: # define SETSTO(x,y) (stotree=(x),stocook=(y)) ! 147: extern int stocook; ! 148: # define DELAYS 20 ! 149: extern NODE *deltrees[DELAYS]; ! 150: extern int deli; /* mmmmm */ ! 151: ! 152: extern NODE *stotree; ! 153: extern int callflag; ! 154: ! 155: extern int fregs; ! 156: ! 157: # ifndef ONEPASS ! 158: union ndu { ! 159: ! 160: struct { ! 161: int op; ! 162: int rall; ! 163: TWORD type; ! 164: int su; ! 165: int stalign; /* alignment of structure objects */ ! 166: #ifndef FLEXNAMES ! 167: char name[NCHNAM]; ! 168: #else ! 169: char *name; ! 170: #endif ! 171: NODE *left; ! 172: NODE *right; ! 173: }in; /* interior node */ ! 174: ! 175: struct { ! 176: int op; ! 177: int rall; ! 178: TWORD type; ! 179: int su; ! 180: int stalign; /* alignment of structure objects */ ! 181: #ifndef FLEXNAMES ! 182: char name[NCHNAM]; ! 183: #else ! 184: char *name; ! 185: #endif ! 186: CONSZ lval; ! 187: int rval; ! 188: }tn; /* terminal node */ ! 189: ! 190: struct { ! 191: int op, rall; ! 192: TWORD type; ! 193: int su; ! 194: int stalign; /* alignment of structure objects */ ! 195: int label; /* for use with branching */ ! 196: }bn; /* branch node */ ! 197: ! 198: struct { ! 199: int op, rall; ! 200: TWORD type; ! 201: int su; ! 202: int stalign; /* alignment of structure objects */ ! 203: int stsize; /* sizes of structure objects */ ! 204: }stn; /* structure node */ ! 205: ! 206: }; ! 207: #endif ! 208: ! 209: extern NODE node[]; ! 210: ! 211: extern struct optab { ! 212: int op; ! 213: int visit; ! 214: int lshape; ! 215: int ltype; ! 216: int rshape; ! 217: int rtype; ! 218: int needs; ! 219: int rewrite; ! 220: char * cstring; ! 221: } ! 222: table[]; ! 223: ! 224: extern NODE resc[]; ! 225: ! 226: extern OFFSZ tmpoff; ! 227: extern OFFSZ maxoff; ! 228: extern OFFSZ baseoff; ! 229: extern OFFSZ maxtemp; ! 230: extern int maxtreg; ! 231: extern int ftnno; ! 232: extern int rtyflg; ! 233: ! 234: extern int nrecur; /* flag to keep track of recursions */ ! 235: ! 236: # define NRECUR (10*TREESZ) ! 237: ! 238: extern NODE ! 239: *talloc(), ! 240: *eread(), ! 241: *tcopy(), ! 242: *getlr(); ! 243: ! 244: extern CONSZ rdin(); ! 245: ! 246: extern int eprint(); ! 247: ! 248: extern char *rnames[]; ! 249: ! 250: extern int lineno; ! 251: extern char filename[]; ! 252: extern int fldshf, fldsz; ! 253: extern int lflag, xdebug, udebug, edebug, odebug, rdebug, radebug, tdebug, sdebug; ! 254: ! 255: #ifndef callchk ! 256: #define callchk(x) allchk() ! 257: #endif ! 258: ! 259: #ifndef PUTCHAR ! 260: # define PUTCHAR(x) putchar(x) ! 261: #endif ! 262: ! 263: /* macros for doing double indexing */ ! 264: # define R2PACK(x,y,z) (0200*((x)+1)+y+040000*z) ! 265: # define R2UPK1(x) ((((x)>>7)-1)&0177) ! 266: # define R2UPK2(x) ((x)&0177) ! 267: # define R2UPK3(x) (x>>14) ! 268: # define R2TEST(x) ((x)>=0200) ! 269: ! 270: # ifdef MULTILEVEL ! 271: ! 272: union mltemplate{ ! 273: struct ml_head{ ! 274: int tag; /* identifies class of tree */ ! 275: int subtag; /* subclass of tree */ ! 276: union mltemplate * nexthead; /* linked by mlinit() */ ! 277: } mlhead; ! 278: struct ml_node{ ! 279: int op; /* either an operator or op description */ ! 280: int nshape; /* shape of node */ ! 281: /* both op and nshape must match the node. ! 282: * where the work is to be done entirely by ! 283: * op, nshape can be SANY, visa versa, op can ! 284: * be OPANY. ! 285: */ ! 286: int ntype; /* type descriptor from mfile2 */ ! 287: } mlnode; ! 288: }; ! 289: ! 290: # endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.