Commit Graph

99 Commits

Author SHA1 Message Date
H. Peter Anvin
ac8f8fcb27 Use an explicit table for tolower() to avoid a function call
On some platforms, tolower() is implemented as a function call, in
order to handle locale support.  We never change locales, so can the
result of tolower() into a table, so we don't have to sit through the
function call every time.

~1.3% overall performance improvement on a macro-heavy benchmark under
Linux x86-64.
2008-06-11 15:49:41 -07:00
H. Peter Anvin
7df0417e58 Add %warning, saner unquoting of %error
- Add %warning directive
- Only unquote an %error or %warning string if it is the only thing on
  the directive line.
- Don't expand macros inside a quoted string, even for %error.
2008-06-10 18:27:38 -07:00
H. Peter Anvin
fcb8909749 Move all the RAA code out of nasmlib
The RAA code doesn't have to be in nasmlib; it is only used by nasm
itself, and is better handled in a separate module.
2008-06-09 17:40:16 -07:00
H. Peter Anvin
1803dedae8 Move all the SAA code out of nasmlib
Move all the SAA code out of nasmlib; it's not used by anything than
nasm itself.  Cleaning out the kitchen sink known as nasmlib is a good
thing, too.
2008-06-09 17:32:43 -07:00
H. Peter Anvin
9e1f528c36 Add the -MP option to emit phony targets
Add the -MP option to emit phony targets.  Since this means each
header file has to be visited more than once, change the
implementation to use an internal list of all the dependencies, and
centralize the emission of the dependency files.
2008-05-29 21:38:00 -07:00
H. Peter Anvin
07b7b9e15e Implement -MD, -MF, -MT, -MQ
Implement the dependency options:

-MF: set the file to which dependencies are written.
-MD: generate dependencies in parallel with compilation.
-MT: set the name of the dependency target.
-MQ: same as -MT, but *attempt* to quote it for Makefile safety.
2008-05-29 19:09:11 -07:00
H. Peter Anvin
dfb918047b Add DY, YWORD, and the SY instruction flag
Add the DY instruction, YWORD keyword, and an SY marker for
instruction sizes.  Add a few more AVX sample instructions.
2008-05-20 11:43:53 -07:00
H. Peter Anvin
d85d250fa2 First cut at AVX machinery.
First cut at AVX machinery support.  The only instruction implemented
is VPERMIL2PS, and it's probably buggy.  I'm checking this in with the
hope that other people can start helping out with (a) testing this,
and (b) adding instructions.

NDISASM support is not there yet.
2008-05-04 17:53:31 -07:00
H. Peter Anvin
6b18bcce46 BR 774131: date and time macros
This checkin creates the following date and time macros:

__DATE__, __TIME__, __UTC_DATE__, __UTC_TIME__: strings

__DATE_NUM__, __TIME_NUM__, __UTC_DATE_NUM__, __UTC_TIME_NUM__:
civil dates in digit-string formats

__POSIX_TIME__: time in POSIX time_t format
2008-02-16 14:54:10 -08:00
H. Peter Anvin
2b046cf67f Ignore ERR_PASS1 except for actual warnings
is_suppressed_warning() should never return true unless we're actually
dealing with a warning.  There is a handful of cases where we pass
ERR_PASS1 down together with errors, but that's mostly because it fits
into an overall pattern.  Thus, ignore it.
2008-01-22 14:08:36 -08:00
H. Peter Anvin
be2678cd31 nasm.c: clean up the handing of response files
Avoid using malloc/free (not nasm_malloc/nasm_free even) in the
processing of response files; move to separate function.
2008-01-21 16:23:59 -08:00
H. Peter Anvin
a2c486cd6b Remove debugging printf
Remove debugging printf which shouldn't ever have been checked in ;)
2008-01-13 11:46:04 -08:00
H. Peter Anvin
00835fec0e Sanitize the pass logic, and only issue PASS1 warnings on pass0 == 1
For PASS1 warnings, only do them when pass0 == 1.  The prior passes
are to be considered training passes.  This is a bit awkward if we
then hit an error, but it's better than n repeated warnings.
2008-01-08 23:03:57 -08:00
H. Peter Anvin
34ec300643 Remove magic "five pass minimum" - I'm pretty sure optimizer is fixed.
The five-pass-minimum was a hack for a bug which I think is identified
now.  Doesn't really change the fact that if you want the optimizer,
you probably want -Ox.
2008-01-08 22:31:20 -08:00
H. Peter Anvin
62cf415f49 Optimizer: force progression through final passes when hitting limit
We have a number of bug reports about things not working properly when
the optimizer is running out of passes.  I suspect the reason is
simply that we don't properly execute the final passes (pass0 = 1, 2)
when hitting the limit.  Make sure we advance pass0 the last few
times.
2008-01-08 22:29:21 -08:00
Beroset
095e6a2973 regularized spelling of license to match name of LICENSE file 2007-12-29 09:44:23 -05:00
H. Peter Anvin
70c0bf22a2 BR 1834731: Remove redundant error messages for no input file
Avoid redundant error messages:

