platform/upstream/nasm.git
16 years agotest: add a test for %imacro
H. Peter Anvin [Sun, 29 Jun 2008 01:32:16 +0000 (18:32 -0700)]
test: add a test for %imacro

Add a test for case-insensitive matching of %imacro.

16 years agonasmlib: fix nasm_str[n]icmp()
H. Peter Anvin [Sun, 29 Jun 2008 01:31:08 +0000 (18:31 -0700)]
nasmlib: fix nasm_str[n]icmp()

Fix nasm_str[n]icmp() on platforms which don't have this function
natively.

XXX: Given the new nasm_tolower() implementation, we should consider
if this might actually be a faster function than the platform-native
one.

16 years agopreproc: MMacro.finishes is a pointer, not a boolean
H. Peter Anvin [Sun, 29 Jun 2008 01:30:27 +0000 (18:30 -0700)]
preproc: MMacro.finishes is a pointer, not a boolean

MMacro.finishes is a pointer, not a boolean, so set it to "false", not
"NULL".

16 years agoAES instructions are WESTMERE, not NEHALEM
H. Peter Anvin [Fri, 27 Jun 2008 18:41:59 +0000 (11:41 -0700)]
AES instructions are WESTMERE, not NEHALEM

Still need to make this crap saner...

16 years agoMake the macros table "unsigned char"
H. Peter Anvin [Wed, 25 Jun 2008 21:54:14 +0000 (14:54 -0700)]
Make the macros table "unsigned char"

It gets less ugly if we make the macros table "unsigned char".

16 years agoRun "make alldeps"
H. Peter Anvin [Sun, 22 Jun 2008 01:19:13 +0000 (18:19 -0700)]
Run "make alldeps"

16 years agopp_directives_len can be uint8_t
H. Peter Anvin [Sun, 22 Jun 2008 01:18:41 +0000 (18:18 -0700)]
pp_directives_len can be uint8_t

Save a few hundred bytes...

16 years agoDrop the index tables from the canned macros
H. Peter Anvin [Sat, 21 Jun 2008 22:15:40 +0000 (15:15 -0700)]
Drop the index tables from the canned macros

Instead of an array of strings, just have a character array; that
reduces the size of canned macros by up to 30%, and we only did
sequential access anyway.

16 years agoFix a few more <ctype.h> instances
H. Peter Anvin [Sat, 21 Jun 2008 18:03:51 +0000 (11:03 -0700)]
Fix a few more <ctype.h> instances

A few isolated instances of isalpha() and isxdigit().

16 years agoctype.h: wrapper ctype functions with a cast to (unsigned char)
H. Peter Anvin [Sat, 21 Jun 2008 17:23:17 +0000 (10:23 -0700)]
ctype.h: wrapper ctype functions with a cast to (unsigned char)

ctype functions take an *int*, which the user is expected to have
taken the input character from getc() and friends, or taken a
character and cast it to (unsigned char).

We don't care about EOF (-1), so use macros that cast to (unsigned
char) for us.

16 years agopreproc: free the include path and the final filename
H. Peter Anvin [Fri, 20 Jun 2008 22:55:45 +0000 (15:55 -0700)]
preproc: free the include path and the final filename

Memory leaks: free the include path, and the final used filename.

16 years agoMove the output format macros into the macros.pl mechanism
H. Peter Anvin [Fri, 20 Jun 2008 22:20:16 +0000 (15:20 -0700)]
Move the output format macros into the macros.pl mechanism

Move the handling of "extra" macros (i.e. output format macros) into
the macros.pl mechanism.  This allows us to change the format of the
internal macro store in the future - e.g. to a single byte store
without redundant pointers.

Also, stop using indicies into a long array when there is no good
reason to not just use different arrays.

16 years agoraa: clean up indentation
H. Peter Anvin [Fri, 20 Jun 2008 06:19:20 +0000 (23:19 -0700)]
raa: clean up indentation

Clean up in indentation in the RAA code.

16 years agosaa: fix indentation
H. Peter Anvin [Fri, 20 Jun 2008 06:09:11 +0000 (23:09 -0700)]
saa: fix indentation

Apply standard indentation to the SAA code, not sure why it was
different...

