8 extern Target T_amd64_sysv
;
15 { "amd64_sysv", &T_amd64_sysv
},
16 { "arm64", &T_arm64
},
26 ['P'] = 0, /* parsing */
27 ['A'] = 0, /* abi lowering */
28 ['I'] = 0, /* instruction selection */
29 ['L'] = 0, /* liveness */
30 ['M'] = 0, /* memory optimization */
31 ['N'] = 0, /* ssa construction */
32 ['C'] = 0, /* copy elimination */
33 ['F'] = 0, /* constant folding */
34 ['S'] = 0, /* spilling */
35 ['R'] = 0, /* reg. allocation */
46 if (d
->type
== DEnd
) {
47 fputs("/* end data */\n\n", outf
);
59 fprintf(stderr
, "**** Function %s ****", fn
->name
);
61 fprintf(stderr
, "\n> After parsing:\n");
93 assert(fn
->rpo
[0] == fn
->start
);
95 if (n
== fn
->nblk
-1) {
99 fn
->rpo
[n
]->link
= fn
->rpo
[n
+1];
102 fprintf(outf
, "/* end function %s */\n\n", fn
->name
);
104 fprintf(stderr
, "\n");
109 main(int ac
, char *av
[])
119 while ((c
= getopt(ac
, av
, "hd:o:G:t:")) != -1)
122 for (; *optarg
; optarg
++)
123 if (isalpha(*optarg
)) {
124 debug
[toupper(*optarg
)] = 1;
129 if (strcmp(optarg
, "-") != 0)
130 outf
= fopen(optarg
, "w");
133 for (tm
=tmap
;; tm
++) {
135 fprintf(stderr
, "unknown target '%s'\n", optarg
);
138 if (strcmp(optarg
, tm
->name
) == 0) {
145 if (strcmp(optarg
, "e") == 0)
147 else if (strcmp(optarg
, "m") == 0)
150 fprintf(stderr
, "unknown gas flavor '%s'\n", optarg
);
156 hf
= c
!= 'h' ? stderr
: stdout
;
157 fprintf(hf
, "%s [OPTIONS] {file.ssa, -}\n", av
[0]);
158 fprintf(hf
, "\t%-11s prints this help\n", "-h");
159 fprintf(hf
, "\t%-11s output to file\n", "-o file");
160 fprintf(hf
, "\t%-11s generate for a target among:\n", "-t <target>");
161 fprintf(hf
, "\t%-11s ", "");
162 for (tm
=tmap
, sep
=""; tm
->name
; tm
++, sep
=", ")
163 fprintf(hf
, "%s%s", sep
, tm
->name
);
165 fprintf(hf
, "\t%-11s generate gas (e) or osx (m) asm\n", "-G {e,m}");
166 fprintf(hf
, "\t%-11s dump debug information\n", "-d <flags>");
183 if (!f
|| strcmp(f
, "-") == 0) {
189 fprintf(stderr
, "cannot open '%s'\n", f
);
193 parse(inf
, f
, data
, func
);
194 } while (++optind
< ac
);