acqn
164eb198ce
Moved type facility functions for deciding code generation type flags.
2022-10-12 13:10:17 +08:00
acqn
d1e84a6dae
Avoided unnecessary BSS name duplication for tentative global variables.
2022-10-11 14:23:21 +08:00
acqn
2cda47cd36
More descriptive names for SymEntry usage.
2022-10-11 14:14:48 +08:00
acqn
959be2c98c
SymEntry struct cleanups.
2022-10-11 14:14:38 +08:00
Bob Andrews
71d64a3c1c
Merge pull request #1857 from acqn/PPFix
...
[cc65] Improved preprocessor
2022-10-09 19:00:07 +02:00
acqn
9eab36b95a
Fixed block-scope extern declarations visibility.
...
Fixed missing file-scope static function codegen output in a rare care.
2022-09-30 14:32:08 +08:00
acqn
9900e7361d
#pragma message now uses the new "note" level message routine.
2022-09-30 09:09:09 +08:00
acqn
715aa919e6
C++ style comments in C89 mode will cause errors only once per input file.
2022-09-29 19:47:31 +08:00
acqn
29c9cb3e00
Improved diagnostics on conflicting type declarations.
2022-09-29 19:38:32 +08:00
acqn
96df4e8b5e
Added a diagnostic level "note" for infomative messages.
2022-09-29 19:38:32 +08:00
acqn
133507b031
Fixed line info for #pragma messages and diagnostics.
2022-09-29 17:55:09 +08:00
Rutger van Bergen
2b07204952
Merge branch 'cc65:master' into kim1
2022-09-19 20:03:23 +02:00
Rutger van Bergen
cb8cb876ec
Add documentation, make capitalization uniform
2022-09-19 19:56:57 +02:00
mrdudz
fd6d00a4dd
revert 6096a24
- this breaks the case when the "label" is an expression containing spaces.
...
fixes bug #1853
2022-09-17 14:41:59 +02:00
mrdudz
253af1ed07
Force 16bit address for absolute-indirect-x-indexed in 65816 mode.
...
should fix issue #1846 (and hopefully not break anything :))
2022-09-03 18:36:40 +02:00
acqn
b4ddd01d78
Fixed checks on __VA_ARGS__.
2022-09-01 12:58:52 +08:00
acqn
950606d46a
Improved diagnostics on wrong number of arguments in function-like macro calls.
2022-09-01 12:59:00 +08:00
acqn
92f94e4e5b
A space character will be inserted in front of a leading '#' pp-token as the result of macro expansion.
2022-09-01 12:58:52 +08:00
acqn
770e529b20
Fixed newline counting inside old C style comments.
2022-09-01 12:58:52 +08:00
acqn
3d1e322519
Fixed keeping spacing in certain rare cases.
2022-09-01 12:58:52 +08:00
acqn
942ee47d05
Changed supposed usage of the original line input stack. It is now used for reusing input lines.
2022-09-01 12:58:52 +08:00
acqn
dc001cb4be
Reverted E_ADDRESS_OF logic fix.
...
Added testcase.
2022-09-01 12:56:46 +08:00
mrdudz
5bda57de87
add extra underscore to _bzero, add a test for bzero/memset
2022-08-29 23:20:48 +02:00
mrdudz
d371046ae4
Despite not technically needed, it seems to be desirable to remove all trailing whitespace from inline assembly
2022-08-28 03:43:02 +02:00
mrdudz
6096a24f1d
dont add whitespace after a label to the actual label, this fixes the root cause of #1252
2022-08-28 03:41:48 +02:00
acqn
9f8bfb859c
Fixed handling adjacent macro expansions that should not concatenate.
...
Example: F()G /* expansion results of F() shall not be concatenated with G */
2022-08-22 14:34:50 +08:00
acqn
c7ff416ce9
Fixed wide strings for preprocessor.
2022-08-22 14:34:50 +08:00
acqn
be95cb8f58
Fixed stringized macro argument concatenation.
...
Example: #define s(a) L## #a.
2022-08-22 14:34:50 +08:00
acqn
6260414136
The '#' operator in macro replacement is now checked at macro definition instead of macro expansion.
2022-08-22 14:34:50 +08:00
acqn
2f6b5621cc
Changed handling on nested macro replacement to match up with the behavior of other major C compilers, which is unspecified by the C standard.
2022-08-22 14:34:50 +08:00
acqn
95e5471cd6
Better preprocess macro expansion.
2022-08-22 14:34:50 +08:00
acqn
43d2fd2a96
Added support for the popular __COUNTER__ macro.
2022-07-24 23:19:05 +08:00
Bob Andrews
d2628d5949
Merge pull request #1840 from acqn/FnParamFix
...
[cc65] Fixed function parameters declared as function types rather than function pointers
2022-08-26 23:19:55 +02:00
Bob Andrews
68610490c9
Merge pull request #1837 from acqn/PPLineFix
...
[cc65] Fixed predefined __FILE__, __LINE__ and added missing preprocessing directive #line
2022-08-26 23:12:59 +02:00
acqn
26945c32ac
Fixed function parameters declared as function types rather than function pointers.
2022-08-24 15:30:52 +08:00
acqn
57ad7c8766
Improved diagnostics about C++ style comments for c89.
2022-08-22 14:31:53 +08:00
acqn
fd7f32ecd3
Improved error handling and diagnostics with failed macro definitions.
2022-08-22 14:31:51 +08:00
acqn
9565f41381
Improved Diagnostic with #include.
2022-08-19 13:27:56 +08:00
acqn
5d5bd472c6
Removed extra whitespace at line ends in preprocess-only output (-E).
...
Increased threshold from 5 to 7 for skipped newlines with #line directives in preprocess-only output (-E).
2022-08-22 00:27:21 +08:00
acqn
79f97e7714
Reused code more for macros in preprocessing directives.
2022-08-22 00:24:28 +08:00
acqn
bb9c98f4c9
Added support for the #line directive.
2022-07-24 23:19:05 +08:00
acqn
36123c9c8f
Improved naming for stuff related to preprocessing directives.
2022-07-24 23:19:05 +08:00
acqn
624e5025b0
Fixed parsing wide char constants.
2022-08-17 22:28:00 +08:00
acqn
5cca1e8b1d
Fixed parsing numeric constants.
2022-08-11 10:55:16 +08:00
acqn
4bb4f033ea
Fixed the bug that C keywords were not simply recognized as identifiers in preprocessing.
2022-08-07 16:14:45 +08:00
acqn
7a139a800e
Added # and ## as punctuators recognized by the tokenizer.
...
Reorganized the token enum.
2022-08-06 18:45:49 +08:00
Bob Andrews
12b9b10355
Merge pull request #1832 from acqn/PPDefineFix
...
[cc65] Preprocessor directive #define fixes
2022-08-20 14:27:25 +02:00
Bob Andrews
03421694b2
Merge pull request #1817 from acqn/PPFix
...
[cc65] More preprocessor fixes
2022-08-19 21:37:16 +02:00
acqn
3fbefdef45
Fixed warning on forward declaration of enums.
...
Fixed the issue that global static variables put on zeropage were missing optimization.
2022-08-19 18:48:52 +08:00
acqn
cf7558add3
Added check for ## at either end of macro expansion.
2022-08-18 23:16:29 +08:00
acqn
47d5e74a6e
Modified way to keep undefined macro handling more consistent.
2022-08-18 22:51:23 +08:00
Bob Andrews
ec310fceb8
Merge pull request #1825 from ReallyNiceGuy/master
...
Revert: Parse file included inside a macro at definition time
2022-08-11 00:03:12 +02:00
acqn
78e80eb942
Fixed superfluous warning on pointer types comparing a non-void pointer to a void pointer.
2022-08-09 13:13:33 +08:00
Marco Aurelio da Costa
71a9ed04a2
Revert: Parse file included inside a macro at definition time
...
The reverted change broke too many use cases where users
where expecting the compiler quirky behavior to be the correct
behavior.
A better solution is needed for the quirk which does not break
current usage.
2022-08-07 11:24:47 -03:00
acqn
a3a5fbe809
Disallowed 'defined' as a macro name.
2022-08-07 13:56:47 +08:00
acqn
7971eec3cc
Fixed parentheses handling when a function-like macro name itself is used as an macro argument.
2022-08-07 12:45:48 +08:00
acqn
ae811baaf1
Fixed the bug that redefined macros could co-exist but not all be undefined with a single #undef.
2022-08-06 18:21:42 +08:00
acqn
0a051a4dee
Unsupported #pragma within argument lists of function-like macro invocation.
2022-08-06 16:56:28 +08:00
acqn
251e984ba8
Fixed error recovery with preprocessing directives failures.
2022-08-05 14:03:51 +08:00
Bob Andrews
2c742ffc1c
Merge pull request #1800 from acqn/PPFix
...
[cc65] Preprocessor fixes
2022-07-28 01:48:41 +02:00
acqn
f8d08b1e1a
More post-C99 predefined macros.
2022-07-26 21:40:19 +08:00
acqn
2f357ba9b2
Preprocessor directives can now appear in the argument list of function-like macro calls.
...
#pragma PP-tokens can now be macro replaced.
#include header names directly enclosed in <> are free of macro replacement.
Preprocess-only mode (-E) now outputs with #line as source info.
Moved testcases for #760 and #1357 .
Added testcase for #1643 .
2022-07-26 21:10:38 +08:00
acqn
80fc8cd11e
Added preprocessor warning on missing terminating characters of character/string literals.
2022-07-26 21:10:36 +08:00
acqn
2c9c8ee196
Fixed extra "Macro argument count mismatch" message when a macro argument list is unterminated.
2022-07-26 21:10:31 +08:00
acqn
60c1290468
Fixed the bug that preprocessor could run past the end of included files.
...
Fixed the wrong filename and 0 line number in disgnostics when a preprocessor error occurred at the end of a file.
Fixed diagnostics for missing #endif.
2022-07-26 21:10:26 +08:00
acqn
8289c94e69
Fixed skipped lines consist of a leading # followed by any non-directive PP-token sequence.
2022-07-26 14:28:27 +08:00
acqn
0063f73f8a
Fixed __FILE__ and __LINE__ macros for preprocessor.
2022-07-24 23:19:05 +08:00
acqn
7381a2c420
Added check for extra tokens at the end of directives.
...
Improved diagnostics on missing/illegal macro names.
2022-07-24 19:07:16 +08:00
acqn
be26b0631b
Fixed #ifdef and #ifndef.
2022-07-24 19:07:02 +08:00
acqn
066a5e0fec
Fixed #pragma charmap for string literals.
2022-07-24 16:38:41 +08:00
acqn
ac4cb258be
Removed a mysterious "Hey!" message.
2022-07-21 11:59:38 +08:00
acqn
16a8a64746
Use a dedicated expression parser for the preprocessor.
2022-07-21 11:10:02 +08:00
acqn
f91c8ad247
Allowed comments right after "#" in preporcessor directives.
2022-07-21 11:09:59 +08:00
acqn
d3d6de2704
Allowed the pp-tokens following #error and #warning directives to be optional.
2022-07-21 11:09:56 +08:00
Bob Andrews
560317c8ba
Merge pull request #1789 from acqn/PPDiagnostics
...
[cc65] Fixed ICE with duplicate macro parameters
2022-07-19 17:38:29 +02:00
Bob Andrews
6b0afe0834
Merge pull request #1785 from acqn/Effectless
...
[cc65] Avoid generating asm from C code that has no observable effects
2022-07-19 17:38:03 +02:00
Bob Andrews
c802980d6a
Merge pull request #1784 from acqn/Diagnostics
...
[cc65] Slight improvements on diagnostics
2022-07-19 17:37:42 +02:00
Bob Andrews
82b268ee50
Merge pull request #1783 from acqn/MiscFixes
...
[cc65] Misc fixes and improvements
2022-07-19 17:37:19 +02:00
mrdudz
7165b29809
omit an error message also when an unresolved import was added by the compiler. fixes bug #1551
2022-07-14 22:54:18 +02:00
mrdudz
a6b807b1d8
more verbose comment
2022-07-14 22:39:29 +02:00
acqn
9e3b759540
Fixed ICE with duplicate macro parameters.
2022-07-05 22:22:49 +08:00
Dave Plummer
799aec23a6
Add KIM-1 Support
2022-06-04 13:00:48 -07:00
rofl0r
94e7b11870
cl65: fix regression in --print-target-path
...
since the "empty prefix means run from current dir" hack was removed,
cl65 --print-target-path no longer prints the path relative to the
binary, but the hardcoded library path which points to prefix, because
the code adds the hardcoded path first to the pathsearch, but then actually
only returns the first entry rather than looking whether the path exists.
closes #1754
2022-05-30 12:22:02 +00:00
Greg King
93e94c8dea
Fixed a multi-line comment.
...
The left border is thicker in cc65 than it is in VICE.
2022-05-18 05:09:48 -04:00
compyx
2fdb1e6b0d
Fix set but unused variable
2022-05-17 10:05:25 +02:00
mrdudz
f67fb3b326
define __CC65__ as ((VER_MAJOR * 0x100) + VER_MINOR), fixes issue #1667
2022-05-10 01:12:13 +02:00
mrdudz
b6ffa4af64
Fix endless loop on expanding a recursive macro, fixed issue #1678 , patch by kugelfuhr
2022-05-09 21:26:45 +02:00
mrdudz
43af562ce1
At the end of the optimizer run, remove jump cascades again. fixes the
...
regression reported in #1652
2022-05-08 13:22:10 +02:00
mrdudz
5813fd81d3
add extra optimizer step that replaces BRA by JMP if the target is external
2022-05-08 13:20:18 +02:00
Bob Andrews
71cec58d86
Adjust comments
2022-05-05 14:24:02 +02:00
rofl0r
20dd6fd872
change GetProgPath() to return full & resolved binary path
...
GetProgPath() now resolves the path derived from argv[0] always
via realpath(3p) to its real location in the filesystem, and returns
the path including binary name, effectively making it work like
windows' GetModuleFileName(), so we can re-use the existing code
to strip the trailing binary name.
since symlinks are now always resolved, we no longer need the
special case code for linux to use /proc/self/exe for this purpose.
2022-05-02 08:22:21 +00:00
Bob Andrews
74f92564c3
Try reading from /proc/self first on linux, this is needed to make the edgy "make avail" work
2022-04-30 15:01:58 +02:00
rofl0r
d78672a4b4
rename AddSubSearchPathFromWinBin to AddSubSearchPathFromBin
2022-04-28 18:35:05 +00:00
rofl0r
b32c12dd83
implement AddSubSearchPathFromWinBin() counterpart for unix
...
this looks up paths relative to the binary used to start the
specific application.
2022-04-28 18:35:05 +00:00
rofl0r
8669710c0f
build: allow empty prefix
...
there was some concern that this will break windows' way of doing
file lookups relatively from the binary, rather than via hardcoded
locations, but so far each occurence adding e.g. "CA65_INC" to
the pathsearch is already shielded with an #ifndef _WIN32.
addressing #1726
2022-04-27 16:19:06 +00:00
mrdudz
7c7c5af59f
Merge remote-tracking branch 'upstream/master' into constexpr
2022-04-26 16:43:10 +02:00
rofl0r
13081e0989
remove orphaned STRINGIZE macro
2022-04-25 17:12:09 +00:00
rofl0r
bf1ef6157c
build: properly quote strings passed as cpp macros
...
until now, the strings intended to be hardcoded into the binary,
such as directory names and build id, were passed unquoted, which
means they're interpreted by the preprocessor as C tokens, rather
than strings, which can result in all sorts of "interesting"
behaviour such as interpreting paths starting with // as C++-style
comment.
this was then worked around using a stringize macro which turned
the tokens into a string (if they happened to be in a compatible
format).
adresses #1726
2022-04-25 16:52:46 +00:00
rofl0r
d8482fbd57
build: allow the user to specify make V=1 for verbose build
...
it's often required to see the full commandline when things go wrong.
the standard way for Makefile-only based buildsystems and autoconf
is to pass V=1 to make.
2022-04-25 14:58:38 +00:00
mrdudz
23831f08de
const value should never have default size, use 32bit instead
2022-04-21 14:50:48 +02:00
mrdudz
a0280d4917
Also handle the case when the non constant side of the AND expression is
...
known to have a smaller size than the constant side of the expression.
2022-04-20 12:53:34 +02:00
mrdudz
f64bf76ae8
special case for evaluating the AND operator, this should fix the problems
...
described in issue #1538
2022-04-20 00:13:34 +02:00
mrdudz
8d0098b818
more descriptive error message
2022-04-20 00:12:03 +02:00
mrdudz
89fcb0d404
typo
2022-04-20 00:11:24 +02:00
acqn
4f4487cb03
Added supports for long bit-fields.
2022-01-04 18:23:04 +08:00
acqn
21858b52e7
Separated data initializer stuff from declaration stuff.
2022-01-03 13:10:32 +08:00
acqn
970607cde5
Optimized g_testbitfield() and g_extractbitfield() with enhanced support for long bit-fields.
2021-12-05 12:21:01 +08:00
acqn
2d96f79bc7
Added and used new utility type functions for bit-fields.
...
Fixed GetUnderlyingTypeCode() for bit-fields with widths > 16.
2021-12-01 09:45:17 +08:00
mrdudz
3c1bb85b8e
remove dangling spaces
2022-04-17 16:07:09 +02:00
Bob Andrews
4cf7db1ef5
Merge pull request #1692 from karrika/atari7800
...
#805 Atari7800 target
2022-03-20 20:39:36 +01:00
Bob Andrews
58de94edd4
Merge pull request #1560 from empathicqubit/master
...
Add --debug-tables <filename> option and output struct fields
2022-03-20 20:27:15 +01:00
Greg King
b2ae73879b
Added a URL to the snapshot's commit history as a comment in the Windows snapshot ZIPs.
2022-03-12 01:35:33 -05:00
nyanpasu64
9cb81f1410
Replace #include "inttypes.h" with <inttypes.h>
2022-03-06 14:48:51 -08:00
nyanpasu64
3466abc60c
Fix format strings to properly format uintptr_t
2022-03-06 14:48:03 -08:00
nyanpasu64
2feba69622
Remove broken inttypes.h
...
src/common/inttypes.h is a shim to fix building cc65 on
non-C99-compliant compilers missing inttypes.h (like VS2012 and
earlier). The shim is actually incomplete and does not define the PRI...
macros supplied by the actual compiler headers. Since we're planning to
use those macros, delete this header so cc65's source files instead use
host-supplied inttypes.h containing macro definitions.
2022-03-06 14:47:58 -08:00
nyanpasu64
f36b9b544d
Fix segfault on 64-bit LLP64 Windows builds
...
There are many occurrences of unsigned long in codegen.h's function
arguments. Changing g_getimmed and g_defdata makes `make` succeed
without segfaulting. I don't know if it makes cc65 behave correctly in
all cases, or if there are more unsigned long that need to be changed.
2022-03-06 14:47:51 -08:00
Karri Kaksonen
786b4310d0
Merge branch 'cc65:master' into atari7800
2022-03-05 19:09:05 +02:00
acqn
c8956ce19b
Fixed signed long comparisons with smaller unsigned types.
2022-03-03 20:24:14 +08:00
Bob Andrews
0587d9f5d4
Merge pull request #1675 from acqn/ShiftFix
...
[cc65] Fixed bitwise shift with numeric constant operand(s)
2022-03-01 19:50:21 +01:00
Karri Kaksonen
3266e70de4
Add target atari7800
2022-03-01 06:44:55 +02:00
acqn
5ef420af5a
Fixed OptCmp1 with certain code patterns with labels.
2022-03-01 10:40:01 +08:00
Jeff Tranter
2bf8be5b3b
Fix some commonly made spelling errors in comments.
2022-02-21 15:44:31 -05:00
acqn
2bda128ef1
Fixed LimitExprValue() for 64-bit long env.
2022-02-26 23:02:51 +08:00
acqn
14988f5dda
Fixed bitwise shift with numeric constant operand(s).
2022-02-16 20:10:54 +08:00
Spiro Trikaliotis
364e72921c
ca65: .constructor after .export fails
...
The actor directives (.constructor, .destructor, .interruptor, and .condes)
can't handle a symbol that's already exported.
The relevant code does the checks in the wrong order.
For example, the following correct snippet does not assemble:
.export C
C: .constructor C, 5
The assembler outputs: test.s:2: Error: Address size mismatch for symbol 'C'
Exchanging both lines makes it work.
This fixes #1647 ; the patch is provided by 'kugelfuhr' and taken from there.
2022-02-15 22:03:47 +01:00
Spiro Trikaliotis
3d0013ab30
Invalid flagged errors if token is missing
...
A missing factor in an expression causes an expected but missing token
to be skipped, leading to invalid flagged errors in the following line:
l = 3 +
lda #$00
An error should be output for line 1, but not for line 2. Actually, both
are flagged as errors:
test.s(1): Error: Syntax error
test.s(2): Error: Unexpected trailing garbage characters
This patch (as proposed in issue #1634 by kugelfuhr) fixes this.
2022-02-15 21:46:07 +01:00
Bob Andrews
24c8de87c2
Merge pull request #1662 from acqn/StructFix
...
[cc65] Fixed ICE on unnamed bit-fields declared with typedef'ed types
2022-02-14 17:31:45 +01:00
Greg King
86b6514c16
Added code that avoids infinite loops that were caused by circular references
...
(a symbol that was defined by referring to itself directly or indirectly). Patch by kugelfuhr.
2022-02-13 07:38:00 -05:00
Greg King
112e216e53
Removed an obsolete command-line option from the cc65 compiler.
2022-01-30 22:10:06 -05:00
Matthew D. Steele
22a3d55e40
Add space after function names
2022-01-08 16:39:30 -05:00
Matthew D. Steele
1f6bc6240f
Move local variable declaration to top of block
2022-01-08 16:29:42 -05:00
Matthew D. Steele
92bfbeb8ab
Adjust Pop() sequencing in paravirt.c
2022-01-08 16:24:40 -05:00
Matthew D. Steele
cf1bc4fad4
Fix Pop() implementation in src/sim65/paravirt.c ( fixes #1625 )
...
The Pop() function was not handling stack pointer wrap around correctly.
Also, change the simulated RTS implementation in ParaVirtHooks() to
explicitly sequence the two Pop() calls in the correct order.
2022-01-07 09:56:46 -05:00
acqn
6beb090193
Fixed anonymous bit-fields declared with typedef'ed type names.
2022-01-03 23:54:14 +08:00
acqn
38511843e5
Fixed crash with labels in non-function/block scopes.
2022-01-03 23:50:48 +08:00
Bob Andrews
6a76d6d905
Merge pull request #1611 from polluks2/patch-3
...
Fixed many typos
2021-12-13 20:05:31 +01:00
polluks2
1d3318c247
Fixed many typos
2021-12-13 17:20:56 +01:00
polluks2
9e9b3dbaca
Fixed typo
2021-12-13 17:14:57 +01:00
Greg King
325ff9667e
Used (size_t), instead of (long) where converting between pointers and integers.
...
(long) still is 32 bits on 64-bit Windows!
2021-12-12 19:40:43 -05:00
Bob Andrews
332742b688
Merge branch 'master' into master
2021-12-11 22:35:50 +01:00
Oliver Schmidt
8b0de8a931
Merge branch 'master' into master
2021-11-23 22:56:51 +01:00
empathicqubit
fd8d51497c
Add --debug-tables <filename> option and output struct and union fields
2021-09-29 05:20:44 +02:00
acqn
eeaa111835
Fixed crash in Opt_a_toscmpbool caused by wrong order of condition checks.
2021-09-28 17:02:37 +02:00
Greg King
fcda94f258
Made a slight improvement in the ld65 expression evaluator.
2021-06-13 20:36:05 -04:00
acqn
25a35d6b59
Fixed result type of certain operations, which was broken with the bit-field fix.
2021-06-10 21:54:32 +02:00
acqn
5adb29ce31
Made "bit-field-ness" a type property instead of a SymbolEntry or ExprDesc property.
...
Fixed integer promotion and result type in certain operations.
Fixed bit-fields 'op=' and postfix inc/dec operators.
2021-06-09 08:03:12 +02:00
acqn
1d7bf7355c
Better function naming in declare.c.
...
Scalar initialization routines need only 'const Type*' as parameters.
2021-06-09 08:03:12 +02:00
acqn
004c60de39
Optional flags for the codegen to skip restoring the expression results into the primary registers.
2021-06-09 08:03:12 +02:00
acqn
dcacba472a
Moved ArithmeticConvert() from cc65/expr.c to cc65/datatype.c.
...
Reorganized a few functions in cc65/datatype.c.
Added SignedType() and UnsignedType() for future usage.
Made LimitExprValue() external so that it can be used more often.
2021-06-09 08:03:12 +02:00
Filip Golewski
09862e7ce9
Update src/msbuild.cmd script to optionally include Visual Studio 2019 Community build tools
2021-06-08 21:16:20 +02:00
acqn
2324bd62f6
If __A__,__AX__ or __EAX__ is used, post-inc/dec within the same statement will not modify it.
...
Moved testcase from src/test/todo to src/test/val plus minor improvement on portability.
2021-06-08 14:16:14 +08:00
polluks2
ed9f9ccbab
Fix #1536
2021-06-07 23:12:50 +02:00
Wayne Parham
69e2313a63
First round of requested code changes
2021-06-06 23:20:54 +01:00
Greg King
1c16e46f23
Improved ld65's error messages about ca65's .BANK() function.
...
* Split a message into two more specific messages.
2021-06-05 11:31:28 -04:00
Greg King
39ef63cbbc
Don't check for circular references of imports that don't have matching exports.
...
This fix will avoid referring to a struct member through a null pointer.
2021-06-04 13:35:26 -04:00
bbbradsmith
d5d9183ccf
conform to prevailing if bracket style
2021-06-04 07:09:58 -04:00
bbbradsmith
6ebe551919
return is sufficient, TooComplex flag is unnecessary to resolve this crash case
...
suggested by greg-king5 in #1409
2021-06-04 07:09:58 -04:00
bbbradsmith
3584c4c87f
fix crash when a NULL ExprNode is checked for circular references
2021-06-04 07:09:58 -04:00
acqn
4d5fe38540
Fixed OptStackOps when the stuff pushed on stack top is accessed before the op.
2021-06-03 12:03:53 +02:00
acqn
79be6dec16
More quick hack for CE_GenRegInfo.
2021-06-03 12:03:53 +02:00
acqn
0bfa13722b
More funcinfo on register usage fixes.
2021-06-03 12:03:53 +02:00
Greg King
0d3c827d80
Made the C preprocessor #if nesting stack have 256 levels.
...
Closes #1523 .
2021-05-30 03:52:32 -04:00
Greg King
d14148ab4f
Restricted commit b9a3c78888
to classic-style Assembly macros.
...
.include will work at expansion-time for .define macros.
2021-05-17 19:48:47 -04:00
acqn
1450f146a5
Fixed '[]', '()' '.' and '->' operators following a postfix increment/decrement.
2021-05-16 20:43:49 +02:00
acqn
43ca887263
Fixed 'case'/'default' labels in non-compound 'switch' body statement.
2021-05-16 20:43:49 +02:00
WayneParham
e9fd87d07a
Merge branch 'master' into master
2021-05-16 10:02:37 -05:00
acqn
f5dacda69b
NoCodeConstExpr() fix to avoid exessive error messages.
2021-05-16 19:08:43 +08:00
acqn
6a3b9a9880
E_ADDRESS_OF logic fix.
2021-05-16 19:08:42 +08:00
acqn
aac03eae6f
Better future-proof bit-masking.
2021-05-16 19:08:42 +08:00
acqn
2d014383cd
Replaced certain usage of "(New-)PointerTo()" with "AddressOf()".
2021-06-08 00:43:26 +08:00
acqn
924fcf5d06
Replaced several occurance of PtrConversion() with StdConversion().
...
Variadic arguments of functions should be default-promoted.
2021-06-08 09:32:58 +08:00
acqn
18ae09f682
Less excessive errors with failed array declarations.
2021-05-14 10:48:17 +02:00
acqn
dfba8d77ca
Error messages shouldn't raise warnings about unused expressions by themselves.
2021-05-14 10:48:17 +02:00
Greg King
e5813cfb1a
Removed two duplicate TYPEDEFs from a header.
...
The first one is replaced by an #include of the header that has its original TYPEDEF.
The second one is replaced by its base type.
That change allows pedantic C90-compliant compilers to accept the header.
2021-05-13 00:24:32 -04:00
Greg King
af4c4f6aaf
Removed a "return" keyword from an inline function that must return (void).
2021-05-12 19:43:32 -04:00
Andrea Odetti
05f545e189
More line number related changes.
2021-05-11 17:41:59 +02:00
Andrea Odetti
93762a2117
ld65: move 2 more cases to the notation file:line.
2021-05-11 17:41:59 +02:00
Andrea Odetti
feccc68c54
ld65: avoid redundant error message information.
2021-05-11 17:41:59 +02:00
Andrea Odetti
bcc670ee36
Standard formatting of error messages.
...
https://www.gnu.org/prep/standards/html_node/Errors.html
Issue: https://github.com/cc65/cc65/issues/1494
2021-05-11 17:41:59 +02:00
Bob Andrews
82ee502f57
Merge branch 'master' into wrapped-call
2021-05-11 14:16:25 +02:00
mrdudz
07dd1e3849
fix formatting
2021-05-11 14:14:44 +02:00
mrdudz
18f94d1fe0
rework to use a magic value instead of a flag, as suggested by Oliver
2021-05-11 14:00:49 +02:00
mrdudz
ef74226993
improve error message
2021-05-11 13:37:53 +02:00
Oliver Schmidt
b7856ddd4f
Just some source formatting adjustments.
2021-05-11 10:40:44 +02:00
Wayne Parham
a2def19de5
Added TGT_SYM1
2021-05-10 15:20:49 +01:00
Wayne Parham
f81aefe8bd
Synertek Systems Sym-1 config files
2021-05-09 17:13:24 -05:00
Wayne Parham
044a0838a3
Changes to existing cc65 source to support Synertek Systems Sym-1
2021-05-09 16:52:48 -05:00
mrdudz
0fbf2af09d
Fix the warning that is produced for unused functions
2021-05-08 01:03:43 +02:00
mrdudz
c9f242e566
Extend #pragma wrapped-call to support "bank" argument
2021-05-05 14:42:29 +02:00
Marco Aurelio da Costa
04cd884f8f
Prevent missed .ENDMACRO in included file
2021-05-02 14:17:11 +02:00
Marco Aurelio da Costa
b9a3c78888
Parse file included inside a macro at definition time
2021-05-02 14:17:11 +02:00
Evgeny Vrublevsky
8e02f8f5ec
Add .REFTO as an alias to .REFERTO. Update the docs related to it.
2021-04-29 07:55:43 -04:00
Evgeny Vrublevsky
50a58e7706
Added documentation for the .REFERTO.
2021-04-29 07:55:43 -04:00
Evgeny Vrublevsky
83e7c37277
Use .REFERTO instead of .REF as the command.
2021-04-29 07:55:43 -04:00
Evgeny Vrublevsky
e9a72b2462
Add .REF control command implementation.
2021-04-29 07:55:43 -04:00
acqn
71bd6415d6
No more unnecessary jump-over labels generated for logical OR false cases.
2021-04-24 23:53:26 +02:00
Oliver Schmidt
5d84a4ba13
Removed non-ASCII chars.
2021-04-19 16:06:10 +02:00
Oliver Schmidt
f272bc8f42
Removed non-ASCII chars.
2021-04-19 15:50:52 +02:00
Marco Aurelio da Costa
fd3d5d35fb
mc: Implemented .LITERAL
2021-04-19 15:42:29 +02:00
acqn
f901adba22
Predefined type strings for inlined std function parameters.
2021-04-19 15:36:55 +02:00
acqn
9cea9ce5e2
Made the code more constness-correct with 'Type' usage.
2021-04-19 15:36:55 +02:00
acqn
cb64aaf20c
Made the code more constness-correct with 'Type' usage for inlined std functions.
2021-04-19 15:36:55 +02:00
acqn
328345b9c3
Removed a helper function that is no longer used.
2021-04-19 15:36:55 +02:00
acqn
24d36854d2
Minor cleanups with array element qualifiers.
2021-04-19 15:36:55 +02:00
acqn
896f463a23
Used more specific pointers instead of the "arbitary attribute pointer" used in type strings.
2021-04-19 15:36:55 +02:00
acqn
bfb7c936aa
Preparation for constness-correction.
2021-04-19 15:36:55 +02:00
Evgeny Vrublevsky
ac08482fa3
Allow editing cc65.props from Property Manager.
2021-04-18 21:12:51 +02:00
Evgeny Vrublevsky
ee8c7b47bc
Add new lines at the end of the project files.
2021-04-18 21:12:51 +02:00
Evgeny Vrublevsky
7be3b53f72
cc65.props uses spaces instead of tabs.
2021-04-18 21:12:51 +02:00
Evgeny Vrublevsky
2120dd662c
Move all common project settings into cc65.props.
2021-04-18 21:12:51 +02:00
Marco Aurelio da Costa
83ee928fb1
mc: Formatting, remove stray lines
2021-04-18 20:39:05 +02:00
Marco Aurelio da Costa
c915b5d7f3
Implemented charmap stack
...
New commands:
.PUSHCHARMAP: will push the current charmap state into an internal stack
.POPCHARMAP: will restore the current charmap to the last pushed charmap
Details:
The push and pop facilities are implemented directly inside the tgttrans.h,
to facilitate its reuse on the C compiler.
2021-04-18 20:39:05 +02:00
acqn
6e61093e79
Fixed pointer subtraction in certain very rare cases.
2021-04-17 11:14:37 +02:00
acqn
e9545d68ee
Minor clean-ups and typo fixes.
2021-04-17 11:43:03 +08:00
Dirk Lehmann
eb1cf750f2
-W-unreachable-code option added, alphabetic order of --list-warnings
2021-04-13 09:37:55 +02:00
acqn
e435da6234
Interim fix for Issue #897 .
2021-04-06 22:20:39 +02:00
acqn
bd8eae67f1
Fixed local struct field access via the address of the struct.
2021-04-05 15:49:54 +02:00
acqn
1a3628df1a
Fixed the term 'argument' vs 'parameter' in function parser.
2021-04-03 17:50:46 +02:00
acqn
2864b3ef8a
Fixed composition of prototypes and old-style function definitions with default promotions.
...
Fixed function parameter list comparison with empty ones.
2021-04-03 17:50:46 +02:00
acqn
91fd30611a
Fixed ICE on error cases such as '&func + int a'.
2021-04-03 17:45:52 +02:00
acqn
4a38965384
Warnings on discarding pointer qualifiers always.
...
Added new -W options to turn on/off warnings on certain pointer conversion cases:
- pointer-sign: to a pointer type differing in pointee signedness. Default on.
- pointer-types: to a pointer type incompatible. Default on.
2021-03-30 19:41:20 +02:00
acqn
b802efde54
Fixed ternary result type detection with pointer types.
...
Fixed pointer type comparison and conversion, especially regarding qualifiers.
Improved diagnostics about type comparison and conversion.
Reorganized some type-comparison/conversion functions.
2021-03-30 19:41:20 +02:00
acqn
f9812930c1
More detailed diagnostic info about conflicted function types.
2021-03-30 16:47:57 +08:00
acqn
cb8fbf4772
Removed the non-existing-in-C "struct/union scope" for structs/unions.
...
Fixed handling of struct/union field declarations without identifiers, which do nothing.
2021-03-29 19:28:22 +02:00
acqn
f273b1ebcb
Fixed crash with non-inlined __fastcall__ function invocation with no arguments.
2021-03-26 11:02:46 +08:00
acqn
3755e4a863
Replaced checking for __fastcall__ aginst AutoCDecl etc. with IsFastcallFunc().
2021-03-24 14:35:44 +08:00
acqn
3c2e7ce41c
More reliable test for true/false with addresses for AND, OR and ternary operators.
...
Minor comment typo fix.
2021-03-20 01:39:32 +01:00
acqn
f8835d2867
Fixed codegen with addresses as boolean test conditions.
...
Fixed warning on unreachable code of if body.
2021-03-20 01:39:32 +01:00
acqn
325b7b4ab3
Enabled 'a ? b, c : d'.
2021-03-20 00:09:47 +01:00
acqn
a51d6d40de
Ternary fix for some obscure cases.
2021-03-20 00:09:47 +01:00
acqn
6974c1ff12
Fixed and cleaned up codegen logic with arithmetic conversion in addition and subtraction.
2021-03-19 16:35:03 +01:00
Christian Groessler
cd116e5ba0
src/ar65/library.c: style fix
2021-03-18 22:27:42 +01:00
Christian Groessler
9b05fe9982
src/ar65/library.c: fix compilation on Windows
2021-03-18 22:27:42 +01:00
Christian Groessler
358d750b3e
ar65: fix parallel builds by using a per-process temp file
2021-03-18 22:27:42 +01:00
Christian Groessler
64449f0f54
ar65: better version of last change
2021-03-18 22:27:42 +01:00
Christian Groessler
d3c495e8b9
ar65: fix parallel builds by using a per-process temp file
2021-03-18 22:27:42 +01:00
acqn
b02838439c
Changed g_addaddr_local() codegen to reduce code size.
2021-03-16 22:29:20 +01:00
acqn
8eeaaa3f36
Made certain types of comparison between addresses in constant expressions work.
2021-03-16 22:29:20 +01:00
acqn
99c7fe0ada
Reusing code from parseadd() for ArrayRef().
...
Now index[ptr] works in constant expressions.
Fixed codegen for cast type in constant expressions.
Calls on swapstk in 'i[ptr]' is avoided when possible.
2021-03-16 22:29:20 +01:00
acqn
f5972dfd08
Made int+pointer work in constant expressions.
...
Fixed codegen for cast type addition in constant expressions.
Calls on swapstk in 'i+ptr' is avoided when possible.
2021-03-16 22:29:20 +01:00
acqn
aa6fdf58b8
Addresses in constant subtraction expressions now work.
...
Fixed codegen for cast type subtraction in constant expressions.
2021-03-16 22:29:20 +01:00
acqn
c4a2620e29
Added an utility function to check for quasi-constant addresses (of stack variables).
2021-03-16 22:29:20 +01:00
acqn
0a8ca3041a
Changd all Find*Last*InOpenRange() to return the beginning of the open range.
...
Fixed FindArgLastUsageInOpenRange().
2021-03-16 22:24:19 +01:00
acqn
4376b83390
Fixed LoadAAt().
2021-03-16 22:24:19 +01:00
acqn
bd5d5b7385
Removed the prototype of evalexpr() that no longer exists.
2021-03-16 22:24:19 +01:00
acqn
047d0f479b
Comments format fix.
2021-03-03 10:07:24 +01:00
acqn
2aad72af90
Removed trailing whitespaces.
2021-03-03 10:07:24 +01:00
acqn
8b6d78a075
Added Opt_a_tosbitwise for 8-bit bitwise operations.
2021-03-01 22:11:22 +08:00
acqn
3caceb8174
Fixed result type in certain contant expression addition cases.
2021-02-26 19:45:46 +01:00
acqn
f2eed38fc8
Fixed expression type of the result of numeric constant comparison.
2021-02-26 19:45:46 +01:00
acqn
ea0c634e12
Improved codegen for unsigned char type comparison with numeric constants.
2021-02-23 22:06:21 +01:00
acqn
d628772cd1
Fixed signed char type comparison with unsigned numeric constants.
2021-02-23 22:06:21 +01:00
acqn
f1c715c455
Fixed a bug that pointer subtraction results from two absolute addresses are calculated as unsigned long.
2021-02-22 14:14:59 -05:00
acqn
81d6321cd7
Fixed internal representation of calculated constant results.
...
Minor clean-up.
2021-02-22 14:14:59 -05:00
acqn
eadaf2fef8
Fixed deferred post-inc and post-dec in unevaluated context such as 'sizeof(i++)'.
2021-02-22 11:02:47 +01:00
acqn
40b26f4060
Now the compiler removes code that has no observable effect.
2021-02-22 13:47:32 +08:00
acqn
7f05bd797f
Now the compiler tracks code that has no observable effect.
2021-02-21 16:36:29 +08:00
acqn
55ae350fed
Fixed 'Opt_staxspidx' for the invariant of 'staxspidx'.
2021-02-17 07:03:11 -05:00
acqn
6617a017fa
Added Opt_a_tossub for 8-bit subtraction.
2021-02-05 17:29:49 +08:00
acqn
bfc7a51a44
Fixed Issue #1265 according to C89/C99 standards.
2021-01-30 14:31:51 +01:00
acqn
c9ac515286
Functions with no prototypes might use EAX registers.
2021-01-30 14:31:51 +01:00
acqn
a1992702f8
Declarations of 'extern' object and function should be visible in the file scope.
2021-01-30 14:31:51 +01:00
acqn
b99455cc47
Fixed Issue #1374 .
2021-01-19 14:33:27 +01:00
Rocky
a9b71b6207
return-type - new warning suppression type added
2021-01-06 16:05:04 +01:00
Jesse Rosenstock
e0c12c90cd
g_asr, g_asl: Use ROL/ROR for char shifts by >= 6
...
Instead of `val` right (left) shifts, we can also do `9 - val` left (right)
rotates and a mask. This saves 3 bytes and 8 cycles for `val == 7` and
1 byte and 4 cycles for `val == 6`.
2020-12-27 14:22:40 -05:00
Christian Groessler
ef258bdc19
remove TABs which again slipped in....
2020-12-25 07:16:26 +01:00
Jesse Rosenstock
dfd047ce6a
g_typeadjust: Use CF_CHAR for char args
...
If lhs and rhs are either both signed char or both unsigned char,
return flags for that type instead of (unsigned) int. The flags
are used only for codegen. Currently, this does nothing, since
codegen treats chars as ints unless CF_FORCECHAR is set, but it
allows more efficient char x char -> int codegen to be added in
the future.
2020-12-24 14:40:39 -05:00
Greg King
b2c1a77bb3
Fixed the cc65 code that optimizes 16-bit compares when the high bytes are known to be equal.
...
Only the low bytes are compared. Originally, signed 16-bit compares were optimized into signed 8-bit compares. But, the sign bits are in the high bytes; and, they're equal. Therefore, the low bytes always must be compared as unsigned numbers.
Fixes #1348 .
2020-12-24 12:27:09 -05:00
Tim Gates
2646c06f61
docs: fix simple typo, paramater -> parameter
...
There is a small typo in src/cc65/pragma.c.
Should read `parameter` rather than `paramater`.
2020-11-29 10:26:08 +01:00
Greg King
8b42f570e9
Fixed code that caused a seg-fault after parsing a (deferred) post-count argument followed by a (nested) function-call argument.
...
The old broken code defers the count until the end of the (parent function's) argument list. But, a nested function call clears the pointer to the deferred type. That leads to an access violation.
The new code defers only until the end of each argument. Fixes #1320 .
2020-11-20 17:45:14 -05:00
Oliver Schmidt
cffcbce60f
Bumped version.
...
I placed the Git tag V2.19 in hindsight at 555282497c
. But I certainly don't want to rewrite the Git history just for the reported version, so I simply set the reported version at today's HEAD to 2.19.
2020-11-20 19:11:20 +01:00
Zsolt Branyiczky
63543dee07
Revert transient modification of EATab Table 0 comment
2020-11-19 22:02:07 +01:00
Zsolt Branyiczky
527500cedc
instruction table contained wrong parameters at SIR opcode
2020-11-19 22:02:07 +01:00
Zsolt Branyiczky
0e98818db5
assembled SAC and SIR opcodes of 6502DTV cpu were wrong
2020-11-19 22:02:07 +01:00
Zsolt Branyiczky
130d3b52a2
new macros supporting 6502DTV cpu
2020-11-19 22:02:07 +01:00
Zsolt Branyiczky
4205a04a34
6502DTV is not a superset of 6502X more
2020-11-19 22:02:07 +01:00
Polluks
bd6e5927c4
Fixed #1341
2020-11-18 10:28:19 +01:00
Oliver Schmidt
116682c190
Avoid C99 idioms.
2020-11-16 18:08:00 +01:00
Jesse Rosenstock
060417b0dc
Adjust type of int constants that fit in char
...
When there is an integral constant like `3` in an expression, it has
type `int` according to the C spec, even though it can be represented
as an `unsigned char`. Change codegen (`hie_internal` and `typeadjust`)
to treat it as `unsigned char` instead of `int` so that faster,
unsigned operations can be used.
For the test case in #1298 , reduces the cycles per iteration from
4311 to 1884. This is a great improvement, but still much worse than
the 1053 cycles/iter from `c4698df~`, so more work remains to be done.
Further partial fix for #1298 and #1308 .
2020-11-16 00:56:19 +01:00
Greg King
2915464667
Fixed cc65's generation of char-type bit-shift code.
...
Fixed CHAR-to-INT type conversions in the right-shift code generator. Also fixed some printf-style format specifiers.
2020-11-15 15:22:23 -05:00
Zsolt Branyiczky
2d7777b604
Instruction table is synchronized with the c65's one
2020-11-15 16:35:55 +01:00
Zsolt Branyiczky
0f7cf87bfa
Synchronizin InsTab6502DTV instructions table for DTV with the illegal opcodes verified by VICE-emu tests
2020-11-15 16:35:55 +01:00
Zsolt Branyiczky
92c013944e
Mistyped comment, missing comma
2020-11-15 16:35:55 +01:00
Zsolt Branyiczky
b33b053307
add c64dtv support
2020-11-15 16:35:55 +01:00
Jesse Rosenstock
5db74b4b19
Use u16 codegen for u8 x u8 ops
...
In g_typeadjust, before we apply the integral promotions, we check if
both types are unsigned char. If so, we promote to unsigned int, rather
than int, which would be chosen by the standard rules. This is only a
performance optimization and does not affect correctness, as the flags
returned by g_typeadjust are only used for code generation, and not to
determine types of other expressions containing this one. All unsigned
char bit-patterns are valid as both int and unsigned int and represent
the same value, so either signed or unsigned int operations can be used.
This special case part is not duplicated by ArithmeticConvert.
Partial fix for #1308 .
2020-11-09 21:19:22 +01:00
Jesse Rosenstock
b5f0c0468d
Add stdint.h types for C89 compilers
...
Add `intN_t` and `uintN_t` for N = 8, 16, 32.
2020-11-03 21:24:52 +01:00
Jesse Rosenstock
65193c6aaf
Add stdint.h constants INT32_MIN and UINT32_MAX
...
These were missing before
2020-11-03 09:26:26 +01:00
acqn
07cc6a3d20
Made optimization steps aware of long branches better.
2020-10-24 21:25:24 +02:00
acqn
5c43d1e04f
Changed codegen for postfix inc/dec operations by deferring them till sequence points.
...
This usually allows faster & smaller code.
Note that deferred operations must still be called at sequence points even if the whole expressions containing them had constant values.
2020-10-20 22:01:55 +02:00
acqn
bb7b69f513
Added OptShiftBack for shifting the C flag into register A and back.
2020-10-20 21:55:39 +02:00
acqn
0354322413
Added OptSignExtened for testing signness right after sign extention.
2020-10-20 21:55:39 +02:00
acqn
9c776a24e5
Use bcc instead of bne in OptNegAX2 to ease optimizations.
2020-10-20 21:55:39 +02:00
acqn
4f3a96a535
Added new opt OptPushPop2.
...
Also renamed OptPushPop to OptPushPop1.
2020-10-20 21:55:39 +02:00
acqn
262c4235df
Symbols in ZP segments will use '.exportzp' instead of '.export' if exported.
2020-10-11 23:05:20 +02:00
acqn
e58c84acf7
Support for optionally specifying address size for segments with:
...
#pragma ***-name([push,] "name"[, "addrsize"])
where "addrsize" is any addressing size supported in ca65.
2020-10-11 23:05:20 +02:00
acqn
f8c9dde989
The instruction parser can now recognize ZP locations and set the addressing mode for them.
2020-10-11 23:05:20 +02:00
Jesse Rosenstock
81550ca1ee
CS_MergeLabels: Keep labels referenced by data
...
Partial fix for ICE in #1211 . This may fix enough to allow #1049 to be
fixed.
When merging labels, keep the first label with a ref that has no JumpTo;
this is a data segment label, used by computed gotos.
The real fix is to track and rewrite labels in data, but this is more
involved.
2020-10-08 12:11:03 +02:00
acqn
dbba5f3fc9
Fixed handling of %v in inline asm parser.
2020-10-04 12:25:24 +02:00
acqn
a85d5330fa
Fixed StrBuf initialization in PreparseArg().
2020-10-04 12:17:14 +02:00
Jesse Rosenstock
b931e65811
Fix ICE for bit-fields with typedef
...
Fixes #1267
Avoid ICE, but treat plain int bit-fields declared via typedef as
signed rather than unsigned. It is more efficient to treat them
as unsigned, but this requires distinguishing int from signed int,
and this is curently not done.
2020-10-03 15:04:31 +02:00
Greg King
c05a750f47
Fixed some copy-&-paste typo mistakes about HuC6280's TMA mnemonic.
2020-10-01 07:25:08 -04:00
acqn
b525554bfe
Added support for parsing asm byte size expressions with a pair of parentheses.
2020-09-27 12:22:05 +02:00
acqn
688342e194
Now every code entry has its argument parsed to tell some info.
...
It fixes the compiling performance regression as well.
Built-in ZPs are recognized.
2020-09-27 12:22:05 +02:00
acqn
cc0f8422f2
More fixes and new utils to check if opcode arguments can be used elsewhere.
...
Fixed tracking with LI_RELOAD_Y and LI_DIRECT.
Fixed tracking with LI_CHECK_Y and LI_RELOAD_Y.
2020-09-27 12:22:05 +02:00
acqn
f3771a465d
Fixed various issues in the usage-tracking code.
...
Added some utility functions.
2020-09-27 12:22:05 +02:00
acqn
d379affc4b
Moved some reusable code from cc65/coptstop.c into new files.
2020-09-27 12:22:05 +02:00
acqn
28c7aa2bc8
Replaced direct CEF_NUMARG flag checks on code entries with CE_HasNumArg().
2020-09-27 12:22:05 +02:00
acqn
c45a6b3685
Utility function ParseOpcArgStr().
2020-09-27 12:22:05 +02:00
Jesse Rosenstock
d0089aef95
Fix bit-field truncation warning message
...
Fix copy & paste bug with warning message.
struct X {
signed int a : 3;
};
struct X g = { 5 };
Before:
s.c(4): Warning: Implicit truncation from 'int' to 'int : 3' in bit-field
initializer changes value from 5 to 5
After:
s.c(4): Warning: Implicit truncation from 'int' to 'int : 3' in bit-field
initializer changes value from 5 to -3
Fixes #1268
2020-09-26 17:41:45 -04:00
Greg King
81ac28ff71
Used TAY/TYA instead of PHA/PLA when extracting a bit-field.
...
Without optimization, it saves a few CPU cycles. With optimization, it saves more cycles and a few bytes.
2020-09-22 12:47:09 -04:00
Greg King
ea95728330
Avoided an avalanche of messages from bad bit-field declarations.
...
Made cc65 replace a bad bit-field type with a good one, and always parse the field width.
Shortenned a parameter name to a spelling that's consistent with other function headers.
2020-09-22 12:47:09 -04:00
Greg King
07ea5259ac
Changed a cc65 error message to say that the sizes of bit-field types (not bit-fields) are limited.
2020-09-22 12:47:08 -04:00
Greg King
bf4b195016
Added some comments that explain where the g_branch() code generator can and can't be used.
2020-09-18 15:50:26 -04:00
acqn
de630a1245
Fixed quick hack for known registers after calling certain runtime functions,
...
and new quick hack for tosshrax.
2020-09-18 09:04:15 +02:00
acqn
079f4a99dd
Added processor state info to the OPCDesc table. However, since some opcodes are affected by the addressing mode, this info is unused in codegen/optimizer but just as quick in-code documentation/hints.
2020-09-18 09:04:15 +02:00
acqn
a7d6eb9190
Added processor flag usage/change-tracking for non-JSR/RTS code entries.
...
Some existing optimizations are impacted and need fixes in order to work correctly again.
Fixed and improved OptPrecalc. Now it respects the C/V/Z/N flags.
Fixed optimizations impacted by added support of tracking processor flags.
2020-09-18 09:04:15 +02:00
acqn
d02b12fa6c
Made local code/data labels really local to the functions where they live in.
2020-09-18 09:02:16 +02:00
acqn
86ced2bd4c
Avoided unnecessarily boosting the code label numbers with boolean AND.
2020-09-18 08:59:56 +02:00
acqn
b8ae5c28fe
Added debug output support for processor flags.
2020-09-13 13:50:35 +02:00
acqn
810e17edfe
Fixed processor states tracking for the BIT/TRB/TSB opcode.
...
Added new opcode descriptions about whether and how the opcode accesses memory.
2020-09-13 13:50:35 +02:00
acqn
66c5faeb9a
Added processor flags usage tracking.
...
Added ZNRegs for tracking what register(s) Z/N flags currently reflect.
Added utility functions to check if the specified processor state is known to be a certain value.
2020-09-13 13:50:35 +02:00
acqn
fe3f267233
Added new runtime sub bcasta/bcastax/bcasteax opposing to bnega/bnegax/bnegeax.
2020-09-11 13:33:54 +02:00
acqn
142b0bf9b3
Added utility functions to get names of comparison function/transformer subroutines.
2020-09-11 13:33:54 +02:00
acqn
ab7e9f8424
Hotfix for Issue #1250 .
2020-09-08 16:28:21 +02:00
Jesse Rosenstock
4e4e4c2d21
Allow char bit-fields
...
These are not required to be supported (only int, signed int, and
unsigned int are required), but most compilers support it.
https://port70.net/~nsz/c/c89/c89-draft.html#3.5.2.1
https://port70.net/~nsz/c/c89/c89-draft.html#A.6.5.8
For consistency with other integral types, plain `char` bit-fields
are unsigned, regardless of the `--signed-chars` option.
Fixes #1047
2020-09-08 14:24:04 +02:00
acqn
41cee0eb44
Extended support for more addressing modes in tos* optimizations.
2020-09-08 14:19:48 +02:00
acqn
7553b60ef0
Improved OptStackOps for optimizating further when operands have equal hi-bytes.
2020-09-08 14:19:48 +02:00
acqn
57117fa687
Utility functions about compare conditions.
2020-09-08 14:19:48 +02:00
acqn
64ef562fa7
Moved all optimization steps from codeopt.c and some optimization steps from coptind.c into new separate files.
2020-09-08 14:18:22 +02:00
Jesse Rosenstock
9a0e4a35e1
Fix enum bit-field ICE #1244
...
This previously resulted in an ICE:
cc65: Check failed: (Entry->Type->C & T_MASK_SIGN) == T_SIGN_SIGNED,
file 'cc65/symtab.c', line 874
This CHECK is in the code that deals with changing `int` bitfields to
`unsigned int`.
Work around this by treating enum bit-fields as having their signedness
specified, so this type change code does not get called.
Fixes #1244 .
2020-09-07 11:21:23 +02:00
Tevo
1e7a9e44af
Update comment to reflect addition of integer boundary constants
2020-09-06 23:32:00 +02:00
Tevo
23a8b2c303
Define integer size macros for lacking systems
...
Define integer size macros for lacking systems
2020-09-06 23:32:00 +02:00
acqn
6bb2d1d5d1
Fixed a comment on struct/union types in DoCompare().
2020-09-06 22:47:11 +02:00
acqn
1cde952cf5
Fixed comparing an enum type with a non-enum type in DoCompare().
2020-09-06 22:47:11 +02:00
acqn
6e0fb630d7
Fixed check for processor flags usage in case of PHP.
2020-09-06 13:32:38 +02:00
acqn
e2f950b15e
Avoided referencing string literals with sizeof so that they are not output if unused elsewhere.
2020-09-05 13:21:21 +02:00
acqn
903e84c24c
Std-functions are no longer inlined if they are unevaluated.
2020-09-05 13:21:21 +02:00
acqn
df07e23f2c
Fixed bnegeax funcinfo on register usage.
2020-09-05 02:25:56 -04:00
acqn
f849de6769
Object addresses as non-NULL for comparison with NULL.
2020-09-04 19:50:32 +02:00
acqn
8e0b2f0833
Object addresses as non-NULL in boolean context.
2020-09-04 19:50:32 +02:00
acqn
bc5570b708
Fixed logical-NOT in constant context.
2020-09-04 19:50:32 +02:00
acqn
676b14429d
Better opt chance for certain optimization steps e.g. OptPtrStore1 etc.
2020-09-04 12:00:10 +02:00
acqn
29d1999947
Rearranged the OptFunc's in alphabetic order.
2020-09-04 12:00:10 +02:00
acqn
761d00b7dc
Ignore running removed old optimization steps. Neither list them in help info.
2020-09-04 12:00:10 +02:00
acqn
ae340703f2
OptDupLoads shouldn't silently do optimizations.
2020-09-04 11:58:25 +02:00
acqn
f45d2515eb
Fixed OptPush1 in case later code would rely on that pushax zeroes register Y.
2020-09-04 11:58:25 +02:00
acqn
fb6bc275bc
Fixed evaluation flags propagation to subexpressions in assignments and function calls.
2020-09-02 21:36:59 +02:00
acqn
2379504449
Fixed AND/OR in certain cases where the 'E_NEED_TEST' flag set for usage only in subexpressions should be cleared.
2020-09-02 21:36:59 +02:00
acqn
28de3423eb
Merged some switch cases in code generation subroutines.
2020-08-31 09:12:03 +02:00
acqn
6b64b43395
Made local static data use a separated label pool from the code label pool.
2020-08-31 09:12:03 +02:00