16 years agoSomewhat more clever way to generate the %use guard macros
H. Peter Anvin [Fri, 20 Jun 2008 04:42:42 +0000 (21:42 -0700)]
Somewhat more clever way to generate the %use guard macros

Automatically generate a %define as the first string in the include
block, and just pick the string out of it from that %define statement
to verify existence.  That way we eliminate any use of toupper() --
all case-insensitivity in NASM uses tolower()/nasm_tolower().

16 years agoProtect %use from multi-inclusion and provide a test macro
H. Peter Anvin [Fri, 20 Jun 2008 01:39:24 +0000 (18:39 -0700)]
Protect %use from multi-inclusion and provide a test macro

Automatically provide an include guard for %use packages; the macro
__USE_package__ is automatically defined, and inclusion is suppressed
if it is already defined.

16 years agodoc: framework for documenting standard macro packages
H. Peter Anvin [Thu, 19 Jun 2008 23:58:05 +0000 (16:58 -0700)]
doc: framework for documenting standard macro packages

Add a framework for documenting the standard macro packages.  Also
move the standard macros to the end of the preprocessor section,
instead of having them in the middle of the directives list.

16 years ago%use: call these directives "standard macro packages"
H. Peter Anvin [Thu, 19 Jun 2008 23:26:12 +0000 (16:26 -0700)]
%use: call these directives "standard macro packages"

Adopt the term "standard macro packages", "modules" are too
ambiguous.

16 years agomacros.pl: need to use $' to get proper left-to-right behaviour
H. Peter Anvin [Thu, 19 Jun 2008 23:17:41 +0000 (16:17 -0700)]
macros.pl: need to use $' to get proper left-to-right behaviour

Using ^(.*) means we do right-to-left search, since (.*) is a greedy
expression; instead use $' to get the lead-in part of the string.

16 years agomacros.pl: remove debug prints; improve compression regex
H. Peter Anvin [Thu, 19 Jun 2008 23:12:20 +0000 (16:12 -0700)]
macros.pl: remove debug prints; improve compression regex

Remove debug print statements from macros.pl
Make sure we test for whitespace at end of statements

16 years agomacros.c: compress by tokenizing macro directives
H. Peter Anvin [Thu, 19 Jun 2008 23:00:04 +0000 (16:00 -0700)]
macros.c: compress by tokenizing macro directives

Compress macros.c by representing macro directives with a single byte.
We can do this because we only use the ASCII character range inside
the standard macro files.

Note: we could save significant additional space by not having a
pointer array, and instead relying on the fact that we sweep
sequentially through the output array.

16 years agopreproc: add support for builtin include modules (%use)
H. Peter Anvin [Thu, 19 Jun 2008 22:04:18 +0000 (15:04 -0700)]
preproc: add support for builtin include modules (%use)

Add a builtin equivalent to the %include directive called %use.
%use includes a standard macro file compiled into the binary; these
come from the macros/ directory in the source code.

The idea here is to be able to provide optional macro packages with
the distribution, without adding complex host filesystem dependencies.

16 years agodoc: macroize texi2ipf and ipfc
H. Peter Anvin [Thu, 19 Jun 2008 18:47:13 +0000 (11:47 -0700)]
doc: macroize texi2ipf and ipfc

Macroize the texi2ipf and ipfc commands (used for OS/2).

16 years agodoc: for ps to pdf conversion, use "acrodist", "ps2pdf" or "pstopdf"
H. Peter Anvin [Thu, 19 Jun 2008 18:39:23 +0000 (11:39 -0700)]
doc: for ps to pdf conversion, use "acrodist", "ps2pdf" or "pstopdf"

For PostScript to PDF conversion, use whichever of "acrodist",
"ps2pdf", or "pstopdf" which we can find on the system.  I haven't
tried either acrodist or pstopdf myself, only going my the
documentation, but prefer acrodist since it is claimed to produce
smaller output files than ps2pdf.

16 years agoMerge branch 'nasm-2.03.x'
H. Peter Anvin [Tue, 17 Jun 2008 04:45:42 +0000 (21:45 -0700)]
Merge branch 'nasm-2.03.x'

Conflicts:

