mrbc.c: add `--no-optimize` option to disable optimization; close
@@ -25,7 +25,8 @@ struct mrbc_args {
mrb_bool verbose : 1;
mrb_bool remove_lv : 1;
mrb_bool no_ext_ops : 1;
- uint8_t flags : 4;
+ mrb_bool no_optimize : 1;
+ uint8_t flags : 2;
};
static void
@@ -42,6 +43,7 @@ usage(const char *name)
"-s define <symbol> as static variable",
"--remove-lv remove local variables",
"--no-ext-ops prohibit using OP_EXTs",
+ "--no-optimize disable peephole optimization",
"--verbose run at verbose mode",
"--version print the version",
"--copyright print the copyright",
@@ -169,6 +171,10 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct mrbc_args *args)
args->no_ext_ops = TRUE;
break;
}
+ else if (strcmp(argv[i] + 2, "no-optimize") == 0) {
+ args->no_optimize = TRUE;
+ break;
+ }
return -1;
default:
return i;
@@ -224,6 +230,7 @@ load_file(mrb_state *mrb, struct mrbc_args *args)
c->dump_result = TRUE;
c->no_exec = TRUE;
c->no_ext_ops = args->no_ext_ops;
+ c->no_optimize = args->no_optimize;
if (input[0] == '-' && input[1] == '\0') {
infile = stdin;
}
