Commit Graph

67 Commits

Author SHA1 Message Date
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
Irmen de Jong
7936fc5bd8 tiny optimization of negating a register 2021-11-20 21:42:55 +01:00
Irmen de Jong
adfaddbcf4 give a nicer error when given a wrong compilation target. 2021-11-20 18:30:55 +01:00
Irmen de Jong
f9399bcce7 r=(q+r)-c and r=q+(r-c) are now both also 'augmentable', and BinExprSplitter doesn't check for associativeOperator anymore 2021-11-20 02:03:32 +01:00
Irmen de Jong
b334d89715 refactor and fix the way memory addresses are checked to be in IO space or regular ram 2021-11-18 22:47:58 +01:00
Irmen de Jong
fa11a6e18b removed faulty and too aggressive assembly optimization of double-store 2021-11-18 01:43:22 +01:00
Irmen de Jong
f48d6ca9f8 simplified NumericLiteral to always just contain a Double instead of a Number for the value 2021-11-16 23:52:54 +01:00
Irmen de Jong
964e8e0a17 update to Kotlin 1.6.0 2021-11-16 22:36:23 +01:00
Irmen de Jong
1f60a2d8b9 comments 2021-11-15 01:30:12 +01:00
Irmen de Jong
53e1729e2f introduce option to use internal scratch variables via prog8_lib definitions (ony for compiler, not for user code!) 2021-11-14 16:01:54 +01:00
Irmen de Jong
5190594c8a added several more assembly-level optimizations to remove redundant instructions 2021-11-14 12:23:46 +01:00
Irmen de Jong
222bcb808f optimize load-store-load combo in output asm 2021-11-10 23:47:35 +01:00
Irmen de Jong
686483f51a fixed division of signed byte number by 2. (!) 2021-11-10 00:17:56 +01:00
Irmen de Jong
8df3da11e3 add cosr8, sinr8, cosr16 and sinr16 builtin functions that take a degree 0..179 (= 0..358 in 2 degree steps)
to more easily scale halves/quarters etc of a circle than possible with the ones that take 0..255 'degrees'.
2021-11-09 23:39:26 +01:00
Irmen de Jong
b909facfe5 fix compiler stackoverflow crash on certain typecasted expressions containing floats. 2021-11-09 19:31:19 +01:00
Irmen de Jong
4937e004b5 fix compiler crash where it used wrong datatype in split assignment
fixes crash for "ubyte bb ;; uword ww ;; bb = not bb or not ww"
2021-11-09 01:13:23 +01:00
Irmen de Jong
c8a4b6f23c refactor expressionsAsmGen so that it now has just 1 single public function
this makes replacing it by a non-stack based solution easier in the future.
2021-11-08 19:21:55 +01:00
Irmen de Jong
857724c7e6 attempt to make if-statement not use stack eval anymore 2021-11-08 19:07:36 +01:00
Irmen de Jong
984272beb4 migrated compilerAst module to KoTest (but not finished with the assertions yet) 2021-11-07 17:25:53 +01:00
Irmen de Jong
b9ce94bb68 migrated codeGeneration module to KoTest 2021-11-07 15:40:05 +01:00
Irmen de Jong
18d820da94 correct assignment type 2021-11-06 18:52:54 +01:00
Irmen de Jong
26e66f046f implement some more missing codegen for inplace Prefix expressions 2021-11-06 18:48:42 +01:00
Irmen de Jong
74456d1135 optimized prefix-expression in to use stack evaluation less 2021-11-06 17:57:00 +01:00
Irmen de Jong
62dc824bc0 tweaks 2021-11-06 17:14:07 +01:00
Irmen de Jong
1605791f1b float swap() no longer uses evaluation stack but a single temp var instead + FAC1 2021-11-06 03:36:14 +01:00
Irmen de Jong
37a46aa2cf complex memory assignment also tries to avoid estack evaluation (but not done yet) 2021-11-06 00:03:19 +01:00
Irmen de Jong
1d2d217b94 non-optimized typecast assignments now attempt to not use evalstack 2021-11-05 23:25:07 +01:00
Irmen de Jong
23961f695d fixed some parse tree node position end-columns. cleanup some todo's 2021-11-05 22:48:28 +01:00
Irmen de Jong
730b208617 relaxed some type checks on certain word register assignment
preparing to optimize asmsub arg passing for complex expressions
2021-11-04 23:57:25 +01:00
Irmen de Jong
f09c04eeac fix invalid asm addressing mode for certain value-to-evalstack transfers 2021-11-04 22:44:31 +01:00
Irmen de Jong
7f49731618 fix: don't initialize block vars twice, fix: make sure the prog8_init_vars generated routine is correctly called when needed 2021-11-02 23:13:28 +01:00
Irmen de Jong
1110bd0851 fix vardecl initialization value to not use stack eval anymore but separate assignment
(this causes the optimized assignment code gen to be used instead)
but some programs now end up larger in output size
2021-11-01 00:24:15 +01:00
Irmen de Jong
1b576f826d remove unneeded sibling methods 2021-10-31 16:50:15 +01:00