Makefile.in
Mkfiles/msvc.mak
Mkfiles/netware.mak
Mkfiles/openwcom.mak
Mkfiles/owlinux.mak

16 years agodoc: add missing nasmdoc.txt target
H. Peter Anvin [Tue, 17 Jun 2008 04:19:34 +0000 (21:19 -0700)]
doc: add missing nasmdoc.txt target

16 years agoNASM 2.03.01
H. Peter Anvin [Tue, 17 Jun 2008 04:11:59 +0000 (21:11 -0700)]
NASM 2.03.01

16 years agoBackport the syncfiles script to the nasm-2.03.x branch
H. Peter Anvin [Mon, 16 Jun 2008 22:55:19 +0000 (15:55 -0700)]
Backport the syncfiles script to the nasm-2.03.x branch

This is a maintenance tool only, it doesn't change the code in any
way.  However, it makes it a lot less likely that we'll have a release
go out with a broken Makefile.

16 years agosyncfiles: use #-- ... --# for consistency with mkdep.pl
H. Peter Anvin [Mon, 16 Jun 2008 06:50:50 +0000 (23:50 -0700)]
syncfiles: use #-- ... --# for consistency with mkdep.pl

mkdep.pl already used #-- ... --# (two dashes) whereas syncfiles.pl
was using #--- ... ---# (three dashes).  Change syncfiles.pl to match
mkdep.pl.

16 years agosyncfiles: terminate directory names at equal signs
H. Peter Anvin [Mon, 16 Jun 2008 06:43:44 +0000 (23:43 -0700)]
syncfiles: terminate directory names at equal signs

In the case where the directory name should be removed (null pathname
separator) don't search backwards past an equal sign, just in case
there isn't a space after the assignment.

16 years agoMerge branch 'nasm-2.03.x'
H. Peter Anvin [Mon, 16 Jun 2008 04:51:52 +0000 (21:51 -0700)]
Merge branch 'nasm-2.03.x'

16 years ago-F implies -g backported to 2.03.01
H. Peter Anvin [Mon, 16 Jun 2008 04:51:17 +0000 (21:51 -0700)]
-F implies -g backported to 2.03.01

16 years agoCHANGES: document backport of -F implies -g
H. Peter Anvin [Mon, 16 Jun 2008 04:50:41 +0000 (21:50 -0700)]
CHANGES: document backport of -F implies -g

16 years agoMerge branch 'nasm-2.03.x'
H. Peter Anvin [Mon, 16 Jun 2008 04:27:30 +0000 (21:27 -0700)]
Merge branch 'nasm-2.03.x'

Conflicts:

doc/nasmdoc.src

16 years agoMake -F imply -g (BR 1991213)
H. Peter Anvin [Mon, 16 Jun 2008 04:25:56 +0000 (21:25 -0700)]
Make -F imply -g (BR 1991213)

When the user specifies -F, imply the -g option.  Too many users seem
to make this mistake.

Conflicts:

doc/nasmdoc.src

16 years agoMerge branch 'nasm-2.03.x'
H. Peter Anvin [Mon, 16 Jun 2008 04:22:40 +0000 (21:22 -0700)]
Merge branch 'nasm-2.03.x'

Conflicts:

doc/nasmdoc.src

16 years agodoc: Nasm -> NASM
H. Peter Anvin [Thu, 12 Jun 2008 04:09:22 +0000 (21:09 -0700)]
doc: Nasm -> NASM

Consistently write NASM in all capitals

16 years agodoc: title capitalization
H. Peter Anvin [Thu, 12 Jun 2008 01:52:54 +0000 (18:52 -0700)]
doc: title capitalization

16 years agodoc: add missing period.
H. Peter Anvin [Mon, 16 Jun 2008 04:20:45 +0000 (21:20 -0700)]
doc: add missing period.

Conflicts:

16 years agodoc: Makefile fixes missing from previous checkin
H. Peter Anvin [Thu, 12 Jun 2008 01:38:15 +0000 (18:38 -0700)]
doc: Makefile fixes missing from previous checkin

16 years agodoc: another case of the RTF backend corrupting state
H. Peter Anvin [Thu, 12 Jun 2008 01:32:33 +0000 (18:32 -0700)]
doc: another case of the RTF backend corrupting state

