Annotation of coherent/b/bin/c/n1/code.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * C compiler.
                      3:  * Code driver (sel, out)
                      4:  */
                      5: #ifdef   vax
                      6: #include "INC$LIB:cc1.h"
                      7: #else
                      8: #include "cc1.h"
                      9: #endif
                     10: 
                     11: PREGSET        curbusy;
                     12: PREGSET        curxreg;
                     13: PREGSET        maxbusy;
                     14: int    nstorelist;
                     15: TREE   *storelist[NSTORE];
                     16: 
                     17: /*
                     18:  * Generate code for an
                     19:  * expression. The argument `tp' is
                     20:  * a pointer to a marked tree. 
                     21:  * The context is `c'. If `c' is MFLOW
                     22:  * then `r' is a truth sense and `n'
                     23:  * is a label.
                     24:  */
                     25: code(tp, c, s, n)
                     26: TREE *tp;
                     27: register s;
                     28: {
                     29:        register TREE *ap;
                     30: 
                     31:        ap = tp;
                     32:        walk(ap, amd);
                     33: #if !TINY
                     34:        if (sflag) snapf("%W%E", "Before select", ap);
                     35: #endif
                     36:        if (c != MFLOW) {
                     37:                s = ANYR;
                     38:                if (c == MSWITCH) {
                     39:                        s = SWREG;
                     40:                        c = MRVALUE;
                     41:                }
                     42:                if (c == MRETURN) {
                     43:                        s = pertype[ap->t_type].p_frreg;
                     44:                        c = pertype[ap->t_type].p_frcxt;
                     45:                }
                     46:        }
                     47:        curtemp = maxauto;
                     48:        curbusy = regbusy;
                     49:        curxreg = 0;
                     50:        nstorelist = 0;
                     51:        if (code1(&tp, c, s) != 0) {
                     52:                ap = tp;
                     53: #if !TINY
                     54:                if (sflag) snapf("%W%E%W", "After select", ap, NULL);
                     55: #endif
                     56:                output(ap, c, s, n);
                     57:        } else
                     58:                nomatch(tp);
                     59: }
                     60: 
                     61: nomatch(tp)
                     62: TREE *tp;
                     63: {
                     64: #if !TINY
                     65:        snapf("%W%E%W", "No match", tp, NULL);
                     66:        if (! sflag)
                     67: #endif
                     68:        cbotch("no match, op=%d", tp->t_op);
                     69: }
                     70: 
                     71: /*
                     72:  * Select the node pointed to by tpp
                     73:  * and any stores generated by its selection.
                     74:  * Prepend the store nodes onto tpp with
                     75:  * COMMA's and store the result node into tpp.
                     76:  * This routine makes side effects happen
                     77:  * in the right places.
                     78:  * A failure to select is fatal.
                     79:  */
                     80: code1(tpp, c, r)
                     81: TREE **tpp;
                     82: {
                     83:        register TREE   *ap;
                     84:        int     match;
                     85:        PREGSET savbusy;
                     86:        PREGSET savxreg;
                     87:        int     savstor;
                     88: 
                     89:        ap = *tpp;
                     90:        match = 1;
                     91:        savbusy = curbusy;
                     92:        savxreg = curxreg;
                     93:        savstor = nstorelist;
                     94: 
                     95: #if !TINY
                     96:        if (sflag > 1) snapf("%W%E", "Before code1", ap);
                     97: #endif
                     98:        if (select(ap, c, r) == 0) {
                     99:                /* nomatch(ap); */
                    100:                match = 0;
                    101:        }
                    102: 
                    103:        if (savstor < nstorelist) {
                    104:                register int i;
                    105:                PREGSET used;
                    106:                REGNAME rreg;
                    107:                int     type;
                    108:                int     size;
                    109: 
                    110:                used = ap->t_used;
                    111:                rreg = ap->t_rreg;
                    112:                type = ap->t_type;
                    113:                size = ap->t_size;
                    114:                for (i = savstor; i < nstorelist; i += 1) {
                    115:                        curbusy = savbusy;
                    116:                        curxreg = 0;
                    117:                        ap = storelist[i];
                    118:                        if (select(ap, MEFFECT, ANYR) == 0) {
                    119:                                /* nomatch(ap); */
                    120:                                match = 0;
                    121:                        }
                    122: #if !TINY
                    123:                        if (sflag > 2)
                    124:                                snapf("%W%E%W", "Stored node", ap, NULL);
                    125: #endif
                    126:                        used |= ap->t_used;
                    127:                        ap = leftnode(COMMA, ap, type, size);
                    128:                        ap->t_used = used;
                    129:                        ap->t_rreg = rreg;
                    130:                        ap->t_rp = *tpp;
                    131:                        *tpp = ap;
                    132:                }
                    133:        }
                    134:        if (curtemp > maxtemp)
                    135:                maxtemp = curtemp;
                    136:        maxbusy |= ap->t_used;
                    137:        curbusy = savbusy;
                    138:        curxreg = savxreg;
                    139:        nstorelist = savstor;
                    140:        return (match);
                    141: }
                    142: 
                    143: 

unix.superglobalmegacorp.com

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