Commit Graph

99 Commits

Author SHA1 Message Date
Irmen de Jong
c55fdd9834 removed special code generation for while and util expression (replaced by jumps)
also added exhaustive parent node checker in validation step
2021-12-27 02:04:28 +01:00
Irmen de Jong
4da4f96669 lower code: break -> goto after (simplifies codegen) 2021-12-25 22:30:38 +01:00
Irmen de Jong
1462c57d0c no need for intermediary returnvalue var for prefix expressions 2021-12-16 21:00:38 +01:00
Irmen de Jong
3cf9b9d9a5 code size optimization: subroutine calls with 2 byte arg will pass it via A/Y registers instead of separate param assignments at every call site 2021-12-16 01:48:22 +01:00
Irmen de Jong
629117e594 code size optimization: subroutine calls with 1 int arg will pass it via register instead of separate param assignment at every call site 2021-12-16 00:56:59 +01:00
Irmen de Jong
08f87c321f fixed capitalization of operator sets to be consistent with other sets names 2021-12-15 23:43:14 +01:00
Irmen de Jong
1e9d249f71 fixed output of float values in cmp instructions 2021-12-13 00:17:59 +01:00
Irmen de Jong
a7b5949e6a fix compiler crash when using a gosub/subroutinecall in a branch statement 2021-12-11 15:11:16 +01:00
Irmen de Jong
75ea453bf4 fix asm code optimization problem caused in previous release where asm file is not read back in separate lines anymore 2021-12-10 15:37:53 +01:00
Irmen de Jong
e342311bef fix wrong code for inplace modification of a pointervariable's memory value 2021-12-10 14:48:53 +01:00
Irmen de Jong
d8d56b195f comments 2021-12-09 21:13:13 +01:00
Irmen de Jong
84f75f4156 tweaked some more .getOrElse 2021-12-06 21:22:00 +01:00
Irmen de Jong
ff69da3fa2 error when 'else' choice in when statemetn isn't the last one, also generate slightly better code for when statements 2021-12-05 21:54:46 +01:00
Irmen de Jong
b6fe40ada4 fix: cx16.r0 now properly treated as zeropage var on cx16 so @(cx16.r0) won't copy it to temp var anymore 2021-12-05 21:21:41 +01:00
Irmen de Jong
0018dc6ce7 refactor machinedefinition 2021-12-04 19:07:19 +01:00
Irmen de Jong
c92f914081 gradle build settings tweak to avoid jdk version conflict 2021-12-04 18:36:47 +01:00
Irmen de Jong
0498444ef2 moved all unit tests into single project to avoid dependency issues 2021-12-04 18:20:22 +01:00
Irmen de Jong
397f98513b optimize loading A from pointervar 2021-12-04 05:36:48 +01:00
Irmen de Jong
e545ea9504 fix and optimize storing A into pointervar 2021-12-04 04:43:58 +01:00
Irmen de Jong
b867d8f731 cleanups 2021-12-04 01:03:51 +01:00
Irmen de Jong
c3144a20db spacing 2021-12-02 00:10:06 +01:00
Irmen de Jong
df997e5d3b don't write the asm file twice 2021-11-30 03:47:57 +01:00
Irmen de Jong
ea0fe8d3d2 PrefixExpression doesn't cause clobber risk 2021-11-30 02:32:37 +01:00
Irmen de Jong
2560042ac7 fix compiler crashes on in-place operations on cx16 registers or invalid signed types 2021-11-30 02:27:37 +01:00
Irmen de Jong
7748c261da rsave/rrestore moved from sys to builtin function to solve the stack related problem when calling it as a regular subroutine 2021-11-29 23:13:04 +01:00
Irmen de Jong
a2db44f80c also consider Y register for clobber check for functioncall arguments 2021-11-29 22:09:05 +01:00
Irmen de Jong
45b8762188 use inc/ina instead of adc 2021-11-29 00:07:15 +01:00
Irmen de Jong
47c2c0376a added some cpu stack related assembly-level optimizations 2021-11-28 17:27:01 +01:00
Irmen de Jong
f0dadc4a43 optimize 1-arg functioncalls 2021-11-28 16:55:10 +01:00
Irmen de Jong
d6abd72e55 fix push() of signed values 2021-11-28 13:01:46 +01:00
Irmen de Jong
3d23b39f4c moved A to the end of the param list to avoid having to store its value 2021-11-28 04:03:18 +01:00
Irmen de Jong
f3a4048ebf improved setting Carry bit as asmsub parameter 2021-11-28 03:31:32 +01:00
Irmen de Jong
7c5ec1853d nice error message if pop() argument is wrong 2021-11-28 02:20:35 +01:00
Irmen de Jong
e8f4686430 undid failed attempt of using sys.push/sys.pop for stack args - now using new push(), pushw(), pop(), popw() builtin functions 2021-11-28 01:22:40 +01:00
Irmen de Jong
02348924d0 failed attempt of using sys.push/pop for stack args 2021-11-27 23:52:47 +01:00
Irmen de Jong
c838821615 refactor fuction arguments codegen a bit 2021-11-27 21:14:21 +01:00
Irmen de Jong
e8e25c6fd6 added sys.push() and sys.pop() to put values on cpu stack. Added missing builtin functions to syntax-files. 2021-11-27 18:09:15 +01:00
Irmen de Jong
62485b6851 allow assigns to asmsub parameters (registers), but this is not very useful in practice. 2021-11-27 15:41:44 +01:00
Irmen de Jong
54025d2bf5 small refactor and spelling fixes 2021-11-27 14:49:18 +01:00
Irmen de Jong
f5ebf79e71 make sure X register is also saved if needed when GoSub is used 2021-11-26 22:11:52 +01:00
Irmen de Jong
66d5490702 just added missing FAC2 assign possibility 2021-11-26 21:34:00 +01:00
Irmen de Jong
42fe052f9f got rid of old getScopedSymbolNameForTarget routine 2021-11-26 21:09:29 +01:00
Irmen de Jong
58d9c46a9b got rid of old makeScopedName routine 2021-11-26 20:56:30 +01:00
Irmen de Jong
110e047681 replace subroutine calls (statement) by GoSub 2021-11-26 19:47:01 +01:00
Irmen de Jong
ff715881bc allow scoped identifiers to reference a subroutine parameter directly.
also for asmsubroutines, but the asm generation for that is not yet done.
2021-11-21 23:21:39 +01:00
Irmen de Jong
8095c4c155 added GoSub node (internal use only later for calling subroutines) 2021-11-21 16:23:48 +01:00
Irmen de Jong
787e35c9f3 asm optimizer can now also see of a symbol reference if it is in IO space or not (to a certain extent), so that these instructions are no longer optimized away 2021-11-21 13:12:51 +01:00
Irmen de Jong
3c39baf1d6 don't optimize seemingly redundant assembly instructions away that manipulate IO memory space 2021-11-21 03:24:03 +01:00
Irmen de Jong
b292124f3c replaced many short/int values by unsigned types if appropriate 2021-11-21 00:55:56 +01:00
Irmen de Jong
c0035ba1a2 char encodings now use UByte type instead of short 2021-11-21 00:07:17 +01:00