Annotation of researchv10no/cmd/ideal/bldds.c, revision 1.1

1.1     ! root        1: /* BuiLD Data Structures */
        !             2: 
        !             3: #include "ideal.h"
        !             4: #include "y.tab.h"
        !             5: 
        !             6: NOADPTR rbuildnoadtree (corrputnode)
        !             7: PUTPTR corrputnode;
        !             8: {
        !             9:        NOADPTR nuroot, putsons, boxsons;
        !            10:        dprintf "building noad tree for %s\n", idprint (corrputnode->name));
        !            11:        nuroot = noadgen (
        !            12:                        corrputnode,
        !            13:                        buildvarlist (corrputnode->parm->stmtlist),
        !            14:                        buildvarlist ((findbox (corrputnode->parm->name,FALSE))->stmtlist)
        !            15:                );
        !            16:        putsons = walkputlist (corrputnode->parm->stmtlist, nuroot);
        !            17:        boxsons = walkputlist ((findbox (corrputnode->parm->name,FALSE))->stmtlist, nuroot);
        !            18:        if (putsons == NULL) {
        !            19:                nuroot->son = boxsons;
        !            20:        } else {
        !            21:                NOADPTR temp;
        !            22:                for (temp = putsons;
        !            23:                        temp->brother != NULL;
        !            24:                        temp = temp->brother)
        !            25:                        ;
        !            26:                temp->brother = boxsons;
        !            27:                nuroot->son = putsons;
        !            28:        }
        !            29:        return (nuroot);
        !            30: }
        !            31: 
        !            32: NOADPTR buildnoadtree (corrputnode)
        !            33: PUTPTR corrputnode;
        !            34: {
        !            35:        NOADPTR retval;
        !            36:        if (when_bug & 02) bug_on;
        !            37:        retval = rbuildnoadtree (corrputnode);
        !            38:        bug_off;
        !            39:        return (retval);
        !            40: }
        !            41: 
        !            42: VARPTR buildvarlist (stmtlist)
        !            43: STMTPTR stmtlist;
        !            44: {
        !            45:        VARPTR curlist;
        !            46:        NAMEPTR namewalk;
        !            47:        curlist = NULL;
        !            48:        stmtlist = nextstmt (VAR, stmtlist);
        !            49:        while (stmtlist) {
        !            50:                /* make room for each local variable, and
        !            51:                /* make each independent (x = 1*x) */
        !            52:                for (namewalk = ((NAMEPTR) stmtlist->stmt);
        !            53:                        namewalk;
        !            54:                        namewalk = namewalk->next) {
        !            55:                        VARPTR newre, newim;
        !            56:                        newre = vargen (namewalk->name, TRUE, (DEPPTR) NULL);
        !            57:                        newre->deplist = depgen (newre, 1.0);
        !            58:                        newim = vargen (namewalk->name, FALSE, (DEPPTR) NULL);
        !            59:                        newim->deplist = depgen (newim, 1.0);
        !            60:                        newre->next = newim;
        !            61:                        newim->next = curlist;
        !            62:                        curlist = newre;
        !            63:                }
        !            64:                stmtlist = nextstmt (VAR, stmtlist->next);
        !            65:        }
        !            66:        return (curlist);
        !            67: }
        !            68: 
        !            69: NOADPTR walkputlist (stmtlist, parent)
        !            70: STMTPTR stmtlist;
        !            71: NOADPTR parent;
        !            72: {
        !            73:        NOADPTR headnoad, curnoad, prevnoad;
        !            74:        stmtlist = nextstmt (PUT, stmtlist);
        !            75:        if (!stmtlist)
        !            76:                return (NULL);
        !            77:        headnoad = prevnoad = rbuildnoadtree ((PUTPTR) stmtlist->stmt);
        !            78:        prevnoad->father = parent;
        !            79:        stmtlist = nextstmt (PUT, stmtlist->next);
        !            80:        while (stmtlist) {
        !            81:                curnoad = rbuildnoadtree ((PUTPTR) stmtlist->stmt);
        !            82:                curnoad->father = parent;
        !            83:                prevnoad->brother = curnoad;
        !            84:                prevnoad = curnoad;
        !            85:                stmtlist = nextstmt (PUT, stmtlist->next);
        !            86:        }
        !            87:        return (headnoad);
        !            88: }

unix.superglobalmegacorp.com

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