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");
92 assert(fn
->rpo
[0] == fn
->start
);
94 if (n
== fn
->nblk
-1) {
98 fn
->rpo
[n
]->link
= fn
->rpo
[n
+1];
101 fprintf(outf
, "/* end function %s */\n\n", fn
->name
);
103 fprintf(stderr
, "\n");
108 main(int ac
, char *av
[])
118 while ((c
= getopt(ac
, av
, "hd:o:G:t:")) != -1)
121 for (; *optarg
; optarg
++)
122 if (isalpha(*optarg
)) {
123 debug
[toupper(*optarg
)] = 1;
128 if (strcmp(optarg
, "-") != 0)
129 outf
= fopen(optarg
, "w");
132 for (tm
=tmap
;; tm
++) {
134 fprintf(stderr
, "unknown target '%s'\n", optarg
);
137 if (strcmp(optarg
, tm
->name
) == 0) {
144 if (strcmp(optarg
, "e") == 0)
146 else if (strcmp(optarg
, "m") == 0)
149 fprintf(stderr
, "unknown gas flavor '%s'\n", optarg
);
155 hf
= c
!= 'h' ? stderr
: stdout
;
156 fprintf(hf
, "%s [OPTIONS] {file.ssa, -}\n", av
[0]);
157 fprintf(hf
, "\t%-11s prints this help\n", "-h");
158 fprintf(hf
, "\t%-11s output to file\n", "-o file");
159 fprintf(hf
, "\t%-11s generate for a target among:\n", "-t <target>");
160 fprintf(hf
, "\t%-11s ", "");
161 for (tm
=tmap
, sep
=""; tm
->name
; tm
++, sep
=", ")
162 fprintf(hf
, "%s%s", sep
, tm
->name
);
164 fprintf(hf
, "\t%-11s generate gas (e) or osx (m) asm\n", "-G {e,m}");
165 fprintf(hf
, "\t%-11s dump debug information\n", "-d <flags>");
182 if (!f
|| strcmp(f
, "-") == 0) {
188 fprintf(stderr
, "cannot open '%s'\n", f
);
192 parse(inf
, f
, data
, func
);
193 } while (++optind
< ac
);