./nasm
nasm: error: no input file specified
nasm: fatal: file `' is both input and output file
type `nasm -h' for help

... which is more than a wee bit confusing to the user.
2007-11-19 11:45:40 -08:00
H. Peter Anvin
dc24271fae BR 1091926: Bounds checking for command line parsing
Avoid failure if the command line has doctored arguments.
2007-11-18 11:55:10 -08:00
H. Peter Anvin
423e381dd7 Clean up the command-line parsing; make -w/-W match others
Clean up the command-line parsing and make -w/-W match the behaviour
of all the other options with regards to arguments.
2007-11-15 17:12:29 -08:00
H. Peter Anvin
c68ec01277 Enable a few warnings by default; clean up warning descriptions 2007-11-13 11:34:34 -08:00
H. Peter Anvin
b030c92fee Add gcc-style -W/-Wno- warning selections; -Wall; -Werror
Add gcc-style -Wxxx -Wno-xxx warning selection as an alternative to
-w+xxx/-w-xxx.

Add "all" as an alias for all (actual) warnings.

Add "error" to treat warnings as errors.
2007-11-13 11:31:15 -08:00
H. Peter Anvin
d1fb15c154 Address data is int64_t; simplify writing an address object
Address data is always int64_t even if the size itself is smaller;
this was broken on bigendian hosts (still need testing!)

Create simple "write sized object" macros.
2007-11-13 09:37:59 -08:00
Charles Crayne
5fbbc8c2e7 Upgrade RAA functions to hold 64-bit data. 2007-11-07 19:03:46 -08:00
H. Peter Anvin
7065309739 Formatting: kill off "stealth whitespace"
"Stealth whitespace" makes it harder to read diffs, and just generally
cause unwanted weirdness.  Do a source-wide pass to get rid of it.
2007-10-19 14:42:29 -07:00
Charles Crayne
192d5b5e9c Suppress a few signedness warnings 2007-10-18 19:02:42 -07:00
H. Peter Anvin
f6c9e65d4f Implement floating-point option control directive
New directive [FLOAT] with associated standard macros; allows the
setting to be saved and restored.
2007-10-16 14:40:27 -07:00
H. Peter Anvin
fab3a6c9de Floating-point warning fixes; fix round-to-overflow
Actually generate the appropriate floating-point warnings, and only
one per assembly, pretty please.

Correct the round-to-overflow condition; as written all numbers with a
positive exponent were considered overflows!
2007-10-16 11:48:07 -07:00
H. Peter Anvin
125c878e96 Handle rounding of denorms correctly; make fp overflow a warning
- Handle rounding of denorms correctly
- Make fp overflow a warning, not an error (produces Inf)
- Make fp warnings controllable
2007-10-16 11:32:58 -07:00
H. Peter Anvin
70055964fc Additional uses of bool and enum
Proper use of bool and enum makes code easier to debug.  Do more of
it.  In particular, we really should stomp out any residual uses of
magic constants that aren't enums or, in some cases, even #defines.
2007-10-11 00:05:57 -07:00
H. Peter Anvin
6867acc18e Use the compiler-provided booleans if available, otherwise emulate
Both C and C++ have "bool", "true" and "false" in lower case; C
requires <stdbool.h> for this, in C++ it is an inherent type built
into the compiler.  Use those instead of the old macros; emulate with
a simple typedef enum if unavailable.
2007-10-10 14:58:45 -07:00
H. Peter Anvin
fd7dd11345 Create option -Ox to tell NASM to do unlimited passes
Add option -Ox to tell NASM to do as many passes as it needs, instead
of imposing a fixed number.
2007-10-10 14:06:59 -07:00
H. Peter Anvin
9d637df6da Rewrite the handling of SAA's to allow random access
SAA's were never intended to allow random access, but several backends
do random or semirandom access via saa_fread() and saa_fwrite()
anyway.  Rewrite the SAA system to allow for efficient random access.

