53 Commits

Author SHA1 Message Date
Ulf Norell
4371bf7db4 Improve inlining of PUSH 2019-05-07 13:16:39 +02:00
Ulf Norell
1f40d2a321 Compile builtins 2019-05-07 13:16:39 +02:00
Ulf Norell
6f17477c72 Distinguish local vars and top-level names already in fcode 2019-05-07 13:16:39 +02:00
Ulf Norell
1d39464190 Add compile-time evaluation for more operators 2019-05-07 13:16:39 +02:00
Ulf Norell
b5330882ba Fixed left-over reference to STR_EQ 2019-05-07 13:16:39 +02:00
Ulf Norell
ef120a7194 Simplify JUMPIF on true/false 2019-05-07 13:16:39 +02:00
Ulf Norell
4a8fb5ba05 Compile maps 2019-05-07 13:16:39 +02:00
Ulf Norell
cd454fb538 Compile all the operators 2019-05-07 13:16:39 +02:00
Ulf Norell
8559ab0628 fix minor bugs 2019-05-07 13:16:39 +02:00
Ulf Norell
0307a82433 Case on constructor optimization 2019-05-07 13:16:39 +02:00
Ulf Norell
389a5c4e62 some constant propagation optimizations 2019-05-07 13:16:39 +02:00
Ulf Norell
081a4d28b6 use STORE ?a instead of PUSH during optimizations 2019-05-07 13:16:39 +02:00
Ulf Norell
8a5c64ad45 Compile function calls
(to fully saturated top-level functions only)
2019-05-07 13:16:39 +02:00
Ulf Norell
a4bbe2bc2f Unary operators 2019-05-07 13:16:39 +02:00
Ulf Norell
272c247b4d compile address literals 2019-05-07 13:16:39 +02:00
Ulf Norell
c419b105bf Minor refactoring of op instruction handling 2019-05-07 13:16:39 +02:00
Ulf Norell
b7153b1d75 string literals and pattern matching on the same 2019-05-07 13:16:39 +02:00
Ulf Norell
0ce144db13 Use the fact that SWITCH and JUMPIF can use args and vars 2019-05-07 13:16:39 +02:00
Ulf Norell
960ffb383f Optimize matching on single constructors datatypes 2019-05-07 13:16:39 +02:00
Ulf Norell
6806554d77 Remove incorrect push for tuple switches 2019-05-07 13:16:39 +02:00
Ulf Norell
9ac5a36265 Compile variants 2019-05-07 13:16:39 +02:00
Ulf Norell
ed60cd8ddc Use SETELEMENT instruction 2019-05-07 13:16:39 +02:00
Ulf Norell
5c77237316 compile records (patterns and construction) 2019-05-07 13:16:38 +02:00
Ulf Norell
bdc5e17ab7 Use op_view in more places 2019-05-07 13:16:38 +02:00
Ulf Norell
d333b5f11f Compile list patterns 2019-05-07 13:16:38 +02:00
Ulf Norell
6042294f96 Compile pattern matching on integer literals 2019-05-07 13:16:38 +02:00
Ulf Norell
96bff0c32f Fix dialyzer things 2019-05-07 13:16:38 +02:00
Ulf Norell
ff58ec0cba Remove 'if' from fcode 2019-05-07 13:16:38 +02:00
Ulf Norell
46c538b7bf Tag instructions in annotated scode 2019-05-07 13:16:38 +02:00
Ulf Norell
758f836bf6 Remove optimization for if-then-else 2019-05-07 13:16:38 +02:00
Ulf Norell
b3131504b0 Handle switch_body in optimizations 2019-05-07 13:16:38 +02:00
Ulf Norell
771e4aa967 Fix various bugs in pattern match compilation 2019-05-07 13:16:38 +02:00
Ulf Norell
e597a3780a compile list literals 2019-05-07 13:16:38 +02:00
Ulf Norell
42c7fde413 Shortcut let x = y in ... 2019-05-07 13:16:38 +02:00
Ulf Norell
961af8ba93 Simplify variables bindings in environment 2019-05-07 13:16:38 +02:00
Ulf Norell
66413ae7fe Compile case trees all the way to Fate assembly 2019-05-07 13:16:38 +02:00
Ulf Norell
ab13222d29 Pattern matching on booleans 2019-05-07 13:16:38 +02:00
Ulf Norell
59845dec54 Limit the number of iterations for the optimization loop
Should finish in one iteration, but we shouldn't loop if there are bugs
or corner cases where it doesn't.
2019-05-07 13:16:38 +02:00
Ulf Norell
4814cfbf96 Keep better track of liveness annotations when swapping instructions 2019-05-07 13:16:38 +02:00
Ulf Norell
d05130a569 Get rid of unnecessary STORE instructions 2019-05-07 13:16:38 +02:00
Ulf Norell
4b6191aa25 Reannotate and repeat optimization pass once it done
Could try hard to keep annotations more precise, but would be more error prone
2019-05-07 13:16:38 +02:00
Ulf Norell
41387ce0b1 Compile nested pattern matching to case trees
(Only tuple and variable patterns so far)
2019-05-07 13:16:38 +02:00
Ulf Norell
ac25a8fc55 Improve instruction analysis and generalize some optimizations 2019-05-07 13:16:38 +02:00
Ulf Norell
788840f0fa Compile tuple construction 2019-05-07 13:16:38 +02:00
Ulf Norell
3ec156a4b4 Refactor optimization rules 2019-05-07 13:16:38 +02:00
Ulf Norell
185487afda Nicer debug printing 2019-05-07 13:16:38 +02:00
Ulf Norell
e224aadff7 Use RETURNR when possible 2019-05-07 13:16:38 +02:00
Ulf Norell
68ee18fe70 Liveness analysis for local variables 2019-05-07 13:16:38 +02:00
Ulf Norell
200f80cc89 Compile shallow matching on tuples 2019-05-07 13:16:38 +02:00
Ulf Norell
d37ef8cec2 Basic tuple patterns 2019-05-07 13:16:38 +02:00