Annotation of 3BSD/cmd/mip/mfile2, revision 1.1.1.1

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 filename ftitle
                     16: # define getlab get2lab
                     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: # define STARNM 02000
                     64: # define STARREG 04000
                     65: # define SWADD 040000
                     66: # define SPECIAL 0100000
                     67: # define SZERO SPECIAL
                     68: # define SONE (SPECIAL|1)
                     69: # define SMONE (SPECIAL|2)
                     70: # define SCCON (SPECIAL|3)     /* -256 <= constant < 256 */
                     71: # define SSCON (SPECIAL|4)     /* -32768 <= constant < 32768 */
                     72: # define SSOREG (SPECIAL|5)    /* non-indexed OREG */
                     73: 
                     74:        /* FORARG and INTEMP are carefully not conflicting with shapes */
                     75: 
                     76:        /* types */
                     77: 
                     78: # define TCHAR 01
                     79: # define TSHORT 02
                     80: # define TINT 04
                     81: # define TLONG 010
                     82: # define TFLOAT 020
                     83: # define TDOUBLE 040
                     84: # define TPOINT 0100
                     85: # define TUCHAR 0200
                     86: # define TUSHORT 0400
                     87: # define TUNSIGNED 01000
                     88: # define TULONG 02000
                     89: # define TPTRTO 04000  /* pointer to one of the above */
                     90: # define TANY 010000  /* matches anything within reason */
                     91: # define TSTRUCT 020000   /* structure or union */
                     92: 
                     93:        /* reclamation cookies */
                     94: 
                     95: # define RNULL 0    /* clobber result */
                     96: # define RLEFT 01
                     97: # define RRIGHT 02
                     98: # define RESC1 04
                     99: # define RESC2 010
                    100: # define RESC3 020
                    101: # define RESCC 04000
                    102: # define RNOP 010000   /* DANGER: can cause loops.. */
                    103: 
                    104:        /* needs */
                    105: 
                    106: # define NAREG 01
                    107: # define NACOUNT 03
                    108: # define NAMASK 017
                    109: # define NASL 04  /* share left register */
                    110: # define NASR 010 /* share right register */
                    111: # define NBREG 020
                    112: # define NBCOUNT 060
                    113: # define NBMASK 0360
                    114: # define NBSL 0100
                    115: # define NBSR 0200
                    116: # define NTEMP 0400
                    117: # define NTMASK 07400
                    118: # define REWRITE 010000
                    119: 
                    120: 
                    121: # define MUSTDO 010000   /* force register requirements */
                    122: # define NOPREF 020000  /* no preference for register assignment */
                    123: 
                    124: 
                    125:        /* register allocation */
                    126: 
                    127: extern int rstatus[];
                    128: extern int busy[];
                    129: 
                    130: extern struct respref { int cform; int mform; } respref[];
                    131: 
                    132: # define isbreg(r) (rstatus[r]&SBREG)
                    133: # define istreg(r) (rstatus[r]&(STBREG|STAREG))
                    134: # define istnode(p) (p->op==REG && istreg(p->rval))
                    135: 
                    136: # define TBUSY 01000
                    137: # define REGLOOP(i) for(i=0;i<REGSZ;++i)
                    138: 
                    139: # define SETSTO(x,y) (stotree=(x),stocook=(y))
                    140: extern int stocook;
                    141: # define DELAYS 20
                    142: extern NODE *deltrees[DELAYS];
                    143: extern int deli;   /* mmmmm */
                    144: 
                    145: extern NODE *stotree;
                    146: extern int callflag;
                    147: 
                    148: extern int fregs;
                    149: 
                    150: # ifndef ONEPASS
                    151: union ndu {
                    152: 
                    153:        struct {
                    154:                int op;
                    155:                int rall;
                    156:                TWORD type;
                    157:                int su;
                    158:                char name[NCHNAM];
                    159:                NODE *left;
                    160:                NODE *right;
                    161:                };
                    162:        
                    163:        struct {
                    164:                int op;
                    165:                int rall;
                    166:                TWORD type;
                    167:                int su;
                    168:                char name[NCHNAM];
                    169:                CONSZ lval;
                    170:                int rval;
                    171:                };
                    172:        
                    173:        struct {
                    174:                int op, rall;
                    175:                TWORD type;
                    176:                int su;
                    177:                int label;  /* for use with branching */
                    178:                };
                    179: 
                    180:        struct {
                    181:                int op, rall;
                    182:                TWORD type;
                    183:                int su;
                    184:                int stsize;  /* sizes of structure objects */
                    185:                int stalign;  /* alignment of structure objects */
                    186:                };
                    187: 
                    188:        };
                    189: #endif
                    190: 
                    191: extern NODE node[];
                    192: 
                    193: extern struct optab {
                    194:        int op;
                    195:        int visit;
                    196:        int lshape;
                    197:        int ltype;
                    198:        int rshape;
                    199:        int rtype;
                    200:        int needs;
                    201:        int rewrite;
                    202:        char * cstring;
                    203:        }
                    204:        table[];
                    205: 
                    206: extern NODE resc[];
                    207: 
                    208: extern OFFSZ tmpoff;
                    209: extern OFFSZ maxoff;
                    210: extern OFFSZ baseoff;
                    211: extern OFFSZ maxtemp;
                    212: extern int maxtreg;
                    213: extern int ftnno;
                    214: 
                    215: extern int nrecur;  /* flag to keep track of recursions */
                    216: 
                    217: # define NRECUR (10*TREESZ)
                    218: 
                    219: extern NODE
                    220:        *talloc(),
                    221:        *eread(),
                    222:        *tcopy(),
                    223:        *getlr();
                    224: 
                    225: extern CONSZ rdin();
                    226: 
                    227: extern int eprint();
                    228: 
                    229: extern char *rnames[];
                    230: 
                    231: extern int lineno;
                    232: extern char filename[];
                    233: extern int fldshf, fldsz;
                    234: extern int lflag, xdebug, udebug, edebug, odebug, rdebug, radebug, tdebug, sdebug;
                    235: 
                    236: #ifndef callchk
                    237: #define callchk(x) allchk()
                    238: #endif
                    239: 
                    240: #ifndef PUTCHAR
                    241: # define PUTCHAR(x) putchar(x)
                    242: #endif
                    243: 
                    244:        /* macros for doing double indexing */
                    245: # define R2PACK(x,y,z) (0200*((x)+1)+y+040000*z)
                    246: # define R2UPK1(x) ((((x)>>7)-1)&0177)
                    247: # define R2UPK2(x) ((x)&0177)
                    248: # define R2UPK3(x) (x>>14)
                    249: # define R2TEST(x) ((x)>=0200)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.