12 ['P'] = 0, /* parsing */
13 ['A'] = 0, /* abi lowering */
14 ['I'] = 0, /* instruction selection */
15 ['L'] = 0, /* liveness */
16 ['M'] = 0, /* memory optimization */
17 ['N'] = 0, /* ssa construction */
18 ['C'] = 0, /* copy elimination */
19 ['F'] = 0, /* constant folding */
20 ['S'] = 0, /* spilling */
21 ['R'] = 0, /* reg. allocation */
32 if (d
->type
== DEnd
) {
33 fputs("/* end data */\n\n", outf
);
45 fprintf(stderr
, "**** Function %s ****", fn
->name
);
47 fprintf(stderr
, "\n> After parsing:\n");
78 assert(fn
->rpo
[0] == fn
->start
);
80 if (n
== fn
->nblk
-1) {
84 fn
->rpo
[n
]->link
= fn
->rpo
[n
+1];
87 fprintf(outf
, "/* end function %s */\n\n", fn
->name
);
89 fprintf(stderr
, "\n");
94 main(int ac
, char *av
[])
102 while ((c
= getopt(ac
, av
, "hd:o:G:")) != -1)
105 for (; *optarg
; optarg
++)
106 if (isalpha(*optarg
)) {
107 debug
[toupper(*optarg
)] = 1;
112 if (strcmp(optarg
, "-") != 0)
113 outf
= fopen(optarg
, "w");
116 if (strcmp(optarg
, "e") == 0)
118 else if (strcmp(optarg
, "m") == 0)
121 fprintf(stderr
, "unknown gas flavor '%s'\n", optarg
);
127 fprintf(stderr
, "%s [OPTIONS] {file.ssa, -}\n", av
[0]);
128 fprintf(stderr
, "\t%-10s prints this help\n", "-h");
129 fprintf(stderr
, "\t%-10s output to file\n", "-o file");
130 fprintf(stderr
, "\t%-10s generate gas (e) or osx (m) asm\n", "-G {e,m}");
131 fprintf(stderr
, "\t%-10s dump debug information\n", "-d <flags>");
148 if (!f
|| strcmp(f
, "-") == 0) {
154 fprintf(stderr
, "cannot open '%s'\n", f
);
158 parse(inf
, f
, data
, func
);
159 } while (++optind
< ac
);