mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-09-22 10:43:39 -04:00
Revert "Improve process_ea and introduce -OL"
This reverts commit ac732cb6a5
.
Resolved Conflicts:
doc/nasmdoc.src
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
99
assemble.c
99
assemble.c
@@ -751,59 +751,36 @@ int64_t insn_size(int32_t segment, int64_t offset, int bits, uint32_t cp,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool possible_sbyte(operand *o, int min_optimizing)
|
static bool possible_sbyte(operand *o)
|
||||||
{
|
{
|
||||||
return o->wrt == NO_SEG && o->segment == NO_SEG &&
|
return o->wrt == NO_SEG && o->segment == NO_SEG &&
|
||||||
!(o->opflags & OPFLAG_UNKNOWN) &&
|
!(o->opflags & OPFLAG_UNKNOWN) &&
|
||||||
optimizing >= min_optimizing && !(o->type & STRICT);
|
optimizing >= 0 && !(o->type & STRICT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check that opn[op] is a signed byte of size 16 or 32 */
|
/* check that opn[op] is a signed byte of size 16 or 32 */
|
||||||
static bool is_sbyte16(operand *o, int min_optimizing)
|
static bool is_sbyte16(operand *o)
|
||||||
{
|
{
|
||||||
int16_t v;
|
int16_t v;
|
||||||
|
|
||||||
if (!possible_sbyte(o, min_optimizing))
|
if (!possible_sbyte(o))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
v = o->offset;
|
v = o->offset;
|
||||||
return v >= -128 && v <= 127;
|
return v >= -128 && v <= 127;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool is_sbyte32(operand *o, int min_optimizing)
|
static bool is_sbyte32(operand *o)
|
||||||
{
|
{
|
||||||
int32_t v;
|
int32_t v;
|
||||||
|
|
||||||
if (!possible_sbyte(o, min_optimizing))
|
if (!possible_sbyte(o))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
v = o->offset;
|
v = o->offset;
|
||||||
return v >= -128 && v <= 127;
|
return v >= -128 && v <= 127;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if o is zero of size 16 or 32 */
|
|
||||||
static bool is_zero16(operand *o, int min_optimizing)
|
|
||||||
{
|
|
||||||
int16_t v;
|
|
||||||
|
|
||||||
if (!possible_sbyte(o, min_optimizing))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
v = o->offset;
|
|
||||||
return v == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool is_zero32(operand *o, int min_optimizing)
|
|
||||||
{
|
|
||||||
int32_t v;
|
|
||||||
|
|
||||||
if (!possible_sbyte(o, min_optimizing))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
v = o->offset;
|
|
||||||
return v == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Common construct */
|
/* Common construct */
|
||||||
#define case4(x) case (x): case (x)+1: case (x)+2: case (x)+3
|
#define case4(x) case (x): case (x)+1: case (x)+2: case (x)+3
|
||||||
|
|
||||||
@@ -905,7 +882,7 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case4(0140):
|
case4(0140):
|
||||||
length += is_sbyte16(opx, 0) ? 1 : 2;
|
length += is_sbyte16(opx) ? 1 : 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case4(0144):
|
case4(0144):
|
||||||
@@ -914,7 +891,7 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case4(0150):
|
case4(0150):
|
||||||
length += is_sbyte32(opx, 0) ? 1 : 4;
|
length += is_sbyte32(opx) ? 1 : 4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case4(0154):
|
case4(0154):
|
||||||
@@ -945,7 +922,7 @@ static int64_t calcsize(int32_t segment, int64_t offset, int bits,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case4(0250):
|
case4(0250):
|
||||||
length += is_sbyte32(opx, 0) ? 1 : 4;
|
length += is_sbyte32(opx) ? 1 : 4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case4(0254):
|
case4(0254):
|
||||||
@@ -1441,7 +1418,7 @@ static void gencode(int32_t segment, int64_t offset, int bits,
|
|||||||
case4(0140):
|
case4(0140):
|
||||||
data = opx->offset;
|
data = opx->offset;
|
||||||
warn_overflow_opd(opx, 2);
|
warn_overflow_opd(opx, 2);
|
||||||
if (is_sbyte16(opx, 0)) {
|
if (is_sbyte16(opx)) {
|
||||||
bytes[0] = data;
|
bytes[0] = data;
|
||||||
out(offset, segment, bytes, OUT_RAWDATA, 1, NO_SEG,
|
out(offset, segment, bytes, OUT_RAWDATA, 1, NO_SEG,
|
||||||
NO_SEG);
|
NO_SEG);
|
||||||
@@ -1456,7 +1433,7 @@ static void gencode(int32_t segment, int64_t offset, int bits,
|
|||||||
case4(0144):
|
case4(0144):
|
||||||
EMIT_REX();
|
EMIT_REX();
|
||||||
bytes[0] = *codes++;
|
bytes[0] = *codes++;
|
||||||
if (is_sbyte16(opx, 0))
|
if (is_sbyte16(opx))
|
||||||
bytes[0] |= 2; /* s-bit */
|
bytes[0] |= 2; /* s-bit */
|
||||||
out(offset, segment, bytes, OUT_RAWDATA, 1, NO_SEG, NO_SEG);
|
out(offset, segment, bytes, OUT_RAWDATA, 1, NO_SEG, NO_SEG);
|
||||||
offset++;
|
offset++;
|
||||||
@@ -1465,7 +1442,7 @@ static void gencode(int32_t segment, int64_t offset, int bits,
|
|||||||
case4(0150):
|
case4(0150):
|
||||||
data = opx->offset;
|
data = opx->offset;
|
||||||
warn_overflow_opd(opx, 4);
|
warn_overflow_opd(opx, 4);
|
||||||
if (is_sbyte32(opx, 0)) {
|
if (is_sbyte32(opx)) {
|
||||||
bytes[0] = data;
|
bytes[0] = data;
|
||||||
out(offset, segment, bytes, OUT_RAWDATA, 1, NO_SEG,
|
out(offset, segment, bytes, OUT_RAWDATA, 1, NO_SEG,
|
||||||
NO_SEG);
|
NO_SEG);
|
||||||
@@ -1480,7 +1457,7 @@ static void gencode(int32_t segment, int64_t offset, int bits,
|
|||||||
case4(0154):
|
case4(0154):
|
||||||
EMIT_REX();
|
EMIT_REX();
|
||||||
bytes[0] = *codes++;
|
bytes[0] = *codes++;
|
||||||
if (is_sbyte32(opx, 0))
|
if (is_sbyte32(opx))
|
||||||
bytes[0] |= 2; /* s-bit */
|
bytes[0] |= 2; /* s-bit */
|
||||||
out(offset, segment, bytes, OUT_RAWDATA, 1, NO_SEG, NO_SEG);
|
out(offset, segment, bytes, OUT_RAWDATA, 1, NO_SEG, NO_SEG);
|
||||||
offset++;
|
offset++;
|
||||||
@@ -1544,7 +1521,7 @@ static void gencode(int32_t segment, int64_t offset, int bits,
|
|||||||
errfunc(ERR_WARNING | ERR_PASS2 | ERR_WARN_NOV,
|
errfunc(ERR_WARNING | ERR_PASS2 | ERR_WARN_NOV,
|
||||||
"signed dword immediate exceeds bounds");
|
"signed dword immediate exceeds bounds");
|
||||||
}
|
}
|
||||||
if (is_sbyte32(opx, 0)) {
|
if (is_sbyte32(opx)) {
|
||||||
bytes[0] = data;
|
bytes[0] = data;
|
||||||
out(offset, segment, bytes, OUT_RAWDATA, 1, NO_SEG,
|
out(offset, segment, bytes, OUT_RAWDATA, 1, NO_SEG,
|
||||||
NO_SEG);
|
NO_SEG);
|
||||||
@@ -2226,9 +2203,7 @@ static enum match_result matches(const struct itemplate *itemp,
|
|||||||
static ea *process_ea(operand * input, ea * output, int bits,
|
static ea *process_ea(operand * input, ea * output, int bits,
|
||||||
int addrbits, int rfield, opflags_t rflags)
|
int addrbits, int rfield, opflags_t rflags)
|
||||||
{
|
{
|
||||||
bool byte_offs = !!(input->eaflags & EAF_BYTEOFFS);
|
bool forw_ref = !!(input->opflags & OPFLAG_UNKNOWN);
|
||||||
bool word_offs = !!(input->eaflags & EAF_WORDOFFS);
|
|
||||||
bool no_offs = !!(input->eaflags & EAF_NO_OFFS);
|
|
||||||
|
|
||||||
output->rip = false;
|
output->rip = false;
|
||||||
|
|
||||||
@@ -2288,6 +2263,7 @@ static ea *process_ea(operand * input, ea * output, int bits,
|
|||||||
}
|
}
|
||||||
} else { /* it's an indirection */
|
} else { /* it's an indirection */
|
||||||
int i = input->indexreg, b = input->basereg, s = input->scale;
|
int i = input->indexreg, b = input->basereg, s = input->scale;
|
||||||
|
int32_t seg = input->segment;
|
||||||
int hb = input->hintbase, ht = input->hinttype;
|
int hb = input->hintbase, ht = input->hinttype;
|
||||||
int t, it, bt; /* register numbers */
|
int t, it, bt; /* register numbers */
|
||||||
opflags_t x, ix, bx; /* register flags */
|
opflags_t x, ix, bx; /* register flags */
|
||||||
@@ -2315,7 +2291,7 @@ static ea *process_ea(operand * input, ea * output, int bits,
|
|||||||
if ((ix|bx) & (BITS32|BITS64)) {
|
if ((ix|bx) & (BITS32|BITS64)) {
|
||||||
/* it must be a 32/64-bit memory reference. Firstly we have
|
/* it must be a 32/64-bit memory reference. Firstly we have
|
||||||
* to check that all registers involved are type E/Rxx. */
|
* to check that all registers involved are type E/Rxx. */
|
||||||
int32_t sok = BITS32|BITS64;
|
int32_t sok = BITS32|BITS64, o = input->offset;
|
||||||
|
|
||||||
if (it != -1) {
|
if (it != -1) {
|
||||||
if (!(REG64 & ~ix) || !(REG32 & ~ix))
|
if (!(REG64 & ~ix) || !(REG32 & ~ix))
|
||||||
@@ -2385,13 +2361,15 @@ static ea *process_ea(operand * input, ea * output, int bits,
|
|||||||
mod = 0;
|
mod = 0;
|
||||||
} else {
|
} else {
|
||||||
rm = (bt & 7);
|
rm = (bt & 7);
|
||||||
if (rm != REG_NUM_EBP &&
|
if (rm != REG_NUM_EBP && o == 0 &&
|
||||||
(no_offs || is_zero32(input, -1)) &&
|
seg == NO_SEG && !forw_ref &&
|
||||||
!(byte_offs || word_offs))
|
!(input->eaflags &
|
||||||
|
(EAF_BYTEOFFS | EAF_WORDOFFS)))
|
||||||
mod = 0;
|
mod = 0;
|
||||||
else if (byte_offs ||
|
else if (input->eaflags & EAF_BYTEOFFS ||
|
||||||
(! word_offs && is_sbyte32(input, -1)) ||
|
(o >= -128 && o <= 127 && seg == NO_SEG
|
||||||
(rm == REG_NUM_EBP && no_offs))
|
&& !forw_ref
|
||||||
|
&& !(input->eaflags & EAF_WORDOFFS)))
|
||||||
mod = 1;
|
mod = 1;
|
||||||
else
|
else
|
||||||
mod = 2;
|
mod = 2;
|
||||||
@@ -2431,13 +2409,15 @@ static ea *process_ea(operand * input, ea * output, int bits,
|
|||||||
mod = 0;
|
mod = 0;
|
||||||
} else {
|
} else {
|
||||||
base = (bt & 7);
|
base = (bt & 7);
|
||||||
if (base != REG_NUM_EBP &&
|
if (base != REG_NUM_EBP && o == 0 &&
|
||||||
(no_offs || is_zero32(input, -1)) &&
|
seg == NO_SEG && !forw_ref &&
|
||||||
!(byte_offs || word_offs))
|
!(input->eaflags &
|
||||||
|
(EAF_BYTEOFFS | EAF_WORDOFFS)))
|
||||||
mod = 0;
|
mod = 0;
|
||||||
else if (byte_offs ||
|
else if (input->eaflags & EAF_BYTEOFFS ||
|
||||||
(! word_offs && is_sbyte32(input, -1)) ||
|
(o >= -128 && o <= 127 && seg == NO_SEG
|
||||||
(base == REG_NUM_EBP && no_offs))
|
&& !forw_ref
|
||||||
|
&& !(input->eaflags & EAF_WORDOFFS)))
|
||||||
mod = 1;
|
mod = 1;
|
||||||
else
|
else
|
||||||
mod = 2;
|
mod = 2;
|
||||||
@@ -2450,6 +2430,7 @@ static ea *process_ea(operand * input, ea * output, int bits,
|
|||||||
}
|
}
|
||||||
} else { /* it's 16-bit */
|
} else { /* it's 16-bit */
|
||||||
int mod, rm;
|
int mod, rm;
|
||||||
|
int16_t o = input->offset;
|
||||||
|
|
||||||
/* check for 64-bit long mode */
|
/* check for 64-bit long mode */
|
||||||
if (addrbits == 64)
|
if (addrbits == 64)
|
||||||
@@ -2519,13 +2500,13 @@ static ea *process_ea(operand * input, ea * output, int bits,
|
|||||||
if (rm == -1) /* can't happen, in theory */
|
if (rm == -1) /* can't happen, in theory */
|
||||||
return NULL; /* so panic if it does */
|
return NULL; /* so panic if it does */
|
||||||
|
|
||||||
if (rm != 6 &&
|
if (o == 0 && seg == NO_SEG && !forw_ref && rm != 6 &&
|
||||||
(no_offs || is_zero16(input, -1)) &&
|
!(input->eaflags & (EAF_BYTEOFFS | EAF_WORDOFFS)))
|
||||||
!(byte_offs || word_offs))
|
|
||||||
mod = 0;
|
mod = 0;
|
||||||
else if (byte_offs ||
|
else if (input->eaflags & EAF_BYTEOFFS ||
|
||||||
(! word_offs && is_sbyte16(input, -1)) ||
|
(o >= -128 && o <= 127 && seg == NO_SEG
|
||||||
(rm == 6 && no_offs))
|
&& !forw_ref
|
||||||
|
&& !(input->eaflags & EAF_WORDOFFS)))
|
||||||
mod = 1;
|
mod = 1;
|
||||||
else
|
else
|
||||||
mod = 2;
|
mod = 2;
|
||||||
|
@@ -28,7 +28,7 @@ since 2007.
|
|||||||
|
|
||||||
\b Macros parameters range expansion introduced. See \k{mlmacrange}.
|
\b Macros parameters range expansion introduced. See \k{mlmacrange}.
|
||||||
|
|
||||||
\b Backward compatibility on expanding of local single line macros restored.
|
\b Backward compatibility on expanging of local sigle macros restored.
|
||||||
|
|
||||||
\b 8 bit relocations for \c{elf} and \c{bin} output formats are introduced.
|
\b 8 bit relocations for \c{elf} and \c{bin} output formats are introduced.
|
||||||
|
|
||||||
@@ -59,10 +59,7 @@ since 2007.
|
|||||||
\b Tighten EA checks. We warn a user if there overflow in EA addressing.
|
\b Tighten EA checks. We warn a user if there overflow in EA addressing.
|
||||||
|
|
||||||
\b Make \c{-Ox} the default optimization level. For the legacy
|
\b Make \c{-Ox} the default optimization level. For the legacy
|
||||||
behavior, specify \c{-OL} explicitly. See \k{opt-O}.
|
behavior, specify \c{-O0} explicitly. See \k{opt-O}.
|
||||||
|
|
||||||
\b Don't optimize displacements in \c{-O0}. For the legacy
|
|
||||||
behavior, specify \c{-OL}. See \k{opt-O}.
|
|
||||||
|
|
||||||
\b Environment variables read with \c{%!} or tested with \c{%ifenv}
|
\b Environment variables read with \c{%!} or tested with \c{%ifenv}
|
||||||
can now contain non-identifier characters if surrounded by quotes.
|
can now contain non-identifier characters if surrounded by quotes.
|
||||||
|
@@ -539,7 +539,7 @@ an intervening space. For example:
|
|||||||
\c nasm -f bin driver.asm -odriver.sys
|
\c nasm -f bin driver.asm -odriver.sys
|
||||||
|
|
||||||
Note that this is a small o, and is different from a capital O , which
|
Note that this is a small o, and is different from a capital O , which
|
||||||
is used to specify the optimization level. See \k{opt-O}.
|
is used to specify the number of optimisation passes required. See \k{opt-O}.
|
||||||
|
|
||||||
|
|
||||||
\S{opt-f} The \i\c{-f} Option: Specifying the \i{Output File Format}
|
\S{opt-f} The \i\c{-f} Option: Specifying the \i{Output File Format}
|
||||||
@@ -840,29 +840,28 @@ argument, instructs NASM to replace its powerful \i{preprocessor}
|
|||||||
with a \i{stub preprocessor} which does nothing.
|
with a \i{stub preprocessor} which does nothing.
|
||||||
|
|
||||||
|
|
||||||
\S{opt-O} The \i\c{-O} Option: Specifying \i{Code Size Optimization}
|
\S{opt-O} The \i\c{-O} Option: Specifying \i{Multipass Optimization}
|
||||||
|
|
||||||
|
NASM defaults to not optimizing operands which can fit into a signed byte.
|
||||||
|
This means that if you want the shortest possible object code,
|
||||||
|
you have to enable optimization.
|
||||||
|
|
||||||
Using the \c{-O} option, you can tell NASM to carry out different
|
Using the \c{-O} option, you can tell NASM to carry out different
|
||||||
levels of optimization. The syntax is:
|
levels of optimization. The syntax is:
|
||||||
|
|
||||||
\b \c{-O0}: No optimization. All operands take their long forms,
|
\b \c{-O0}: No optimization. All operands take their long forms,
|
||||||
if a short form is not specified, except conditional jumps.
|
if a short form is not specified, except conditional jumps.
|
||||||
|
|
||||||
\b \c{-OL}: Legacy optimization. Like \c{-O0}, but displacements
|
|
||||||
which will fit in a signed byte and do not contain references
|
|
||||||
to labels later in the file are optimized, unless the long form
|
|
||||||
is specified.
|
|
||||||
This is intended to match NASM 0.98 behavior.
|
This is intended to match NASM 0.98 behavior.
|
||||||
|
|
||||||
\b \c{-O1}: Minimal optimization. Like \c{-O0}, but immediate operands
|
\b \c{-O1}: Minimal optimization. As above, but immediate operands
|
||||||
which will fit in a signed byte are optimized,
|
which will fit in a signed byte are optimized,
|
||||||
unless the long form is specified. Conditional jumps default
|
unless the long form is specified. Conditional jumps default
|
||||||
to the long form unless otherwise specified.
|
to the long form unless otherwise specified.
|
||||||
|
|
||||||
\b \c{-Ox} (where \c{x} is the actual letter \c{x}): Full optimization.
|
\b \c{-Ox} (where \c{x} is the actual letter \c{x}): Multipass optimization.
|
||||||
Minimize branch offsets, displacements and immediates,
|
Minimize branch offsets and signed immediate bytes,
|
||||||
overriding size specification unless the \c{strict} keyword
|
overriding size specification unless the \c{strict} keyword
|
||||||
has been used (see \k{strict}). For compatibility with earlier
|
has been used (see \k{strict}). For compatability with earlier
|
||||||
releases, the letter \c{x} may also be any number greater than
|
releases, the letter \c{x} may also be any number greater than
|
||||||
one. This number has no effect on the actual number of passes.
|
one. This number has no effect on the actual number of passes.
|
||||||
|
|
||||||
@@ -1844,8 +1843,8 @@ invent one using the macro processor.
|
|||||||
|
|
||||||
\H{strict} \i\c{STRICT}: Inhibiting Optimization
|
\H{strict} \i\c{STRICT}: Inhibiting Optimization
|
||||||
|
|
||||||
When assembling with the optimizer set to full (see \k{opt-O}),
|
When assembling with the optimizer set to level 2 or higher (see
|
||||||
NASM will use size specifiers (\c{BYTE}, \c{WORD},
|
\k{opt-O}), NASM will use size specifiers (\c{BYTE}, \c{WORD},
|
||||||
\c{DWORD}, \c{QWORD}, \c{TWORD}, \c{OWORD} or \c{YWORD}), but will
|
\c{DWORD}, \c{QWORD}, \c{TWORD}, \c{OWORD} or \c{YWORD}), but will
|
||||||
give them the smallest possible size. The keyword \c{STRICT} can be
|
give them the smallest possible size. The keyword \c{STRICT} can be
|
||||||
used to inhibit optimization and force a particular operand to be
|
used to inhibit optimization and force a particular operand to be
|
||||||
@@ -4953,7 +4952,7 @@ be specified, even if it is the same as the internal name. The
|
|||||||
available attributes are:
|
available attributes are:
|
||||||
|
|
||||||
\b \c{resident} indicates that the exported name is to be kept
|
\b \c{resident} indicates that the exported name is to be kept
|
||||||
resident by the system loader. This is an optimization for
|
resident by the system loader. This is an optimisation for
|
||||||
frequently used symbols imported by name.
|
frequently used symbols imported by name.
|
||||||
|
|
||||||
\b \c{nodata} indicates that the exported symbol is a function which
|
\b \c{nodata} indicates that the exported symbol is a function which
|
||||||
|
23
nasm.c
23
nasm.c
@@ -674,22 +674,14 @@ static bool process_arg(char *p, char *q)
|
|||||||
case '5': case '6': case '7': case '8': case '9':
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
opt = strtoul(param, ¶m, 10);
|
opt = strtoul(param, ¶m, 10);
|
||||||
|
|
||||||
if (opt == 0)
|
/* -O0 -> optimizing == -1, 0.98 behaviour */
|
||||||
/* no optimization */
|
/* -O1 -> optimizing == 0, 0.98.09 behaviour */
|
||||||
optimizing = -2;
|
if (opt < 2)
|
||||||
else if (opt == 1)
|
optimizing = opt - 1;
|
||||||
/* 0.98.09 behaviour */
|
|
||||||
optimizing = 0;
|
|
||||||
else
|
else
|
||||||
optimizing = opt;
|
optimizing = opt;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'L':
|
|
||||||
/* 0.98 behaviour */
|
|
||||||
param++;
|
|
||||||
optimizing = -1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
case '+':
|
case '+':
|
||||||
param++;
|
param++;
|
||||||
@@ -791,11 +783,10 @@ static bool process_arg(char *p, char *q)
|
|||||||
" -F format select a debugging format\n\n"
|
" -F format select a debugging format\n\n"
|
||||||
" -I<path> adds a pathname to the include file path\n");
|
" -I<path> adds a pathname to the include file path\n");
|
||||||
printf
|
printf
|
||||||
(" -O<digit> optimize code size\n"
|
(" -O<digit> optimize branch offsets\n"
|
||||||
" -O0: No optimization\n"
|
" -O0: No optimization (default)\n"
|
||||||
" -OL: Legacy optimization\n"
|
|
||||||
" -O1: Minimal optimization\n"
|
" -O1: Minimal optimization\n"
|
||||||
" -Ox: Full optimization (default)\n\n"
|
" -Ox: Multipass optimization (recommended)\n\n"
|
||||||
" -P<file> pre-includes a file\n"
|
" -P<file> pre-includes a file\n"
|
||||||
" -D<macro>[=<value>] pre-defines a macro\n"
|
" -D<macro>[=<value>] pre-defines a macro\n"
|
||||||
" -U<macro> undefines a macro\n"
|
" -U<macro> undefines a macro\n"
|
||||||
|
3
nasm.h
3
nasm.h
@@ -484,8 +484,7 @@ enum ea_flags { /* special EA flags */
|
|||||||
EAF_TIMESTWO = 4, /* really do EAX*2 not EAX+EAX */
|
EAF_TIMESTWO = 4, /* really do EAX*2 not EAX+EAX */
|
||||||
EAF_REL = 8, /* IP-relative addressing */
|
EAF_REL = 8, /* IP-relative addressing */
|
||||||
EAF_ABS = 16, /* non-IP-relative addressing */
|
EAF_ABS = 16, /* non-IP-relative addressing */
|
||||||
EAF_FSGS = 32, /* fs/gs segment override present */
|
EAF_FSGS = 32 /* fs/gs segment override present */
|
||||||
EAF_NO_OFFS = 64 /* no explicit offset in source */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eval_hint { /* values for `hinttype' */
|
enum eval_hint { /* values for `hinttype' */
|
||||||
|
1
parser.c
1
parser.c
@@ -804,7 +804,6 @@ is_expression:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result->oprs[operand].eaflags |= EAF_NO_OFFS;
|
|
||||||
o = 0;
|
o = 0;
|
||||||
result->oprs[operand].wrt = NO_SEG;
|
result->oprs[operand].wrt = NO_SEG;
|
||||||
result->oprs[operand].segment = NO_SEG;
|
result->oprs[operand].segment = NO_SEG;
|
||||||
|
@@ -1,37 +0,0 @@
|
|||||||
;Testname=O0; Arguments=-O0 -fbin -ozero_displacement.bin; Files=stdout stderr zero_displacement.bin
|
|
||||||
;Testname=OL; Arguments=-OL -fbin -ozero_displacement.bin; Files=stdout stderr zero_displacement.bin
|
|
||||||
;Testname=O1; Arguments=-O1 -fbin -ozero_displacement.bin; Files=stdout stderr zero_displacement.bin
|
|
||||||
;Testname=Ox; Arguments=-Ox -fbin -ozero_displacement.bin; Files=stdout stderr zero_displacement.bin
|
|
||||||
|
|
||||||
bits 16
|
|
||||||
|
|
||||||
mov ax, [bx]
|
|
||||||
mov ax, [bx+0]
|
|
||||||
|
|
||||||
mov ax, [bx+di]
|
|
||||||
mov ax, [bx+di+0]
|
|
||||||
|
|
||||||
mov ax, [bp]
|
|
||||||
mov ax, [bp+0]
|
|
||||||
|
|
||||||
bits 32
|
|
||||||
|
|
||||||
mov eax, [eax]
|
|
||||||
mov eax, [eax+0]
|
|
||||||
|
|
||||||
mov eax, [eax+ebx]
|
|
||||||
mov eax, [eax+ebx+0]
|
|
||||||
|
|
||||||
mov eax, [ebp]
|
|
||||||
mov eax, [ebp+0]
|
|
||||||
|
|
||||||
bits 64
|
|
||||||
|
|
||||||
mov eax, [rax]
|
|
||||||
mov eax, [rax+0]
|
|
||||||
|
|
||||||
mov eax, [rax+rbx]
|
|
||||||
mov eax, [rax+rbx+0]
|
|
||||||
|
|
||||||
mov eax, [rbp]
|
|
||||||
mov eax, [rbp+0]
|
|
Reference in New Issue
Block a user