- char *endptr;
- long int value = strtol(opt, &endptr, 10);
- if (*endptr != '\0') {
- fprintf(stderr, "error: wrong option '-m %s'\n", opt);
- argument_errors = true;
- }
- if (value != 16 && value != 32 && value != 64) {
- fprintf(stderr, "error: option -m supports only 16, 32 or 64\n");
- argument_errors = true;
- } else {
- machine_size = (unsigned int)value;
- }
- } else if (option[0] == '\0') {
- if(input != NULL) {
- fprintf(stderr, "error: multiple input files specified\n");
- argument_errors = true;
+ if (strstart(opt, "arch=")) {
+ GET_ARG_AFTER(opt, "-march=");
+ snprintf(arch_opt, sizeof(arch_opt), "%s-arch=%s", cpu_arch, opt);
+ int res = firm_be_option(arch_opt);
+ if (res == 0)
+ argument_errors = true;
+ else {
+ snprintf(arch_opt, sizeof(arch_opt), "%s-opt=%s", cpu_arch, opt);
+ int res = firm_be_option(arch_opt);
+ if (res == 0)
+ argument_errors = true;
+ }
+ } else if (strstart(opt, "tune=")) {
+ GET_ARG_AFTER(opt, "-mtune=");
+ snprintf(arch_opt, sizeof(arch_opt), "%s-opt=%s", cpu_arch, opt);
+ int res = firm_be_option(arch_opt);
+ if (res == 0)
+ argument_errors = true;
+ } else if (strstart(opt, "cpu=")) {
+ GET_ARG_AFTER(opt, "-mcpu=");
+ snprintf(arch_opt, sizeof(arch_opt), "%s-arch=%s", cpu_arch, opt);
+ int res = firm_be_option(arch_opt);
+ if (res == 0)
+ argument_errors = true;
+ } else if (strstart(opt, "fpmath=")) {
+ GET_ARG_AFTER(opt, "-mfpmath=");
+ if (streq(opt, "387"))
+ opt = "x87";
+ else if (streq(opt, "sse"))
+ opt = "sse2";
+ else {
+ fprintf(stderr, "error: option -mfpumath supports only 387 or sse\n");
+ argument_errors = true;
+ }
+ if(!argument_errors) {
+ snprintf(arch_opt, sizeof(arch_opt), "%s-fpunit=%s", cpu_arch, opt);
+ int res = firm_be_option(arch_opt);
+ if (res == 0)
+ argument_errors = true;
+ }
+ } else if (strstart(opt, "preferred-stack-boundary=")) {
+ GET_ARG_AFTER(opt, "-mpreferred-stack-boundary=");
+ snprintf(arch_opt, sizeof(arch_opt), "%s-stackalign=%s", cpu_arch, opt);
+ int res = firm_be_option(arch_opt);
+ if (res == 0)
+ argument_errors = true;
+ } else if (streq(opt, "omit-leaf-frame-pointer")) {
+ set_be_option("omitleaffp=1");
+ } else if (streq(opt, "no-omit-leaf-frame-pointer")) {
+ set_be_option("omitleaffp=0");