On "label.pl 10000000" this improves performance by a factor of 12.
2007-10-04 13:42:56 -07:00
H. Peter Anvin
12e46510bc Change cloc_t to struct location, and reorder the members
Change cloc_t to struct location, and reorder the members so that it
should fit in 16 bytes instead of needing 8 bytes of extra padding on
64-bit machines.
2007-10-03 21:30:57 -07:00
H. Peter Anvin
bfc1712137 BR 1352920: change loc_t -> cloc_t
Change loc_t to cloc_t to avoid AIX conflict.
We really shouldn't use _t names at all; they are usually considered
platform types, but worry about that later.
2007-10-03 21:24:51 -07:00
H. Peter Anvin
0a98f6046d BR 1352920: Handle upper case %line 2007-10-03 21:22:16 -07:00
H. Peter Anvin
fe501957c0 Portability fixes
Concentrate compiler dependencies to compiler.h; make sure compiler.h
is included first in every .c file (since some prototypes may depend
on the presence of feature request macros.)

Actually use the conditional inclusion of various functions (totally
broken in previous releases.)
2007-10-02 21:53:51 -07:00
H. Peter Anvin
c147da0d28 Unspecified files are null strings, not null pointers
We use empty strings, not null pointers, for unspecified files, so
there is no need to compare them for nullness.
2007-10-01 11:28:32 -07:00
H. Peter Anvin
59ddd26aac Check for the most basic filename overlaps
Check for the most basic filename overlaps, in case we have the
opportunity to save the user from himself.
2007-10-01 11:26:31 -07:00
Charles Crayne
fcce07f171 modified: nasm.1 to add newer command line options
modified:   nasm.c to fully parse command line before redirecting stderr.
2007-09-30 22:15:36 -07:00
H. Peter Anvin
413fb900bf nasm option reshuffling, -E -> -Z
Old -E becomes -Z
New -E is alias for -e
Remove the obsolete -r option
2007-09-26 15:19:28 -07:00
H. Peter Anvin
97e15755f9 Fix BR 1445441: uninitialized use of "error_file" 2007-09-25 08:48:37 -07:00
H. Peter Anvin
37a321fbbe Implement the -MG option (SF RFE 1564264)
Implement the -MG option, to generate dependencies in the presence of
generated files.  In the end, we probably need to support the full
gamut of GCC-like dependency-generation options.
2007-09-24 13:41:58 -07:00
H. Peter Anvin
4408b6265c Add TY_OWORD for "DO" output 2007-09-22 21:29:41 -07:00
H. Peter Anvin
269700972c Disallow optimizing by less than 5 passes.
Disallow optimizing by less than 5 passes.  If the user requests 2-4
passes, run 5 passes anyway.
2007-09-22 18:20:49 -07:00
H. Peter Anvin
74cc5e569c Finishing touches on perfect hash tokenizer; actually turn the thing on
Finish the perfect hash tokenizer, and actually enable it.

Move stdscan() et al to a separate file, since it's not needed in any
of the clients of nasmlib other than nasm itself.

Run make alldeps.
2007-08-30 22:35:34 +00:00
H. Peter Anvin
62b24d7e2f Add [default] directive
Add the [default {abs|rel}] directive, and clean up directive parsing.
2007-08-29 16:38:05 +00:00
H. Peter Anvin
99c4ecd18f Implement REL/ABS modifiers
Implement "REL" and "ABS" modifiers for offsets in 64-bit mode.  This
replaces "rip+XXX" type addressing.  The infrastructure to set the default
mode is there, but there is nothing to throw the switch just yet.
2007-08-28 23:06:00 +00:00
H. Peter Anvin
5a640e1161 Clean up the existing operand flag definitions, and document 2007-05-29 23:57:12 +00:00
H. Peter Anvin
0db11e236b Handle "LOCK as REX.R" for MOV CRx; fix warning for invalid 64-bit regs
- MOV gpr,CRx or MOV CRx,gpr can access high control registers with a LOCK
  prefix; handle that in both the assembler and disassembler.
- Get a saner error message when trying to access high resources in
  non-64-bit mode.
2007-04-17 20:23:11 +00:00
Keith Kanios
c7ae18dba1 Placated unreferenced types. 2007-04-14 00:46:25 +00:00