instead of re2c-generated code. This gives identifier recognition a
significant speedup and also drastically shortens compilation time of yasm
itself. This rewrite encouraged combining instruction and prefix
recognition into one function and register and target modifier
recognition into a second function (rather than having 5 or so separate
functions).
Also created a state in the NASM parser (as was done in the GAS parser),
so instructions/prefixes are only looked for until an instruction is
recognized. This avoids search time in the instructions hash for operands.
The tool used to generate the new identifier recognition is called GAP.
Someday we might extend this to generate more code than just the perfect
hash lookup.
* tools/gap: New tool to Generate Architecture Parser (aka perfect hashes).
* phash.c, phash.h: Helper functions used by GAP-generated code.
* x86id.re: Delete. Split into..
* x86parse.gap: Contains all identifier recognition portions.
* x86id.c: Contains instruction operand tables and code and higher-level
entry points into x86parse.gap perfect hash recognizers. Chose to flow
history of x86id.re into this file.
* arch.h: Combine instruction/prefix entry points and register/target
modifier entry points.
* lc3barch.c, lc3bid.re, lc3barch.h: Update to match.
* x86arch.c, x86arch.h: Update to match.
* Makefile.am, various Makefile.inc: Update.
* POTFILES.in: Update due to numerous file changes (not just this commit).
* Mkfiles: Update. VC build files untested at the moment.
svn path=/trunk/yasm/; revision=1395
(NASM syntax) in 64-bit mode. While I'm here, make all ret forms in GAS mode
match GAS output.
Noticed by: Stefan <SMarF@gmx.de>
svn path=/trunk/yasm/; revision=1393
The fix for this rippled into a lot of places, and I'm starting to see some
opportunities for cleaning up some of the object and objfmt structures.
* objfmt.h (yasm_objfmt_add_default_section): Move from standalone function
into objfmt-specific function.
(yasm_objfmt_module): Remove default_section_name string, and add objfmt
specific add_default_section function.
* yasm.c (main): Use slightly updated parameters when calling.
* section.h (yasm_section_is_default, yasm_section_set_default): New.
* section.c (yasm_section): Add def member (for default section flag).
(yasm_section_is_default, yasm_section_set_default): Implement.
* xdf-objfmt.c, bin-objfmt.c, dbg-objfmt.c, coff-objfmt.c: Implement.
Usually this required refactoring the objfmt-specific section data creation
into a separate function that could be used by both section_switch() and
the new add_default_section() functions, and changing section_switch() to
update changes to the section data if section was new or previously just a
default section, instead of the previous behavior of warning if the section
was not new.
* objfmt.c: Delete (no longer needed).
* Makefile.inc, Makefile.flat, libyasm.vcproj
Makefile.dj: Update to reflect removal.
* xdf-overdef.asm, win32-overdef.asm, elf-overdef.asm: Test.
svn path=/trunk/yasm/; revision=1390
alignment bytecode rather than just times'ing a NOP. This generates better
NOP code.
The new align only triggers when the NASM align directive is used unadorned
or with nop as the parameter (e.g. "align 16" or "align 16, nop"). Other
uses, including all uses of balign, maintain their old NASM behavior. This
is somewhat useful if you still want a string of NOPs rather than more
optimized instruction patterns: just use "balign X, nop" rather than
"align X". The new align also follows the GAS behavior of increasing the
section's alignment to be the specified alignment (if not already larger).
While I was in here, I found and fixed a bug in 16-bit alignment generation
(typo). I also changed the x86 32-bit code alignment fill pattern per
suggestions in the AMD x86 code optimization manual.
* nasm-bison.y: Implement a new [align] directive that can take a single
parameter (the alignment) and generate a nop-generating align bytecode.
* standard.mac: Change align macro to generate [align] if the second
macro parameter is nonexistent or "nop".
* x86arch.c (x86_get_fill): Update 32-bit fill pattern and fix bug in 16-bit
fill pattern.
svn path=/trunk/yasm/; revision=1389
debug information is generated if no file/loc directives are used. Also will
generate basic DWARF2 info/abbrev/aranges if not specified in source. What's
not handled is multiple code sections; I need to figure out how DWARF2 expects
these to be generated.
The implementation of this refactors all the line generation into
dwarf2-line.c and makes dwarf2-dbgfmt.c contain only the core DWARF2
functions.
One challenge yet to be taken care of is how to test the automatic generation,
as the current working directory is saved into the output object file.
* dwarf64_2loc: Update so built-in info generation doesn't happen.
svn path=/trunk/yasm/; revision=1376
initial traversal of object sections. This ensures any symbols generated by
elf_objfmt_create_dbg_secthead() are properly accounted for.
(elf_objfmt_create_dbg_secthead): Update to be properly called from traversal.
svn path=/trunk/yasm/; revision=1374
or the current BITS-derived operation size.
* x86id.re (OPS_BITS): New match rule for size == BITS setting.
(push_insn): Use OPS_BITS for 16-bit/32-bit mode, and reuse GAS rule for
64-bit mode.
(yasm_x86__finalize_insn): Set size_lookup[7] to BITS setting. Set opersize
based on this value if OPS_BITS is used.
* pushnosize.asm: New test for push imm, both sized and unsized, in all BITS
modes.
svn path=/trunk/yasm/; revision=1371
* intnum.h (yasm_intnum_check_size): Remove reference to nonexistent param
"is_signed" (this was replaced a long time ago with the rangetype param).
svn path=/trunk/yasm/; revision=1368
signed LEB128-encoded numbers straight from long values (rather than going
through intnum).
(yasm_get_uleb128, yasm_size_uleb128): Likewise, for unsigned LEB128.
* intnum.c (get_leb128, size_leb128): Move most of functionality here from:
(yasm_intnum_get_leb128, yasm_intnum_size_leb128): Here (refactor).
(yasm_get_sleb128, yasm_size_sleb128, yasm_get_uleb128, yasm_size_uleb128):
Implement using refactored functionality.
svn path=/trunk/yasm/; revision=1366
fixing underlying HAMT implementation to match. Change is to reflect that
traversal stops when subfunction return is nonzero.
* hamt.h (HAMT_traverse): Update doxygen comment for stop on nonzero instead
of stop on zero.
* hamt.c (HAMT_traverse): Implement.
* symrec.c, xdf-objfmt.c, elf-objfmt.c, coff-objfmt.c: Update return values
for subfunctions.
svn path=/trunk/yasm/; revision=1365
The only way to cause this to happen is with incbin, and while we do have a test intended for this,
it doesn't actually check this functionality due to a change made to unbreak distcheck; next up is
figuring out a good test that will work for different source/build directories.
svn path=/trunk/yasm/; revision=1362
the source filename stored in the object file (as GAS does). The internals
of this move the source and object filename data into the yasm_object
structure and simplify the dbgfmt and objfmt interfaces to remove this
information from function parameters.
* section.c (yasm_object_create): Add src_filename and obj_filename params.
(yasm_object_set_source_fn, yasm_object_get_source_fn)
(yasm_object_get_object_fn): New.
* section.h: Prototype.
* objfmt.h (yasm_objfmt_create): Remove in_filename param.
(yasm_objfmt_output): Remove obj_filename param.
* bin-objfmt.c, dbg-objfmt.c, coff-objfmt.c, xdf-objfmt.c: Update.
* elf-objfmt.c: Update.
* elf.c (elf_strtab_entry_set_str): New ELF support function.
* elf.h (elf_strtab_entry_set_str): Prototype.
* dbgfmt.h (yasm_dbgfmt_create): Remove in_filename and obj_filename params.
* null-dbgfmt.c, stabs-dbgfmt.c, dwarf2-dbgfmt.c: Update.
* dwarf2-dbgfmt.c (dwarf2_dbgfmt_directive): Implement .file "foo.c".
* yasm.c (main): Update to match yasm_object, objfmt and dbgfmt changes.
svn path=/trunk/yasm/; revision=1356
passthrough information for line numbers through the use of the .loc and
.file directives in the GAS parser and does NOT generate line numbers for
raw assembly files. This will be added next, after the other Mkfiles are
updated.
* dwarf2-dbgfmt.c: New.
* elf-objfmt.c (elf_objfmt_dbgfmt_keywords): Add to list of supported dbgfmts.
* coff-objfmt.c (elf_objfmt_dbgfmt_keywords): Likewise.
* elf-objfmt.c (elf_objfmt_create_dbg_secthead): Support all DWARF2 debug_*
sections.
* dwarf2/tests: Tests for passthrough cases for ELF32, ELF64, and Win64.
svn path=/trunk/yasm/; revision=1350
bytes.
(yasm_arch_get_address_size): Get the active address size in bits.
* lc3barch.c, x86arch.c: Implement.
These are needed for the DWARF2 dbgfmt, but may be useful for other things
in the future.
svn path=/trunk/yasm/; revision=1349
* splitpath.c (yasm__splitpath_unix, yasm__splitpath_win): New.
* coretype.h: Prototype above and alias yasm__splitpath.
* splitpath_test.c: New test for above.
svn path=/trunk/yasm/; revision=1345