Commit Graph

49 Commits

Author SHA1 Message Date
acqn 7f05bd797f Now the compiler tracks code that has no observable effect. 2021-02-21 16:36:29 +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 f901adba22 Predefined type strings for inlined std function parameters. 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 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 fb6bc275bc Fixed evaluation flags propagation to subexpressions in assignments and function calls. 2020-09-02 21:36:59 +02: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 56b659c0be Made char type a distinct type. 2020-08-18 10:48:38 +02:00
acqn 2108489523 Fix for Issue #1075 and #1077. 2020-07-18 12:54:29 +02:00
Piotr Fusik 675dd3c963 Optimize the inlined memcpy/memset for the sizes of 128/129. 2017-05-17 10:08:08 +02:00
Piotr Fusik 6011bdb2f6 Optimize the inlined strlen. 2017-05-17 10:00:35 +02:00
Oliver Schmidt 02daf9f8b5 So far the built-in inlining of several known standard function was always (!) enabled and the option -Os enabled additional, potentially unsafe inlining of some of those functions.
There were two aspects of this behavior that were considered undesirable:
- Although the safe inlining is in general desirable it should only be enabled if asked for it - like any other optimization.
- The option name -Os implies that it is a safe option, the potentially unsafe inlining should have a more explicit name.

So now:
- The option -Os enables the safe inlining.
- The new option --eagerly-inline-funcs enables the potentially unsafe inlining (including the safe inlining).

Additionally was added:
- The option --inline-stdfuncs that does like -Os enable the safe inlining but doesn't enable optimizations.
- The pragma inline-stdfuncs that works identical to --inline-stdfuncs.
- The pragma allow-eager-inline that enables the potentially unsafe inlining but doesn't include the safe inlining. That means that by itself it only marks code as safe for potentially unsafe inlining but doesn't actually enable any inlining.
2017-04-03 23:20:26 +02:00
Greg King 8d5717b57a Small optimization of some cc65-generated loops.
"bne" means also branch-on-not-zero.  Therefore, this optimization doesn't put a compare-to-zero between an increment and a "bne".
2016-05-24 15:52:12 -04: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 3c9f722fbf Fixed a problem with a memcpy optimization (source and target have been
swapped).


git-svn-id: svn://svn.cc65.org/cc65/trunk@5796 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-07-28 12:26:57 +00:00
uz b916fae1cc Generate special memcpy code if the target is less than 256 bytes in size and
located at the stack bottom.


git-svn-id: svn://svn.cc65.org/cc65/trunk@5693 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-06-07 13:30:21 +00:00
uz ca9170cd20 More strcmp inlining.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4638 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-03-23 21:47:12 +00:00
uz e192edd021 Inline some occurances of strcmp.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4635 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-03-22 22:28:45 +00: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 3976746735 Rewrote literal handling. Literals are now saved together with other function
data, and at the end of compilation merged if possible. Literals for unused
functions are removed together with the function.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4501 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-12-05 22:39:45 +00:00
uz e68332a10b Fixed several more problems like the one in Assignment() some time ago: An
expression that yields a constant value may have side effects, and the
expression code must not be removed in this case.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4138 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-09-08 20:29:12 +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 8874a80ddd Fixed a bug in inlined memcpy
git-svn-id: svn://svn.cc65.org/cc65/trunk@3236 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-10-09 19:09:35 +00:00
cuz 9df7321d90 Cleanup in ShiftExpr.
Changed GetCodePos to also remember the stack pointer at the given location,
this removes the necessity to manipulate the stack when removing code. Since
CodeMark is now a struct, the API for most asmcode functions has changed.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3145 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-07-06 11:30:08 +00:00
cuz d8279302a9 Make the -O and --codesize options stackable.
Copy the current optimization settings into a code segment on creation.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3129 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-15 20:29:49 +00:00
cuz 8752f0b2c1 Removed ExprLoad to LoadExpr.
Moved LoadExpr + support functions into a separate module.
Removed obsolete files.
Some cleanup and makefile adjustments.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3113 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-09 14:12:57 +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 3a0edbff75 Fixed a bug
git-svn-id: svn://svn.cc65.org/cc65/trunk@3096 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-06-05 11:50:04 +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 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 4f024ca81b Added a missing include
git-svn-id: svn://svn.cc65.org/cc65/trunk@3049 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-05-26 13:55:48 +00:00
cuz 2cdef2d58f Add standard names for library functions
git-svn-id: svn://svn.cc65.org/cc65/trunk@3047 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-05-26 13:42:19 +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 1a9c9bf32f Output a warning for a call to memset with a count of zero.
git-svn-id: svn://svn.cc65.org/cc65/trunk@2939 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-03-18 09:43:08 +00:00
cuz b78ef1e0b4 Removed obsolete comment
git-svn-id: svn://svn.cc65.org/cc65/trunk@2929 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-03-14 11:16:49 +00:00
cuz 14fc5c1073 Renamed exprhs to ExprLoad
git-svn-id: svn://svn.cc65.org/cc65/trunk@2426 b7a2c559-68d2-44c3-8de9-860c34a00d81
2003-08-29 09:16:28 +00:00
cuz 81f94afd5c Rewrote type conversions
git-svn-id: svn://svn.cc65.org/cc65/trunk@2262 b7a2c559-68d2-44c3-8de9-860c34a00d81
2003-08-11 20:18:30 +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 02c26efdd3 Replace calls to memset with _bzero if the fill value is zero and -Oi in
effect.


git-svn-id: svn://svn.cc65.org/cc65/trunk@1359 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-07-16 11:01:51 +00:00
cuz c8415fc17c More source splitting.
Remove the -Wno-unused-parameter in favour of __atribute__((unused)).


git-svn-id: svn://svn.cc65.org/cc65/trunk@986 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-09-30 21:56:45 +00:00
cuz f249ae345e More renaming. Remove the case label limit by using a collection to store
the switch entries.


git-svn-id: svn://svn.cc65.org/cc65/trunk@807 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-07-17 21:53:17 +00:00
cuz cc83744882 Renamed struct expent
git-svn-id: svn://svn.cc65.org/cc65/trunk@805 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-07-17 21:24:19 +00:00
cuz 544705e6f4 * Added several type casts to increase C++ compatibility.
* __fixargs__ is now an actual function symbol and no longer handled in the
   scanner.
 * Additional symbol __argsize__ that is a constant in normal functions and
   a const local variable for variadic functions. Using this symbol, the
   va_arg macro gets a lot simpler and smaller.
 * Added special code to handle the fixed parameters of a variadic function.
   The code has some overhead, but the va_fix macro is no longer needed (and
   the compiler generated code is better than va_fix anyway).


git-svn-id: svn://svn.cc65.org/cc65/trunk@652 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-03-23 19:17:04 +00:00
cuz 25f5c69efa Reworked type comparison and handling of type qualifiers
git-svn-id: svn://svn.cc65.org/cc65/trunk@285 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-08-14 22:18:26 +00:00
cuz e133416d05 Moved the check module to the common dir.
Replaced the type constants by something more expandable.


git-svn-id: svn://svn.cc65.org/cc65/trunk@248 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-08-01 15:04:35 +00:00
uz 53dd513176 This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-05-28 13:40:48 +00:00