From 3c1f4d2901c2a4745f8b34c7d61529063941f193 Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Sun, 15 Oct 2017 22:48:04 +0200 Subject: [PATCH] Minor syntax fixes --- src/main/java/dk/camelot64/kickc/TODO.txt | 33 ++++++++++--------- .../java/dk/camelot64/kickc/icl/Operator.java | 18 +++++----- .../kickc/passes/VariableReplacer.java | 2 +- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/src/main/java/dk/camelot64/kickc/TODO.txt b/src/main/java/dk/camelot64/kickc/TODO.txt index 9e56e84bb..0256b40ae 100644 --- a/src/main/java/dk/camelot64/kickc/TODO.txt +++ b/src/main/java/dk/camelot64/kickc/TODO.txt @@ -1,17 +1,3 @@ -TODO's for new Constant Solution -+ 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. -- Reintroduce constant addition optimization -+ Add asmName for ConstantVar to remove subscripts -+ Inline constants for "single" versions of vars - such as .const i#0 = 0 -+ Look at optimizing liverange.kc's ASM further - atm. there are to many copy-operations into unnecesary registers. -+ In summin.asm the result of the 2nd sum() is clobbered twice during call to sum(). jsr sum, txa, lda #$d, ldx #$9, jsr sum - + Fix by introducing "effective alive vars" which includes alive vars at all calls to containing methods and using that during clobber check. -+ In loopnest.asm x&y are used in both loops - the outer x&y are clobbered by the inner loop. -+ In voronoi.asm in render() x is clobbered during call to findcol(). Features - Move the main code into a main() function, and disallow code outside functions. The main function per default has no parameters and exits with RTS. @@ -44,7 +30,7 @@ Features Assembler Improvements - Make generated ASM human readable. + Use hex-numbers - - add labels for constants and zp-variables. + + add labels for constants and zp-variables. - Eliminate chained JMP's (replace by direct JMP) - example: loopsplit.asm - Better ASM static value analysis - Not just constants - but also other values (value of var, value of var1[var2], value of var+4 etc.) @@ -110,4 +96,19 @@ Real Usage - Implement library for fast multiply (mul.asm) - Implement spline library (spline.asm) - Implement polygon filler for complex polygons. -- Implement a true type font renderer. \ No newline at end of file +- Implement a true type font renderer. + +New Constant Solution ++ 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. ++ Reintroduce constant addition optimization ++ Add asmName for ConstantVar to remove subscripts ++ Inline constants for "single" versions of vars - such as .const i#0 = 0 ++ Look at optimizing liverange.kc's ASM further - atm. there are to many copy-operations into unnecesary registers. ++ In summin.asm the result of the 2nd sum() is clobbered twice during call to sum(). jsr sum, txa, lda #$d, ldx #$9, jsr sum + + Fix by introducing "effective alive vars" which includes alive vars at all calls to containing methods and using that during clobber check. ++ In loopnest.asm x&y are used in both loops - the outer x&y are clobbered by the inner loop. ++ In voronoi.asm in render() x is clobbered during call to findcol(). diff --git a/src/main/java/dk/camelot64/kickc/icl/Operator.java b/src/main/java/dk/camelot64/kickc/icl/Operator.java index a0b33e699..abf82863c 100644 --- a/src/main/java/dk/camelot64/kickc/icl/Operator.java +++ b/src/main/java/dk/camelot64/kickc/icl/Operator.java @@ -102,18 +102,20 @@ public class Operator { @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; Operator operator1 = (Operator) o; - return operator != null ? operator.equals(operator1.operator) : operator1.operator == null; + if (precedence != operator1.precedence) return false; + if (!operator.equals(operator1.operator)) return false; + return type == operator1.type; } @Override public int hashCode() { - return operator != null ? operator.hashCode() : 0; + int result = operator.hashCode(); + result = 31 * result + precedence; + result = 31 * result + type.hashCode(); + return result; } + } diff --git a/src/main/java/dk/camelot64/kickc/passes/VariableReplacer.java b/src/main/java/dk/camelot64/kickc/passes/VariableReplacer.java index 76efb9966..99ff683e4 100644 --- a/src/main/java/dk/camelot64/kickc/passes/VariableReplacer.java +++ b/src/main/java/dk/camelot64/kickc/passes/VariableReplacer.java @@ -8,7 +8,7 @@ import java.util.List; import java.util.Map; /** - * A replacer capable to getReplacement all usages of a variable (or constant var) with a suitable replacement + * A replacer capable to alias all usages of a variable (or constant var) with a suitable replacement */ public class VariableReplacer {