Annotation of coherent/b/bin/c/n1/reg0.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * This file contains the
        !             3:  * machine independent parts of register
        !             4:  * allocation. Most has to do with
        !             5:  * extracting information from the register
        !             6:  * tables.
        !             7:  */
        !             8: #ifdef   vax
        !             9: #include "INC$LIB:cc1.h"
        !            10: #else
        !            11: #include "cc1.h"
        !            12: #endif
        !            13: 
        !            14: /*
        !            15:  * Get the name of the
        !            16:  * high order half of a register pair.
        !            17:  */
        !            18: hihalf(r)
        !            19: {
        !            20:        return (reg[r].r_hihalf);
        !            21: }
        !            22: 
        !            23: /*
        !            24:  * Get the name of the
        !            25:  * low half of a register pair.
        !            26:  */
        !            27: lohalf(r)
        !            28: {
        !            29:        return (reg[r].r_lohalf);
        !            30: }
        !            31: 
        !            32: /*
        !            33:  * Get the name of the register
        !            34:  * pair that encloses the specified
        !            35:  * register.
        !            36:  */
        !            37: enpair(r)
        !            38: {
        !            39:        return (reg[r].r_enpair);
        !            40: }
        !            41: 
        !            42: /*
        !            43:  * Check if a register is busy by
        !            44:  * looking to see if any bits are set in
        !            45:  * the busy mask.
        !            46:  */
        !            47: isbusy(r)
        !            48: {
        !            49:        if ((reg[r].r_phys&curbusy) != 0)
        !            50:                return (1);
        !            51:        return (0);
        !            52: }
        !            53: 
        !            54: /*
        !            55:  * Turn on the busy bits for register
        !            56:  * `r' in the busy mask.
        !            57:  */
        !            58: setbusy(r)
        !            59: {
        !            60:        curbusy |= reg[r].r_phys;
        !            61: }
        !            62: 
        !            63: /*
        !            64:  * Turn off the busy bits for register
        !            65:  * `r' in the busy mask.
        !            66:  */
        !            67: clrbusy(r)
        !            68: {
        !            69:        curbusy &= ~reg[r].r_phys;
        !            70: }
        !            71: 
        !            72: /*
        !            73:  * Allocate a register. The
        !            74:  * register will be able to hold the
        !            75:  * result type of tree `tp'.
        !            76:  * Registers in the `used' set will
        !            77:  * be avoided.
        !            78:  * Flag = 0 means rvalue temp.
        !            79:  * Flag = 1 means offset temp.
        !            80:  * Flag = 2 means index  temp.
        !            81:  * The register name is returned. A
        !            82:  * -1 is returned if no register is
        !            83:  * available.
        !            84:  */
        !            85: rallo(tp, used, flag)
        !            86: TREE *tp;
        !            87: register PREGSET used;
        !            88: {
        !            89:        register REGDESC *rp;
        !            90:        register KIND kind;
        !            91: 
        !            92:        kind  = pertype[tp->t_type].p_kind;
        !            93:        used |= curbusy;
        !            94:        if (flag != 2)
        !            95:                used |= curxreg;
        !            96:        rp = &reg[NRREG];
        !            97:        while (--rp >= &reg[FRREG]) {
        !            98:                if ((rp->r_phys&used) != 0)
        !            99:                        continue;
        !           100:                if (flag == 0) {
        !           101:                        if ((rp->r_rvalue&kind) == 0)
        !           102:                                continue;
        !           103:                } else {
        !           104:                        if ((rp->r_lvalue&kind) == 0)
        !           105:                                continue;
        !           106:                }
        !           107:                return (rp - &reg[0]);
        !           108:        }
        !           109:        return (-1);
        !           110: }
        !           111: 
        !           112: /*
        !           113:  * This routine figures out the
        !           114:  * register name that gets passed down to
        !           115:  * a subordinate. The first argument `s'
        !           116:  * is a selector. The second is the current
        !           117:  * temp. 
        !           118:  */
        !           119: reguse(selreg, tmpreg)
        !           120: register selreg;
        !           121: register tmpreg;
        !           122: {
        !           123:        if (selreg == TEMP)
        !           124:                selreg = tmpreg;
        !           125:        else if (selreg == LOTEMP)
        !           126:                selreg = lohalf(tmpreg);
        !           127:        else if (selreg == HITEMP)
        !           128:                selreg = hihalf(tmpreg);
        !           129:        return (selreg);
        !           130: }

unix.superglobalmegacorp.com

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