8 extern Target T_amd64_sysv
;
16 { "amd64_sysv", &T_amd64_sysv
},
17 { "arm64", &T_arm64
},
28 ['P'] = 0, /* parsing */
29 ['M'] = 0, /* memory optimization */
30 ['N'] = 0, /* ssa construction */
31 ['C'] = 0, /* copy elimination */
32 ['F'] = 0, /* constant folding */
33 ['A'] = 0, /* abi lowering */
34 ['I'] = 0, /* instruction selection */
35 ['L'] = 0, /* liveness */
36 ['S'] = 0, /* spilling */
37 ['R'] = 0, /* reg. allocation */
48 if (d
->type
== DEnd
) {
49 fputs("/* end data */\n\n", outf
);
61 fprintf(stderr
, "**** Function %s ****", fn
->name
);
63 fprintf(stderr
, "\n> After parsing:\n");
95 assert(fn
->rpo
[0] == fn
->start
);
97 if (n
== fn
->nblk
-1) {
101 fn
->rpo
[n
]->link
= fn
->rpo
[n
+1];
104 fprintf(outf
, "/* end function %s */\n\n", fn
->name
);
106 fprintf(stderr
, "\n");
111 main(int ac
, char *av
[])
121 while ((c
= getopt(ac
, av
, "hd:o:G:t:")) != -1)
124 for (; *optarg
; optarg
++)
125 if (isalpha(*optarg
)) {
126 debug
[toupper(*optarg
)] = 1;
131 if (strcmp(optarg
, "-") != 0) {
132 outf
= fopen(optarg
, "w");
134 fprintf(stderr
, "cannot open '%s'\n", optarg
);
140 for (tm
=tmap
;; tm
++) {
142 fprintf(stderr
, "unknown target '%s'\n", optarg
);
145 if (strcmp(optarg
, tm
->name
) == 0) {
152 if (strcmp(optarg
, "e") == 0)
154 else if (strcmp(optarg
, "m") == 0)
157 fprintf(stderr
, "unknown gas flavor '%s'\n", optarg
);
163 hf
= c
!= 'h' ? stderr
: stdout
;
164 fprintf(hf
, "%s [OPTIONS] {file.ssa, -}\n", av
[0]);
165 fprintf(hf
, "\t%-11s prints this help\n", "-h");
166 fprintf(hf
, "\t%-11s output to file\n", "-o file");
167 fprintf(hf
, "\t%-11s generate for a target among:\n", "-t <target>");
168 fprintf(hf
, "\t%-11s ", "");
169 for (tm
=tmap
, sep
=""; tm
->name
; tm
++, sep
=", ")
170 fprintf(hf
, "%s%s", sep
, tm
->name
);
172 fprintf(hf
, "\t%-11s generate gas (e) or osx (m) asm\n", "-G {e,m}");
173 fprintf(hf
, "\t%-11s dump debug information\n", "-d <flags>");
190 if (!f
|| strcmp(f
, "-") == 0) {
196 fprintf(stderr
, "cannot open '%s'\n", f
);
200 parse(inf
, f
, data
, func
);
201 } while (++optind
< ac
);
205 if (asmmode
== Gaself
)
206 fprintf(outf
, ".section .note.GNU-stack,\"\",@progbits\n");