1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-25 05:33:29 +00:00
Commit Graph

317 Commits

Author SHA1 Message Date
jespergravgaard
f46aba8c9b Added inline ASM clobber test. 2017-11-05 09:56:04 +01:00
jespergravgaard
09dd676363 Added semicolon to do {} while (); 2017-11-05 09:44:00 +01:00
jespergravgaard
f1512af630 Added failing test for inline asm with variable reference parameters. 2017-11-05 03:10:10 +01:00
jespergravgaard
8d68d449c4 Implemented inline asm syntax and code generation. Now need to handle parameters. 2017-11-05 03:01:32 +01:00
jespergravgaard
86b1d0db73 Created a single parser for KickC incorporating the ASM parser (for inline ASM - but also for ASM fragment files. ) 2017-11-05 02:20:29 +01:00
jespergravgaard
506b891ef3 Added basic upstart jumping to main() 2017-11-04 19:53:55 +01:00
Jesper Gravgaard
fc45798d75 Separated fragment generation & fragment signature / loading / synthesizing. 2017-11-04 19:04:39 +01:00
jespergravgaard
3d607aba7f Working on inline asm 2017-11-04 14:15:44 +01:00
jespergravgaard
bcef1c3662 Fixed constant propagation problem: (const-identification.kc) Constants are not identified correctly. Some times constant pointers are treated as variables Eg. byte* SCREEN = $0400 is adressed through zero-page even though it can be adressed directly. 2017-11-03 07:58:02 +01:00
jespergravgaard
14219443a8 Ensured that assignment to variables with ALU potential does not affect potential registers through clobbering. 2017-11-01 16:43:13 +01:00
jespergravgaard
4bcef390f3 Fixed bresenham line to do proper word-based addition. 2017-11-01 14:10:49 +01:00
jespergravgaard
0317fc50c3 Improved constant inlining to inline constants with different valued versions 2017-11-01 13:26:32 +01:00
jespergravgaard
4de433730f Fixed problems with versioned constant call parameters being mixed up and with missing scope name on constant references across scopes. 2017-11-01 12:59:29 +01:00
jespergravgaard
6097d80b91 Added a bunch of test cases highlighting each known error 2017-10-29 11:43:39 +01:00
jespergravgaard
c4c60a5b36 Added a bunch of test cases highlighting each known error 2017-10-29 11:41:35 +01:00
jespergravgaard
00f53c49b6 Added support for lo/hi lvalues. Added more ALU options. Working on bitmap plotter. 2017-10-29 01:56:53 +02:00
jespergravgaard
f60be66531 Working on bitmap bresenham. Added lo/hi unary operators. 2017-10-26 12:48:04 +02:00
jespergravgaard
7def3abf28 Improved TODO 2017-10-23 01:29:39 +02:00
jespergravgaard
0d9a0a84f8 Added another known problem 2017-10-23 01:23:39 +02:00
jespergravgaard
cd2c50b8a8 Fixed NPE 2017-10-23 01:22:36 +02:00
jespergravgaard
471117561b Updated TODO. Removed string keyword. 2017-10-23 01:12:13 +02:00
jespergravgaard
943775d97d Implemented phi transition assignment clobber checking. 2017-10-23 00:48:22 +02:00
jespergravgaard
ee5499a313 Added minimal PHI clobber example. 2017-10-21 13:34:42 +02:00
jespergravgaard
f63a540d15 Removed unnecessary (synthesizeable) fragments. 2017-10-21 12:58:03 +02:00
jespergravgaard
774e909a20 Added half-asses halfscii. 2017-10-21 12:36:37 +02:00
jespergravgaard
c569ce8de9 Improved fragment manager enabling synthesis of more fragments. Added boolean operators (and, or, xor, not) 2017-10-20 17:25:04 +02:00
jespergravgaard
1ee63ce40a Added literal char syntax. Added literal test. Improved voronoi by using inmem arrays. 2017-10-19 10:21:32 +02:00
jespergravgaard
b4abb9394e Fixed ClassCastException when attempting to removing a procedure with an empty start. Added a pointer conter increment test. 2017-10-19 09:12:46 +02:00
jespergravgaard
5a4388d6d3 Added KC-based scroller 2017-10-19 01:29:44 +02:00
jespergravgaard
7be265f42c Fixed culling problem causing conditional branches into phi-functions to be skipped. 2017-10-18 14:16:59 +02:00
jespergravgaard
6fb5372f1b Added support for ASM .string directives through string initializer. 2017-10-17 22:51:16 +02:00
jespergravgaard
1a649008b9 Added support for ASM .byte directives through array initializers. 2017-10-17 13:34:41 +02:00
jespergravgaard
feba0565b4 Cleaned up RValue hierarchy. Removing redundant Constant interface. Moving ConstantVar out of the value-hierarchy. 2017-10-17 11:35:37 +02:00
jespergravgaard
efc750ce11 Moved type inference into the model. Renamed ICL to model. 2017-10-17 09:58:00 +02:00
jespergravgaard
09ed57fb98 Separated ASM fragment system out from ASM base 2017-10-17 09:47:26 +02:00
jespergravgaard
1f4efe0a4f Added asm names to symbol table printout. 2017-10-17 09:39:15 +02:00
Jesper Gravgaard
5de6bbba13 Added missing fragments (through signature rewriting) 2017-10-16 13:20:08 +02:00
jespergravgaard
520361f7b6 Optimized live range effective - vastly improving compile speed. 2017-10-16 12:47:42 +02:00
jespergravgaard
d551f8c569 Small numbers skip $ 2017-10-15 23:15:49 +02:00
jespergravgaard
3c1f4d2901 Minor syntax fixes 2017-10-15 22:48:04 +02:00
Jesper Gravgaard
46ffa81633 Added operator precedence to constant printing - avoiding unnecesary perenthesis 2017-10-15 22:39:50 +02:00
Jesper Gravgaard
7b9e80aaac Added constant addition consolidation optimization. 2017-10-15 17:53:18 +02:00
jespergravgaard
525ac454cc Added a new constant test 2017-10-14 22:37:30 +02:00
jespergravgaard
a09ca15dbf Inlining constants that are unnamed, single versions of a variable or aliases of other constants 2017-10-14 22:36:52 +02:00
jespergravgaard
1a9ae72668 Added unnamed constant inlining 2017-10-13 08:06:55 +02:00
jespergravgaard
ccfa6bdbf3 added simple asm constants (syntax error still) 2017-10-04 01:08:36 +02:00
Jesper Gravgaard
6f2dfdbec3 Initial working implementation of constants in the symbol table and ASM. Still needs to output const definitions (intelligently). 2017-10-02 21:47:12 +02:00
Jesper Gravgaard
a553cb97c3 Added more fragments 2017-09-06 21:23:48 +02:00
Jesper Gravgaard
616311daf8 Finally new live ranges are working correctly - including effective live ranges for statements inside methods. 2017-09-06 18:59:53 +02:00
Jesper Gravgaard
99088aef58 Improved uplift test and zp coalesce test to include live ranges from calling statements in overlap testing. The new live range system is still far from perfect. Next step is getEffectiveAlive(stmt) returning alive vars + alive vars from all calling contexts. 2017-09-04 22:15:18 +02:00
Jesper Gravgaard
eb6cf1188c Working on a new live range analysis and the ability to handle constants symbolically. TODOs remaining: Live range overlap analysis of register combinations inside methods must also look at registers alive at all calls. Examine why temp-vars are used in flipper. Examine why flipper is plotted in a wrong position on the screen. Implement constants into the symbol table and support them in code. Implement new constant consolidation steps. 2017-09-04 00:49:00 +02:00
jespergravgaard
61d16b3030 Implemented phi transition reuse when transitions are identical on a register basis 2017-08-26 02:05:46 +02:00
jespergravgaard
83edd3e21b Implemented phi transition reuse when transitions are identical 2017-08-26 01:15:57 +02:00
jespergravgaard
23d9af8420 Started work on phi transition optimization 2017-08-23 09:37:16 +02:00
Jesper Gravgaard
f72585e3c0 Fixed clobber issues caused by statement idx of phi statementsin ASM changed to the call-statement instead of the phi. 2017-08-22 14:57:04 +02:00
jespergravgaard
64c690f925 Improved ZP register ASM naming further. (issue with allocation not choosing optimal registers in some cases - a few tests left failing) 2017-08-21 08:27:34 +02:00
jespergravgaard
029227652e Improved zp register references across scopes. 2017-08-21 01:19:43 +02:00
jespergravgaard
5a91902c21 Moved register allocation into symbol table Variable 2017-08-20 21:41:17 +02:00
jespergravgaard
1982d01297 renames 2017-08-20 21:20:07 +02:00
jespergravgaard
ffce3298ef Moved bresenham into main() 2017-08-20 21:12:40 +02:00
jespergravgaard
2707bd5861 Working on outputting variable labels in ASM. Moving register allocation & constant values into symbol table. 2017-08-20 21:09:03 +02:00
jespergravgaard
df631667a0 Changed ranged loop to only accept constants. 2017-08-18 08:40:15 +02:00
jespergravgaard
14dfaee552 Implemented for() loops. 2017-08-18 00:28:39 +02:00
jespergravgaard
5a075a0ce4 Added for syntax to parser 2017-08-14 08:34:02 +02:00
jespergravgaard
d5f62dfd11 Improved program flow for if-statements without else by inverting the condition and jumping over the stmts. Improved fragment synthesizing. 2017-08-13 03:03:56 +02:00
jespergravgaard
7b30fa4f2c Added ifmin() for optimizing if() block sequence. 2017-08-13 00:44:48 +02:00
jespergravgaard
4741a2d22e Improve pass structure 2017-08-13 00:30:51 +02:00
jespergravgaard
9c8372b989 Redundant and unused label elimination in ASM. 2017-08-12 21:27:36 +02:00
jespergravgaard
5f27eba623 Fixed scope issues in ASM. Added scope to blocks. 2017-08-12 20:16:07 +02:00
Jesper Gravgaard
15a9415d63 Improved ASM readability 2017-08-12 18:30:21 +02:00
jespergravgaard
1577fe026e Changed ASM numbers to HEX 2017-08-12 02:55:20 +02:00
jespergravgaard
7555d45b34 Finally got a hold of live ranges when propagating back over calls. 2017-08-12 02:30:37 +02:00
jespergravgaard
9334e435da refactored addpoint to increment its own counter 2017-08-12 00:31:14 +02:00
jespergravgaard
7c7e0ec08f Added more minimal test for modifying globals 2017-08-12 00:23:55 +02:00
jespergravgaard
450fc1add0 Added more minimal test for modifying globals 2017-08-12 00:22:46 +02:00
jespergravgaard
fc859e8a03 Implemented ability of procedures to modify globals 2017-08-12 00:15:59 +02:00
jespergravgaard
867d78fd31 Implemented ASM voronoi with squared distance function. 2017-08-07 23:17:56 +02:00
jespergravgaard
1f4ea4f68c Scrren init moved out of main loop. 2017-08-07 21:40:32 +02:00
jespergravgaard
3eaed1c946 Animated voronoi. Added fragments as needed. 2017-08-07 21:23:35 +02:00
jespergravgaard
772a2a3761 Removed unnecessary fragments 2017-08-07 17:53:43 +02:00
jespergravgaard
9f5efab3ee Less logging during uplift. 2017-08-07 17:17:14 +02:00
jespergravgaard
d640c53033 Added fragment manager with ability to do fragment synthesis from sub-fragments. Added more fragments. 2017-08-07 16:35:10 +02:00
jespergravgaard
2a19c52c1d Implemented Voronoi renderer. Added missing fragments. Added combination limit and an iteration trying to uplift the remains. 2017-08-07 14:53:25 +02:00
jespergravgaard
ec1838adba Added ALU uplift potential analysis 2017-08-06 17:00:10 +02:00
jespergravgaard
3624e3ec27 Fixed two register allocation issues. 1. disallow two variables in the same phi-block to be allocated to the same register. 2. When analyzing potential registers call parameter phi statements are no longer examined. 2017-08-06 15:41:06 +02:00
jespergravgaard
0dae641df0 Optimized ASM instruction lookup by introducing a map. 2017-08-06 15:01:11 +02:00
jespergravgaard
0da6c7af6a Optimized fragment generation by caching loaded fragment files. 2017-08-06 14:14:58 +02:00
jespergravgaard
439a70e52a Implemented potential register elimination based on clobber analysis of individual statements. 2017-08-06 13:31:29 +02:00
Jesper Gravgaard
0e5bd97e21 Moved uplift combination testing to separate pass. Made interface for limiting the relevant registers for each equivalence class - improving speed of the combination testing. 2017-08-03 15:05:36 +02:00
jespergravgaard
3b99b6671c Added ALU to uplift attempts 2017-08-03 01:08:48 +02:00
jespergravgaard
59d33faf92 Implemented new uplift score function sum(cycles*10^loopdepth). Added a lot of missing fragments. Sorted scopes so max weight scopes are allocated first. 2017-08-02 22:20:00 +02:00
jespergravgaard
b9831c9445 Implemented register uplift combination search. This yields near optimal register allocation - but at a calculation cost at O(4^N) where N is the number of live range equivalence classes in a scope. 2017-08-02 00:57:29 +02:00
jespergravgaard
14c8ec13bf Improved segment generation 2017-08-01 20:38:55 +02:00
jespergravgaard
323e10ab37 Introduced Asm Segments which establish relation between ASM code and the generating ICL. 2017-08-01 13:58:15 +02:00
jespergravgaard
14c1f7e8eb Now identifying undeclared variables 2017-08-01 01:33:42 +02:00
jespergravgaard
b56f634b1e Merge remote-tracking branch 'gitlab/master' 2017-07-31 23:41:25 +02:00
jespergravgaard
64d9ff3f23 Gathered all pass results in Program. 2017-07-31 23:41:10 +02:00
Jesper Gravgaard
46dd64e46c Fixed test data 2017-07-31 23:39:42 +02:00
Jesper Gravgaard
27084f8667 Merge remote-tracking branch 'gitlab/master' 2017-07-31 23:38:05 +02:00
Jesper Gravgaard
4a9a3d54f5 Fixed test data 2017-07-31 23:37:15 +02:00
jespergravgaard
5d21c6aa97 Added indexes to ASM lines in AsmProgram 2017-07-31 21:53:42 +02:00
jespergravgaard
47e8b6b2b9 More fragments - a start at calculating value for ASM. 2017-07-31 20:00:25 +02:00
Jesper Gravgaard
18bbde8a44 Started implementing register uplift with clobber checks. Added a bunch of missing fragments. Added a few failing tests of errors that should give a nice error message. 2017-07-30 16:31:59 +02:00
jespergravgaard
3a14d2ef5b Cleaned up pointer handling in ASM fragments and binding 2017-07-30 11:28:28 +02:00
jespergravgaard
5f1cf097a4 Added a pointer test 2017-07-30 11:08:44 +02:00
jespergravgaard
120eba90a5 Implemented clobber assertion check for testing potential register allocations. 2017-07-29 23:38:07 +02:00
jespergravgaard
e34e01544b Fixed constant addition elimination. Moved ASM generation for a single statement to separate function - preparing for clobber analysis of register allocation. Added fibmem test. Tested ALU. 2017-07-29 21:04:28 +02:00
jespergravgaard
7f20f2a6ba Implemented variable register weight analysis. 2017-07-29 17:10:32 +02:00
jespergravgaard
0377193ec8 Moved to maven based configuration & build. 2017-07-29 14:59:55 +02:00
jespergravgaard
c12c45b5bd Fixed cross-scope aliasing. Improved assignment ASM for register copies. 2017-07-29 13:41:47 +02:00
jespergravgaard
d159163f21 fixed tests 2017-07-29 11:18:15 +02:00
jespergravgaard
438bdc38b4 Propagating live ranges backwards through calls to avoid coalescing variables in procedures with variables alive outside during the call. 2017-07-29 11:08:24 +02:00
jespergravgaard
9634741d76 Split zero page register allocation into separate phase steps. Added live range information to register allocation phases. 2017-07-29 10:24:37 +02:00
jespergravgaard
b4d5685222 Added a nested loop test. 2017-07-28 03:08:19 +02:00
jespergravgaard
007a5d34b4 Implemented loop depth analysis pass. 2017-07-28 02:55:19 +02:00
jespergravgaard
d1a13402fe Added loop depth analysis pass - not implemented yet. 2017-07-28 01:23:20 +02:00
jespergravgaard
45e64d59f1 A few renames and better doc. 2017-07-28 00:43:55 +02:00
jespergravgaard
d501534561 Implemented call graph analysis. 2017-07-28 00:38:17 +02:00
jespergravgaard
e7ea5fb4ea Implemented control flow graph loop analysis. 2017-07-27 22:20:50 +02:00
jespergravgaard
709cc57a1a Implemented graph dominator analysis. 2017-07-27 15:23:46 +02:00
jespergravgaard
be212f3b38 Implemented live ranged based register allocation - coalescing on phi statements first, copy-assignments second, other assignments third - and finally the remaining vars are added. 2017-07-27 01:33:10 +02:00
jespergravgaard
13c84a1741 Implemented PhiMemCoalesce. 2017-07-26 19:44:51 +02:00
jespergravgaard
16d4ab93f0 Added another block assertion 2017-07-26 17:01:01 +02:00
jespergravgaard
878059da13 Added more asserts 2017-07-26 16:09:47 +02:00
jespergravgaard
d7e0a638f2 Fixed tests 2017-07-26 15:14:56 +02:00
jespergravgaard
bebf020364 Improved phi lifting by introducing new blocks when lifting back to blocks with conditional jumps. Improved sequence planner to ensure blocks in the same scopes are kept together. 2017-07-26 15:09:00 +02:00
jespergravgaard
c43ab3acef Implemented variable live range identification 2017-07-26 00:26:50 +02:00
jespergravgaard
69cbee294d Made room for new pass 3 interval analysis 2017-07-25 00:56:42 +02:00
jespergravgaard
0aa64b3203 Added pass1 optimization removing empty blocks. 2017-07-25 00:21:40 +02:00
jespergravgaard
2819d3c58a Added pass1 optimization removing empty blocks. 2017-07-25 00:17:56 +02:00
jespergravgaard
524252105a Refactored toString to avoid redundant code. 2017-07-24 08:19:44 +02:00
jespergravgaard
300bb644b9 Refactored phi to use blocks instead of individual statements 2017-07-23 23:29:40 +02:00
jespergravgaard
122cef4e30 Better label naming when creating intermediate labels 2017-07-21 12:18:05 +02:00
jespergravgaard
88c7ed453a Better label naming when creating intermediate labels 2017-07-21 11:32:41 +02:00
jespergravgaard
4c0a9cd241 Removed cast calls to getSymbol() 2017-07-21 10:49:28 +02:00
jespergravgaard
6ef3af4fdf ICL Programs are now JSON serializable 2017-07-21 01:53:38 +02:00
jespergravgaard
d38c26eeb5 added a few toString()s 2017-07-20 10:14:22 +02:00
jespergravgaard
00463cd72f Moved all ref creation to getRef() 2017-07-20 10:02:25 +02:00
Jesper Gravgaard
de88808c5f Replaced all program labels with labelrefs ans procedures with procedurerefs. 2017-07-20 09:26:06 +02:00
Jesper Gravgaard
e6d09187e3 Added typed and untyped print functions everywhere. Now getting the same output as the old compilation! 2017-07-19 13:21:16 +02:00
Jesper Gravgaard
6e087e9a1c Now serializing all symbol types 2017-07-18 23:13:24 +02:00
Jesper Gravgaard
819c904419 Implementing JSON serialization of ICL 2017-07-18 22:49:25 +02:00
Jesper Gravgaard
1b0b81baf2 Restructured code in new packages 2017-07-18 18:12:11 +02:00
Jesper Gravgaard
92747454c7 Restructured code in new packages 2017-07-18 18:10:12 +02:00
Jesper Gravgaard
32a2c9eb2b Optimized registers for fibmem. 2017-07-18 16:46:52 +02:00
Jesper Gravgaard
a7e0e2b1d0 Added main method to flipper. Fixed a few bugs in compiler. 2017-07-16 11:09:32 +02:00
Jesper Gravgaard
f6eeb5ff83 Removed comments from ASM output 2017-07-16 09:41:27 +02:00
Jesper Gravgaard
67b4257ad9 Added a second test 2017-07-15 23:32:25 +02:00
Jesper Gravgaard
0116c9e21d Added full compile log to test 2017-07-15 23:26:45 +02:00
Jesper Gravgaard
8e59603418 made map linked for predictability 2017-07-15 22:21:07 +02:00