Commit Graph

39 Commits

Author SHA1 Message Date
acqn dc001cb4be Reverted E_ADDRESS_OF logic fix.
Added testcase.
2022-09-01 12:56:46 +08: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
acqn 6a3b9a9880 E_ADDRESS_OF logic fix. 2021-05-16 19:08:42 +08:00
acqn 7f05bd797f Now the compiler tracks code that has no observable effect. 2021-02-21 16:36:29 +08:00
nyanpasu64 9cb81f1410 Replace #include "inttypes.h" with <inttypes.h> 2022-03-06 14:48:51 -08: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 9cea9ce5e2 Made the code more constness-correct with 'Type' usage. 2021-04-19 15:36:55 +02: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 c4a2620e29 Added an utility function to check for quasi-constant addresses (of stack variables). 2021-03-16 22:29:20 +01:00
acqn 2aad72af90 Removed trailing whitespaces. 2021-03-03 10:07:24 +01:00
acqn 903e84c24c Std-functions are no longer inlined if they are unevaluated. 2020-09-05 13:21:21 +02:00
acqn 8e0b2f0833 Object addresses as non-NULL in boolean context. 2020-09-04 19:50:32 +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 d87846e1e1 Improved comments according to PR reviews. 2020-08-30 22:12:30 +08:00
acqn 3ea3887c77 Fixed warnings on const comparison.
Warnings on expressions with no effects.
Fixed const ternary.
Fixed ternary with struct/union types as the true/false-branch expressions.
2020-08-20 07:52:06 +08:00
acqn 17bbba7327 Added integer boolean type string.
No longer set the "expression tested" flag with constant results in comparison.
2020-08-20 07:52:03 +08:00
acqn 3c52ad1d9e New utility ED_DisBitField() to make an expression no longer a bit-field. 2020-07-20 14:54:32 +02:00
acqn 2108489523 Fix for Issue #1075 and #1077. 2020-07-18 12:54:29 +02:00
Greg King c67e90dd19 Changed the type of a compiler variable that holds either integers or pointers.
The change allows cc65 to be compiled on 64-bit Windows, without getting warnings.  That OS is actually 32 bits with 64-bit pointers.  Its pointers are "long long" instead of "long".  The change uses type-names that are configured for the actual pointer width.
2018-01-09 05:34:16 -05:00
Greg King 0390c34e88 Changed multi-line C comments into another style.
The left side doesn't look unbalanced.
2014-06-30 16:51:07 -04:00
Oliver Schmidt 4185caf855 Normalized code. 2014-03-04 01:11:19 +01:00
Oliver Schmidt 85885001b1 Removed (pretty inconsistently used) tab chars from source code base. 2013-05-09 13:57:12 +02:00
uz 1a4e2edede Reenable compile time evaluation of strlen for string literals.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4631 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-03-20 18:51:59 +00:00
uz 0c20177fce Allow to store start and end of generated code in the ExprDesc structure. New
function MarkedExprWithCheck.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4135 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-08 19:48:22 +00:00
uz 6b4fe90928 First implementation of bit fields.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4079 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-08-29 21:20:13 +00:00
uz 0b4f6426e2 Some more floating point support.
git-svn-id: svn://svn.cc65.org/cc65/trunk@3886 b7a2c559-68d2-44c3-8de9-860c34a00d81
2008-08-11 17:51:00 +00:00
cuz de3a20a898 Changed the low level type representation from a strung of unsigned short
elements to a string of structs, each representing one type element. This
should fix problems on unusual architectures, since it is no longer necessary
to embedd pointers and other data converted to numbers in the string of
unsigned shorts.
Increased the TypeCode length to unsigned long to make room for more type
bits.
Inline more functions in datatype.h.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3709 b7a2c559-68d2-44c3-8de9-860c34a00d81
2006-02-19 12:29:37 +00:00
cuz daf8e0d1e6 Added license information preproc.h
git-svn-id: svn://svn.cc65.org/cc65/trunk@3135 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-29 20:26:27 +00:00
cuz 9fc71c5e93 Renamed ExprDesc.Val to ExprDesc.IVal. Added an FVal field for a floating
point constant.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3107 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-06 14:48:59 +00:00
cuz 5586527fcc Move the test flags into the Flags bitset of struct ExprDesc
git-svn-id: svn://svn.cc65.org/cc65/trunk@3101 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-05 20:29:47 +00:00
cuz 104ae3a54f Move the compiler stack pointer into its own module.
Improved the inlining of standard C functions. Added more standard functions
to inline.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3095 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-05 11:35:53 +00:00
cuz 1ec972d0c4 Fixed a typo
git-svn-id: svn://svn.cc65.org/cc65/trunk@3093 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-04 21:30:37 +00:00
cuz da2049637a Fixed a typo
git-svn-id: svn://svn.cc65.org/cc65/trunk@3088 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-04 17:00:48 +00:00
cuz 6e34e386cb Rewrote code generation for the strlen standard function. Added code for
other standard functions in several places.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3069 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-02 21:33:35 +00:00
cuz 8d8162eb23 Rewrite/cleanup of the complete expression flags handling.
git-svn-id: svn://svn.cc65.org/cc65/trunk@3056 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-05-31 15:27:33 +00:00
cuz 878e4f1352 Changed the expression parser to return the lvalue flag as part of the
ExprDesc structure, not as separate value.
WARNING: The current code does compile but does not work correctly, because
the lvalue flag is part of ExprDesc.Flags and not masked out in several tests
throughout the code.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3046 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-05-25 20:59:38 +00:00
cuz 4e2110a7a9 Fixed the inlined strlen function
git-svn-id: svn://svn.cc65.org/cc65/trunk@1738 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-12-12 17:40:58 +00:00
cuz 57d6c2f51e New function ReplaceType
git-svn-id: svn://svn.cc65.org/cc65/trunk@1520 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-11-14 22:51:59 +00:00
cuz 8810e38bb7 Move the assignment parser into a separate module.
When assigning structures, copy them using the primary register when the
size is 1, 2, or 4.
When assigning structures, allow structures by value when the size is 1,
2, or 4. These structures are expected to be in the primary register. The
only case when this can happen is by return from function, so this change
makes div() work.


git-svn-id: svn://svn.cc65.org/cc65/trunk@1477 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-11-01 21:27:31 +00:00