Commit Graph

662 Commits

Author SHA1 Message Date
Irmen de Jong
5986dcdd2f add new containment check codegen for IR 2024-09-12 22:04:20 +02:00
Irmen de Jong
255c5bfaca improve containment check for few values 2024-09-11 03:24:30 +02:00
Irmen de Jong
8eaf884f69 improve codegen for for loops downto 0,1 when start value is not const 2024-09-10 23:54:44 +02:00
Irmen de Jong
699a2bb7ab improved codegen for for loops downto 0 2024-09-10 21:33:57 +02:00
Irmen de Jong
4e98fb75d6 support assigning multiple return flags from asmsub in 6502 codegen 2024-09-09 22:56:40 +02:00
Irmen de Jong
edc5a5a94f improve data driven unit tests to use kotest withData() 2024-09-08 16:55:08 +02:00
Irmen de Jong
2396f707c6 fix bug in codegen for certain array lookups using word typed index value (i.e. via a pointer variable) 2024-09-06 18:11:41 +02:00
Irmen de Jong
29dd758302 Fix compiler crash in for loops with just 1 iteration 2024-09-05 21:26:46 +02:00
Irmen de Jong
2c2ae64194 replace java Stack by kotlin ArrayDeque 2024-09-02 00:15:28 +02:00
Irmen de Jong
bdeac74cfc removed the -nostrictbool compiler option
boolean types and bytes are no longer implicitly interchangeable using this option
2024-09-01 20:53:39 +02:00
Irmen de Jong
b70ce0015c fix missing opportunities to use TSB instruction 2024-07-24 22:51:49 +02:00
Irmen de Jong
c67f877857 Codegen: use BIT instruction for memory location bit 7 and 6 tests (use N and V flags) 2024-07-24 19:26:54 +02:00
Irmen de Jong
4c98070b3c optimize shifts by 1 by inlining it better 2024-07-21 22:08:41 +02:00
Irmen de Jong
3681d6ee1c optimize division by powers of 2 better (into bit shifts) 2024-07-21 21:34:38 +02:00
Irmen de Jong
0af17cdc33 todo's for division optimizations 2024-07-21 20:32:03 +02:00
Irmen de Jong
d18f2a7bfd improved codegen for some pointer+index expressions 2024-07-18 23:41:34 +02:00
Irmen de Jong
9046fe8d3a ringbuffer and pointer optimization todo 2024-07-16 22:59:31 +02:00
Irmen de Jong
78c7ee247a generate 65c02 TSB/TRB instructions in certain cases 2024-07-16 00:36:00 +02:00
Irmen de Jong
484677b4b1 Get rid of any() and all() builtin functions.
Replaced by regular subroutines in the anyall module.
2024-07-06 18:49:03 +02:00
Irmen de Jong
25f25a8767 Get rid of sort() and reverse() builtin functions.
Sort() had too many gotchas and reverse() is kinda redundant you can loop in decreasing order through an array too.
2024-07-06 17:07:58 +02:00
Irmen de Jong
43c55b58d2 fix register overwriting for certain subroutine call parameter combinations. Fixes #136 2024-07-02 23:26:34 +02:00
Irmen de Jong
ead8aa7800 asm optimization: bxx+jmp -> opposite bxx 2024-06-29 17:22:57 +02:00
Irmen de Jong
7a9dd1ac9b optimize trivial 65c02 stack instructions 2024-06-29 15:42:40 +02:00
Irmen de Jong
1c97c22eff optimize simple word and byte addition/subtraction better 2024-06-29 14:33:42 +02:00
Irmen de Jong
4f8aaf9244 some tweaks and todos 2024-06-26 21:22:40 +02:00
Irmen de Jong
034f27a8dd added queens example, update kotest lib 2024-06-19 23:57:43 +02:00
Irmen de Jong
c9a4235669 update to kotlin 2.0, fix several code style issues 2024-06-04 01:00:46 +02:00
Irmen de Jong
d3dcd24b4d add profiler script 2024-05-29 00:56:31 +02:00
Irmen de Jong
fd1e6796ef correct branch instruction, fixes #137 2024-05-24 20:54:40 +02:00
Irmen de Jong
0dc50a93a4 added @nozp variable flag 2024-05-21 21:53:58 +02:00
Irmen de Jong
c719e274d5 java version tweaks 2024-05-18 20:25:44 +02:00
Irmen de Jong
6e8a89e6f1 optimize const word repeat setup 2024-05-18 16:30:27 +02:00
Irmen de Jong
aa2437cfb8 fix invalid repeat loop when iterations is already in register Y 2024-05-18 15:09:56 +02:00
Irmen de Jong
4a710ecdfc cleanups 2024-05-17 18:48:04 +02:00
Irmen de Jong
7915dda35f update libraries 2024-05-12 03:02:54 +02:00
Irmen de Jong
a7247f5b8b fix boolean expression optimization bug 2024-04-12 21:56:25 +02:00
Irmen de Jong
5d7ddebcad fix bool to uword cast in 6502 codegen 2024-04-11 00:34:53 +02:00
Irmen de Jong
53df0eb707 cleanups 2024-04-10 22:04:03 +02:00
Irmen de Jong
66a6659a6e cbm.STOP2() and cbm.GETIN2() convenience routines 2024-04-06 02:16:21 +02:00
Irmen de Jong
88ae3daa42 Merge branch 'refs/heads/master' into multi-assign
# Conflicts:
#	examples/test.p8
2024-04-06 00:14:41 +02:00
Irmen de Jong
08b8fe01ab added missing cmp #0 after func()==0
cx16: diskio.fastmode() now returns success boolean
2024-04-06 00:04:54 +02:00
Irmen de Jong
98acff802f better checking for number of return values
assignment optimization if return register already is the same as the assignment target
2024-04-04 23:47:33 +02:00
Irmen de Jong
34f3169dda tweak library routines for multiple return values.
cbm:
MEMTOP changed (now also returns nr of banks in A)
STOP2 removed (just use STOP)
RDTIM_safe() added                  TEST IRQ ENABLE
RDTIM16 changed (internally)        TEST IRQ ENABLE