Another case of the RTF backend corrupting global state.  "Fix" it by
only outputting one format at a time; this also makes it possible to
run in parallel.

16 years agodoc: ps/pdf: set page numbers in normal-sized italic
H. Peter Anvin [Thu, 12 Jun 2008 01:23:14 +0000 (18:23 -0700)]
doc: ps/pdf: set page numbers in normal-sized italic

Set page numbers in normal-sized italic, instead of large and bold.
We might want to consider using bold italic, but I think this is just
fine.

16 years agodoc: Add NASMENV to the index (BR 1917084)
H. Peter Anvin [Thu, 12 Jun 2008 01:14:24 +0000 (18:14 -0700)]
doc: Add NASMENV to the index (BR 1917084)

Add NASMENV to the documentation index.

16 years agoMerge branch 'nasm-2.03.x'
H. Peter Anvin [Mon, 16 Jun 2008 04:15:18 +0000 (21:15 -0700)]
Merge branch 'nasm-2.03.x'

Conflicts:

doc/psfonts.ph

16 years agoDocumentation facelift backported to 2.03.x
H. Peter Anvin [Mon, 16 Jun 2008 04:13:12 +0000 (21:13 -0700)]
Documentation facelift backported to 2.03.x

16 years agoCHANGES: Document documentation facelift
H. Peter Anvin [Mon, 16 Jun 2008 04:11:35 +0000 (21:11 -0700)]
CHANGES: Document documentation facelift

16 years agops/pdf doc: default to 10-point font, wider leading
H. Peter Anvin [Thu, 12 Jun 2008 01:09:02 +0000 (18:09 -0700)]
ps/pdf doc: default to 10-point font, wider leading

Switch the main font to 10 points Times Roman, but leave the leading
at 11 points.  This produces, in my opinion, a much more legible and
printable document.

16 years agoMerge branch 'nasm-2.03.x'
H. Peter Anvin [Mon, 16 Jun 2008 04:01:25 +0000 (21:01 -0700)]
Merge branch 'nasm-2.03.x'

Conflicts:

CHANGES

16 years agoCHANGES: call the next version on this branch 2.03.01
H. Peter Anvin [Mon, 16 Jun 2008 04:00:16 +0000 (21:00 -0700)]
CHANGES: call the next version on this branch 2.03.01

Call the next version on this branch 2.03.01.

16 years agosyncfiles: use the same regexp for hints as mkdep uses
H. Peter Anvin [Mon, 16 Jun 2008 01:35:01 +0000 (18:35 -0700)]
syncfiles: use the same regexp for hints as mkdep uses

Use the same regular expression for hints in both mkdep and syncfiles.

16 years agosyncfiles: handle the case of the null path separator
H. Peter Anvin [Mon, 16 Jun 2008 01:33:03 +0000 (18:33 -0700)]
syncfiles: handle the case of the null path separator

Correctly handle the null path separator (meaning remove the directory
portion entirely.)

16 years agoutf.asm: add some error cases
H. Peter Anvin [Mon, 16 Jun 2008 00:53:12 +0000 (17:53 -0700)]
utf.asm: add some error cases

Add some error cases for testing

16 years agosyncfiles.pl: remove obsolete comment
H. Peter Anvin [Mon, 16 Jun 2008 00:52:45 +0000 (17:52 -0700)]
syncfiles.pl: remove obsolete comment

There isn't anything magic about the input file syntax.

16 years agoFree EOT_DB_STRING_FREE in cleanup_insn()
H. Peter Anvin [Mon, 16 Jun 2008 00:39:45 +0000 (17:39 -0700)]
Free EOT_DB_STRING_FREE in cleanup_insn()

Free EOT_DB_STRING_FREE data in cleanup_insn(), which is where we free
all the other extop data.

16 years agoMark Perl scripts executable
H. Peter Anvin [Sun, 15 Jun 2008 23:55:39 +0000 (16:55 -0700)]
Mark Perl scripts executable

Be consistent about marking Perl scripts executable, even if we always
invoke them with $(PERL) in the Makefiles.

