structure() { VERT v, *head; if (progress) fprintf(stderr," getreach:\n"); getreach(); if (routerr) return; if (progress) fprintf(stderr," getflow:\n"); getflow(); if (progress) fprintf(stderr," getthen:\n"); getthen(START); head = challoc(nodenum * sizeof(*head)); for (v = 0; v < nodenum; ++v) head[v] = UNDEFINED; for (v = START; DEFINED(v); v = RSIB(v)) fixhd(v,UNDEFINED,head); /* fixhd must be called before getloop so that it gets applied to IFVX which becomes NXT(w) for UNTVX w */ if (progress) fprintf(stderr," getloop:\n"); getloop(); if (progress) fprintf(stderr," getbranch:\n"); getbranch(head); chfree(head,nodenum * sizeof(*head)); head = 0; }
output() { VERT w; int i; brace = challoc(nodenum * sizeof(*brace)); for (i = 0; i < nodenum; ++i) brace[i] = FALSE; if (progress) fprintf(stderr,"ndbrace:\n"); for (w = START; DEFINED(w); w = RSIB(w)) ndbrace(w); if (progress) fprintf(stderr,"outrat:\n"); for (w = START; DEFINED(w); w = RSIB(w)) outrat(w,0,YESTAB); OUTSTR("END\n"); chfree(brace,nodenum * sizeof(*brace)); brace = 0; }
getreach() /* obtain REACH(v) for each node v */ { VERT v; struct pair *pr; for (v = 0; v < nodenum; ++v) REACH(v) = UNDEFINED; number(START); for (v = START; DEFINED(v); v = RSIB(v)) { pr = exits(v); /* need to free the space for pr */ chfree(pr,sizeof(*pr)); } }