12 void print_help (char *prgname
)
16 " %s [-g] [-n nidsfile] [-v] prxfile\n"
18 " -g output graphviz dot\n"
19 " -t print depth first search number\n"
20 " -r print the reverse depth first search number\n"
21 " -d print the dominator\n"
22 " -x print the reverse dominator\n"
23 " -f print the frontier\n"
24 " -z print the reverse frontier\n"
25 " -p print phi functions\n"
26 " -q print code into nodes\n"
27 " -s print structures\n"
28 " -e print edge types\n"
30 " -v increase verbosity\n"
31 " -n specify nids xml file\n",
36 int main (int argc
, char **argv
)
38 char *prxfilename
= NULL
;
39 char *nidsfilename
= NULL
;
41 int i
, j
, verbosity
= 0;
42 int printgraph
= FALSE
;
44 int printcode
= FALSE
;
46 struct nidstable
*nids
= NULL
;
50 for (i
= 1; i
< argc
; i
++) {
51 if (strcmp ("--help", argv
[i
]) == 0) {
54 } else if (argv
[i
][0] == '-') {
56 for (j
= 0; s
[j
]; j
++) {
58 case 'v': verbosity
++; break;
59 case 'g': printgraph
= TRUE
; break;
60 case 'c': printcode
= TRUE
; break;
61 case 't': graphoptions
|= OUT_PRINT_DFS
; break;
62 case 'r': graphoptions
|= OUT_PRINT_RDFS
; break;
63 case 'd': graphoptions
|= OUT_PRINT_DOMINATOR
; break;
64 case 'x': graphoptions
|= OUT_PRINT_RDOMINATOR
; break;
65 case 'f': graphoptions
|= OUT_PRINT_FRONTIER
; break;
66 case 'z': graphoptions
|= OUT_PRINT_RFRONTIER
; break;
67 case 'p': graphoptions
|= OUT_PRINT_PHIS
; break;
68 case 'q': graphoptions
|= OUT_PRINT_CODE
; break;
69 case 's': graphoptions
|= OUT_PRINT_STRUCTURES
; break;
70 case 'e': graphoptions
|= OUT_PRINT_EDGE_TYPES
; break;
73 fatal (__FILE__
": missing nids file");
75 nidsfilename
= argv
[++i
];
80 prxfilename
= argv
[i
];
90 nids
= nids_load (nidsfilename
);
92 p
= prx_load (prxfilename
);
94 fatal (__FILE__
": can't load prx `%s'", prxfilename
);
97 prx_resolve_nids (p
, nids
);
99 if (verbosity
> 2 && nids
)
102 if (verbosity
> 0) prx_print (p
, (verbosity
> 1));
104 c
= code_analyse (p
);
106 fatal (__FILE__
": can't analyse code `%s'", prxfilename
);
110 print_graph (c
, prxfilename
, graphoptions
);
113 print_code (c
, prxfilename
, verbosity
);