Commit Graph

371 Commits

Author SHA1 Message Date
Irmen de Jong
f470576822 it's now possible to use symbols that are the same name as 6502 instructions
because these are now prefixed internally before generating assembly.
2022-11-30 18:39:56 +01:00
Irmen de Jong
cfa7258ff4 various 2022-10-25 23:18:42 +02:00
Irmen de Jong
76428b16f0 Merge branch 'master' into labeledchunks
# Conflicts:
#	codeGenIntermediate/src/prog8/codegen/intermediate/BuiltinFuncGen.kt
#	docs/source/todo.rst
#	examples/test.p8
#	virtualmachine/src/prog8/vm/VirtualMachine.kt
2022-10-23 12:19:02 +02:00
Irmen de Jong
e94bf4c63c replace rnd()/rndw() builtin functions by regular routines in math module 2022-10-22 17:02:43 +02:00
Irmen de Jong
6fc89607d3 ir: moving to labeled chunks, no more IRLabel nodes 2022-10-07 00:34:56 +02:00
Irmen de Jong
af6be44676 ir: adding register usage inspections
fix compiler problems with untrimmed inlined asm, and when only a single return statement is present in a subroutine
2022-09-30 20:25:00 +02:00
Irmen de Jong
0d4dd385b8 added '%ir' to write inline IR code, '%asm' is now only for real 6502 assembly.
(%ir is probably only used in the library modules for the virtual machine target)
2022-09-30 15:12:26 +02:00
Irmen de Jong
c26e116f0e vm: fix crashes when array contains pointers/strings 2022-09-24 14:42:07 +02:00
Irmen de Jong
68abda1219 fix a few small compiler errors (removing functioncall, removing block, assigning virtual register return value) 2022-08-09 23:38:29 +02:00
Irmen de Jong
93ce74eeb1 removed problematic expression "simplifications" (that introduced arbitrary r9 temp register usage) 2022-08-07 12:26:11 +02:00
Irmen de Jong
f718f4251b working on better encoding of romsub in new ast/vmtarget 2022-08-07 12:21:10 +02:00
Irmen de Jong
4644c9b621 got rid of GoSub ast node and codegen complexity related to that.
sometimes programs get smaller, sometimes bigger.
2022-08-07 03:24:20 +02:00
Irmen de Jong
05f935b598 simplify & fix recursion detector 2022-07-22 22:22:43 +02:00
Irmen de Jong
35af53828a fix endless loop in optimizer, fix cx16 register clobbering in psg interrupt handler, fix crash on certain arrays, fix undefined symbol when it's in another imported module 2022-07-13 18:42:06 +02:00
Irmen de Jong
edf12bec71 improve bool params typecasting, fix compiler crash on abs(floatvar) 2022-07-12 17:52:37 +02:00
Irmen de Jong
88cbb6913d tweak bool type handling 2022-07-11 14:55:50 +02:00
Irmen de Jong
7a26646e1b tweak bool type handling 2022-07-11 02:08:12 +02:00
Irmen de Jong
92eb3b0bf6 bool logical testcase 2022-07-09 22:29:38 +02:00
Irmen de Jong
211e2bb37a improved bool type checking 2022-07-08 22:29:13 +02:00
Irmen de Jong
81b3d2db4f fix compiler crash 2022-07-08 21:50:06 +02:00
Irmen de Jong
1dfa8ee7d8 add ARRAY_BOOL array type 2022-07-07 23:07:30 +02:00
Irmen de Jong
1163543a98 fix bool param lookup problem 2022-07-07 22:23:56 +02:00
Irmen de Jong
bdb7de34be added several compiler checks against weird boolean type use in expressions 2022-07-07 22:23:56 +02:00
Irmen de Jong
9500fc11ac document new bool datatype and removal of boolean() conversion function 2022-07-07 22:23:56 +02:00
Irmen de Jong
41f4e22a17 introduce BOOL type 2022-07-07 22:23:56 +02:00
Irmen de Jong
25aad8d7be improve const-evaluation of builtin expressions 2022-07-02 16:29:01 +02:00
Irmen de Jong
965340ff90 logical and/or/xor/not all replaced by bitwise &,|,^,~ (ast, codegens)
this also fixed some invalid outcomes of logical expressions!
2022-07-02 00:38:17 +02:00
Irmen de Jong
97cb0cbd08 tweak "not" removal/rewriting 2022-06-30 02:16:30 +02:00
Irmen de Jong
4b358abbb7 "not" operator removed from ast and codegen (it's been replaced with x==0 as equivalent) 2022-06-29 01:13:08 +02:00
Irmen de Jong
435d6f6f3f vm: and/or/xor/not are all bitwise operations again 2022-06-28 03:17:51 +02:00
Irmen de Jong
ef92451d1a fix logical expressions on arbitrary values, for now with boolean() around the operands 2022-06-28 01:18:36 +02:00
Irmen de Jong
af98d01053 failed attempt at McCarthy shortcut evaluation 2022-06-27 21:40:48 +02:00
Irmen de Jong
bb1cda0916 fix: boolean values of terms in logical expressions are now properly evaluated 2022-06-26 23:55:34 +02:00
Irmen de Jong
eea09f4de5 fix invalid asm label sometimes generated for multiple loops in same subroutine 2022-06-24 02:26:45 +02:00
Irmen de Jong
cc174b7b85 added boolean() builtin function and use it to get rid of !=0 comparisons 2022-06-14 23:34:45 +02:00
Irmen de Jong
bf9d120081 logical operators now always return a boolean byte result, instead of sometimes word type as well
(preparing for codegen simplifications for these)
2022-06-13 01:37:16 +02:00
Irmen de Jong
775c85fc18 don't swap operands that would change function evaluation order + vm: fix label casing error 2022-06-13 00:25:45 +02:00
Irmen de Jong
5a756aaed9 Pipe expression "|>" removed from the language 2022-06-12 18:41:42 +02:00
Irmen de Jong
c6e92ecac4 some code cleanup 2022-06-12 16:15:08 +02:00
Irmen de Jong
710f27afa9 bump library versions 2022-06-09 22:44:17 +02:00
Irmen de Jong
b042b7705e fix invalid removal of repeated assignments. 2022-06-06 17:27:06 +02:00
Irmen de Jong
3054a1d32d api change: removed swap() builtin function (too complex in codegen for little used function) 2022-06-06 16:01:11 +02:00
Irmen de Jong
46ca0ac10d properly optimize X - -1 and X + -1, this also fixes type change of ubyte - 2 + 10 2022-06-05 15:35:29 +02:00
Irmen de Jong
031f647952 allow casting negative numbers to unsigned, result = 2's complement 2022-06-05 14:21:10 +02:00
Irmen de Jong
7f69517fd4 preparing optimizing pointer indexing 2022-06-04 16:18:27 +02:00
Irmen de Jong
ba614801ee cleanup 2022-05-22 23:11:22 +02:00
Irmen de Jong
fd6eb47e68 added inlining certain trivial non-asm subroutine calls 2022-05-22 20:22:09 +02:00
Irmen de Jong
627aa61184 clean up subroutine inlining, basis for new try 2022-05-09 15:42:58 +02:00
Irmen de Jong
942c5cc04b fix crash when optimizing pipe expression too aggressively 2022-05-07 17:29:36 +02:00
Irmen de Jong
b32641db87 remove syscall() builtin functions
vm code can do this via inline assembly
2022-05-01 00:41:30 +02:00