cx16:
screen_mode changed (now also returns width and height in X,Y)
kbdbuf_peek2 removed (just use kbdbuf_peek)
joystick_get changed (presence now returned as bool in Y)
joystick_get2 removed (just use joystick_get)
mouse_pos changed (now properly returns x and y position in R0 and R1)
set_led_brightness changed into set_led_state, with only a boolean on/off argument. There is no variable brightness.

sys.set_leds_brightness() removed. Use cx16.set_led_brightness().
2024-04-04 01:39:19 +02:00
Irmen de Jong
641f6c05d8 allow 'void' as dummy assign target in multi-assignment statements 2024-03-31 23:43:26 +02:00
Irmen de Jong
3e34a3ef72 allow multi-assign to skip any status register result 2024-03-29 23:10:08 +01:00
Irmen de Jong
9a27505315 6502 codegen for multi-assigns 2024-03-25 22:17:31 +01:00
Irmen de Jong
66e7c51064 IR: fix some things related to asmsubs 2024-03-22 21:49:01 +01:00
Irmen de Jong
1fc79ff6dd implement the missing in-place array operators for split word arrays and numeric operand 2024-03-13 21:16:49 +01:00
Irmen de Jong
820541e427 fixed and optimized pointervar indexed in-place operations 2024-03-11 23:27:48 +01:00
Irmen de Jong
80f39e8097 Merge branch 'booleans'
# Conflicts:
#	compiler/res/prog8lib/cx16/monogfx.p8
#	compiler/res/prog8lib/virtual/monogfx.p8
#	compiler/src/prog8/compiler/astprocessing/BoolRemover.kt
#	compiler/test/TestTypecasts.kt
#	docs/source/todo.rst
#	examples/cx16/highresbitmap.p8
#	examples/test.p8
#	httpCompilerService/src/prog8/http/TestHttp.kt
2024-03-11 01:00:48 +01:00
Irmen de Jong
fc0fae8caf tweak the redundant beq asm optimizer a bit more 2024-03-09 00:05:06 +01:00
Irmen de Jong
04f7b772a3 lib updates, removed unused and obsolete http and dbus modules 2024-03-05 23:42:35 +01:00
Irmen de Jong
9f1bd2d7d6 asmoptimizer that removes redundant branches on boolean in A 2024-03-05 20:37:15 +01:00
Irmen de Jong
9826d7c494 optimize certain boolean comparisons more 2024-03-05 03:09:53 +01:00
Irmen de Jong
e55cde2a81 more nonstrictbool conversions 2024-03-03 19:43:48 +01:00
Irmen de Jong
da1620807f fixed all todos in ifelse gen 2024-03-03 12:10:42 +01:00
Irmen de Jong
f39ef8f565 optimize byte comparison assignment to use rol trick instead of branching 2024-03-03 00:01:14 +01:00
Irmen de Jong
fe8b6e820c getting rid of problematic fallback (infinite recursion) 2024-03-02 23:19:55 +01:00
Irmen de Jong
f29d24e96a fixup split words array comparisons 2024-03-02 23:19:55 +01:00
Irmen de Jong
620ffe54ec asm optimizer: don't remove labels. remove redundant cmp/cpx/cpy instructions. 2024-03-02 23:19:53 +01:00
Irmen de Jong
ceaa4cd07d array issue 2024-03-02 23:19:39 +01:00
Irmen de Jong
af17f903ee fix that if not fcall() wasn't transformed to a conditional branch instruction 2024-03-02 23:19:39 +01:00
Irmen de Jong
dba0846866 optimize word >, word <= 2024-03-02 23:19:39 +01:00
Irmen de Jong
bed629998a fix large code for some compares 2024-03-02 23:19:39 +01:00
Irmen de Jong
bc2ede76bf tweak to byte compares 2024-03-02 23:19:39 +01:00
Irmen de Jong
2a1fec2ed2 fix codegen error for comparisons 2024-03-02 23:19:39 +01:00
Irmen de Jong
b941d6f1e4 new comparison tests 2024-03-02 23:19:39 +01:00
Irmen de Jong
37b346740b fix 6502 casting uword and float to bool 2024-03-02 23:19:39 +01:00
Irmen de Jong
f5e332daf7 remove redundant IR instructions like SNZ 2024-03-02 23:19:39 +01:00
Irmen de Jong
fe9a9fc5cb new if tests 2024-03-02 23:19:39 +01:00
Irmen de Jong
a1574a7187 added txt.print_bool, several fixes 2024-03-02 23:19:39 +01:00
Irmen de Jong
006713fe13 optimize boolean to ubyte assignment (skip type cast) 2024-03-02 23:19:39 +01:00
Irmen de Jong
7868e672e0 ifelse more 2024-03-02 23:19:39 +01:00
Irmen de Jong
e1a133c2c0 ifelse more 2024-03-02 23:19:39 +01:00
Irmen de Jong
c77cd0da39 ifelse more 2024-03-02 23:19:39 +01:00
Irmen de Jong
577333f2c4 new ifelse codegen 2024-03-02 23:19:39 +01:00
Irmen de Jong
7d8cdcbfea more bool fixes and optimizations in codegen 2024-03-02 23:19:39 +01:00
Irmen de Jong
c5c4c6f111 start of new ifelse 2024-03-02 23:19:39 +01:00
Irmen de Jong
acd841dbb6 bool changes in 6502 assignment codegen 2024-03-02 23:19:37 +01:00
Irmen de Jong
6b52ba9397 6502 asmgen 2024-03-02 23:19:20 +01:00
Irmen de Jong
41afeccd51 compiler stuff 2024-03-02 23:19:20 +01:00
Irmen de Jong
bc2b38daf4 added PtBool and other changes to intermediate Ast 2024-03-02 23:19:20 +01:00
Irmen de Jong
f40b7b62bb updated unit tests and some basic changes for them 2024-03-02 23:19:20 +01:00
Irmen de Jong
c48012c385 tweak ifelse > and <= order 2024-03-02 17:01:31 +01:00
Irmen de Jong
a282b17286 added asm optimizer for <= byte (bcc+beq->bcs) 2024-03-02 15:34:54 +01:00
Irmen de Jong
58d9463f16 consolidate word comparison codegen 2024-03-02 14:00:12 +01:00
Irmen de Jong
047decd552 consolidate byte comparison codegen 2024-03-01 22:21:22 +01:00
Irmen de Jong
4e1686f6e3 fix warnings in gradle build scripts 2024-02-22 10:34:51 +01:00
Irmen de Jong
88458f5355 faster array copy and fix for length 256 2024-02-11 23:57:38 +01:00
Irmen de Jong
8201408f16 fix element size calc when copying array 2024-02-10 22:58:44 +01:00
Irmen de Jong
5522a305ab add -dumpvars option to dump all allocated variables (zp, normal ram, etc) 2024-02-10 18:42:31 +01:00
Irmen de Jong
d7f72056fc rest of the array copying 2024-02-10 17:16:06 +01:00
Irmen de Jong
906d9d858c implementing the array copys 2024-02-10 01:40:36 +01:00
Irmen de Jong
6c8c8e11cc fix cpu register overwrites when using @(...) arguments to an asmsub 2024-02-09 19:55:35 +01:00
Irmen de Jong
e941d2665a preparing for new array copy codegen 2024-02-09 18:22:41 +01:00
Irmen de Jong
68669dbef0 fix & of pointervar indexing 2024-02-08 23:03:53 +01:00
Irmen de Jong
6a48de9a9f IR: fix & of array-element 2024-02-08 21:27:53 +01:00
Irmen de Jong
73ec8c31ad fix 6502 code for zp pointer lookup clobbering registers. 2024-02-07 22:09:04 +01:00
Irmen de Jong
8485b8429f optimizing +=1/-=1 2024-02-06 23:49:40 +01:00
Irmen de Jong
358215e4dd removed postIncrDecr (still allow ++/-- to be parsed into +=1/-=1) 2024-02-06 18:50:08 +01:00