1: #ifndef lint
2: static char sccsid[] = "@(#)2.main.c 4.1 (Berkeley) 2/11/83";
3: #endif not lint
4:
5: #include <stdio.h>
6: #include "def.h"
7: #include "2.def.h"
8:
9: VERT *after;
10: int *ntobef, *ntoaft;
11: build()
12: {
13: VERT v, *dom, *head;
14: int type;
15: struct list **inarc;
16: dfs(START);
17: if (routerr) return;
18: for (v = 0; v < nodenum; ++v)
19: {
20: type = NTYPE(v);
21: if (type == LOOPVX || type == DOVX)
22: FATH(ARC(v,0)) = v;
23: }
24:
25: head = challoc(sizeof(*head) * nodenum);
26: if (progress) fprintf(stderr," gethead:\n");
27: gethead(head); /* sets head[v] to ITERVX heading smallest loop containing v or UNDEFINED */
28:
29: if (routerr) return;
30: inarc = challoc(nodenum * sizeof(*inarc));
31: if (progress) fprintf(stderr," getinarc:\n");
32: getinarc(inarc,head); /* sets inarc[v] to list of forward arcs entering v */
33:
34: dom = challoc(nodenum * sizeof(*dom));
35: if (progress) fprintf(stderr," getdom:\n");
36: getdom(inarc,dom); /* sets dom[v] to immediate dominator of v or UNDEFINED */
37: if (routerr) return;
38: if (progress) fprintf(stderr," gettree:\n");
39: gettree(inarc, dom, head);
40: if (routerr) return;
41:
42: chfree(head, nodenum * sizeof(*head)); head = 0;
43: chfree(dom,nodenum * sizeof(*dom)); dom = 0;
44: for (v = 0; v < nodenum; ++v)
45: {
46: freelst(inarc[v]);
47: inarc[v] = 0;
48: }
49: chfree(inarc,sizeof(*inarc) * nodenum); inarc = 0;
50: chfree(ntoaft,sizeof(*ntoaft) * nodenum); ntoaft = 0;
51: chfree(ntobef,sizeof(*ntobef) * nodenum); ntobef = 0;
52: chfree(after, sizeof(*after) * accessnum); after = 0;
53: }
Defined functions
build
defined in line
11; used 1 times
Defined variables
ntoaft
defined in line
10; used 18 times
ntobef
defined in line
10; used 13 times
sccsid
defined in line
2;
never used