1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-11 05:29:33 +00:00
Commit Graph

51 Commits

Author SHA1 Message Date
Jeff Tranter
ba13ba32a1 Fix some commonly made spelling errors in comments. 2022-07-21 03:18:13 +02: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
9398e1cd33 Use a dedicated label pool for literals. 2020-08-31 09:12:03 +02:00
Greg King
36dd82f0e6 Added g_branch() to cc65's code generator.
It uses BRA if the platform's CPU has BRA.  Else, it generates a JMP.

(Used it in the bitfield sign-extending code.)
2020-08-18 19:11:18 -04:00
Jesse Rosenstock
ff535b8e1a Treat signed int bit-fields as signed
Prior to this PR, `int`, `signed int`, and `unsigned int`
bitfields are all treated as `unsigned int`.

With this PR, `signed int` will be treated as `signed int`,
and the others remain unsigned.

Since `Type` does not distinguish between `int` and `signed int`,
add an extra `int* SignenessSpecified` param to `ParseTypeSpec`
so we can tell these apart for bit-fields and treat plain `int : N`
as `unsigned int : N` since it is more efficient to zero-extend
than sign-extend.

Fixes #1095
2020-08-18 12:23:20 +02:00
Jesse Rosenstock
55cebc7b9e Move bit-field adjustment to codegen.c
Extract functions g_testbitfield and g_extractbitfield from LoadExpr.

This helps prepare for #1192, since g_extractbitfield will get much
longer and call AddCodeLine.
2020-08-18 10:55:31 +02:00
acqn
d23b577331 More compiler flags on address types to match the location types of expressions. 2020-07-18 12:54:29 +02:00
acqn
2108489523 Fix for Issue #1075 and #1077. 2020-07-18 12:54:29 +02:00
laubzega
2ac2ffcd43 Adjust SP on gotos between blocks with local variables. 2018-10-02 18:49:53 +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
e6aa00b339 Reorder CF_xxx flags so that they can be used as table index.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5990 b7a2c559-68d2-44c3-8de9-860c34a00d81
2013-03-06 12:53:07 +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
0ce362a69b Some cleanup in the code generator. Added a g_drop function. g_drop and
g_space can now handle sizes > 255 bytes.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4370 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-10-15 21:08:03 +00:00
uz
dff0e86458 Prepared the code for referencing a symbol that forces the startup code to get
linked in.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3976 b7a2c559-68d2-44c3-8de9-860c34a00d81
2009-07-28 18:55:23 +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
40dc3582a9 Allow push/pop arguments for segment name #pragmas
git-svn-id: svn://svn.cc65.org/cc65/trunk@2907 b7a2c559-68d2-44c3-8de9-860c34a00d81
2004-03-08 22:33:27 +00:00
cuz
f1b0fb9763 Added some code to handle floats/doubles.
git-svn-id: svn://svn.cc65.org/cc65/trunk@2487 b7a2c559-68d2-44c3-8de9-860c34a00d81
2003-10-10 11:39:30 +00:00
cuz
065b8f2596 If main() takes arguments, generate a forced import to a special module
constructor which will setup command line arguments.


git-svn-id: svn://svn.cc65.org/cc65/trunk@2011 b7a2c559-68d2-44c3-8de9-860c34a00d81
2003-03-07 12:41:47 +00:00
cuz
c123666d24 Added flexible array members for structs
git-svn-id: svn://svn.cc65.org/cc65/trunk@1925 b7a2c559-68d2-44c3-8de9-860c34a00d81
2003-02-03 22:14:20 +00:00
cuz
70755921a9 Re-added register variables.
Changed/added several optimizer steps to detect register variables correctly
or to handle them in a special way.


