mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-01-24 16:35:40 +08:00
Move optimizer output from '-g' switch to '-Ov' switch
This commit is contained in:
parent
d0e365d523
commit
0efaec964e
48
nasm.c
48
nasm.c
@ -37,7 +37,7 @@ static void register_output_formats(void);
|
|||||||
static void report_error (int severity, const char *fmt, ...);
|
static void report_error (int severity, const char *fmt, ...);
|
||||||
static void usage(void);
|
static void usage(void);
|
||||||
|
|
||||||
static int using_debug_info;
|
static int using_debug_info, opt_verbose_info;
|
||||||
int tasm_compatible_mode = FALSE;
|
int tasm_compatible_mode = FALSE;
|
||||||
int pass0;
|
int pass0;
|
||||||
|
|
||||||
@ -58,11 +58,11 @@ static unsigned long cpu = IF_PLEVEL; /* passed to insn_size & assemble.c */
|
|||||||
int global_offset_changed; /* referenced in labels.c */
|
int global_offset_changed; /* referenced in labels.c */
|
||||||
|
|
||||||
static loc_t location;
|
static loc_t location;
|
||||||
int in_abs_seg; /* Flag we are in ABSOLUTE seg */
|
int in_abs_seg; /* Flag we are in ABSOLUTE seg */
|
||||||
long abs_seg; /* ABSOLUTE segment basis */
|
static long abs_seg;
|
||||||
long abs_offset; /* ABSOLUTE offset */
|
|
||||||
|
|
||||||
static struct RAA *offsets;
|
static struct RAA *offsets;
|
||||||
|
static long abs_offset;
|
||||||
|
|
||||||
static struct SAA *forwrefs; /* keep track of forward references */
|
static struct SAA *forwrefs; /* keep track of forward references */
|
||||||
static struct forwrefinfo *forwref;
|
static struct forwrefinfo *forwref;
|
||||||
@ -388,13 +388,25 @@ static int process_arg (char *p, char *q)
|
|||||||
ofmt->current_dfmt = ofmt->debug_formats[0];
|
ofmt->current_dfmt = ofmt->debug_formats[0];
|
||||||
} else if (p[1]=='O') { /* Optimization level */
|
} else if (p[1]=='O') { /* Optimization level */
|
||||||
int opt;
|
int opt;
|
||||||
if (!isdigit(*param)) report_error(ERR_FATAL,
|
opt = -99;
|
||||||
"command line optimization level must be 0..3 or <nn>");
|
while (*param) {
|
||||||
opt = atoi(param);
|
if (isdigit(*param)) {
|
||||||
if (opt<=0) optimizing = -1; /* 0.98 behaviour */
|
opt = atoi(param);
|
||||||
else if (opt==1) optimizing = 0; /* Two passes, 0.98.09 behavior */
|
while(isdigit(*++param)) ;
|
||||||
else if (opt<=3) optimizing = opt*5; /* Multiple passes */
|
if (opt<=0) optimizing = -1; /* 0.98 behaviour */
|
||||||
else optimizing = opt; /* Multiple passes */
|
else if (opt==1) optimizing = 0; /* Two passes, 0.98.09 behavior */
|
||||||
|
else if (opt<=3) optimizing = opt*5; /* Multiple passes */
|
||||||
|
else optimizing = opt; /* Multiple passes */
|
||||||
|
} else {
|
||||||
|
if (*param == 'v' || *param == '+') {
|
||||||
|
++param;
|
||||||
|
opt_verbose_info = TRUE;
|
||||||
|
opt = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* while (*param) */
|
||||||
|
if (opt == -99) report_error(ERR_FATAL,
|
||||||
|
"command line optimization level must be 'v', 0..3 or <nn>");
|
||||||
} else if (p[1]=='P' || p[1]=='p') { /* pre-include */
|
} else if (p[1]=='P' || p[1]=='p') { /* pre-include */
|
||||||
pp_pre_include (param);
|
pp_pre_include (param);
|
||||||
} else if (p[1]=='D' || p[1]=='d') { /* pre-define */
|
} else if (p[1]=='D' || p[1]=='d') { /* pre-define */
|
||||||
@ -952,15 +964,15 @@ static void assemble_file (char *fname)
|
|||||||
"cannot use non-relocatable expression as "
|
"cannot use non-relocatable expression as "
|
||||||
"ABSOLUTE address");
|
"ABSOLUTE address");
|
||||||
else {
|
else {
|
||||||
abs_seg = reloc_seg(e);
|
abs_seg = reloc_seg(e);
|
||||||
abs_offset = reloc_value(e);
|
abs_offset = reloc_value(e);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (pass==1) abs_offset = 0x100;/* don't go near zero in case of / */
|
if (pass==1) abs_offset = 0x100;/* don't go near zero in case of / */
|
||||||
else report_error (ERR_PANIC, "invalid ABSOLUTE address "
|
else report_error (ERR_PANIC, "invalid ABSOLUTE address "
|
||||||
"in pass two");
|
"in pass two");
|
||||||
in_abs_seg = TRUE;
|
in_abs_seg = TRUE;
|
||||||
location.segment = NO_SEG;
|
location.segment = abs_seg;
|
||||||
break;
|
break;
|
||||||
case 7: /* DEBUG */
|
case 7: /* DEBUG */
|
||||||
p = value;
|
p = value;
|
||||||
@ -1112,9 +1124,9 @@ static void assemble_file (char *fname)
|
|||||||
{
|
{
|
||||||
int isext = output_ins.oprs[0].opflags & OPFLAG_EXTERN;
|
int isext = output_ins.oprs[0].opflags & OPFLAG_EXTERN;
|
||||||
def_label (output_ins.label,
|
def_label (output_ins.label,
|
||||||
output_ins.oprs[0].segment,
|
output_ins.oprs[0].segment,
|
||||||
output_ins.oprs[0].offset,
|
output_ins.oprs[0].offset,
|
||||||
NULL, FALSE, isext, ofmt, report_error);
|
NULL, FALSE, isext, ofmt, report_error);
|
||||||
}
|
}
|
||||||
else if (output_ins.operands == 2 &&
|
else if (output_ins.operands == 2 &&
|
||||||
(output_ins.oprs[0].type & IMMEDIATE) &&
|
(output_ins.oprs[0].type & IMMEDIATE) &&
|
||||||
@ -1265,7 +1277,7 @@ static void assemble_file (char *fname)
|
|||||||
preproc->cleanup(0);
|
preproc->cleanup(0);
|
||||||
nasmlist.cleanup();
|
nasmlist.cleanup();
|
||||||
#if 1
|
#if 1
|
||||||
if (optimizing>0 && using_debug_info) /* -On and -g switches */
|
if (optimizing>0 && opt_verbose_info) /* -On and -Ov switches */
|
||||||
fprintf(stdout,
|
fprintf(stdout,
|
||||||
"info:: assembly required 1+%d+1 passes\n", pass_cnt-2);
|
"info:: assembly required 1+%d+1 passes\n", pass_cnt-2);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user