From 663b885196b16d24bb5a9c087460a3155e618699 Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Tue, 28 Nov 2017 00:39:15 +0100 Subject: [PATCH] Now removing any unused procedures in pass 1. Closed #96 --- .../java/dk/camelot64/kickc/Compiler.java | 12 +- .../kickc/model/ControlFlowGraph.java | 7 +- .../kickc/model/VariableReferenceInfos.java | 1 - .../kickc/passes/Pass1AddTypePromotions.java | 1 + .../Pass1EliminateUncalledProcedures.java | 53 +++ .../dk/camelot64/kickc/test/TestPrograms.java | 4 + .../camelot64/kickc/test/ref/asm-clobber.log | 1 + .../kickc/test/ref/bitmap-bresenham.log | 16 + .../kickc/test/ref/bitmap-plotter.log | 16 + .../dk/camelot64/kickc/test/ref/bresenham.log | 1 + .../camelot64/kickc/test/ref/bresenhamarr.log | 2 + .../kickc/test/ref/callconstparam.log | 1 + .../dk/camelot64/kickc/test/ref/casting.log | 1 + .../dk/camelot64/kickc/test/ref/chargen.log | 60 +++ .../kickc/test/ref/const-identification.log | 2 + .../camelot64/kickc/test/ref/constantmin.log | 2 + .../dk/camelot64/kickc/test/ref/fibmem.log | 1 + .../camelot64/kickc/test/ref/flipper-rex2.log | 4 + .../camelot64/kickc/test/ref/forrangemin.log | 2 + .../dk/camelot64/kickc/test/ref/halfscii.log | 128 +++++ .../dk/camelot64/kickc/test/ref/ifmin.log | 1 + .../dk/camelot64/kickc/test/ref/incd020.log | 1 + .../camelot64/kickc/test/ref/inline-asm.log | 14 + .../kickc/test/ref/inlinearrayproblem.log | 2 + .../camelot64/kickc/test/ref/inmemarray.log | 1 + .../camelot64/kickc/test/ref/inmemstring.log | 1 + .../dk/camelot64/kickc/test/ref/iterarray.log | 1 + .../dk/camelot64/kickc/test/ref/literals.log | 1 + .../camelot64/kickc/test/ref/local-string.log | 1 + .../dk/camelot64/kickc/test/ref/loopnest.log | 1 + .../dk/camelot64/kickc/test/ref/loopnest2.log | 1 + .../dk/camelot64/kickc/test/ref/modglobal.log | 1 + .../camelot64/kickc/test/ref/modglobalmin.log | 1 + .../kickc/test/ref/overlap-allocation-2.log | 1 + .../kickc/test/ref/overlap-allocation.log | 1 + .../camelot64/kickc/test/ref/ptr-complex.log | 62 +++ .../dk/camelot64/kickc/test/ref/ptrtest.log | 4 + .../camelot64/kickc/test/ref/ptrtestmin.log | 1 + .../kickc/test/ref/scroll-clobber.log | 2 + .../dk/camelot64/kickc/test/ref/scroll.log | 4 + .../dk/camelot64/kickc/test/ref/scrollbig.log | 7 + .../camelot64/kickc/test/ref/signed-bytes.log | 1 + .../kickc/test/ref/unused-method.asm | 10 + .../kickc/test/ref/unused-method.cfg | 12 + .../kickc/test/ref/unused-method.log | 442 ++++++++++++++++++ .../kickc/test/ref/unused-method.sym | 8 + .../dk/camelot64/kickc/test/ref/useglobal.log | 16 + .../dk/camelot64/kickc/test/ref/voronoi.log | 2 + .../camelot64/kickc/test/ref/zpparammin.log | 2 + .../dk/camelot64/kickc/test/ref/zpptr.log | 1 + .../dk/camelot64/kickc/test/unused-method.kc | 8 + 51 files changed, 912 insertions(+), 14 deletions(-) create mode 100644 src/main/java/dk/camelot64/kickc/passes/Pass1EliminateUncalledProcedures.java create mode 100644 src/main/java/dk/camelot64/kickc/test/ref/unused-method.asm create mode 100644 src/main/java/dk/camelot64/kickc/test/ref/unused-method.cfg create mode 100644 src/main/java/dk/camelot64/kickc/test/ref/unused-method.log create mode 100644 src/main/java/dk/camelot64/kickc/test/ref/unused-method.sym create mode 100644 src/main/java/dk/camelot64/kickc/test/unused-method.kc diff --git a/src/main/java/dk/camelot64/kickc/Compiler.java b/src/main/java/dk/camelot64/kickc/Compiler.java index 310beec6b..78a454fcc 100644 --- a/src/main/java/dk/camelot64/kickc/Compiler.java +++ b/src/main/java/dk/camelot64/kickc/Compiler.java @@ -86,14 +86,12 @@ public class Compiler { log.append("INITIAL CONTROL FLOW GRAPH"); log.append(program.getGraph().toString(program)); - Pass1EliminateEmptyBlocks pass1EliminateEmptyBlocks = new Pass1EliminateEmptyBlocks(program); - boolean blockEliminated = pass1EliminateEmptyBlocks.eliminate(); - if (blockEliminated) { - log.append("CONTROL FLOW GRAPH"); - log.append(program.getGraph().toString(program)); - } + new Pass1EliminateUncalledProcedures(program).eliminate(); + new Pass1EliminateEmptyBlocks(program).eliminate(); + log.append("CONTROL FLOW GRAPH"); + log.append(program.getGraph().toString(program)); - (new Pass1ModifiedVarsAnalysis(program)).findModifiedVars(); + new Pass1ModifiedVarsAnalysis(program).findModifiedVars(); log.append("PROCEDURE MODIFY VARIABLE ANALYSIS"); log.append(program.getProcedureModifiedVars().toString(program)); diff --git a/src/main/java/dk/camelot64/kickc/model/ControlFlowGraph.java b/src/main/java/dk/camelot64/kickc/model/ControlFlowGraph.java index f7e7e634f..2af488713 100644 --- a/src/main/java/dk/camelot64/kickc/model/ControlFlowGraph.java +++ b/src/main/java/dk/camelot64/kickc/model/ControlFlowGraph.java @@ -118,12 +118,7 @@ public class ControlFlowGraph { predecessorBlocks.add(other); } } - Collections.sort(predecessorBlocks, new Comparator() { - @Override - public int compare(ControlFlowBlock o1, ControlFlowBlock o2) { - return o1.getLabel().getFullName().compareTo(o2.getLabel().getFullName()); - } - }); + Collections.sort(predecessorBlocks, Comparator.comparing(o -> o.getLabel().getFullName())); return predecessorBlocks; } diff --git a/src/main/java/dk/camelot64/kickc/model/VariableReferenceInfos.java b/src/main/java/dk/camelot64/kickc/model/VariableReferenceInfos.java index d920d4b69..d9b7d5cab 100644 --- a/src/main/java/dk/camelot64/kickc/model/VariableReferenceInfos.java +++ b/src/main/java/dk/camelot64/kickc/model/VariableReferenceInfos.java @@ -21,7 +21,6 @@ public class VariableReferenceInfos { /** Variables defined in each statement. */ private Map> stmtDefined; - public VariableReferenceInfos( Map> blockReferenced, Map> blockUsed, diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass1AddTypePromotions.java b/src/main/java/dk/camelot64/kickc/passes/Pass1AddTypePromotions.java index 161841e93..8e88e4749 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass1AddTypePromotions.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass1AddTypePromotions.java @@ -61,6 +61,7 @@ public class Pass1AddTypePromotions { if(assignment.getOperator()==null) { // No operator - add cast directly! assignment.setOperator(Operator.getCastUnary(lValueType)); + getProgram().getLog().append("Promoting "+rValueType+" to "+lValueType+" in "+assignment); } else { throw new RuntimeException("Tmp-var promotions not implemented yet "+assignment); } diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass1EliminateUncalledProcedures.java b/src/main/java/dk/camelot64/kickc/passes/Pass1EliminateUncalledProcedures.java new file mode 100644 index 000000000..8e1c00588 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/passes/Pass1EliminateUncalledProcedures.java @@ -0,0 +1,53 @@ +package dk.camelot64.kickc.passes; + +import dk.camelot64.kickc.model.*; + +import java.util.Collection; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +/** Eliminate uncalled methods */ +public class Pass1EliminateUncalledProcedures { + + private Program program; + + public Pass1EliminateUncalledProcedures(Program program) { + this.program = program; + } + + public void eliminate() { + Set calledProcedures = new LinkedHashSet<>(); + for (ControlFlowBlock block : program.getGraph().getAllBlocks()) { + for (Statement statement : block.getStatements()) { + if(statement instanceof StatementCall) { + StatementCall call = (StatementCall) statement; + ProcedureRef procedureRef = call.getProcedure(); + calledProcedures.add(procedureRef); + } + } + } + + Set unusedProcedures = new LinkedHashSet<>(); + Collection allProcedures = program.getScope().getAllProcedures(true); + for (Procedure procedure : allProcedures) { + if(!calledProcedures.contains(procedure.getRef())) { + // The procedure is not used - mark for removal! + unusedProcedures.add(procedure.getRef()); + } + } + + for (ProcedureRef unusedProcedure : unusedProcedures) { + program.getLog().append("Removing unused procedure "+unusedProcedure); + Procedure procedure = program.getScope().getProcedure(unusedProcedure); + List procedureBlocks = program.getGraph().getScopeBlocks(unusedProcedure); + for (ControlFlowBlock procedureBlock : procedureBlocks) { + program.getGraph().remove(procedureBlock.getLabel()); + } + procedure.getScope().remove(procedure); + } + + + } + +} diff --git a/src/main/java/dk/camelot64/kickc/test/TestPrograms.java b/src/main/java/dk/camelot64/kickc/test/TestPrograms.java index e4d5c99d1..3855b80ff 100644 --- a/src/main/java/dk/camelot64/kickc/test/TestPrograms.java +++ b/src/main/java/dk/camelot64/kickc/test/TestPrograms.java @@ -24,6 +24,10 @@ public class TestPrograms extends TestCase { helper = new ReferenceHelper("dk/camelot64/kickc/test/ref/"); } + public void testUnusedMethod() throws IOException, URISyntaxException { + compileAndCompare("unused-method"); + } + public void testLocalString() throws IOException, URISyntaxException { compileAndCompare("local-string"); } diff --git a/src/main/java/dk/camelot64/kickc/test/ref/asm-clobber.log b/src/main/java/dk/camelot64/kickc/test/ref/asm-clobber.log index e935e258b..b54a3373d 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/asm-clobber.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/asm-clobber.log @@ -68,6 +68,7 @@ SYMBOLS (byte) main::k (byte) main::l +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) SCREEN ← ((byte*)) (word/signed word) 1024 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/bitmap-bresenham.log b/src/main/java/dk/camelot64/kickc/test/ref/bitmap-bresenham.log index 7912b1f52..d637dee1c 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/bitmap-bresenham.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/bitmap-bresenham.log @@ -707,6 +707,22 @@ SYMBOLS (byte[]) plot_yhi (byte[]) plot_ylo +Promoting word to byte* in COLS ← ((byte*)) 55296 +Promoting word to byte* in BGCOL ← ((byte*)) 53280 +Promoting word to byte* in FGCOL ← ((byte*)) 53281 +Promoting word to byte* in SCROLL ← ((byte*)) 53270 +Promoting word to byte* in D018 ← ((byte*)) 53272 +Promoting word to byte* in D011 ← ((byte*)) 53265 +Promoting word to byte* in D016 ← ((byte*)) 53270 +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 +Promoting word/signed word to byte* in BITMAP ← ((byte*)) 8192 +Promoting word/signed word to byte[] in plot_xlo ← ((byte*)) 4096 +Promoting word/signed word to byte[] in plot_xhi ← ((byte*)) 4352 +Promoting word/signed word to byte[] in plot_ylo ← ((byte*)) 4608 +Promoting word/signed word to byte[] in plot_yhi ← ((byte*)) 4864 +Promoting word/signed word to byte[] in plot_bit ← ((byte*)) 5120 +Promoting byte/signed byte/word/signed word to byte* in plot::plotter_x ← ((byte*)) 0 +Promoting byte/signed byte/word/signed word to byte* in init_plot_tables::yoffs ← ((byte*)) 0 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) COLS ← ((byte*)) (word) 55296 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/bitmap-plotter.log b/src/main/java/dk/camelot64/kickc/test/ref/bitmap-plotter.log index ca00e9597..75f6c140d 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/bitmap-plotter.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/bitmap-plotter.log @@ -331,6 +331,22 @@ SYMBOLS (byte[]) plots_x (byte[]) plots_y +Promoting word to byte* in D011 ← ((byte*)) 53265 +Promoting word to byte* in RASTER ← ((byte*)) 53266 +Promoting word to byte* in D016 ← ((byte*)) 53270 +Promoting word to byte* in D018 ← ((byte*)) 53272 +Promoting word to byte* in BGCOL ← ((byte*)) 53280 +Promoting word to byte* in FGCOL ← ((byte*)) 53281 +Promoting word to byte* in COLS ← ((byte*)) 55296 +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 +Promoting word/signed word to byte* in BITMAP ← ((byte*)) 8192 +Promoting word/signed word to byte[] in plot_xlo ← ((byte*)) 4096 +Promoting word/signed word to byte[] in plot_xhi ← ((byte*)) 4352 +Promoting word/signed word to byte[] in plot_ylo ← ((byte*)) 4608 +Promoting word/signed word to byte[] in plot_yhi ← ((byte*)) 4864 +Promoting word/signed word to byte[] in plot_bit ← ((byte*)) 5120 +Promoting byte/signed byte/word/signed word to byte* in plot::plotter_x ← ((byte*)) 0 +Promoting byte/signed byte/word/signed word to byte* in init_plot_tables::yoffs ← ((byte*)) 0 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) D011 ← ((byte*)) (word) 53265 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/bresenham.log b/src/main/java/dk/camelot64/kickc/test/ref/bresenham.log index f6f3e593d..05c55747a 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/bresenham.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/bresenham.log @@ -104,6 +104,7 @@ SYMBOLS (byte) main::y1 (byte) main::yd +Promoting word/signed word to byte[1000] in SCREEN ← ((byte*)) 1024 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte) STAR ← (byte/signed byte/word/signed word) 81 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/bresenhamarr.log b/src/main/java/dk/camelot64/kickc/test/ref/bresenhamarr.log index d88206edc..0b34a0aa5 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/bresenhamarr.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/bresenhamarr.log @@ -102,6 +102,8 @@ SYMBOLS (byte) main::y1 (byte) main::yd +Promoting word/signed word to byte[1000] in main::screen ← ((byte*)) 1024 +Promoting byte to word in main::idx ← ((word)) main::$4 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from to:@1 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/callconstparam.log b/src/main/java/dk/camelot64/kickc/test/ref/callconstparam.log index 500659079..917a5dd31 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/callconstparam.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/callconstparam.log @@ -53,6 +53,7 @@ SYMBOLS (label) main::@return (byte*) screen +Promoting word/signed word to byte* in screen ← ((byte*)) 1024 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) screen ← ((byte*)) (word/signed word) 1024 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/casting.log b/src/main/java/dk/camelot64/kickc/test/ref/casting.log index 52641ce8a..f3c88594f 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/casting.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/casting.log @@ -114,6 +114,7 @@ SYMBOLS (word) w::w1 (word) w::w2 +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) SCREEN ← ((byte*)) (word/signed word) 1024 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/chargen.log b/src/main/java/dk/camelot64/kickc/test/ref/chargen.log index 6df7872b6..8027cf4f5 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/chargen.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/chargen.log @@ -92,6 +92,9 @@ SYMBOLS (byte) main::x (byte) main::y +Promoting byte/signed byte/word/signed word to byte* in PROCPORT ← ((byte*)) 1 +Promoting word to byte* in CHARGEN ← ((byte*)) 53248 +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) PROCPORT ← ((byte*)) (byte/signed byte/word/signed word) 1 @@ -149,6 +152,63 @@ main::@return: scope:[main] from main::@6 to:@end @end: scope:[] from @1 +CONTROL FLOW GRAPH +@begin: scope:[] from + (byte*) PROCPORT ← ((byte*)) (byte/signed byte/word/signed word) 1 + (byte*) CHARGEN ← ((byte*)) (word) 53248 + (byte*) SCREEN ← ((byte*)) (word/signed word) 1024 + to:@1 +main: scope:[main] from + asm { sei } + (byte*~) main::$0 ← (byte*) CHARGEN + (byte/signed byte/word/signed word) 8 + (byte*) main::CHAR_A ← (byte*~) main::$0 + *((byte*) PROCPORT) ← (byte/signed byte/word/signed word) 50 + (byte*) main::sc ← (byte*) SCREEN + (byte) main::y ← (byte/signed byte/word/signed word) 0 + to:main::@1 +main::@1: scope:[main] from main main::@5 + (byte~) main::$1 ← (byte*) main::CHAR_A *idx (byte) main::y + (byte) main::bits ← (byte~) main::$1 + (byte) main::x ← (byte/signed byte/word/signed word) 0 + to:main::@2 +main::@2: scope:[main] from main::@1 main::@3 + (byte) main::c ← (byte) '.' + (byte~) main::$2 ← (byte) main::bits & (byte/word/signed word) 128 + (boolean~) main::$3 ← (byte~) main::$2 != (byte/signed byte/word/signed word) 0 + (boolean~) main::$4 ← ! (boolean~) main::$3 + if((boolean~) main::$4) goto main::@3 + to:main::@4 +main::@3: scope:[main] from main::@2 main::@4 + *((byte*) main::sc) ← (byte) main::c + (byte*) main::sc ← ++ (byte*) main::sc + (byte~) main::$5 ← (byte) main::bits << (byte/signed byte/word/signed word) 1 + (byte) main::bits ← (byte~) main::$5 + (byte) main::x ← ++ (byte) main::x + (boolean~) main::$6 ← (byte) main::x != (byte/signed byte/word/signed word) 8 + if((boolean~) main::$6) goto main::@2 + to:main::@5 +main::@4: scope:[main] from main::@2 + (byte) main::c ← (byte) '*' + to:main::@3 +main::@5: scope:[main] from main::@3 + (byte*~) main::$7 ← (byte*) main::sc + (byte/signed byte/word/signed word) 32 + (byte*) main::sc ← (byte*~) main::$7 + (byte) main::y ← ++ (byte) main::y + (boolean~) main::$8 ← (byte) main::y != (byte/signed byte/word/signed word) 8 + if((boolean~) main::$8) goto main::@1 + to:main::@6 +main::@6: scope:[main] from main::@5 + *((byte*) PROCPORT) ← (byte/signed byte/word/signed word) 55 + asm { cli } + to:main::@return +main::@return: scope:[main] from main::@6 + return + to:@return +@1: scope:[] from @begin + call main + to:@end +@end: scope:[] from @1 + PROCEDURE MODIFY VARIABLE ANALYSIS CONTROL FLOW GRAPH WITH ASSIGNMENT CALL diff --git a/src/main/java/dk/camelot64/kickc/test/ref/const-identification.log b/src/main/java/dk/camelot64/kickc/test/ref/const-identification.log index e6fdbd150..b516bdae8 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/const-identification.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/const-identification.log @@ -103,6 +103,8 @@ SYMBOLS (byte) plot::x (byte[]) plots +Promoting word/signed word to byte[] in plots ← ((byte*)) 4096 +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte[]) plots ← ((byte*)) (word/signed word) 4096 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/constantmin.log b/src/main/java/dk/camelot64/kickc/test/ref/constantmin.log index b38cd5458..42a3a8b9f 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/constantmin.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/constantmin.log @@ -52,6 +52,8 @@ SYMBOLS (label) main::@return (byte) main::i +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 +Promoting word to byte* in VIC ← ((byte*)) 53248 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) SCREEN ← ((byte*)) (word/signed word) 1024 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/fibmem.log b/src/main/java/dk/camelot64/kickc/test/ref/fibmem.log index 96a7c364b..92a9372bc 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/fibmem.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/fibmem.log @@ -43,6 +43,7 @@ SYMBOLS (label) main::@return (byte) main::i +Promoting word/signed word to byte[15] in fibs ← ((byte*)) 4352 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte[15]) fibs ← ((byte*)) (word/signed word) 4352 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/flipper-rex2.log b/src/main/java/dk/camelot64/kickc/test/ref/flipper-rex2.log index 117e1d02f..c1162be6d 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/flipper-rex2.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/flipper-rex2.log @@ -198,6 +198,10 @@ SYMBOLS (label) prepare::@return (byte) prepare::i +Promoting word/signed word to byte[1000] in SCREEN ← ((byte*)) 1024 +Promoting word/signed word to byte[256] in buffer1 ← ((byte*)) 4096 +Promoting word/signed word to byte[256] in buffer2 ← ((byte*)) 4352 +Promoting word to byte* in RASTER ← ((byte*)) 53266 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte[1000]) SCREEN ← ((byte*)) (word/signed word) 1024 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/forrangemin.log b/src/main/java/dk/camelot64/kickc/test/ref/forrangemin.log index 3c91ed667..bbeac1ae9 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/forrangemin.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/forrangemin.log @@ -47,6 +47,8 @@ SYMBOLS (byte) main::i (byte) main::j +Promoting word/signed word to byte* in SCREEN1 ← ((byte*)) 1024 +Promoting word/signed word to byte* in SCREEN2 ← ((byte*)) 1280 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) SCREEN1 ← ((byte*)) (word/signed word) 1024 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/halfscii.log b/src/main/java/dk/camelot64/kickc/test/ref/halfscii.log index cba303149..8934bca73 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/halfscii.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/halfscii.log @@ -208,6 +208,12 @@ SYMBOLS (byte*) main::charset4 (byte) main::i +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 +Promoting word/signed word to byte* in CHARSET ← ((byte*)) 8192 +Promoting word to byte* in CHARGEN ← ((byte*)) 53248 +Promoting byte/signed byte/word/signed word to byte* in PROCPORT ← ((byte*)) 1 +Promoting word to byte* in D018 ← ((byte*)) 53272 +Promoting word/signed word to byte* in CHARSET4 ← ((byte*)) 10240 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) SCREEN ← ((byte*)) (word/signed word) 1024 @@ -330,6 +336,128 @@ main::@return: scope:[main] from main::@12 to:@end @end: scope:[] from @1 +CONTROL FLOW GRAPH +@begin: scope:[] from + (byte*) SCREEN ← ((byte*)) (word/signed word) 1024 + (byte*) CHARSET ← ((byte*)) (word/signed word) 8192 + (byte*) CHARGEN ← ((byte*)) (word) 53248 + (byte*) PROCPORT ← ((byte*)) (byte/signed byte/word/signed word) 1 + (byte*) D018 ← ((byte*)) (word) 53272 + (byte*) CHARSET4 ← ((byte*)) (word/signed word) 10240 + (byte[]) bits_count ← { (byte/signed byte/word/signed word) 0, (byte/signed byte/word/signed word) 1, (byte/signed byte/word/signed word) 1, (byte/signed byte/word/signed word) 2, (byte/signed byte/word/signed word) 1, (byte/signed byte/word/signed word) 2, (byte/signed byte/word/signed word) 2, (byte/signed byte/word/signed word) 3, (byte/signed byte/word/signed word) 1, (byte/signed byte/word/signed word) 2, (byte/signed byte/word/signed word) 2, (byte/signed byte/word/signed word) 3, (byte/signed byte/word/signed word) 2, (byte/signed byte/word/signed word) 3, (byte/signed byte/word/signed word) 3, (byte/signed byte/word/signed word) 4 } + to:@1 +main: scope:[main] from + asm { sei } + *((byte*) PROCPORT) ← (byte/signed byte/word/signed word) 50 + (byte*) main::chargen ← (byte*) CHARGEN + (byte*) main::charset4 ← (byte*) CHARSET4 + to:main::@1 +main::@1: scope:[main] from main main::@5 + (byte) main::bits_gen ← (byte/signed byte/word/signed word) 0 + (byte*~) main::$0 ← (byte*) main::chargen + (byte/signed byte/word/signed word) 1 + (byte*) main::chargen1 ← (byte*~) main::$0 + (byte~) main::$1 ← *((byte*) main::chargen) & (byte/signed byte/word/signed word) 96 + (byte~) main::$2 ← *((byte*) main::chargen1) & (byte/signed byte/word/signed word) 96 + (byte~) main::$3 ← (byte~) main::$2 >> (byte/signed byte/word/signed word) 2 + (byte~) main::$4 ← (byte~) main::$1 | (byte~) main::$3 + (byte~) main::$5 ← (byte~) main::$4 >> (byte/signed byte/word/signed word) 1 + (byte~) main::$6 ← (byte~) main::$5 >> (byte/signed byte/word/signed word) 2 + (byte~) main::$7 ← (byte[]) bits_count *idx (byte~) main::$6 + (byte) main::bits ← (byte~) main::$7 + (boolean~) main::$8 ← (byte) main::bits >= (byte/signed byte/word/signed word) 2 + (boolean~) main::$9 ← ! (boolean~) main::$8 + if((boolean~) main::$9) goto main::@2 + to:main::@7 +main::@2: scope:[main] from main::@1 main::@7 + (byte~) main::$11 ← (byte) main::bits_gen << (byte/signed byte/word/signed word) 1 + (byte) main::bits_gen ← (byte~) main::$11 + (byte~) main::$12 ← *((byte*) main::chargen) & (byte/signed byte/word/signed word) 24 + (byte~) main::$13 ← *((byte*) main::chargen1) & (byte/signed byte/word/signed word) 24 + (byte~) main::$14 ← (byte~) main::$13 >> (byte/signed byte/word/signed word) 2 + (byte~) main::$15 ← (byte~) main::$12 | (byte~) main::$14 + (byte~) main::$16 ← (byte~) main::$15 >> (byte/signed byte/word/signed word) 1 + (byte~) main::$17 ← (byte[]) bits_count *idx (byte~) main::$16 + (byte) main::bits ← (byte~) main::$17 + (boolean~) main::$18 ← (byte) main::bits >= (byte/signed byte/word/signed word) 2 + (boolean~) main::$19 ← ! (boolean~) main::$18 + if((boolean~) main::$19) goto main::@3 + to:main::@8 +main::@7: scope:[main] from main::@1 + (byte~) main::$10 ← (byte) main::bits_gen + (byte/signed byte/word/signed word) 1 + (byte) main::bits_gen ← (byte~) main::$10 + to:main::@2 +main::@3: scope:[main] from main::@2 main::@8 + (byte~) main::$21 ← (byte) main::bits_gen << (byte/signed byte/word/signed word) 1 + (byte) main::bits_gen ← (byte~) main::$21 + (byte~) main::$22 ← *((byte*) main::chargen) & (byte/signed byte/word/signed word) 6 + (byte~) main::$23 ← (byte~) main::$22 << (byte/signed byte/word/signed word) 1 + (byte~) main::$24 ← *((byte*) main::chargen1) & (byte/signed byte/word/signed word) 6 + (byte~) main::$25 ← (byte~) main::$24 >> (byte/signed byte/word/signed word) 1 + (byte~) main::$26 ← (byte~) main::$23 | (byte~) main::$25 + (byte~) main::$27 ← (byte[]) bits_count *idx (byte~) main::$26 + (byte) main::bits ← (byte~) main::$27 + (boolean~) main::$28 ← (byte) main::bits >= (byte/signed byte/word/signed word) 2 + (boolean~) main::$29 ← ! (boolean~) main::$28 + if((boolean~) main::$29) goto main::@4 + to:main::@9 +main::@8: scope:[main] from main::@2 + (byte~) main::$20 ← (byte) main::bits_gen + (byte/signed byte/word/signed word) 1 + (byte) main::bits_gen ← (byte~) main::$20 + to:main::@3 +main::@4: scope:[main] from main::@3 main::@9 + (byte~) main::$31 ← (byte) main::bits_gen << (byte/signed byte/word/signed word) 1 + (byte) main::bits_gen ← (byte~) main::$31 + (byte~) main::$32 ← *((byte*) main::chargen) & (byte/signed byte/word/signed word) 1 + (byte~) main::$33 ← (byte~) main::$32 << (byte/signed byte/word/signed word) 2 + (byte~) main::$34 ← *((byte*) main::chargen1) & (byte/signed byte/word/signed word) 1 + (byte~) main::$35 ← (byte~) main::$33 | (byte~) main::$34 + (byte~) main::$36 ← (byte[]) bits_count *idx (byte~) main::$35 + (byte) main::bits ← (byte~) main::$36 + (boolean~) main::$37 ← (byte) main::bits >= (byte/signed byte/word/signed word) 2 + (boolean~) main::$38 ← ! (boolean~) main::$37 + if((boolean~) main::$38) goto main::@5 + to:main::@10 +main::@9: scope:[main] from main::@3 + (byte~) main::$30 ← (byte) main::bits_gen + (byte/signed byte/word/signed word) 1 + (byte) main::bits_gen ← (byte~) main::$30 + to:main::@4 +main::@5: scope:[main] from main::@10 main::@4 + (byte~) main::$40 ← (byte) main::bits_gen << (byte/signed byte/word/signed word) 1 + (byte) main::bits_gen ← (byte~) main::$40 + *((byte*) main::charset4) ← (byte) main::bits_gen + (byte*) main::charset4 ← ++ (byte*) main::charset4 + (byte*~) main::$41 ← (byte*) main::chargen + (byte/signed byte/word/signed word) 2 + (byte*) main::chargen ← (byte*~) main::$41 + (byte*~) main::$42 ← (byte*) CHARGEN + (word/signed word) 2048 + (boolean~) main::$43 ← (byte*) main::chargen < (byte*~) main::$42 + if((boolean~) main::$43) goto main::@1 + to:main::@11 +main::@10: scope:[main] from main::@4 + (byte~) main::$39 ← (byte) main::bits_gen + (byte/signed byte/word/signed word) 1 + (byte) main::bits_gen ← (byte~) main::$39 + to:main::@5 +main::@11: scope:[main] from main::@5 + *((byte*) PROCPORT) ← (byte/signed byte/word/signed word) 55 + asm { cli } + (byte) main::i ← (byte/signed byte/word/signed word) 0 + to:main::@6 +main::@6: scope:[main] from main::@11 main::@6 + *((byte*) SCREEN + (byte) main::i) ← (byte) main::i + (byte) main::i ← ++ (byte) main::i + (boolean~) main::$44 ← (byte) main::i != (byte/signed byte/word/signed word) 0 + if((boolean~) main::$44) goto main::@6 + to:main::@12 +main::@12: scope:[main] from main::@6 + *((byte*) D018) ← (byte/signed byte/word/signed word) 25 + to:main::@return +main::@return: scope:[main] from main::@12 + return + to:@return +@1: scope:[] from @begin + call main + to:@end +@end: scope:[] from @1 + PROCEDURE MODIFY VARIABLE ANALYSIS CONTROL FLOW GRAPH WITH ASSIGNMENT CALL diff --git a/src/main/java/dk/camelot64/kickc/test/ref/ifmin.log b/src/main/java/dk/camelot64/kickc/test/ref/ifmin.log index 1a2fbfd4d..450cbfb09 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/ifmin.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/ifmin.log @@ -39,6 +39,7 @@ SYMBOLS (label) main::@return (byte) main::i +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) SCREEN ← ((byte*)) (word/signed word) 1024 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/incd020.log b/src/main/java/dk/camelot64/kickc/test/ref/incd020.log index 0a5779eb8..28b5bcfca 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/incd020.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/incd020.log @@ -28,6 +28,7 @@ SYMBOLS (label) main::@1 (label) main::@return +Promoting word to byte* in BGCOL ← ((byte*)) 53280 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) BGCOL ← ((byte*)) (word) 53280 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/inline-asm.log b/src/main/java/dk/camelot64/kickc/test/ref/inline-asm.log index 25695d30d..7a0ae2cf4 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/inline-asm.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/inline-asm.log @@ -39,6 +39,20 @@ main::@return: scope:[main] from main to:@end @end: scope:[] from @1 +CONTROL FLOW GRAPH +@begin: scope:[] from + to:@1 +main: scope:[main] from + asm { lda#'a'ldx#$ff!:sta$0400,xsta$0500,xsta$0600,xsta$0700,xdexbne!- } + to:main::@return +main::@return: scope:[main] from main + return + to:@return +@1: scope:[] from @begin + call main + to:@end +@end: scope:[] from @1 + PROCEDURE MODIFY VARIABLE ANALYSIS CONTROL FLOW GRAPH WITH ASSIGNMENT CALL diff --git a/src/main/java/dk/camelot64/kickc/test/ref/inlinearrayproblem.log b/src/main/java/dk/camelot64/kickc/test/ref/inlinearrayproblem.log index 697a16c21..0b8e70bae 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/inlinearrayproblem.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/inlinearrayproblem.log @@ -46,6 +46,8 @@ SYMBOLS (byte) main::i (byte[]) main::txt +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 +Promoting word/signed word to byte* in SCREEN2 ← ((byte*)) $0 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) SCREEN ← ((byte*)) (word/signed word) 1024 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/inmemarray.log b/src/main/java/dk/camelot64/kickc/test/ref/inmemarray.log index 730284a0f..9c0598a98 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/inmemarray.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/inmemarray.log @@ -49,6 +49,7 @@ SYMBOLS (byte) main::i (byte) main::j +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) SCREEN ← ((byte*)) (word/signed word) 1024 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/inmemstring.log b/src/main/java/dk/camelot64/kickc/test/ref/inmemstring.log index 261b8ee02..6be31e39f 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/inmemstring.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/inmemstring.log @@ -53,6 +53,7 @@ SYMBOLS (byte*) main::cursor (byte) main::i +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) SCREEN ← ((byte*)) (word/signed word) 1024 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/iterarray.log b/src/main/java/dk/camelot64/kickc/test/ref/iterarray.log index 4bdb8ca44..1c6fcd145 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/iterarray.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/iterarray.log @@ -34,6 +34,7 @@ SYMBOLS (byte[16]) main::buf (byte) main::i +Promoting word/signed word to byte[16] in main::buf ← ((byte*)) 4352 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from to:@1 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/literals.log b/src/main/java/dk/camelot64/kickc/test/ref/literals.log index decb37c78..3c68d95a7 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/literals.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/literals.log @@ -58,6 +58,7 @@ SYMBOLS (byte[]) nums (byte[]) str +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) SCREEN ← ((byte*)) (word/signed word) 1024 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/local-string.log b/src/main/java/dk/camelot64/kickc/test/ref/local-string.log index 618c0781e..b51c9fffa 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/local-string.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/local-string.log @@ -43,6 +43,7 @@ SYMBOLS (byte[]) main::msg (byte*) main::screen +Promoting word/signed word to byte* in main::screen ← ((byte*)) 1024 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from to:@1 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/loopnest.log b/src/main/java/dk/camelot64/kickc/test/ref/loopnest.log index dc38a644b..12406fb61 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopnest.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopnest.log @@ -54,6 +54,7 @@ SYMBOLS (label) nest::@return (byte) nest::j +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) SCREEN ← ((byte*)) (word/signed word) 1024 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.log b/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.log index d059d17ac..fd6eda9d2 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/loopnest2.log @@ -114,6 +114,7 @@ SYMBOLS (byte) nest2::i (byte) nest2::j +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) SCREEN ← ((byte*)) (word/signed word) 1024 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/modglobal.log b/src/main/java/dk/camelot64/kickc/test/ref/modglobal.log index e9984e37c..7ccfa9574 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/modglobal.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/modglobal.log @@ -62,6 +62,7 @@ SYMBOLS (byte~) main::$1 (label) main::@return +Promoting word/signed word to byte[256] in SCREEN ← ((byte*)) 1024 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte) cnt ← (byte/signed byte/word/signed word) 0 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/modglobalmin.log b/src/main/java/dk/camelot64/kickc/test/ref/modglobalmin.log index 655be7270..c9ec2427f 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/modglobalmin.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/modglobalmin.log @@ -48,6 +48,7 @@ SYMBOLS (void~) main::$1 (label) main::@return +Promoting word/signed word to byte[256] in SCREEN ← ((byte*)) 1024 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte) cnt ← (byte/signed byte/word/signed word) 0 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/overlap-allocation-2.log b/src/main/java/dk/camelot64/kickc/test/ref/overlap-allocation-2.log index 5cb4644d1..a2e638d8e 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/overlap-allocation-2.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/overlap-allocation-2.log @@ -73,6 +73,7 @@ SYMBOLS (label) plot::@return (byte) plot::x +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) SCREEN ← ((byte*)) (word/signed word) 1024 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/overlap-allocation.log b/src/main/java/dk/camelot64/kickc/test/ref/overlap-allocation.log index 437590246..3a837f31c 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/overlap-allocation.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/overlap-allocation.log @@ -69,6 +69,7 @@ SYMBOLS (label) plot::@return (byte) plot::x +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) SCREEN ← ((byte*)) (word/signed word) 1024 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/ptr-complex.log b/src/main/java/dk/camelot64/kickc/test/ref/ptr-complex.log index f1f835f92..18094c8dd 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/ptr-complex.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/ptr-complex.log @@ -118,6 +118,8 @@ SYMBOLS (byte*) main::sc2 (byte*) main::screen +Promoting word/signed word to byte* in main::screen ← ((byte*)) 1024 +Promoting word to byte* in main::BGCOL ← ((byte*)) 53280 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from to:@1 @@ -178,6 +180,66 @@ main::@return: scope:[main] from main::@4 to:@end @end: scope:[] from @1 +CONTROL FLOW GRAPH +@begin: scope:[] from + to:@1 +main: scope:[main] from + (byte*) main::screen ← ((byte*)) (word/signed word) 1024 + (byte*~) main::$0 ← (byte*) main::screen + (byte/signed byte/word/signed word) 80 + (byte) main::a ← *((byte*~) main::$0) + (byte) main::i ← (byte/signed byte/word/signed word) 0 + to:main::@1 +main::@1: scope:[main] from main main::@1 + (byte*~) main::$1 ← (byte*) main::screen + (byte/signed byte/word/signed word) 40 + (byte*~) main::$2 ← (byte*~) main::$1 + (byte) main::i + *((byte*) main::screen + (byte) main::i) ← *((byte*~) main::$2) + (byte) main::i ← ++ (byte) main::i + (boolean~) main::$3 ← (byte) main::i != (byte/signed byte/word/signed word) 11 + if((boolean~) main::$3) goto main::@1 + to:main::@3 +main::@3: scope:[main] from main::@1 + (byte*~) main::$4 ← (byte*) main::screen + (byte/signed byte/word/signed word) 81 + (byte*) main::sc2 ← (byte*~) main::$4 + (byte*~) main::$5 ← (byte*) main::screen + (byte/signed byte/word/signed word) 121 + *((byte*) main::sc2) ← *((byte*~) main::$5) + (byte*~) main::$6 ← (byte*) main::screen + (byte/signed byte/word/signed word) 82 + (byte*~) main::$7 ← (byte*) main::screen + (byte/signed byte/word/signed word) 122 + *((byte*~) main::$6) ← *((byte*~) main::$7) + (byte) main::j ← (byte/signed byte/word/signed word) 0 + to:main::@2 +main::@2: scope:[main] from main::@2 main::@3 + (byte*~) main::$8 ← (byte*) main::screen + (byte/word/signed word) 160 + (byte*~) main::$9 ← (byte*~) main::$8 + (byte) main::j + (byte*~) main::$10 ← (byte*) main::screen + (byte/word/signed word) 200 + (byte*~) main::$11 ← (byte*~) main::$10 + (byte) main::j + *((byte*~) main::$9) ← *((byte*~) main::$11) + (byte) main::j ← ++ (byte) main::j + (boolean~) main::$12 ← (byte) main::j != (byte/signed byte/word/signed word) 11 + if((boolean~) main::$12) goto main::@2 + to:main::@4 +main::@4: scope:[main] from main::@2 + (byte*~) main::$13 ← ((byte*)) (word) 53280 + *((byte*~) main::$13) ← ++ *((byte*~) main::$13) + (byte*~) main::$14 ← ((byte*)) (word) 53280 + (byte*~) main::$15 ← ((byte*)) (word) 53280 + (word~) main::$16 ← (word) 53248 + (byte/signed byte/word/signed word) 33 + (byte*~) main::$17 ← ((byte*)) (word~) main::$16 + *((byte*~) main::$17) ← -- *((byte*~) main::$17) + (word~) main::$18 ← (word) 53248 + (byte/signed byte/word/signed word) 33 + (byte*~) main::$19 ← ((byte*)) (word~) main::$18 + (word~) main::$20 ← (word) 53248 + (byte/signed byte/word/signed word) 33 + (byte*~) main::$21 ← ((byte*)) (word~) main::$20 + (byte*) main::BGCOL ← ((byte*)) (word) 53280 + *((byte*) main::BGCOL) ← ++ *((byte*) main::BGCOL) + to:main::@return +main::@return: scope:[main] from main::@4 + return + to:@return +@1: scope:[] from @begin + call main + to:@end +@end: scope:[] from @1 + PROCEDURE MODIFY VARIABLE ANALYSIS CONTROL FLOW GRAPH WITH ASSIGNMENT CALL diff --git a/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.log b/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.log index e47bfb833..3a35ba60f 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/ptrtest.log @@ -203,6 +203,10 @@ SYMBOLS (byte) rvaluevar::i (byte*) rvaluevar::screen +Promoting word/signed word to byte[1024] in lvalue::SCREEN ← ((byte*)) 1024 +Promoting word/signed word to byte[1024] in rvalue::SCREEN ← ((byte*)) 1024 +Promoting word/signed word to byte* in lvaluevar::screen ← ((byte*)) 1024 +Promoting word/signed word to byte* in rvaluevar::screen ← ((byte*)) 1024 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from to:@1 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/ptrtestmin.log b/src/main/java/dk/camelot64/kickc/test/ref/ptrtestmin.log index 4104831f4..0d405f844 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/ptrtestmin.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/ptrtestmin.log @@ -47,6 +47,7 @@ SYMBOLS (byte) main::b (byte) main::i +Promoting word/signed word to byte[1024] in main::SCREEN ← ((byte*)) 1024 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from to:@1 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/scroll-clobber.log b/src/main/java/dk/camelot64/kickc/test/ref/scroll-clobber.log index e3e0b0217..772886ba1 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/scroll-clobber.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/scroll-clobber.log @@ -56,6 +56,8 @@ SYMBOLS (byte) main::i (byte*) main::nxt +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 +Promoting word to byte* in SCROLL ← ((byte*)) 53270 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) SCREEN ← ((byte*)) (word/signed word) 1024 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/scroll.log b/src/main/java/dk/camelot64/kickc/test/ref/scroll.log index d26517804..279df53b1 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/scroll.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/scroll.log @@ -147,6 +147,10 @@ SYMBOLS (byte*) main::nxt (byte) main::scroll +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 +Promoting word to byte* in RASTER ← ((byte*)) 53266 +Promoting word to byte* in BGCOL ← ((byte*)) 53280 +Promoting word to byte* in SCROLL ← ((byte*)) 53270 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) SCREEN ← ((byte*)) (word/signed word) 1024 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/scrollbig.log b/src/main/java/dk/camelot64/kickc/test/ref/scrollbig.log index 78e0802d1..1da9c345a 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/scrollbig.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/scrollbig.log @@ -385,6 +385,13 @@ SYMBOLS (label) scroll_soft::@1 (label) scroll_soft::@return +Promoting byte/signed byte/word/signed word to byte* in PROCPORT ← ((byte*)) 1 +Promoting word to byte* in CHARGEN ← ((byte*)) 53248 +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 +Promoting word to byte* in RASTER ← ((byte*)) 53266 +Promoting word to byte* in BGCOL ← ((byte*)) 53280 +Promoting word to byte* in SCROLL ← ((byte*)) 53270 +Promoting byte to word in scroll_bit::c ← ((word)) scroll_bit::$3 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) PROCPORT ← ((byte*)) (byte/signed byte/word/signed word) 1 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/signed-bytes.log b/src/main/java/dk/camelot64/kickc/test/ref/signed-bytes.log index b012e55b7..768ffd1f4 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/signed-bytes.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/signed-bytes.log @@ -47,6 +47,7 @@ SYMBOLS (byte) main::j (byte[]) main::screen +Promoting word/signed word to byte[] in main::screen ← ((byte*)) 1024 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from to:@1 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/unused-method.asm b/src/main/java/dk/camelot64/kickc/test/ref/unused-method.asm new file mode 100644 index 000000000..6b97d44e9 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/test/ref/unused-method.asm @@ -0,0 +1,10 @@ +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" + jsr main +main: { + .const screen = $400 + lda #1 + sta screen+0 + rts +} diff --git a/src/main/java/dk/camelot64/kickc/test/ref/unused-method.cfg b/src/main/java/dk/camelot64/kickc/test/ref/unused-method.cfg new file mode 100644 index 000000000..658e6782f --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/test/ref/unused-method.cfg @@ -0,0 +1,12 @@ +@begin: scope:[] from + to:@2 +@2: scope:[] from @begin + [0] call main param-assignment [ ] ( ) + to:@end +@end: scope:[] from @2 +main: scope:[main] from @2 + [1] *((const byte*) main::screen#0+(byte/signed byte/word/signed word) 0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:0 [ ] ) + to:main::@return +main::@return: scope:[main] from main + [2] return [ ] ( main:0 [ ] ) + to:@return diff --git a/src/main/java/dk/camelot64/kickc/test/ref/unused-method.log b/src/main/java/dk/camelot64/kickc/test/ref/unused-method.log new file mode 100644 index 000000000..b30f4ff2c --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/test/ref/unused-method.log @@ -0,0 +1,442 @@ +void main() { + byte* screen = $0400; + screen[0] = 1; +} + +byte sum(byte b1, byte b2) { + return b1+b2; +} +PROGRAM +proc (void()) main() + (byte*) main::screen ← (word/signed word) 1024 + *((byte*) main::screen + (byte/signed byte/word/signed word) 0) ← (byte/signed byte/word/signed word) 1 +main::@return: + return +endproc // main() +proc (byte()) sum((byte) sum::b1 , (byte) sum::b2) + (byte~) sum::$0 ← (byte) sum::b1 + (byte) sum::b2 + (byte) sum::return ← (byte~) sum::$0 + goto sum::@return +sum::@return: + (byte) sum::return ← (byte) sum::return + return (byte) sum::return +endproc // sum() + call main + +SYMBOLS +(void()) main() +(label) main::@return +(byte*) main::screen +(byte()) sum((byte) sum::b1 , (byte) sum::b2) +(byte~) sum::$0 +(label) sum::@return +(byte) sum::b1 +(byte) sum::b2 +(byte) sum::return + +Promoting word/signed word to byte* in main::screen ← ((byte*)) 1024 +INITIAL CONTROL FLOW GRAPH +@begin: scope:[] from + to:@1 +main: scope:[main] from + (byte*) main::screen ← ((byte*)) (word/signed word) 1024 + *((byte*) main::screen + (byte/signed byte/word/signed word) 0) ← (byte/signed byte/word/signed word) 1 + to:main::@return +main::@return: scope:[main] from main + return + to:@return +@1: scope:[] from @begin + to:@2 +sum: scope:[sum] from + (byte~) sum::$0 ← (byte) sum::b1 + (byte) sum::b2 + (byte) sum::return ← (byte~) sum::$0 + to:sum::@return +sum::@return: scope:[sum] from sum sum::@1 + (byte) sum::return ← (byte) sum::return + return (byte) sum::return + to:@return +sum::@1: scope:[sum] from + to:sum::@return +@2: scope:[] from @1 + call main + to:@end +@end: scope:[] from @2 + +Removing unused procedure sum +Removing empty block @1 +CONTROL FLOW GRAPH +@begin: scope:[] from + to:@2 +main: scope:[main] from + (byte*) main::screen ← ((byte*)) (word/signed word) 1024 + *((byte*) main::screen + (byte/signed byte/word/signed word) 0) ← (byte/signed byte/word/signed word) 1 + to:main::@return +main::@return: scope:[main] from main + return + to:@return +@2: scope:[] from @begin + call main + to:@end +@end: scope:[] from @2 + +PROCEDURE MODIFY VARIABLE ANALYSIS + +CONTROL FLOW GRAPH WITH ASSIGNMENT CALL +@begin: scope:[] from + to:@2 +main: scope:[main] from @2 + (byte*) main::screen ← ((byte*)) (word/signed word) 1024 + *((byte*) main::screen + (byte/signed byte/word/signed word) 0) ← (byte/signed byte/word/signed word) 1 + to:main::@return +main::@return: scope:[main] from main + return + to:@return +@2: scope:[] from @begin + call main param-assignment + to:@3 +@3: scope:[] from @2 + to:@end +@end: scope:[] from @3 + +Completing Phi functions... +CONTROL FLOW GRAPH SSA +@begin: scope:[] from + to:@2 +main: scope:[main] from @2 + (byte*) main::screen#0 ← ((byte*)) (word/signed word) 1024 + *((byte*) main::screen#0 + (byte/signed byte/word/signed word) 0) ← (byte/signed byte/word/signed word) 1 + to:main::@return +main::@return: scope:[main] from main + return + to:@return +@2: scope:[] from @begin + call main param-assignment + to:@3 +@3: scope:[] from @2 + to:@end +@end: scope:[] from @3 + +CONTROL FLOW GRAPH WITH ASSIGNMENT CALL & RETURN +@begin: scope:[] from + to:@2 +main: scope:[main] from @2 + (byte*) main::screen#0 ← ((byte*)) (word/signed word) 1024 + *((byte*) main::screen#0 + (byte/signed byte/word/signed word) 0) ← (byte/signed byte/word/signed word) 1 + to:main::@return +main::@return: scope:[main] from main + return + to:@return +@2: scope:[] from @begin + call main param-assignment + to:@3 +@3: scope:[] from @2 + to:@end +@end: scope:[] from @3 + +INITIAL SSA SYMBOL TABLE +(label) @2 +(label) @3 +(label) @begin +(label) @end +(void()) main() +(label) main::@return +(byte*) main::screen +(byte*) main::screen#0 + +Culled Empty Block (label) @3 +Succesful SSA optimization Pass2CullEmptyBlocks +CONTROL FLOW GRAPH +@begin: scope:[] from + to:@2 +main: scope:[main] from @2 + (byte*) main::screen#0 ← ((byte*)) (word/signed word) 1024 + *((byte*) main::screen#0 + (byte/signed byte/word/signed word) 0) ← (byte/signed byte/word/signed word) 1 + to:main::@return +main::@return: scope:[main] from main + return + to:@return +@2: scope:[] from @begin + call main param-assignment + to:@end +@end: scope:[] from @2 + +Constant (const byte*) main::screen#0 = ((byte*))1024 +Succesful SSA optimization Pass2ConstantIdentification +CONTROL FLOW GRAPH +@begin: scope:[] from + to:@2 +main: scope:[main] from @2 + *((const byte*) main::screen#0 + (byte/signed byte/word/signed word) 0) ← (byte/signed byte/word/signed word) 1 + to:main::@return +main::@return: scope:[main] from main + return + to:@return +@2: scope:[] from @begin + call main param-assignment + to:@end +@end: scope:[] from @2 + +Consolidated assigned array index constant in assignment *(main::screen#0+0) +Succesful SSA optimization Pass2ConstantAdditionElimination +CONTROL FLOW GRAPH +@begin: scope:[] from + to:@2 +main: scope:[main] from @2 + *((const byte*) main::screen#0+(byte/signed byte/word/signed word) 0) ← (byte/signed byte/word/signed word) 1 + to:main::@return +main::@return: scope:[main] from main + return + to:@return +@2: scope:[] from @begin + call main param-assignment + to:@end +@end: scope:[] from @2 + +FINAL SYMBOL TABLE +(label) @2 +(label) @begin +(label) @end +(void()) main() +(label) main::@return +(byte*) main::screen +(const byte*) main::screen#0 = ((byte*))(word/signed word) 1024 + +Block Sequence Planned @begin @2 @end main main::@return +Block Sequence Planned @begin @2 @end main main::@return +CONTROL FLOW GRAPH - PHI LIFTED +@begin: scope:[] from + to:@2 +@2: scope:[] from @begin + call main param-assignment + to:@end +@end: scope:[] from @2 +main: scope:[main] from @2 + *((const byte*) main::screen#0+(byte/signed byte/word/signed word) 0) ← (byte/signed byte/word/signed word) 1 + to:main::@return +main::@return: scope:[main] from main + return + to:@return + +CALL GRAPH +Calls in [] to main:0 + +Propagating live ranges... +CONTROL FLOW GRAPH - LIVE RANGES FOUND +@begin: scope:[] from + to:@2 +@2: scope:[] from @begin + [0] call main param-assignment [ ] + to:@end +@end: scope:[] from @2 +main: scope:[main] from @2 + [1] *((const byte*) main::screen#0+(byte/signed byte/word/signed word) 0) ← (byte/signed byte/word/signed word) 1 [ ] + to:main::@return +main::@return: scope:[main] from main + [2] return [ ] + to:@return + +Created 0 initial phi equivalence classes +Coalesced down to 0 phi equivalence classes +Block Sequence Planned @begin @2 @end main main::@return +Propagating live ranges... +CONTROL FLOW GRAPH - BEFORE EFFECTIVE LIVE RANGES +@begin: scope:[] from + to:@2 +@2: scope:[] from @begin + [0] call main param-assignment [ ] + to:@end +@end: scope:[] from @2 +main: scope:[main] from @2 + [1] *((const byte*) main::screen#0+(byte/signed byte/word/signed word) 0) ← (byte/signed byte/word/signed word) 1 [ ] + to:main::@return +main::@return: scope:[main] from main + [2] return [ ] + to:@return + +CONTROL FLOW GRAPH - PHI MEM COALESCED +@begin: scope:[] from + to:@2 +@2: scope:[] from @begin + [0] call main param-assignment [ ] ( ) + to:@end +@end: scope:[] from @2 +main: scope:[main] from @2 + [1] *((const byte*) main::screen#0+(byte/signed byte/word/signed word) 0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:0 [ ] ) + to:main::@return +main::@return: scope:[main] from main + [2] return [ ] ( main:0 [ ] ) + to:@return + +DOMINATORS +@begin dominated by @begin +@2 dominated by @2 @begin +@end dominated by @2 @begin @end +main dominated by @2 @begin main +main::@return dominated by main::@return @2 @begin main + +NATURAL LOOPS + +Found 0 loops in scope [] +Found 0 loops in scope [main] +NATURAL LOOPS WITH DEPTH + + +VARIABLE REGISTER WEIGHTS +(void()) main() +(byte*) main::screen + +Initial phi equivalence classes +Complete equivalence classes +INITIAL ASM +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG1 Global Constants & labels +//SEG2 @begin +bbegin: + jmp b2 +//SEG3 @2 +b2: +//SEG4 [0] call main param-assignment [ ] ( ) + jsr main + jmp bend +//SEG5 @end +bend: +//SEG6 main +main: { + .const screen = $400 + //SEG7 [1] *((const byte*) main::screen#0+(byte/signed byte/word/signed word) 0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:0 [ ] ) -- _deref_cowo1=coby2 + lda #1 + sta screen+0 + jmp breturn + //SEG8 main::@return + breturn: + //SEG9 [2] return [ ] ( main:0 [ ] ) + rts +} + +REGISTER UPLIFT POTENTIAL REGISTERS +Statement [1] *((const byte*) main::screen#0+(byte/signed byte/word/signed word) 0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:0 [ ] ) always clobbers reg byte a + +REGISTER UPLIFT SCOPES +Uplift Scope [main] +Uplift Scope [] + +Uplifting [main] best 54 combination +Uplifting [] best 54 combination +Removing instruction jmp b2 +Removing instruction jmp bend +Removing instruction jmp breturn +Succesful ASM optimization Pass5NextJumpElimination +ASSEMBLER +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG1 Global Constants & labels +//SEG2 @begin +bbegin: +//SEG3 @2 +b2: +//SEG4 [0] call main param-assignment [ ] ( ) + jsr main +//SEG5 @end +bend: +//SEG6 main +main: { + .const screen = $400 + //SEG7 [1] *((const byte*) main::screen#0+(byte/signed byte/word/signed word) 0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:0 [ ] ) -- _deref_cowo1=coby2 + lda #1 + sta screen+0 + //SEG8 main::@return + breturn: + //SEG9 [2] return [ ] ( main:0 [ ] ) + rts +} + +Removing instruction bbegin: +Succesful ASM optimization Pass5RedundantLabelElimination +ASSEMBLER +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG1 Global Constants & labels +//SEG2 @begin +//SEG3 @2 +b2: +//SEG4 [0] call main param-assignment [ ] ( ) + jsr main +//SEG5 @end +bend: +//SEG6 main +main: { + .const screen = $400 + //SEG7 [1] *((const byte*) main::screen#0+(byte/signed byte/word/signed word) 0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:0 [ ] ) -- _deref_cowo1=coby2 + lda #1 + sta screen+0 + //SEG8 main::@return + breturn: + //SEG9 [2] return [ ] ( main:0 [ ] ) + rts +} + +Removing instruction b2: +Removing instruction bend: +Removing instruction breturn: +Succesful ASM optimization Pass5UnusedLabelElimination +ASSEMBLER +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG1 Global Constants & labels +//SEG2 @begin +//SEG3 @2 +//SEG4 [0] call main param-assignment [ ] ( ) + jsr main +//SEG5 @end +//SEG6 main +main: { + .const screen = $400 + //SEG7 [1] *((const byte*) main::screen#0+(byte/signed byte/word/signed word) 0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:0 [ ] ) -- _deref_cowo1=coby2 + lda #1 + sta screen+0 + //SEG8 main::@return + //SEG9 [2] return [ ] ( main:0 [ ] ) + rts +} + +FINAL SYMBOL TABLE +(label) @2 +(label) @begin +(label) @end +(void()) main() +(label) main::@return +(byte*) main::screen +(const byte*) main::screen#0 screen = ((byte*))(word/signed word) 1024 + + +FINAL CODE +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG1 Global Constants & labels +//SEG2 @begin +//SEG3 @2 +//SEG4 [0] call main param-assignment [ ] ( ) + jsr main +//SEG5 @end +//SEG6 main +main: { + .const screen = $400 + //SEG7 [1] *((const byte*) main::screen#0+(byte/signed byte/word/signed word) 0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:0 [ ] ) -- _deref_cowo1=coby2 + lda #1 + sta screen+0 + //SEG8 main::@return + //SEG9 [2] return [ ] ( main:0 [ ] ) + rts +} + diff --git a/src/main/java/dk/camelot64/kickc/test/ref/unused-method.sym b/src/main/java/dk/camelot64/kickc/test/ref/unused-method.sym new file mode 100644 index 000000000..57aa0e4bc --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/test/ref/unused-method.sym @@ -0,0 +1,8 @@ +(label) @2 +(label) @begin +(label) @end +(void()) main() +(label) main::@return +(byte*) main::screen +(const byte*) main::screen#0 screen = ((byte*))(word/signed word) 1024 + diff --git a/src/main/java/dk/camelot64/kickc/test/ref/useglobal.log b/src/main/java/dk/camelot64/kickc/test/ref/useglobal.log index e1f6c4c49..0b3e2888a 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/useglobal.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/useglobal.log @@ -17,6 +17,7 @@ SYMBOLS (void()) main() (label) main::@return +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) SCREEN ← ((byte*)) (word/signed word) 1024 @@ -32,6 +33,21 @@ main::@return: scope:[main] from main to:@end @end: scope:[] from @1 +CONTROL FLOW GRAPH +@begin: scope:[] from + (byte*) SCREEN ← ((byte*)) (word/signed word) 1024 + to:@1 +main: scope:[main] from + *((byte*) SCREEN) ← (byte/signed byte/word/signed word) 1 + to:main::@return +main::@return: scope:[main] from main + return + to:@return +@1: scope:[] from @begin + call main + to:@end +@end: scope:[] from @1 + PROCEDURE MODIFY VARIABLE ANALYSIS CONTROL FLOW GRAPH WITH ASSIGNMENT CALL diff --git a/src/main/java/dk/camelot64/kickc/test/ref/voronoi.log b/src/main/java/dk/camelot64/kickc/test/ref/voronoi.log index eab8197d5..287b20b69 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/voronoi.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/voronoi.log @@ -377,6 +377,8 @@ SYMBOLS (byte) render::x (byte) render::y +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 +Promoting word to byte* in COLORS ← ((byte*)) 55296 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) SCREEN ← ((byte*)) (word/signed word) 1024 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/zpparammin.log b/src/main/java/dk/camelot64/kickc/test/ref/zpparammin.log index 7e1d6a6d0..0721285e1 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/zpparammin.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/zpparammin.log @@ -89,6 +89,8 @@ SYMBOLS (byte) sum2::c (byte) sum2::return +Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024 +Promoting word/signed word to byte* in SCREEN2 ← ((byte*)) $0 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from (byte*) SCREEN ← ((byte*)) (word/signed word) 1024 diff --git a/src/main/java/dk/camelot64/kickc/test/ref/zpptr.log b/src/main/java/dk/camelot64/kickc/test/ref/zpptr.log index a5171cf83..dc1653e69 100644 --- a/src/main/java/dk/camelot64/kickc/test/ref/zpptr.log +++ b/src/main/java/dk/camelot64/kickc/test/ref/zpptr.log @@ -61,6 +61,7 @@ SYMBOLS (byte*) main::zpptr (byte*) main::zpptr2 +Promoting word/signed word to byte* in main::zpptr ← ((byte*)) 4096 INITIAL CONTROL FLOW GRAPH @begin: scope:[] from to:@1 diff --git a/src/main/java/dk/camelot64/kickc/test/unused-method.kc b/src/main/java/dk/camelot64/kickc/test/unused-method.kc new file mode 100644 index 000000000..994967839 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/test/unused-method.kc @@ -0,0 +1,8 @@ +void main() { + byte* screen = $0400; + screen[0] = 1; +} + +byte sum(byte b1, byte b2) { + return b1+b2; +} \ No newline at end of file