16 years agoScript to automagically synchronize the object file lists
H. Peter Anvin [Sun, 15 Jun 2008 23:54:29 +0000 (16:54 -0700)]
Script to automagically synchronize the object file lists

Add a script to automagically synchronize the list of object files
between the various Makefiles.

16 years agoUpdate Mkfiles/*.mak
H. Peter Anvin [Sun, 15 Jun 2008 23:18:43 +0000 (16:18 -0700)]
Update Mkfiles/*.mak

Sync the file list in Mkfiles/*.mak

16 years agoCHANGES: Document new features
H. Peter Anvin [Sun, 15 Jun 2008 04:37:46 +0000 (21:37 -0700)]
CHANGES: Document new features

16 years agoMerge branch 'nasm-2.03.x'
H. Peter Anvin [Sun, 15 Jun 2008 04:36:56 +0000 (21:36 -0700)]
Merge branch 'nasm-2.03.x'

16 years agoCHANGES: document changes from nasm-2.03
H. Peter Anvin [Sun, 15 Jun 2008 04:36:18 +0000 (21:36 -0700)]
CHANGES: document changes from nasm-2.03

16 years agodoc: Add Unicode Strings to Unicode index
H. Peter Anvin [Sun, 15 Jun 2008 04:23:39 +0000 (21:23 -0700)]
doc: Add Unicode Strings to Unicode index

16 years agoDocument __utf16__ and __utf32__
H. Peter Anvin [Sun, 15 Jun 2008 04:21:17 +0000 (21:21 -0700)]
Document __utf16__ and __utf32__

16 years agoMerge branch 'nasm-2.03.x'
H. Peter Anvin [Sun, 15 Jun 2008 04:10:21 +0000 (21:10 -0700)]
Merge branch 'nasm-2.03.x'

16 years agoquote: fix termination condition for hexadecimal escapes
H. Peter Anvin [Sun, 15 Jun 2008 04:09:39 +0000 (21:09 -0700)]
quote: fix termination condition for hexadecimal escapes

Fix reversed test for hexadecimal escape sequence termination.

16 years agoSupport __utf16__ and __utf32__ in an expression context
H. Peter Anvin [Sun, 15 Jun 2008 04:08:38 +0000 (21:08 -0700)]
Support __utf16__ and __utf32__ in an expression context

Support __utf16__ and __utf32__ in expression contexts.

16 years agostrfunc: fix UTF-8 mid-character limit
H. Peter Anvin [Sun, 15 Jun 2008 04:07:09 +0000 (21:07 -0700)]
strfunc: fix UTF-8 mid-character limit

16 years agostrfunc: always null-terminate the output buffer
H. Peter Anvin [Sun, 15 Jun 2008 03:53:45 +0000 (20:53 -0700)]
strfunc: always null-terminate the output buffer

Make sure that the buffer is always null-terminated, even though we do
have to use the length, since the string can (and often will) have
embedded nulls.

16 years agoImplement __utf16__() and __utf32__() for the DB family
H. Peter Anvin [Sat, 14 Jun 2008 23:53:48 +0000 (16:53 -0700)]
Implement __utf16__() and __utf32__() for the DB family

Implement __utf16__() and __utf32__() for the DB family of
pseudo-instructions.  Not yet implemented for evaluation context.

16 years agodoc: add a couple of stylistic alternatives
H. Peter Anvin [Sat, 14 Jun 2008 19:09:25 +0000 (12:09 -0700)]
doc: add a couple of stylistic alternatives

Add a few alternate font sets for the documentation.  I would be
interested to see if anyone thinks they are better.

16 years agoMerge branch 'nasm-2.03.x'
H. Peter Anvin [Thu, 12 Jun 2008 16:33:32 +0000 (09:33 -0700)]
Merge branch 'nasm-2.03.x'

16 years agoFix overflow in listing.c (BR 1991797)
H. Peter Anvin [Thu, 12 Jun 2008 16:31:19 +0000 (09:31 -0700)]
Fix overflow in listing.c (BR 1991797)

Fix a buffer overflow in listing.c (BR 1991797).

Putting this on the nasm-2.03.x branch as a potential candidate for a
patch release.

16 years agodoc: Nasm -> NASM
H. Peter Anvin [Thu, 12 Jun 2008 04:09:22 +0000 (21:09 -0700)]
doc: Nasm -> NASM

Consistently write NASM in all capitals

16 years agodoc: title capitalization
H. Peter Anvin [Thu, 12 Jun 2008 01:52:54 +0000 (18:52 -0700)]
doc: title capitalization

16 years agodoc: add missing period.
H. Peter Anvin [Thu, 12 Jun 2008 01:51:14 +0000 (18:51 -0700)]
doc: add missing period.

16 years agodoc: remove obsolete note.
H. Peter Anvin [Thu, 12 Jun 2008 01:50:41 +0000 (18:50 -0700)]
doc: remove obsolete note.

16 years agodoc: Makefile fixes missing from previous checkin
H. Peter Anvin [Thu, 12 Jun 2008 01:38:15 +0000 (18:38 -0700)]
doc: Makefile fixes missing from previous checkin

16 years agodoc: another case of the RTF backend corrupting state
H. Peter Anvin [Thu, 12 Jun 2008 01:32:33 +0000 (18:32 -0700)]
doc: another case of the RTF backend corrupting state

Another case of the RTF backend corrupting global state.  "Fix" it by
only outputting one format at a time; this also makes it possible to
run in parallel.

16 years agodoc: ps/pdf: set page numbers in normal-sized italic
H. Peter Anvin [Thu, 12 Jun 2008 01:23:14 +0000 (18:23 -0700)]
doc: ps/pdf: set page numbers in normal-sized italic

Set page numbers in normal-sized italic, instead of large and bold.
We might want to consider using bold italic, but I think this is just
fine.

16 years agodoc: Add NASMENV to the index (BR 1917084)
H. Peter Anvin [Thu, 12 Jun 2008 01:14:24 +0000 (18:14 -0700)]
doc: Add NASMENV to the index (BR 1917084)

Add NASMENV to the documentation index.

16 years agops/pdf doc: default to 10-point font, wider leading
H. Peter Anvin [Thu, 12 Jun 2008 01:09:02 +0000 (18:09 -0700)]
ps/pdf doc: default to 10-point font, wider leading

Switch the main font to 10 points Times Roman, but leave the leading
at 11 points.  This produces, in my opinion, a much more legible and
printable document.

16 years agoMake -F imply -g (BR 1991213)
H. Peter Anvin [Thu, 12 Jun 2008 01:07:40 +0000 (18:07 -0700)]
Make -F imply -g (BR 1991213)

When the user specifies -F, imply the -g option.  Too many users seem
to make this mistake.

16 years agoCorrect X86_64 reference in dwarf support message
Charles Crayne [Wed, 11 Jun 2008 23:15:01 +0000 (16:15 -0700)]
Correct X86_64 reference in dwarf support message

16 years agoUse an explicit table for tolower() to avoid a function call
H. Peter Anvin [Wed, 11 Jun 2008 22:49:41 +0000 (15:49 -0700)]
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.

16 years agoRemove expand_macros_in_string()
H. Peter Anvin [Wed, 11 Jun 2008 01:29:11 +0000 (18:29 -0700)]
Remove expand_macros_in_string()

Remove the now-unused expand_macros_in_string() function.

16 years agoAdd %warning, saner unquoting of %error
H. Peter Anvin [Wed, 11 Jun 2008 01:27:38 +0000 (18:27 -0700)]
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.

16 years agonasmlib.c: fwriteint*() only need WORDS_LITTLEENDIAN
H. Peter Anvin [Tue, 10 Jun 2008 21:44:09 +0000 (14:44 -0700)]
nasmlib.c: fwriteint*() only need WORDS_LITTLEENDIAN

fwriteint*() don't require unaligned references, so they can be
optimized for WORDS_LITTLEENDIAN rather than X86_MEMORY...

16 years agoFix typo: s/most/least/
H. Peter Anvin [Tue, 10 Jun 2008 21:41:43 +0000 (14:41 -0700)]
Fix typo: s/most/least/

Littleendian = least signficant byte first

16 years agoMake it possible to use "inline" and "restrict"
H. Peter Anvin [Tue, 10 Jun 2008 20:00:27 +0000 (13:00 -0700)]
Make it possible to use "inline" and "restrict"

Put the appropriate machinery in place to be able to use the "inline"
and "restrict" keywords with appropriate semantics.

16 years agoIntroduce likely/unlikely macros, use them in saa.c
H. Peter Anvin [Tue, 10 Jun 2008 16:35:26 +0000 (09:35 -0700)]
Introduce likely/unlikely macros, use them in saa.c

Introduce the likely() and unlikely() macros, as used in Linux.
They are compiler-dependent hints that a particular boolean expression
is likely to be true or false, respectively.

Currently only implemented for gcc.

16 years agoSAA: optimize all power-of-two lengths
H. Peter Anvin [Tue, 10 Jun 2008 16:31:31 +0000 (09:31 -0700)]
SAA: optimize all power-of-two lengths

We can actually use the shift optimization whenever blk_len ==
SAA_BLKLEN, which will be true for all powers of two.

16 years agoSAA: optimize seeks when used on a byte array
H. Peter Anvin [Tue, 10 Jun 2008 16:29:20 +0000 (09:29 -0700)]
SAA: optimize seeks when used on a byte array

In practice, we only ever use the seeking functions on byte arrays
(elem_len == 1).  Optimize for that case, to avoid a general divmod
operation.

16 years agoMake strings a first-class token type; defer evaluation
H. Peter Anvin [Tue, 10 Jun 2008 03:45:19 +0000 (20:45 -0700)]
Make strings a first-class token type; defer evaluation

Make strings a proper, first-class token type, instead of relying on
the "TOKEN_NUM with tv_charptr" hack.  Only convert a string to a
number if requested in an expression context; this also makes it
possible to actually issue a warning when it overflows.

16 years agoMove all the RAA code out of nasmlib
H. Peter Anvin [Tue, 10 Jun 2008 00:40:16 +0000 (17:40 -0700)]
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.

16 years agosaa.h doesn't need nasmlib.h
H. Peter Anvin [Tue, 10 Jun 2008 00:35:33 +0000 (17:35 -0700)]
saa.h doesn't need nasmlib.h

We don't have to include nasmlib.h in saa.h

16 years agoMove all the SAA code out of nasmlib
H. Peter Anvin [Tue, 10 Jun 2008 00:32:43 +0000 (17:32 -0700)]
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.

16 years agoMerge branch 'nasm-2.03.x'
H. Peter Anvin [Mon, 9 Jun 2008 17:21:18 +0000 (10:21 -0700)]
Merge branch 'nasm-2.03.x'

16 years agoFix %? in multi-line macros with a label
H. Peter Anvin [Mon, 9 Jun 2008 17:18:45 +0000 (10:18 -0700)]
Fix %? in multi-line macros with a label

The handling of %? in multi-line macros was broken when the macro name
was preceeded by a label; it would expand to the label instead of the
macro name.  This was particularly serious since this was used in
the macro implementation of INCBIN.

16 years agoReplace the WSAA macros with functions
H. Peter Anvin [Mon, 9 Jun 2008 04:15:01 +0000 (21:15 -0700)]
Replace the WSAA macros with functions

Change the WSAA macros into functions; reducing the icache footprint.

16 years agoUse autoconf to detect WORDS_LITTLEENDIAN
H. Peter Anvin [Mon, 9 Jun 2008 03:53:29 +0000 (20:53 -0700)]
Use autoconf to detect WORDS_LITTLEENDIAN

Use autoconf to detect littleendian word order, and use
WORDS_LITTLEENDIAN instead of X86_MEMORY when we don't require
unaligned memory accesses to be permitted.

16 years agoWSAA: make the WSAA macros contain their own buffer
H. Peter Anvin [Mon, 9 Jun 2008 01:39:55 +0000 (18:39 -0700)]
WSAA: make the WSAA macros contain their own buffer

Make the WSAA macros contain their own buffer definitions.  This
eliminates the need to have a separate "workbuf" declared in the
outelf backends, which isn't even used for anything else, except for a
few completely redundant strcpys.

Note: these macros probably should be replaced with actual
functions.  The overhead of the function call is likely to be more
than offset by lower icache footprint.