1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-23 08:32:39 +00:00

Rafactoring pass 2

This commit is contained in:
Jesper Gravgaard 2019-05-20 11:01:58 +02:00
parent 27c6c3fb86
commit 2b26c813d9
5 changed files with 17 additions and 10 deletions

View File

@ -1,8 +1,8 @@
lda #<{c1}
sta {z1}
lda #>{c1}
sta {z1}+1
lda {z2}
sta {z1}+2
lda {z2}+1
sta {z1}+3
lda #{c1}
sta {z1}
lda #0
sta {z1}+1

View File

@ -0,0 +1,8 @@
lda #<{c1}
sta {z1}
lda #>{c1}
sta {z1}+1
lda {z2}
sta {z1}+2
lda {z2}+1
sta {z1}+3

View File

@ -233,7 +233,7 @@ public class Compiler {
List<Pass2SsaOptimization> optimizations = new ArrayList<>();
optimizations.add(new PassNAddNumberTypeConversions(program));
optimizations.add(new PassNAddArrayNumberTypeConversions(program));
optimizations.add(new PassNDowngradeBytePlusWord(program));
optimizations.add(new PassNDowngradeConstantTypeConversions(program));
optimizations.add(new PassNTypeInference(program));
optimizations.add(new PassNTypeIdSimplification(program));
optimizations.add(new Pass2SizeOfSimplification(program));

View File

@ -13,9 +13,9 @@ import java.util.concurrent.atomic.AtomicBoolean;
/**
* Downgrade any number expression cast that are part of a WORD+NUMBER expression to BYTE if the number is small enough to fit in the byte.
*/
public class PassNDowngradeBytePlusWord extends Pass2SsaOptimization {
public class PassNDowngradeConstantTypeConversions extends Pass2SsaOptimization {
public PassNDowngradeBytePlusWord(Program program) {
public PassNDowngradeConstantTypeConversions(Program program) {
super(program);
}

View File

@ -335,14 +335,13 @@ lin16u_gen: {
sta step
lda stepf+1
sta step+1
lda #<0
sta val
sta val+1
lda min
sta val+2
lda min+1
sta val+3
lda #0
sta val
sta val+1
sta i
sta i+1
b1: