1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-28 03:29:39 +00:00
Commit Graph

3263 Commits

Author SHA1 Message Date
acqn
55ae350fed Fixed 'Opt_staxspidx' for the invariant of 'staxspidx'. 2021-02-17 07:03:11 -05: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