git-svn-id: svn://svn.cc65.org/cc65/trunk@1636 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-11-25 15:05:15 +00:00
cuz
ede471904c Reenable register variables
git-svn-id: svn://svn.cc65.org/cc65/trunk@1625 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-11-24 23:31:54 +00:00
cuz
ac61d6826c Another optimization step
git-svn-id: svn://svn.cc65.org/cc65/trunk@1603 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-11-23 12:05:23 +00:00
cuz
83fb2c8ab4 Allow initialization of local variables of compound type
git-svn-id: svn://svn.cc65.org/cc65/trunk@1458 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-10-10 21:15:24 +00:00
cuz
88b7d6d3bb Fixed a typo
git-svn-id: svn://svn.cc65.org/cc65/trunk@1107 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-11-07 10:34:57 +00:00
cuz
d796de8109 Use a long for the offset of static variables, so negative offsets do work
(even if this is not standard compliant).


git-svn-id: svn://svn.cc65.org/cc65/trunk@1077 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-10-25 10:49:51 +00:00
cuz
41d2cc8f91 Rewrote the switch statement
git-svn-id: svn://svn.cc65.org/cc65/trunk@1021 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-10-11 08:02:03 +00:00
cuz
5d0a52b7ac Finished indirect function calls.
Debugged zero page location tracking.


git-svn-id: svn://svn.cc65.org/cc65/trunk@968 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-09-25 10:30:48 +00:00
cuz
23fbf3ff2a Adding functionality to StrBuf
git-svn-id: svn://svn.cc65.org/cc65/trunk@885 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-09-09 20:49:20 +00:00
cuz
fe2cd767b2 Working on the backend
git-svn-id: svn://svn.cc65.org/cc65/trunk@771 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-06-04 12:27:16 +00:00
cuz
bc8f4f3a1e Added .dbg statement generation for the assembler
git-svn-id: svn://svn.cc65.org/cc65/trunk@744 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-05-22 20:03:26 +00:00
cuz
c1b6680a92 Working
git-svn-id: svn://svn.cc65.org/cc65/trunk@737 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-05-21 06:43:46 +00:00
cuz
e6a5e57b47 Working on the backend
git-svn-id: svn://svn.cc65.org/cc65/trunk@718 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-05-05 21:42:58 +00:00
cuz
e6484f85c7 Working on the new backend
git-svn-id: svn://svn.cc65.org/cc65/trunk@715 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-05-05 13:51:42 +00:00
cuz
c71a80b0af Working on the new backend
git-svn-id: svn://svn.cc65.org/cc65/trunk@709 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-05-03 22:06:59 +00:00
cuz
8a3bacd7f4 Working on the new backend
git-svn-id: svn://svn.cc65.org/cc65/trunk@707 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-05-03 20:16:41 +00:00
cuz
8eadb8aee0 Working on the new backend
git-svn-id: svn://svn.cc65.org/cc65/trunk@706 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-05-03 17:34:54 +00:00
cuz
cd956115fa Working on the new backend
git-svn-id: svn://svn.cc65.org/cc65/trunk@705 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-05-02 20:14:38 +00:00
cuz
239cbdcb2b Working on the backend
git-svn-id: svn://svn.cc65.org/cc65/trunk@702 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-05-01 16:57:43 +00:00
cuz
9d1940a124 Working on the new backend
git-svn-id: svn://svn.cc65.org/cc65/trunk@700 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-05-01 09:21:32 +00:00
cuz
c18453ebcb Inline parameter frame building
git-svn-id: svn://svn.cc65.org/cc65/trunk@661 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-03-24 13:00:16 +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
9528c379c1 Added code to check the 6502 stack
git-svn-id: svn://svn.cc65.org/cc65/trunk@638 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-03-20 22:34:08 +00:00
cuz
3e5ed62469 Added new option and pragma to generate calls to a stack checking routine
git-svn-id: svn://svn.cc65.org/cc65/trunk@631 b7a2c559-68d2-44c3-8de9-860c34a00d81
2001-03-19 23:01:35 +00:00
cuz
699a7cbf3f Remove functions that do no longer exist
git-svn-id: svn://svn.cc65.org/cc65/trunk@51 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-06-10 16:32:37 +00:00
cuz
774b4bb424 Some work on function stuff.
Use xsprintf from the common directory.
Use hashstr from the common directory.


git-svn-id: svn://svn.cc65.org/cc65/trunk@36 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-06-08 20:27:05 +00:00