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