Peter Johnson [Sun, 2 Dec 2001 21:18:04 +0000 (21:18 -0000)]
Allow overrides (a32/a16/rep/etc) to appear on their own line. The way this
is done in the grammer causes 1 shift/reduce and 1 reduce/reduce conflict, but
yacc's default resolution gives correct results, and as the generated grammer
is smaller this way than specifically handling each prefix, we do it this way.
Peter Johnson [Sun, 2 Dec 2001 06:40:17 +0000 (06:40 -0000)]
Do intl more correctly. nointl/libintl.h is unnecessary; it can be detected
in util.h by the ENABLE_NLS define. Fix Mkfiles to reflect. Actually enable
if available in main().
Peter Johnson [Sat, 1 Dec 2001 09:16:27 +0000 (09:16 -0000)]
Change REG_SOMEREG -> reg_somereg and add rules that allow BYTE/WORD/DWORD
prefixes on such registers. Also fix bugs related to existing rules which
allowed those prefixes.
Peter Johnson [Sat, 1 Dec 2001 06:15:58 +0000 (06:15 -0000)]
Don't free EA when simplifying shift_op case. Not only is this code completely
wrong (the ModRM byte definitely must be kept), but it had a memory leak too
(it just freed the ea without calling expr_delete())!
Peter Johnson [Mon, 26 Nov 2001 17:37:09 +0000 (17:37 -0000)]
Switch from using ternary tree to Hash Array Mapped Trie (HAMT), which has
*much* less overhead.
XXX: current implementation of HAMT is *not* portable due to pointer alignment
restrictions (it uses the LSB of a pointer to store a flag). Need to write a
portable (if not so space-efficient) equivalent.
Peter Johnson [Wed, 21 Nov 2001 08:25:09 +0000 (08:25 -0000)]
Massive cleanup of debugging output (via _print() functions). All now take
FILE *'s to print to somewhere other than stdout, and the formatting is
improved through the use of a global indent_level.
Changes to main() include the ability to specify an output file.
Peter Johnson [Wed, 21 Nov 2001 03:17:43 +0000 (03:17 -0000)]
Polish up most directive support. This necessitated adding objfmt-specific
data pointers to symrec for extern/common/etc. Also fixed parsing of direxpr;
it didn't allow exprs with ID's before.
Peter Johnson [Tue, 20 Nov 2001 21:02:17 +0000 (21:02 -0000)]
Don't do REG_E?AX combining with reg8/reg8x instructions, to allow things like
"ADD AX, byte 8" to generate the same code as NASM does (OT: this doesn't save
any space because the reg8x form needs a ModRM, but if it's what the user
wants, do it).
Peter Johnson [Mon, 19 Nov 2001 06:47:14 +0000 (06:47 -0000)]
Print "undefined symbol" message for all undefined symbols. Also make a little
nicer output by only outputting the "reported only once" informational message
once, for the first (line-wise) error.
Note: this isn't foolproof, as different files have different line countings...
need a monotonically increasing "line" counter to fix this. This is a problem
in more areas than just here, though.
Peter Johnson [Mon, 19 Nov 2001 04:25:44 +0000 (04:25 -0000)]
Don't try to redefine a label for an already existing segment. Thus, add a
return flag from sections_switch_general() to indicate if the segment is new,
which is checked in objfmt_sections_switch().
Peter Johnson [Mon, 19 Nov 2001 04:15:22 +0000 (04:15 -0000)]
Fix a memory re-free issue in nasm_parser_directive(). vp->param was passed
to a function that keeps the pointer, and then the pointer is freed. Whoops!
Peter Johnson [Mon, 19 Nov 2001 03:27:56 +0000 (03:27 -0000)]
- Greatly enhance capabilities of directives (they're actually parsed now).
objfmt interface changed a lot due to this.
- New variables cur_objfmt and cur_parser that define what objfmt/parser are
active. They're set in main() by searching through the list of objfmts and
parsers. This necessitated libyasm.a to be listed twice in LDADD.
Peter Johnson [Sun, 18 Nov 2001 07:06:05 +0000 (07:06 -0000)]
Add symrec_delete() for deleting non-table symbols. Use it from expr_delete().
Also allow the sect for labels to be NULL (special case for new directive
handling code).
Peter Johnson [Sat, 17 Nov 2001 08:39:14 +0000 (08:39 -0000)]
Decided to go ahead and commit these little NASM-syntax test files I've been
using for testing various things during development. Many don't even actually
assemble, as they're testing error conditions. These all need to be integrated
into a test suite at some point to be truly useful.
Peter Johnson [Sat, 17 Nov 2001 08:33:23 +0000 (08:33 -0000)]
Modify so that almost everything passes LCLint with the options in lclint.sh.
This is actually worthwhile; I found and fixed a few bugs/edge cases while
doing this.
For more information on LCLint, see <http://lclint.cs.virginia.edu/>.
Peter Johnson [Fri, 16 Nov 2001 22:05:24 +0000 (22:05 -0000)]
Fix some nits found by lclint. Still something weird going on with list2 in
mergesort(), according to lclint, but I haven't figured out if it's real or
not.
Peter Johnson [Sat, 3 Nov 2001 06:22:55 +0000 (06:22 -0000)]
Start framework for separating architecture-dependent functions and data
structures from the rest of the assembler. We're not trying to write GAS
here (yet :), but doing this will make large parts of the codebase a lot
clearer.
Peter Johnson [Sat, 3 Nov 2001 05:17:51 +0000 (05:17 -0000)]
Add coretype.h, make util.h do a lot more, use util.h to simplify include
sections of C files. Also remove IdPath from top comment in files where
RCSID() is used. Move RCSID() to immediately after util.h include.
Peter Johnson [Sat, 3 Nov 2001 04:13:42 +0000 (04:13 -0000)]
bytecode_print(): Change how NULL values are output for imm and multiple.
bytecode_parser_finalize_insn(): Add some preliminary imm handling. Handle
shift_op special-casing (,1 hack).
Peter Johnson [Thu, 1 Nov 2001 03:51:26 +0000 (03:51 -0000)]
Optimize expression building a bit in expr_new() by eliminating IDENT's here.
This saves a lot of extra unnecessary recursions when the expr gets to the
simplification stage.
Peter Johnson [Mon, 29 Oct 2001 00:01:31 +0000 (00:01 -0000)]
Add option for malloc debugging using dmalloc library (http://dmalloc.com/).
Remove unnecessary stdlib includes (because we use xmalloc instead of malloc).
Peter Johnson [Sun, 28 Oct 2001 09:22:13 +0000 (09:22 -0000)]
*COMPLETELY* rewrite most of expression handling.
Features:
- More complex memory expressions like [bx-(bx-di)] are now calculated through
as valid.
- Much better simplification.
Internal changes:
- More flexible n-way tree (rather than old binary-only).
- Many new functions to simplify and deal with very complex expressions.