summaryrefslogtreecommitdiff
path: root/parser.c
Commit message (Collapse)AuthorAgeFilesLines
* BR3104852: only warn once for repeated prefixesVictor van den Elzen2010-11-211-1/+1
|
* Revert "Improve process_ea and introduce -OL"H. Peter Anvin2010-07-251-1/+0
| | | | | | | | | | This reverts commit ac732cb6a599836bf4c988e59ac6de4498758c72. Resolved Conflicts: doc/nasmdoc.src Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Improve process_ea and introduce -OLVictor van den Elzen2010-07-241-0/+1
| | | | | | | | | | | | | | | | | | | Two fixes: 1. Optimization of [bx+0xFFFF] etc 0xFFFF is an sbyte under 16-bit semantics, so make sure to check it right. 2. Don't optimize displacements in -O0 Displacements that fit into an sbyte or can be removed should *not* be optimized in -O0. Implicit zero displacements are still optimized, e.g.: [eax] -> 0 bit displacement, [ebp] -> 8 bit displacement. However explicit displacements are not optimized: [eax+0] -> 32 bit displacement, [ebp+0] -> 32 bit displacement. Because #2 breaks compatibility with 0.98, I introduced a new optimization level: -OL, legacy.
* Revert "BR 2887108: Use overflow_ helper to catch inappropriate imm ↵Cyrill Gorcunov2009-11-011-9/+8
| | | | | | | | | | | | | | | optimization" This reverts commit 41208028ff52d190044ee7532bf14c5aca0f899a. | | From: "H. Peter Anvin" <hpa@zytor.com> | | The tests for overflow_signed() are wrong too. Those are relevant for if a | warning should be issued, but not for how the value should be encoded in | the byte stream. | Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
* Various tab/space/comment cleanupCyrill Gorcunov2009-10-311-209/+213
| | | | | | No change on binary level Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* stdscan: switch to stdscan_get/set routinesCyrill Gorcunov2009-10-311-5/+5
| | | | | | | | | | Instead of manipulating stdscan buffer pointer directly we switch to a routine interface. This allow us to unify stdscan access: ie caller should "talk" to stdscan via stdscan_get/set routines. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* nasmlib: Introduce idata_bytes helperCyrill Gorcunov2009-10-311-37/+18
| | | | | | This allow us to eliminate code duplication Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* BR 2887108: Use overflow_ helper to catch inappropriate imm optimizationCyrill Gorcunov2009-10-311-8/+9
| | | | | | | | | | | | | We should use overflow_ helpers before check if an immediate operand fit a type range, otherwise we may loose high bits. For example when we assemble the following instruction imul eax,eax,0x10000 with -Ox passed we optimze it up to imm8 though it must be imm32. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* parser.c: pasrse_line -- fix alignmentCyrill Gorcunov2009-10-141-3/+3
| | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* Use I_none opcode instead of hardcoded numberCyrill Gorcunov2009-08-231-18/+18
| | | | | | | | Consolidate I_none opcode to be used everywhere instead of mix (-1,I_none). Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Fix some format strings for nasm_errorVictor van den Elzen2009-08-111-3/+3
| | | | | Added a format attribute to nasm_error (only for GCC) and used the resulting warnings to fix some format strings.
* Drop efunc and evaluate argument to parse_line()H. Peter Anvin2009-07-181-49/+47
| | | | | | | | We never invoked the parser with anything but the default definitions for evaluate and efunc. Unlike the backend, though, we sometimes invoke parse_line() with redefine_label() instead of define_label(). Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Drop the ofmt and errfunc arguments to label definition functionsH. Peter Anvin2009-07-181-4/+2
| | | | | | | | We never set ofmt and errfunc to anything but the global values. Dropping them from the label definition function command line simplifies the code. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* NASM: relicense under the 2-clause BSD licenseH. Peter Anvin2009-07-061-12/+0
| | | | | | | | *To the best of my knowledge*, we now have authorization from everyone who has significantly contributed to NASM in the past. As such, change the license to the 2-clause BSD license. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Add copyright headers to the *.c/*.h files in the main directoryH. Peter Anvin2009-06-281-6/+45
| | | | | | | | | | Add copyright headers to the *.c/*.h files in the main directory. For files where I'm sure enough that we have all the approvals, I have given them the 2-BSD license, the others have been given the "LGPL for now" license header. Most of them can probably be changed after auditing. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* parser.c: fix stylistic nitpickH. Peter Anvin2009-06-271-1/+0
| | | | | | Fix stray blank line in parser.c Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* parser: don't use midcode declarationsH. Peter Anvin2009-06-231-1/+2
| | | | | | OpenWatcom can't handle midcode variable declarations. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* BR 2782055: reject invalid tokens after ]Victor van den Elzen2009-06-231-8/+16
| | | | | A bracketed memory reference should be followed by a comma or the end of the line. Enforce this.
* Do not confuse segmentless adresses and unknown forward referencesVictor van den Elzen2009-02-251-0/+8
| | | | Also be optimistic with immediate forward references.
* BR 2592476: Treat WAIT as a prefix even though it's really an instructionH. Peter Anvin2009-02-211-0/+2
| | | | | | WAIT is technically an instruction, but from an assembler standpoint it behaves as if it had been a prefix. In particular, it has to be ordered *before* any real hardware prefixes.
* Allow value to TIMES to be negative while optimization is in progressCharles Crayne2008-09-231-1/+1
| | | | | Change the parser to only issue the "TIMES value %d is negative" error message if all optimization passes have completed.
* Decouple forward references from optimizationCharles Crayne2008-09-101-11/+3
| | | | | | | | | | | | Users who wish to control the level of optimization can continue to specify -O0, -O1, or -Ox, where x can be the letter itself, or any number > 1. However, even with optimization turned off, NASM will always make enough passes to resolve forward references. As a result, INCBIN is now the only item left in the critical expressions list, although TIMES still has its own constant value check.
* Free EOT_DB_STRING_FREE in cleanup_insn()H. Peter Anvin2008-06-151-3/+4
| | | | | Free EOT_DB_STRING_FREE data in cleanup_insn(), which is where we free all the other extop data.
* Implement __utf16__() and __utf32__() for the DB familyH. Peter Anvin2008-06-141-72/+102
| | | | | Implement __utf16__() and __utf32__() for the DB family of pseudo-instructions. Not yet implemented for evaluation context.
* Make strings a first-class token type; defer evaluationH. Peter Anvin2008-06-091-1/+1
| | | | | | | 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.
* Remove EQU for critical expression listCharles Crayne2008-06-041-1/+1
| | | | | | Allow redefine_label to update segment as well as offset, thereby fixing bug which required EQU to be on the critical expression list.
* No 32-byte floating point format: fix error for DYH. Peter Anvin2008-05-201-0/+5
| | | | Output a more legible error message for floating-point with "DY".
* Avoid #including .c files; instead compile as separate unitsH. Peter Anvin2008-05-201-7/+6
| | | | | | Don't #include .c files, even if they are auto-generated; instead compile them as separate compilation units and let the linker do its job.
* Add DY, YWORD, and the SY instruction flagH. Peter Anvin2008-05-201-2/+12
| | | | | Add the DY instruction, YWORD keyword, and an SY marker for instruction sizes. Add a few more AVX sample instructions.
* Correctly identify SBYTE in the optimizerH. Peter Anvin2008-04-041-3/+10
| | | | | Correctly identify SBYTE in the optimizer, *HOWEVER*, this change will cause nuisance warnings to be issued; that will have to be fixed.
* Restore critical expression checking when optimizer enabledCharles Crayne2008-03-261-1/+2
| | | | | | In the prior code, enabling optimization effectively diabled critical expression checking, because the optimization passes took place before checking was enabled.
* regularized spelling of license to match name of LICENSE fileBeroset2007-12-291-1/+1
|
* Clean up remaining build warningsH. Peter Anvin2007-11-181-3/+4
| | | | | | Clean up remaining build warnings. None of this should affect code operations. The only warnings which were actually relevant might have been the ones in ldrdf.c, but it's not clear if anyone ever uses that.
* Permit opcode names as labels as long as they are followed by a colonH. Peter Anvin2007-11-041-2/+20
| | | | | | | | Permit opcode names to be used as labels if and only if they are succeeded by a colon. Opcode names occurring when parsing expressions are all treated as labels; a leading colon occurred when parsing an instruction forces a parser restart with the instruction forcibly treated as an identifier.
* Use a 32-bit floating-point limb size; support 8-bit floatH. Peter Anvin2007-10-291-1/+4
| | | | | | | | | | Use a 32-bit limb size ("like a digit, but bigger") for floating-point conversion. This cuts the number of multiplications per constant by a factor of four. This means supporting fractional-limb-sized numbers, so while we're at it, add support for 8-bit floating point numbers (apparently used in graphics and in audio compression applications.)
* Reduce severity of redundant prefixes from error to warning.Charles Crayne2007-10-291-1/+5
|
* Clean up stealth whitespaceH. Peter Anvin2007-10-281-1/+1
| | | | Remove stealth whitespace
* 64-bit addressing and prefix handling changesH. Peter Anvin2007-10-281-103/+152
| | | | | | | | | Revamp the address- and prefix-handling code to make more sense in 64-bit mode. We are now a lot closer to where we want to be, but we're not quite there yet. ndisasm may very well have problems, or give counterintuitive output. However, checking it in so we can make forward progress.
* Use the compiler-provided booleans if available, otherwise emulateH. Peter Anvin2007-10-101-9/+9
| | | | | | | 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.
* Change cloc_t to struct location, and reorder the membersH. Peter Anvin2007-10-031-2/+2
| | | | | | 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.
* BR 1352920: change loc_t -> cloc_tH. Peter Anvin2007-10-031-2/+2
| | | | | | 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.
* Portability fixesH. Peter Anvin2007-10-021-0/+2
| | | | | | | | | 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.)
* Fix handling of DO; support unary + for floating-point numbersH. Peter Anvin2007-09-181-7/+11
| | | | | Floating-point users generally expect to be able to use a unary plus. Fix support for the DO instruction in several places.
* Support 16-bit IEEE floating point; used in SSE5H. Peter Anvin2007-09-181-9/+15
| | | | | SSE5 supports standard IEEE 16-bit floating point, so we should support that too.
* Implement "oword" (128 bits) as a first-class sizeH. Peter Anvin2007-09-181-10/+25
| | | | | | Implement oword, reso, do, as well as the SO flag to instructions. No instructions are actually flagged with SO yet, but this allows us to specify 128-bit sizes in instruction patterns.
* Fix a few instances of missing renumbersH. Peter Anvin2007-09-171-2/+2
| | | | | parser.c: change hard-coded argument count 3 to MAX_ARGUMENTS assemble.c: change a few missed code renumbers
* Support r/m operands for non-integer typesH. Peter Anvin2007-09-121-1/+2
| | | | | | Support r/m operands for non-integer operands types, i.e. mmx or xmm operands. This allows mmx and xmm operands to be written more compactly, speeding up the assembler.
* Use enumerations where practical to ease debuggingH. Peter Anvin2007-09-121-0/+2
| | | | | | | | We have a lot of enumerations; by declaring fields as such, we make it easier when debugging, since the debugger can display the enumerations in cleartext. However, make sure exceptional values (like -1) are included in the enumeration, since the compiler otherwise may not include it in the valid range of the enumeration.
* Finishing touches on perfect hash tokenizer; actually turn the thing onH. Peter Anvin2007-08-301-0/+1
| | | | | | | | | 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.
* Correct the logic for recording fs: and gs: overrides.H. Peter Anvin2007-08-291-1/+1
|