- {
- if (strcmp (argv[i], OPTION_HELP) == 0)
- {
- printUsage ();
- exit (0);
- }
-
- if (strcmp (argv[i], OPTION_STACK_8BIT) == 0)
- {
- options.stack10bit = 0;
- continue;
- }
-
- if (strcmp (argv[i], OPTION_OUT_FMT_IHX) == 0)
- {
- options.out_fmt = 0;
- continue;
- }
-
- if (strcmp (argv[i], OPTION_LARGE_MODEL) == 0)
- {
- _setModel (MODEL_LARGE, argv[i]);
- continue;
- }
-
- if (strcmp (argv[i], OPTION_MEDIUM_MODEL) == 0)
- {
- _setModel (MODEL_MEDIUM, argv[i]);
- continue;
- }
-
- if (strcmp (argv[i], OPTION_SMALL_MODEL) == 0)
- {
- _setModel (MODEL_SMALL, argv[i]);
- continue;
- }
-
- if (strcmp (argv[i], OPTION_FLAT24_MODEL) == 0)
- {
- _setModel (MODEL_FLAT24, argv[i]);
- continue;
- }
-
- if (strcmp (argv[i], OPTION_DUMP_ALL) == 0)
- {
- options.dump_rassgn =
- options.dump_pack =
- options.dump_range =
- options.dump_kill =
- options.dump_loop =
- options.dump_gcse =
- options.dump_raw = 1;
- continue;
- }
-
- if (strcmp (argv[i], OPTION_PEEP_FILE) == 0)
- {
- options.peep_file = getStringArg(OPTION_PEEP_FILE, argv, &i, argc);
- continue;
- }
-
- if (strcmp (argv[i], OPTION_LIB_PATH) == 0)
- {
- addSet(&libPathsSet, Safe_strdup(getStringArg(OPTION_LIB_PATH, argv, &i, argc)));
- continue;
- }
-
- if (strcmp (argv[i], OPTION_VERSION) == 0)
- {
- printVersionInfo ();
- exit (0);
- continue;
- }
-
- if (strcmp (argv[i], OPTION_CALLEE_SAVES) == 0)
- {
- setParseWithComma(&options.calleeSavesSet, getStringArg(OPTION_CALLEE_SAVES, argv, &i, argc));
- continue;
- }
-
- if (strcmp (argv[i], OPTION_XSTACK_LOC) == 0)
- {
- options.xstack_loc = getIntArg(OPTION_XSTACK_LOC, argv, &i, argc);
- continue;
- }
-
- if (strcmp (argv[i], OPTION_STACK_LOC) == 0)
- {
- options.stack_loc = getIntArg(OPTION_STACK_LOC, argv, &i, argc);
- continue;
- }
-
- if (strcmp (argv[i], OPTION_XRAM_LOC) == 0)
- {
- options.xdata_loc = getIntArg(OPTION_XRAM_LOC, argv, &i, argc);
- continue;
- }
-
- if (strcmp (argv[i], OPTION_IRAM_SIZE) == 0)
- {
- options.iram_size = getIntArg(OPTION_IRAM_SIZE, argv, &i, argc);
- continue;
- }
-
- if (strcmp (argv[i], OPTION_XRAM_SIZE) == 0)
- {
- options.xram_size = getIntArg(OPTION_IRAM_SIZE, argv, &i, argc);
- options.xram_size_set = TRUE;
- continue;
- }
-
- if (strcmp (argv[i], OPTION_CODE_SIZE) == 0)
- {
- options.code_size = getIntArg(OPTION_IRAM_SIZE, argv, &i, argc);
- continue;
- }
-
- if (strcmp (argv[i], OPTION_DATA_LOC) == 0)
- {
- options.data_loc = getIntArg(OPTION_DATA_LOC, argv, &i, argc);
- continue;
- }
-
- if (strcmp (argv[i], OPTION_IDATA_LOC) == 0)
- {
- options.idata_loc = getIntArg(OPTION_IDATA_LOC, argv, &i, argc);
- continue;
- }
-
- if (strcmp (argv[i], OPTION_CODE_LOC) == 0)
- {
- options.code_loc = getIntArg(OPTION_CODE_LOC, argv, &i, argc);
- continue;
- }
-
- if (strcmp (argv[i], OPTION_NO_GCSE) == 0)
- {
- optimize.global_cse = 0;
- continue;
- }
-
- if (strcmp (argv[i], OPTION_NO_LOOP_INV) == 0)
- {
- optimize.loopInvariant = 0;
- continue;
- }
-
- if (strcmp (argv[i], OPTION_NO_LABEL_OPT) == 0)
- {
- optimize.label4 = 0;
- continue;
- }
-
- if (strcmp (argv[i], OPTION_NO_LOOP_IND) == 0)
- {
- optimize.loopInduction = 0;
- continue;
- }
-
- if (strcmp (argv[i], OPTION_LESS_PEDANTIC) == 0)
- {
- options.lessPedantic = 1;
+ {
+ if (strcmp (argv[i], OPTION_USE_STDOUT) == 0)
+ {
+ if (options.use_stdout == 0)
+ {
+ options.use_stdout = 1;
+ dup2(STDOUT_FILENO, STDERR_FILENO);
+ }
+ continue;
+ }
+ if (strcmp (argv[i], OPTION_HELP) == 0)
+ {
+ printUsage ();
+ exit (EXIT_SUCCESS);
+ }
+
+ if (strcmp (argv[i], OPTION_STACK_8BIT) == 0)
+ {
+ options.stack10bit = 0;
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_OUT_FMT_IHX) == 0)
+ {
+ options.out_fmt = 0;
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_OUT_FMT_S19) == 0)
+ {
+ options.out_fmt = 1;
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_LARGE_MODEL) == 0)
+ {
+ _setModel (MODEL_LARGE, argv[i]);
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_MEDIUM_MODEL) == 0)
+ {
+ _setModel (MODEL_MEDIUM, argv[i]);
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_SMALL_MODEL) == 0)
+ {
+ _setModel (MODEL_SMALL, argv[i]);
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_FLAT24_MODEL) == 0)
+ {
+ _setModel (MODEL_FLAT24, argv[i]);
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_DUMP_ALL) == 0)
+ {
+ options.dump_rassgn =
+ options.dump_pack =
+ options.dump_range =
+ options.dump_kill =
+ options.dump_loop =
+ options.dump_gcse =
+ options.dump_raw = 1;
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_PEEP_FILE) == 0)
+ {
+ options.peep_file = getStringArg(OPTION_PEEP_FILE, argv, &i, argc);
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_LIB_PATH) == 0)
+ {
+ addSet(&libPathsSet, Safe_strdup(getStringArg(OPTION_LIB_PATH, argv, &i, argc)));
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_VERSION) == 0)
+ {
+ printVersionInfo (stdout);
+ exit (EXIT_SUCCESS);
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_CALLEE_SAVES) == 0)
+ {
+ setParseWithComma(&options.calleeSavesSet, getStringArg(OPTION_CALLEE_SAVES, argv, &i, argc));
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_XSTACK_LOC) == 0)
+ {
+ options.xstack_loc = getIntArg(OPTION_XSTACK_LOC, argv, &i, argc);
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_STACK_LOC) == 0)
+ {
+ options.stack_loc = getIntArg(OPTION_STACK_LOC, argv, &i, argc);
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_STACK_SIZE) == 0)
+ {
+ options.stack_size = getIntArg(OPTION_STACK_SIZE, argv, &i, argc);
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_XRAM_LOC) == 0)
+ {
+ options.xdata_loc = getIntArg(OPTION_XRAM_LOC, argv, &i, argc);
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_IRAM_SIZE) == 0)
+ {
+ options.iram_size = getIntArg(OPTION_IRAM_SIZE, argv, &i, argc);
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_XRAM_SIZE) == 0)
+ {
+ options.xram_size = getIntArg(OPTION_XRAM_SIZE, argv, &i, argc);
+ options.xram_size_set = TRUE;
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_CODE_SIZE) == 0)
+ {
+ options.code_size = getIntArg(OPTION_CODE_SIZE, argv, &i, argc);
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_DATA_LOC) == 0)
+ {
+ options.data_loc = getIntArg(OPTION_DATA_LOC, argv, &i, argc);
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_IDATA_LOC) == 0)
+ {
+ options.idata_loc = getIntArg(OPTION_IDATA_LOC, argv, &i, argc);
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_CODE_LOC) == 0)
+ {
+ options.code_loc = getIntArg(OPTION_CODE_LOC, argv, &i, argc);
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_NO_GCSE) == 0)
+ {
+ optimize.global_cse = 0;
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_NO_LOOP_INV) == 0)
+ {
+ optimize.loopInvariant = 0;
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_NO_LABEL_OPT) == 0)
+ {
+ optimize.label4 = 0;
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_NO_LOOP_IND) == 0)
+ {
+ optimize.loopInduction = 0;
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_OPT_CODE_SPEED) == 0)
+ {
+ optimize.codeSpeed = 1;
+ optimize.codeSize = 0;
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_OPT_CODE_SIZE) == 0)
+ {
+ optimize.codeSpeed = 0;
+ optimize.codeSize = 1;
+ continue;
+ }
+
+ if (strcmp (argv[i], OPTION_LESS_PEDANTIC) == 0)
+ {
+ options.lessPedantic = 1;