From 1df68ee4d8c04a3ec7ad9906be95cfab46597328 Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Tue, 27 Jul 2021 19:11:14 +0200 Subject: [PATCH] Working on eliminating memcpy() statements when using classic structs. #197 --- .../statements/StatementCallFinalize.java | 5 + .../model/statements/StatementLValue.java | 2 + .../Pass0GenerateStatementSequence.java | 45 +- src/test/ref/address-of-0.log | 11 +- src/test/ref/assignment-compound.log | 9 +- src/test/ref/bitmap-circle-2.log | 16 +- src/test/ref/bitmap-circle.log | 16 +- src/test/ref/bitmap-line-anim-1.asm | 14 +- src/test/ref/bitmap-line-anim-1.log | 92 +- src/test/ref/bitmap-line-anim-2.asm | 14 +- src/test/ref/bitmap-line-anim-2.log | 94 +- src/test/ref/bitmap-plot-0.log | 18 +- src/test/ref/bitmap-plot-3.asm | 14 +- src/test/ref/bitmap-plot-3.log | 92 +- src/test/ref/bitmap-plotter.log | 12 +- src/test/ref/bool-const.log | 21 +- src/test/ref/bool-not-operator-1.asm | 6 +- src/test/ref/bool-not-operator-1.cfg | 4 +- src/test/ref/bool-not-operator-1.log | 56 +- src/test/ref/bool-not-operator-2.log | 12 +- src/test/ref/bool-vars.log | 100 +-- src/test/ref/bresenham.log | 30 +- src/test/ref/bresenhamarr.log | 32 +- src/test/ref/c-types.log | 6 +- src/test/ref/cast-not-needed.log | 9 +- src/test/ref/cast-precedence-problem.log | 33 +- src/test/ref/casting-negative.asm | 3 +- src/test/ref/casting-negative.log | 51 +- src/test/ref/casting.asm | 2 + src/test/ref/casting.log | 57 +- src/test/ref/chargen.log | 10 +- src/test/ref/cia-timer-cyclecount.asm | 3 +- src/test/ref/cia-timer-cyclecount.log | 21 +- src/test/ref/cia-timer-simple.asm | 2 +- src/test/ref/cia-timer-simple.log | 13 +- src/test/ref/coalesce-assignment.log | 20 +- src/test/ref/comma-decl.log | 21 +- src/test/ref/comma-expr-1.log | 11 +- src/test/ref/complex/xmega65/xmega65.log | 6 +- .../ref/consolidate-array-index-problem.log | 11 +- .../ref/consolidate-constant-problem-2.log | 8 +- src/test/ref/const-early-identification.asm | 1 + src/test/ref/const-early-identification.log | 13 +- src/test/ref/constantmin.log | 9 +- src/test/ref/constants.log | 45 +- src/test/ref/cordic-atan2-16.asm | 3 +- src/test/ref/cordic-atan2-16.log | 15 +- src/test/ref/cordic-atan2-clear.asm | 3 +- src/test/ref/cordic-atan2-clear.log | 33 +- src/test/ref/cordic-atan2.asm | 3 +- src/test/ref/cordic-atan2.log | 27 +- src/test/ref/default-font.log | 14 +- src/test/ref/divide-2s.asm | 1 + src/test/ref/divide-2s.log | 9 +- src/test/ref/dword.log | 7 +- src/test/ref/euclid-3.log | 6 +- src/test/ref/examples/c64/3d/perspective.log | 16 +- .../c64/bresenham/bitmap-bresenham.asm | 14 +- .../c64/bresenham/bitmap-bresenham.log | 92 +- .../c64/fastmultiply/fastmultiply8.asm | 3 +- .../c64/fastmultiply/fastmultiply8.log | 23 +- src/test/ref/examples/c64/fire/fire.log | 25 +- .../ref/examples/c64/font-2x2/font-2x2.asm | 11 +- .../ref/examples/c64/font-2x2/font-2x2.log | 50 +- .../examples/c64/kernalload/kernalload.asm | 4 +- .../examples/c64/kernalload/kernalload.log | 14 +- .../ref/examples/c64/krillload/krillload.asm | 4 +- .../ref/examples/c64/krillload/krillload.log | 15 +- .../c64/multiplexer/simple-multiplexer.log | 24 +- .../ref/examples/c64/scrollbig/scrollbig.asm | 3 +- .../ref/examples/c64/scrollbig/scrollbig.log | 21 +- .../ref/examples/c64/showlogo/showlogo.log | 6 +- .../ref/examples/cx16/cx16-rasterbars.log | 16 +- .../ref/examples/helloworld/helloworld.asm | 3 +- .../ref/examples/helloworld/helloworld.log | 37 +- src/test/ref/examples/mega65/banked-music.asm | 14 +- src/test/ref/examples/mega65/banked-music.cfg | 52 +- src/test/ref/examples/mega65/banked-music.log | 530 +++++------- src/test/ref/examples/mega65/banked-music.sym | 20 +- src/test/ref/examples/mega65/dma-test.log | 69 +- src/test/ref/examples/mega65/dma-test2.log | 75 +- src/test/ref/examples/mega65/dma-test3.log | 75 +- src/test/ref/examples/mega65/dma-test4.log | 107 +-- src/test/ref/examples/mega65/dma-test5.log | 75 +- src/test/ref/examples/mega65/dma-test6.log | 101 +-- src/test/ref/examples/mega65/dypp65.log | 121 +-- .../ref/examples/mega65/helloworld-mega65.asm | 3 +- .../ref/examples/mega65/helloworld-mega65.log | 158 ++-- .../ref/examples/mega65/memorymap-test.asm | 24 +- .../ref/examples/mega65/memorymap-test.cfg | 58 +- .../ref/examples/mega65/memorymap-test.log | 817 +++++++----------- .../ref/examples/mega65/memorymap-test.sym | 42 +- src/test/ref/examples/mega65/raster65.asm | 2 + src/test/ref/examples/mega65/raster65.log | 50 +- src/test/ref/examples/nes/nes-dxycp.asm | 4 +- src/test/ref/examples/nes/nes-dxycp.log | 15 +- .../ref/examples/plus4/plus4-randomwalk.log | 31 +- src/test/ref/examples/rom/rom.cfg | 11 +- src/test/ref/examples/rom/rom.log | 64 +- src/test/ref/examples/rom/rom.sym | 2 +- src/test/ref/fill-square.log | 6 +- src/test/ref/flipper-rex2.log | 8 +- src/test/ref/fragment-synth.asm | 8 +- src/test/ref/fragment-synth.log | 33 +- .../ref/function-pointer-noarg-call-14.asm | 3 +- .../ref/function-pointer-noarg-call-14.log | 37 +- src/test/ref/halfscii.log | 17 +- src/test/ref/hex2dec.log | 22 +- src/test/ref/incrementinarray.log | 6 +- src/test/ref/inline-asm-uses-1.asm | 3 +- src/test/ref/inline-asm-uses-1.log | 9 +- src/test/ref/inline-function-level2.log | 16 +- src/test/ref/inline-word.log | 6 +- src/test/ref/intermediates-simple.asm | 3 +- src/test/ref/intermediates-simple.log | 15 +- src/test/ref/intermediates-struct.asm | 32 +- src/test/ref/intermediates-struct.cfg | 28 +- src/test/ref/intermediates-struct.log | 271 +++--- src/test/ref/intermediates-struct.sym | 16 +- src/test/ref/keyboard-glitch.asm | 2 +- src/test/ref/keyboard-glitch.log | 36 +- src/test/ref/linegen.asm | 6 +- src/test/ref/linegen.log | 49 +- src/test/ref/liverange-2.log | 6 +- src/test/ref/liverange-3.log | 6 +- src/test/ref/liverange-4.log | 6 +- src/test/ref/liverange-5.log | 6 +- src/test/ref/liverange-problem-0.asm | 7 +- src/test/ref/liverange-problem-0.log | 21 +- src/test/ref/loop-memset-min.log | 6 +- src/test/ref/loophead-problem-2.asm | 7 +- src/test/ref/loophead-problem-2.log | 15 +- src/test/ref/loophead-problem-3.asm | 3 +- src/test/ref/loophead-problem-3.log | 17 +- src/test/ref/makelong-0.log | 6 +- src/test/ref/makeword-0.log | 6 +- src/test/ref/makeword-1.log | 1 + src/test/ref/memcpy-0.log | 6 +- src/test/ref/memcpy-1.log | 6 +- src/test/ref/min-fmul-16.asm | 3 +- src/test/ref/min-fmul-16.log | 13 +- .../simple-multiplexer-irq.log | 15 +- src/test/ref/multiply-1.log | 17 +- src/test/ref/multiply-16bit-const.log | 6 +- src/test/ref/multiply-2.log | 6 +- src/test/ref/multiply-2s.asm | 1 + src/test/ref/multiply-2s.log | 9 +- src/test/ref/norom-charset.log | 10 +- src/test/ref/number-inference-sum.log | 23 +- src/test/ref/number-ternary-fail-2.log | 6 +- src/test/ref/operator-lohi-problem.log | 13 +- src/test/ref/plus4-keyboard-test.log | 18 +- src/test/ref/pointer-plus-signed-word.log | 7 +- src/test/ref/primes-1000-2.asm | 4 +- src/test/ref/primes-1000-2.log | 28 +- src/test/ref/printf-1.asm | 3 +- src/test/ref/printf-1.log | 43 +- src/test/ref/printf-14.asm | 3 +- src/test/ref/printf-14.log | 53 +- src/test/ref/printf-15.asm | 3 +- src/test/ref/printf-15.log | 37 +- .../procedure-callingconvention-stack-10.asm | 3 +- .../procedure-callingconvention-stack-10.log | 22 +- .../procedure-callingconvention-stack-10.sym | 1 + .../procedure-callingconvention-stack-11.asm | 3 +- .../procedure-callingconvention-stack-11.log | 38 +- .../procedure-callingconvention-stack-11.sym | 1 + .../procedure-callingconvention-stack-13.asm | 3 +- .../procedure-callingconvention-stack-13.log | 13 +- .../procedure-callingconvention-stack-4.asm | 3 +- .../procedure-callingconvention-stack-4.log | 23 +- src/test/ref/procedure-declare-10.log | 6 +- src/test/ref/processor-port-test.log | 6 +- src/test/ref/ptr-complex.asm | 1 + src/test/ref/ptr-complex.log | 11 +- src/test/ref/robozzle64-label-problem.asm | 6 +- src/test/ref/robozzle64-label-problem.log | 22 +- src/test/ref/scan-desire-problem.asm | 3 +- src/test/ref/scan-desire-problem.log | 40 +- src/test/ref/semi-struct-1.log | 24 +- src/test/ref/sieve-min.asm | 1 + src/test/ref/sieve-min.log | 38 +- src/test/ref/signed-indexed-subtract.log | 6 +- src/test/ref/signed-words.log | 22 +- src/test/ref/sinus-basic.asm | 2 +- src/test/ref/sinus-basic.log | 9 +- src/test/ref/sinusgen16.asm | 39 +- src/test/ref/sinusgen16.log | 163 ++-- src/test/ref/sizeof-problem.log | 7 +- src/test/ref/stars-2.asm | 3 +- src/test/ref/stars-2.log | 53 +- src/test/ref/statement-sequence-1.log | 11 +- src/test/ref/struct-23.asm | 6 +- src/test/ref/struct-23.cfg | 34 +- src/test/ref/struct-23.log | 241 ++---- src/test/ref/struct-23.sym | 8 - src/test/ref/struct-ptr-2.asm | 6 +- src/test/ref/struct-ptr-2.log | 19 +- src/test/ref/struct-ptr-22.log | 6 +- src/test/ref/struct-ptr-5.log | 12 +- src/test/ref/summin.asm | 9 +- src/test/ref/summin.log | 41 +- src/test/ref/test-comments-block.asm | 3 +- src/test/ref/test-comments-block.log | 11 +- src/test/ref/test-comments-single.asm | 3 +- src/test/ref/test-comments-single.log | 11 +- src/test/ref/test-comparisons-sword.log | 22 +- src/test/ref/test-comparisons-word.log | 22 +- src/test/ref/test-keyboard-space.asm | 2 +- src/test/ref/test-keyboard-space.log | 28 +- src/test/ref/test-keyboard.asm | 8 +- src/test/ref/test-keyboard.log | 53 +- src/test/ref/test-lowhigh.log | 6 +- src/test/ref/test-signed-word-minus-byte.log | 17 +- src/test/ref/tod-1.asm | 3 +- src/test/ref/tod-1.log | 33 +- src/test/ref/toupper-1.asm | 3 +- src/test/ref/toupper-1.log | 33 +- src/test/ref/true-inline-words.asm | 1 + src/test/ref/true-inline-words.log | 17 +- src/test/ref/unused-vars.log | 2 + src/test/ref/var-register-zp.asm | 3 +- src/test/ref/var-register-zp.log | 14 +- src/test/ref/var-register.log | 6 +- src/test/ref/varcall-4.asm | 6 +- src/test/ref/varcall-4.log | 28 +- src/test/ref/voronoi.asm | 7 +- src/test/ref/voronoi.log | 17 +- src/test/ref/word-pointer-math-1.log | 7 +- src/test/ref/zp-reserve-coalesce-problem.log | 6 +- src/test/ref/zpptr.log | 6 +- 231 files changed, 2551 insertions(+), 3962 deletions(-) diff --git a/src/main/java/dk/camelot64/kickc/model/statements/StatementCallFinalize.java b/src/main/java/dk/camelot64/kickc/model/statements/StatementCallFinalize.java index d2c8224d5..859f3bcfd 100644 --- a/src/main/java/dk/camelot64/kickc/model/statements/StatementCallFinalize.java +++ b/src/main/java/dk/camelot64/kickc/model/statements/StatementCallFinalize.java @@ -51,6 +51,11 @@ public class StatementCallFinalize extends StatementBase implements StatementLVa return initialAssignment; } + @Override + public void setInitialAssignment(boolean initialAssignment) { + this.initialAssignment = initialAssignment; + } + @Override public String toString(Program program, boolean aliveInfo) { StringBuilder res = new StringBuilder(); diff --git a/src/main/java/dk/camelot64/kickc/model/statements/StatementLValue.java b/src/main/java/dk/camelot64/kickc/model/statements/StatementLValue.java index 5ee1e1496..947ba196d 100644 --- a/src/main/java/dk/camelot64/kickc/model/statements/StatementLValue.java +++ b/src/main/java/dk/camelot64/kickc/model/statements/StatementLValue.java @@ -13,4 +13,6 @@ public interface StatementLValue extends Statement { boolean isInitialAssignment(); + void setInitialAssignment(boolean initialAssignment); + } diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass0GenerateStatementSequence.java b/src/main/java/dk/camelot64/kickc/passes/Pass0GenerateStatementSequence.java index 69c138d7a..79ebaa3d1 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass0GenerateStatementSequence.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass0GenerateStatementSequence.java @@ -111,6 +111,21 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor statements = statementSequence.getStatements(); + if(statements.size()==0) + return null; + else + return statements.get(statements.size()-1); + } + + private Procedure getInitProc() { // Statement outside procedure declaration - put into the _init procedure Procedure initProc = program.getScope().getLocalProcedure(SymbolRef.INIT_PROC_NAME); @@ -421,7 +436,7 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor> 1 Adding number conversion cast (unumber) 6 in main::a#8 = main::a#18 ^ 6 Adding number conversion cast (unumber) 1 in main::a#9 = main::a#19 | 1 Adding number conversion cast (unumber) 1 in main::a#10 = main::a#20 & 1 -Adding number conversion cast (unumber) $28 in __start::__init1_$0 = screen1 + $28 +Adding number conversion cast (unumber) $28 in screen2#0 = screen1 + $28 Successful SSA optimization PassNAddNumberTypeConversions Simplifying constant pointer cast (byte*) 1024 Simplifying constant pointer cast (byte*) 55296 @@ -326,7 +325,7 @@ Alias main::i#21 = main::i#9 Alias main::a#20 = main::a#9 Alias main::i#10 = main::i#22 Alias test::i#11 = test::i#12 test::i#13 -Alias screen2#0 = __start::__init1_$0 screen2#16 screen2#15 screen2#3 screen2#1 +Alias screen2#0 = screen2#16 screen2#15 screen2#3 screen2#1 Successful SSA optimization Pass2AliasElimination Identical Phi Values screen2#10 screen2#0 Identical Phi Values screen2#2 screen2#10 diff --git a/src/test/ref/bitmap-circle-2.log b/src/test/ref/bitmap-circle-2.log index 41b1994bb..592eaa9e6 100644 --- a/src/test/ref/bitmap-circle-2.log +++ b/src/test/ref/bitmap-circle-2.log @@ -1,4 +1,6 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx +Eliminating unused variable with no statement circle::$1 +Eliminating unused variable with no statement fill::$0 CONTROL FLOW GRAPH SSA @@ -51,8 +53,7 @@ circle: scope:[circle] from main::@2 circle::r#1 = phi( main::@2/circle::r#0 ) circle::y#0 = circle::r#1 circle::$0 = circle::r#1 << 1 - circle::$1 = 3 - circle::$0 - circle::p#0 = circle::$1 + circle::p#0 = 3 - circle::$0 circle::x1#0 = 0 to:circle::@1 circle::@1: scope:[circle] from circle circle::@13 @@ -245,8 +246,7 @@ fill: scope:[fill] from main main::@4 fill::val#4 = phi( main/fill::val#0, main::@4/fill::val#1 ) fill::size#2 = phi( main/fill::size#0, main::@4/fill::size#1 ) fill::start#2 = phi( main/fill::start#0, main::@4/fill::start#1 ) - fill::$0 = fill::start#2 + fill::size#2 - fill::end#0 = fill::$0 + fill::end#0 = fill::start#2 + fill::size#2 fill::addr#0 = fill::start#2 to:fill::@1 fill::@1: scope:[fill] from fill fill::@2 @@ -291,7 +291,6 @@ void __start() constant byte* bitmask[] = { $80, $40, $20, $10, 8, 4, 2, 1 } void circle(signed word circle::xc , signed word circle::yc , signed word circle::r) signed word~ circle::$0 -number~ circle::$1 signed word~ circle::$10 number~ circle::$11 signed word~ circle::$12 @@ -403,7 +402,6 @@ signed word circle::yc#7 signed word circle::yc#8 signed word circle::yc#9 void fill(byte* fill::start , signed word fill::size , byte fill::val) -byte*~ fill::$0 bool~ fill::$1 byte* fill::addr byte* fill::addr#0 @@ -493,8 +491,7 @@ Adding number conversion cast (snumber) $a0 in circle::xc#0 = $a0 Adding number conversion cast (snumber) $64 in circle::yc#0 = $64 Adding number conversion cast (snumber) 5 in main::i#1 = main::i#4 + 5 Adding number conversion cast (snumber) 1 in circle::$0 = circle::r#1 << 1 -Adding number conversion cast (snumber) 3 in circle::$1 = 3 - circle::$0 -Adding number conversion cast (snumber) circle::$1 in circle::$1 = (snumber)3 - circle::$0 +Adding number conversion cast (snumber) 3 in circle::p#0 = 3 - circle::$0 Adding number conversion cast (snumber) 0 in circle::$3 = circle::p#3 < 0 Adding number conversion cast (snumber) 2 in circle::$9 = circle::x1#3 << 2 Adding number conversion cast (snumber) 6 in circle::$11 = circle::$10 + 6 @@ -593,7 +590,6 @@ Finalized signed number type (signed byte) 3 Finalized signed number type (signed word) $140 Finalized signed number type (signed byte) 7 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to signed word in circle::$1 = 3 - circle::$0 Inferred type updated to signed word in circle::$11 = circle::$10 + 6 Inferred type updated to signed word in circle::$4 = circle::y#3 - 1 Inferred type updated to signed word in circle::$8 = circle::$7 + $a @@ -603,7 +599,6 @@ Inferred type updated to signed word in plot::$12 = plot::$11 * $140 Inferred type updated to signed byte in plot::$13 = plot::x#9 & 7 Alias main::i#2 = main::i#3 main::i#4 Alias circle::y#0 = circle::r#1 -Alias circle::p#0 = circle::$1 Alias circle::p#3 = circle::p#6 circle::p#4 circle::p#5 Alias circle::x1#14 = circle::x1#2 circle::x1#3 circle::x1#4 Alias circle::y#13 = circle::y#2 circle::y#14 circle::y#3 @@ -635,7 +630,6 @@ Alias plot::x#7 = circle::$33 Alias plot::y#7 = circle::$34 Alias plot::x#8 = plot::x#9 Alias plot::y#8 = plot::y#9 -Alias fill::end#0 = fill::$0 Alias fill::addr#0 = fill::start#2 Alias fill::val#2 = fill::val#3 Alias fill::addr#2 = fill::addr#3 diff --git a/src/test/ref/bitmap-circle.log b/src/test/ref/bitmap-circle.log index c85364969..c0718a80e 100644 --- a/src/test/ref/bitmap-circle.log +++ b/src/test/ref/bitmap-circle.log @@ -1,4 +1,6 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx +Eliminating unused variable with no statement circle::$1 +Eliminating unused variable with no statement fill::$0 CONTROL FLOW GRAPH SSA @@ -40,8 +42,7 @@ circle: scope:[circle] from main::@3 circle::r#1 = phi( main::@3/circle::r#0 ) circle::y#0 = circle::r#1 circle::$0 = circle::r#1 << 1 - circle::$1 = 3 - circle::$0 - circle::p#0 = circle::$1 + circle::p#0 = 3 - circle::$0 circle::x1#0 = 0 to:circle::@1 circle::@1: scope:[circle] from circle circle::@13 @@ -221,8 +222,7 @@ fill: scope:[fill] from main main::@2 fill::val#4 = phi( main/fill::val#0, main::@2/fill::val#1 ) fill::size#2 = phi( main/fill::size#0, main::@2/fill::size#1 ) fill::start#2 = phi( main/fill::start#0, main::@2/fill::start#1 ) - fill::$0 = fill::start#2 + fill::size#2 - fill::end#0 = fill::$0 + fill::end#0 = fill::start#2 + fill::size#2 fill::addr#0 = fill::start#2 to:fill::@1 fill::@1: scope:[fill] from fill fill::@2 @@ -267,7 +267,6 @@ void __start() constant byte* bitmask[] = { $80, $40, $20, $10, 8, 4, 2, 1 } void circle(signed word circle::xc , signed word circle::yc , signed word circle::r) signed word~ circle::$0 -number~ circle::$1 signed word~ circle::$10 number~ circle::$11 signed word~ circle::$12 @@ -379,7 +378,6 @@ signed word circle::yc#7 signed word circle::yc#8 signed word circle::yc#9 void fill(byte* fill::start , signed word fill::size , byte fill::val) -byte*~ fill::$0 bool~ fill::$1 byte* fill::addr byte* fill::addr#0 @@ -451,8 +449,7 @@ Adding number conversion cast (snumber) $64 in circle::xc#0 = $64 Adding number conversion cast (snumber) $64 in circle::yc#0 = $64 Adding number conversion cast (snumber) $32 in circle::r#0 = $32 Adding number conversion cast (snumber) 1 in circle::$0 = circle::r#1 << 1 -Adding number conversion cast (snumber) 3 in circle::$1 = 3 - circle::$0 -Adding number conversion cast (snumber) circle::$1 in circle::$1 = (snumber)3 - circle::$0 +Adding number conversion cast (snumber) 3 in circle::p#0 = 3 - circle::$0 Adding number conversion cast (snumber) 0 in circle::$3 = circle::p#3 < 0 Adding number conversion cast (snumber) 2 in circle::$9 = circle::x1#3 << 2 Adding number conversion cast (snumber) 6 in circle::$11 = circle::$10 + 6 @@ -538,7 +535,6 @@ Finalized signed number type (signed byte) 3 Finalized signed number type (signed word) $140 Finalized signed number type (signed byte) 7 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to signed word in circle::$1 = 3 - circle::$0 Inferred type updated to signed word in circle::$11 = circle::$10 + 6 Inferred type updated to signed word in circle::$4 = circle::y#3 - 1 Inferred type updated to signed word in circle::$8 = circle::$7 + $a @@ -547,7 +543,6 @@ Inferred type updated to byte in plot::$1 = plot::$6 & 7 Inferred type updated to signed word in plot::$3 = plot::$2 * $140 Inferred type updated to signed byte in plot::$4 = plot::x#8 & 7 Alias circle::y#0 = circle::r#1 -Alias circle::p#0 = circle::$1 Alias circle::p#3 = circle::p#6 circle::p#4 circle::p#5 Alias circle::x1#14 = circle::x1#2 circle::x1#3 circle::x1#4 Alias circle::y#13 = circle::y#2 circle::y#14 circle::y#3 @@ -577,7 +572,6 @@ Alias plot::x#6 = circle::$30 Alias plot::y#6 = circle::$31 Alias plot::x#7 = circle::$33 Alias plot::y#7 = circle::$34 -Alias fill::end#0 = fill::$0 Alias fill::addr#0 = fill::start#2 Alias fill::val#2 = fill::val#3 Alias fill::addr#2 = fill::addr#3 diff --git a/src/test/ref/bitmap-line-anim-1.asm b/src/test/ref/bitmap-line-anim-1.asm index 1f621282c..c0be63174 100644 --- a/src/test/ref/bitmap-line-anim-1.asm +++ b/src/test/ref/bitmap-line-anim-1.asm @@ -199,25 +199,23 @@ bitmap_line: { .label y = 2 .label x = 8 .label x2 = $e - // abs_u16(x2-x1) + // unsigned int dx = abs_u16(x2-x1) lda.z x2 sta.z abs_u16.w lda.z x2+1 sta.z abs_u16.w+1 jsr abs_u16 - // abs_u16(x2-x1) // unsigned int dx = abs_u16(x2-x1) lda.z abs_u16.return sta.z dx lda.z abs_u16.return+1 sta.z dx+1 - // abs_u16(y2-y1) + // unsigned int dy = abs_u16(y2-y1) lda #y2 sta.z abs_u16.w+1 jsr abs_u16 - // abs_u16(y2-y1) // unsigned int dy = abs_u16(y2-y1) // if(dx==0 && dy==0) lda.z dx @@ -229,25 +227,23 @@ bitmap_line: { jmp __b4 !__b4: __b1: - // sgn_u16(x2-x1) + // unsigned int sx = sgn_u16(x2-x1) lda.z x2 sta.z sgn_u16.w lda.z x2+1 sta.z sgn_u16.w+1 jsr sgn_u16 - // sgn_u16(x2-x1) // unsigned int sx = sgn_u16(x2-x1) lda.z sgn_u16.return sta.z sx lda.z sgn_u16.return+1 sta.z sx+1 - // sgn_u16(y2-y1) + // unsigned int sy = sgn_u16(y2-y1) lda #y2 sta.z sgn_u16.w+1 jsr sgn_u16 - // sgn_u16(y2-y1) // unsigned int sy = sgn_u16(y2-y1) // if(dx > dy) lda.z dy+1 @@ -259,6 +255,7 @@ bitmap_line: { bcc __b2 !: // unsigned int e = dx/2 + // Y is the driver lda.z dx+1 lsr sta.z e+1 @@ -333,6 +330,7 @@ bitmap_line: { rts __b2: // unsigned int e = dy/2 + // X is the driver lda.z dy+1 lsr sta.z e1+1 diff --git a/src/test/ref/bitmap-line-anim-1.log b/src/test/ref/bitmap-line-anim-1.log index c0e50f31c..d931c937a 100644 --- a/src/test/ref/bitmap-line-anim-1.log +++ b/src/test/ref/bitmap-line-anim-1.log @@ -1,5 +1,13 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call __init +Eliminating unused variable with no statement bitmap_clear::$1 +Eliminating unused variable with no statement bitmap_line::$1 +Eliminating unused variable with no statement bitmap_line::$3 +Eliminating unused variable with no statement bitmap_line::$9 +Eliminating unused variable with no statement bitmap_line::$11 +Eliminating unused variable with no statement bitmap_line::$15 +Eliminating unused variable with no statement bitmap_line::$20 +Eliminating unused variable with no statement memset::$2 CONTROL FLOW GRAPH SSA @@ -96,8 +104,7 @@ bitmap_clear: scope:[bitmap_clear] from main::@2 bitmap_clear::bgcol#1 = phi( main::@2/bitmap_clear::bgcol#0 ) bitmap_clear::fgcol#1 = phi( main::@2/bitmap_clear::fgcol#0 ) bitmap_clear::$0 = bitmap_clear::fgcol#1 * $10 - bitmap_clear::$1 = bitmap_clear::$0 + bitmap_clear::bgcol#1 - bitmap_clear::col#0 = bitmap_clear::$1 + bitmap_clear::col#0 = bitmap_clear::$0 + bitmap_clear::bgcol#1 memset::str#0 = (void*)bitmap_screen#8 memset::c#0 = bitmap_clear::col#0 memset::num#0 = $3e8 @@ -154,8 +161,7 @@ bitmap_line::@12: scope:[bitmap_line] from bitmap_line bitmap_line::y1#2 = phi( bitmap_line/bitmap_line::y1#1 ) bitmap_line::y2#1 = phi( bitmap_line/bitmap_line::y2#4 ) abs_u16::return#5 = phi( bitmap_line/abs_u16::return#0 ) - bitmap_line::$1 = abs_u16::return#5 - bitmap_line::dx#0 = bitmap_line::$1 + bitmap_line::dx#0 = abs_u16::return#5 bitmap_line::$2 = bitmap_line::y2#1 - bitmap_line::y1#2 abs_u16::w#1 = bitmap_line::$2 call abs_u16 @@ -170,8 +176,7 @@ bitmap_line::@13: scope:[bitmap_line] from bitmap_line::@12 bitmap_line::x2#4 = phi( bitmap_line::@12/bitmap_line::x2#7 ) bitmap_line::dx#1 = phi( bitmap_line::@12/bitmap_line::dx#0 ) abs_u16::return#6 = phi( bitmap_line::@12/abs_u16::return#1 ) - bitmap_line::$3 = abs_u16::return#6 - bitmap_line::dy#0 = bitmap_line::$3 + bitmap_line::dy#0 = abs_u16::return#6 bitmap_line::$4 = bitmap_line::dx#1 == 0 bitmap_line::$5 = bitmap_line::dy#0 == 0 bitmap_line::$6 = bitmap_line::$4 && bitmap_line::$5 @@ -201,8 +206,7 @@ bitmap_line::@14: scope:[bitmap_line] from bitmap_line::@1 bitmap_line::y1#3 = phi( bitmap_line::@1/bitmap_line::y1#4 ) bitmap_line::y2#2 = phi( bitmap_line::@1/bitmap_line::y2#5 ) sgn_u16::return#5 = phi( bitmap_line::@1/sgn_u16::return#0 ) - bitmap_line::$9 = sgn_u16::return#5 - bitmap_line::sx#0 = bitmap_line::$9 + bitmap_line::sx#0 = sgn_u16::return#5 bitmap_line::$10 = bitmap_line::y2#2 - bitmap_line::y1#3 sgn_u16::w#1 = bitmap_line::$10 call sgn_u16 @@ -217,8 +221,7 @@ bitmap_line::@15: scope:[bitmap_line] from bitmap_line::@14 bitmap_line::dy#1 = phi( bitmap_line::@14/bitmap_line::dy#6 ) bitmap_line::dx#2 = phi( bitmap_line::@14/bitmap_line::dx#7 ) sgn_u16::return#6 = phi( bitmap_line::@14/sgn_u16::return#1 ) - bitmap_line::$11 = sgn_u16::return#6 - bitmap_line::sy#0 = bitmap_line::$11 + bitmap_line::sy#0 = sgn_u16::return#6 bitmap_line::$12 = bitmap_line::dx#2 > bitmap_line::dy#1 if(bitmap_line::$12) goto bitmap_line::@2 to:bitmap_line::@5 @@ -242,8 +245,7 @@ bitmap_line::@2: scope:[bitmap_line] from bitmap_line::@15 bitmap_line::y#14 = phi( bitmap_line::@15/bitmap_line::y#17 ) bitmap_line::x#14 = phi( bitmap_line::@15/bitmap_line::x#17 ) bitmap_line::dy#2 = phi( bitmap_line::@15/bitmap_line::dy#1 ) - bitmap_line::$20 = bitmap_line::dy#2 / 2 - bitmap_line::e1#0 = bitmap_line::$20 + bitmap_line::e1#0 = bitmap_line::dy#2 / 2 to:bitmap_line::@9 bitmap_line::@5: scope:[bitmap_line] from bitmap_line::@15 bitmap_line::sx#9 = phi( bitmap_line::@15/bitmap_line::sx#8 ) @@ -253,8 +255,7 @@ bitmap_line::@5: scope:[bitmap_line] from bitmap_line::@15 bitmap_line::y#11 = phi( bitmap_line::@15/bitmap_line::y#17 ) bitmap_line::x#11 = phi( bitmap_line::@15/bitmap_line::x#17 ) bitmap_line::dx#3 = phi( bitmap_line::@15/bitmap_line::dx#2 ) - bitmap_line::$15 = bitmap_line::dx#3 / 2 - bitmap_line::e#0 = bitmap_line::$15 + bitmap_line::e#0 = bitmap_line::dx#3 / 2 to:bitmap_line::@6 bitmap_line::@6: scope:[bitmap_line] from bitmap_line::@5 bitmap_line::@7 bitmap_line::sx#5 = phi( bitmap_line::@5/bitmap_line::sx#9, bitmap_line::@7/bitmap_line::sx#10 ) @@ -388,8 +389,7 @@ memset::@2: scope:[memset] from memset memset::num#3 = phi( memset/memset::num#2 ) memset::str#3 = phi( memset/memset::str#4 ) memset::$4 = (byte*)memset::str#3 - memset::$2 = memset::$4 + memset::num#3 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#3 memset::dst#0 = ((byte*)) memset::str#3 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -603,7 +603,6 @@ word abs_u16::w#3 word abs_u16::w#4 void bitmap_clear(byte bitmap_clear::bgcol , byte bitmap_clear::fgcol) number~ bitmap_clear::$0 -number~ bitmap_clear::$1 byte bitmap_clear::bgcol byte bitmap_clear::bgcol#0 byte bitmap_clear::bgcol#1 @@ -689,26 +688,20 @@ byte* bitmap_init::yoffs#3 byte* bitmap_init::yoffs#4 void bitmap_line(word bitmap_line::x1 , word bitmap_line::y1 , word bitmap_line::x2 , word bitmap_line::y2) word~ bitmap_line::$0 -word~ bitmap_line::$1 word~ bitmap_line::$10 -word~ bitmap_line::$11 bool~ bitmap_line::$12 -number~ bitmap_line::$15 bool~ bitmap_line::$17 bool~ bitmap_line::$18 bool~ bitmap_line::$19 word~ bitmap_line::$2 -number~ bitmap_line::$20 bool~ bitmap_line::$22 bool~ bitmap_line::$23 bool~ bitmap_line::$24 -word~ bitmap_line::$3 bool~ bitmap_line::$4 bool~ bitmap_line::$5 bool~ bitmap_line::$6 bool~ bitmap_line::$7 word~ bitmap_line::$8 -word~ bitmap_line::$9 word bitmap_line::dx word bitmap_line::dx#0 word bitmap_line::dx#1 @@ -922,7 +915,6 @@ void main() void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -1006,16 +998,13 @@ Adding number conversion cast (unumber) 7 in bitmap_init::$8 = bitmap_init::$7 = Adding number conversion cast (unumber) $28*8 in bitmap_init::$10 = bitmap_init::yoffs#3 + $28*8 Adding number conversion cast (unumber) $10 in bitmap_clear::$0 = bitmap_clear::fgcol#1 * $10 Adding number conversion cast (unumber) bitmap_clear::$0 in bitmap_clear::$0 = bitmap_clear::fgcol#1 * (unumber)$10 -Adding number conversion cast (unumber) bitmap_clear::$1 in bitmap_clear::$1 = bitmap_clear::$0 + bitmap_clear::bgcol#1 Adding number conversion cast (unumber) 0 in memset::c#1 = 0 Adding number conversion cast (unumber) $fff8 in bitmap_plot::$1 = bitmap_plot::x#4 & $fff8 Adding number conversion cast (unumber) bitmap_plot::$1 in bitmap_plot::$1 = bitmap_plot::x#4 & (unumber)$fff8 Adding number conversion cast (unumber) 0 in bitmap_line::$4 = bitmap_line::dx#1 == 0 Adding number conversion cast (unumber) 0 in bitmap_line::$5 = bitmap_line::dy#0 == 0 -Adding number conversion cast (unumber) 2 in bitmap_line::$20 = bitmap_line::dy#2 / 2 -Adding number conversion cast (unumber) bitmap_line::$20 in bitmap_line::$20 = bitmap_line::dy#2 / (unumber)2 -Adding number conversion cast (unumber) 2 in bitmap_line::$15 = bitmap_line::dx#3 / 2 -Adding number conversion cast (unumber) bitmap_line::$15 in bitmap_line::$15 = bitmap_line::dx#3 / (unumber)2 +Adding number conversion cast (unumber) 2 in bitmap_line::e1#0 = bitmap_line::dy#2 / 2 +Adding number conversion cast (unumber) 2 in bitmap_line::e#0 = bitmap_line::dx#3 / 2 Adding number conversion cast (unumber) 0 in memset::$0 = memset::num#2 > 0 Adding number conversion cast (unumber) $80 in abs_u16::$1 = abs_u16::$0 & $80 Adding number conversion cast (unumber) abs_u16::$1 in abs_u16::$1 = abs_u16::$0 & (unumber)$80 @@ -1130,17 +1119,14 @@ Inferred type updated to byte in bitmap_init::$3 = bitmap_init::y#2 & 7 Inferred type updated to byte in bitmap_init::$5 = bitmap_init::$3 | bitmap_init::$4 Inferred type updated to byte in bitmap_init::$7 = bitmap_init::y#2 & 7 Inferred type updated to byte in bitmap_clear::$0 = bitmap_clear::fgcol#1 * $10 -Inferred type updated to byte in bitmap_clear::$1 = bitmap_clear::$0 + bitmap_clear::bgcol#1 Inferred type updated to word in bitmap_plot::$1 = bitmap_plot::x#4 & $fff8 -Inferred type updated to word in bitmap_line::$20 = bitmap_line::dy#2 / 2 -Inferred type updated to word in bitmap_line::$15 = bitmap_line::dx#3 / 2 Inferred type updated to byte in abs_u16::$1 = abs_u16::$0 & $80 Inferred type updated to byte in sgn_u16::$1 = sgn_u16::$0 & $80 Inversing boolean not [9] bitmap_init::$1 = bitmap_init::bits#1 != 0 from [8] bitmap_init::$0 = bitmap_init::bits#1 == 0 Inversing boolean not [29] bitmap_init::$9 = bitmap_init::$7 != 7 from [28] bitmap_init::$8 = bitmap_init::$7 == 7 -Inversing boolean not [124] bitmap_line::$18 = bitmap_line::dy#3 >= bitmap_line::e#1 from [123] bitmap_line::$17 = bitmap_line::dy#3 < bitmap_line::e#1 -Inversing boolean not [144] bitmap_line::$23 = bitmap_line::dx#5 >= bitmap_line::e1#1 from [143] bitmap_line::$22 = bitmap_line::dx#5 < bitmap_line::e1#1 -Inversing boolean not [154] memset::$1 = memset::num#2 <= 0 from [153] memset::$0 = memset::num#2 > 0 +Inversing boolean not [117] bitmap_line::$18 = bitmap_line::dy#3 >= bitmap_line::e#1 from [116] bitmap_line::$17 = bitmap_line::dy#3 < bitmap_line::e#1 +Inversing boolean not [137] bitmap_line::$23 = bitmap_line::dx#5 >= bitmap_line::e1#1 from [136] bitmap_line::$22 = bitmap_line::dx#5 < bitmap_line::e1#1 +Inversing boolean not [147] memset::$1 = memset::num#2 <= 0 from [146] memset::$0 = memset::num#2 > 0 Successful SSA optimization Pass2UnaryNotSimplification Alias bitmap_init::x#2 = bitmap_init::x#4 Alias bitmap_init::gfx#4 = bitmap_init::gfx#5 @@ -1156,7 +1142,6 @@ Alias bitmap_screen#17 = bitmap_screen#18 Alias bitmap_init::yoffs#1 = bitmap_init::$10 Alias bitmap_gfx#1 = bitmap_gfx#7 bitmap_gfx#13 Alias bitmap_screen#1 = bitmap_screen#7 bitmap_screen#13 -Alias bitmap_clear::col#0 = bitmap_clear::$1 Alias bitmap_gfx#14 = bitmap_gfx#8 Alias bitmap_line::x#0 = bitmap_line::x1#1 bitmap_line::x1#4 bitmap_line::x#16 bitmap_line::x1#3 bitmap_line::x#10 bitmap_line::x1#2 bitmap_line::x#19 bitmap_line::x#18 bitmap_line::x#17 bitmap_line::x#3 bitmap_line::x#14 bitmap_line::x#11 Alias bitmap_line::y#0 = bitmap_line::y1#1 bitmap_line::y1#2 bitmap_line::y#16 bitmap_line::y#10 bitmap_line::y1#5 bitmap_line::y1#4 bitmap_line::y#19 bitmap_line::y1#3 bitmap_line::y#18 bitmap_line::y#17 bitmap_line::y#3 bitmap_line::y#14 bitmap_line::y#11 @@ -1164,18 +1149,16 @@ Alias abs_u16::w#0 = bitmap_line::$0 Alias abs_u16::return#0 = abs_u16::return#5 Alias bitmap_line::y2#1 = bitmap_line::y2#4 bitmap_line::y2#8 bitmap_line::y2#5 bitmap_line::y2#2 bitmap_line::y2#11 bitmap_line::y2#10 Alias bitmap_line::x2#1 = bitmap_line::x2#7 bitmap_line::x2#4 bitmap_line::x2#2 bitmap_line::x2#11 bitmap_line::x2#10 bitmap_line::x2#9 -Alias bitmap_line::dx#0 = bitmap_line::$1 bitmap_line::dx#1 bitmap_line::dx#10 bitmap_line::dx#7 bitmap_line::dx#2 bitmap_line::dx#13 bitmap_line::dx#3 Alias abs_u16::w#1 = bitmap_line::$2 Alias abs_u16::return#1 = abs_u16::return#6 -Alias bitmap_line::dy#0 = bitmap_line::$3 bitmap_line::dy#9 bitmap_line::dy#6 bitmap_line::dy#1 bitmap_line::dy#2 bitmap_line::dy#10 +Alias bitmap_line::dx#0 = bitmap_line::dx#1 bitmap_line::dx#10 bitmap_line::dx#7 bitmap_line::dx#2 bitmap_line::dx#13 bitmap_line::dx#3 +Alias bitmap_line::dy#0 = bitmap_line::dy#9 bitmap_line::dy#6 bitmap_line::dy#1 bitmap_line::dy#2 bitmap_line::dy#10 Alias sgn_u16::w#0 = bitmap_line::$8 Alias sgn_u16::return#0 = sgn_u16::return#5 -Alias bitmap_line::sx#0 = bitmap_line::$9 bitmap_line::sx#8 bitmap_line::sx#7 bitmap_line::sx#9 Alias sgn_u16::w#1 = bitmap_line::$10 Alias sgn_u16::return#1 = sgn_u16::return#6 -Alias bitmap_line::sy#0 = bitmap_line::$11 bitmap_line::sy#10 bitmap_line::sy#5 -Alias bitmap_line::e1#0 = bitmap_line::$20 -Alias bitmap_line::e#0 = bitmap_line::$15 +Alias bitmap_line::sx#0 = bitmap_line::sx#8 bitmap_line::sx#7 bitmap_line::sx#9 +Alias bitmap_line::sy#0 = bitmap_line::sy#10 bitmap_line::sy#5 Alias bitmap_line::y#4 = bitmap_line::y#5 Alias bitmap_line::sy#1 = bitmap_line::sy#3 bitmap_line::sy#8 Alias bitmap_line::e#3 = bitmap_line::e#5 @@ -1200,7 +1183,6 @@ Alias memset::return#2 = memset::str#2 memset::return#4 memset::return#3 Alias memset::str#3 = memset::str#4 Alias memset::num#2 = memset::num#3 Alias memset::c#4 = memset::c#5 -Alias memset::end#0 = memset::$2 Alias memset::c#2 = memset::c#3 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -2701,6 +2683,7 @@ bitmap_line: { // bitmap_line::@5 __b5: // [63] bitmap_line::e#0 = bitmap_line::dx#0 >> 1 -- vwuz1=vwuz2_ror_1 + // Y is the driver lda.z dx+1 lsr sta.z e+1 @@ -2825,6 +2808,7 @@ bitmap_line: { // bitmap_line::@2 __b2: // [80] bitmap_line::e1#0 = bitmap_line::dy#0 >> 1 -- vwuz1=vwuz2_ror_1 + // X is the driver lda.z dy+1 lsr sta.z e1+1 @@ -3748,7 +3732,7 @@ bitmap_line: { .label y = 2 .label x = 8 .label x2 = $e - // abs_u16(x2-x1) + // unsigned int dx = abs_u16(x2-x1) // [46] abs_u16::w#0 = bitmap_line::x2#0 -- vwuz1=vwuz2 lda.z x2 sta.z abs_u16.w @@ -3758,16 +3742,15 @@ bitmap_line: { // [103] phi from bitmap_line to abs_u16 [phi:bitmap_line->abs_u16] // [103] phi abs_u16::w#2 = abs_u16::w#0 [phi:bitmap_line->abs_u16#0] -- register_copy jsr abs_u16 - // abs_u16(x2-x1) + // unsigned int dx = abs_u16(x2-x1) // [48] abs_u16::return#0 = abs_u16::return#4 // bitmap_line::@12 - // unsigned int dx = abs_u16(x2-x1) // [49] bitmap_line::dx#0 = abs_u16::return#0 -- vwuz1=vwuz2 lda.z abs_u16.return sta.z dx lda.z abs_u16.return+1 sta.z dx+1 - // abs_u16(y2-y1) + // unsigned int dy = abs_u16(y2-y1) // [50] call abs_u16 // [103] phi from bitmap_line::@12 to abs_u16 [phi:bitmap_line::@12->abs_u16] // [103] phi abs_u16::w#2 = bitmap_line::y2#0 [phi:bitmap_line::@12->abs_u16#0] -- vwuz1=vwuc1 @@ -3776,10 +3759,9 @@ bitmap_line: { lda #>y2 sta.z abs_u16.w+1 jsr abs_u16 - // abs_u16(y2-y1) + // unsigned int dy = abs_u16(y2-y1) // [51] abs_u16::return#1 = abs_u16::return#4 // bitmap_line::@13 - // unsigned int dy = abs_u16(y2-y1) // [52] bitmap_line::dy#0 = abs_u16::return#1 // if(dx==0 && dy==0) // [53] if(bitmap_line::dx#0!=0) goto bitmap_line::@1 -- vwuz1_neq_0_then_la1 @@ -3795,7 +3777,7 @@ bitmap_line: { !__b4: // bitmap_line::@1 __b1: - // sgn_u16(x2-x1) + // unsigned int sx = sgn_u16(x2-x1) // [55] sgn_u16::w#0 = bitmap_line::x2#0 -- vwuz1=vwuz2 lda.z x2 sta.z sgn_u16.w @@ -3805,16 +3787,15 @@ bitmap_line: { // [110] phi from bitmap_line::@1 to sgn_u16 [phi:bitmap_line::@1->sgn_u16] // [110] phi sgn_u16::w#2 = sgn_u16::w#0 [phi:bitmap_line::@1->sgn_u16#0] -- register_copy jsr sgn_u16 - // sgn_u16(x2-x1) + // unsigned int sx = sgn_u16(x2-x1) // [57] sgn_u16::return#0 = sgn_u16::return#4 // bitmap_line::@14 - // unsigned int sx = sgn_u16(x2-x1) // [58] bitmap_line::sx#0 = sgn_u16::return#0 -- vwuz1=vwuz2 lda.z sgn_u16.return sta.z sx lda.z sgn_u16.return+1 sta.z sx+1 - // sgn_u16(y2-y1) + // unsigned int sy = sgn_u16(y2-y1) // [59] call sgn_u16 // [110] phi from bitmap_line::@14 to sgn_u16 [phi:bitmap_line::@14->sgn_u16] // [110] phi sgn_u16::w#2 = bitmap_line::y2#0 [phi:bitmap_line::@14->sgn_u16#0] -- vwuz1=vwuc1 @@ -3823,10 +3804,9 @@ bitmap_line: { lda #>y2 sta.z sgn_u16.w+1 jsr sgn_u16 - // sgn_u16(y2-y1) + // unsigned int sy = sgn_u16(y2-y1) // [60] sgn_u16::return#1 = sgn_u16::return#4 // bitmap_line::@15 - // unsigned int sy = sgn_u16(y2-y1) // [61] bitmap_line::sy#0 = sgn_u16::return#1 // if(dx > dy) // [62] if(bitmap_line::dx#0>bitmap_line::dy#0) goto bitmap_line::@2 -- vwuz1_gt_vwuz2_then_la1 @@ -3841,6 +3821,7 @@ bitmap_line: { // bitmap_line::@5 // unsigned int e = dx/2 // [63] bitmap_line::e#0 = bitmap_line::dx#0 >> 1 -- vwuz1=vwuz2_ror_1 + // Y is the driver lda.z dx+1 lsr sta.z e+1 @@ -3956,6 +3937,7 @@ bitmap_line: { __b2: // unsigned int e = dy/2 // [80] bitmap_line::e1#0 = bitmap_line::dy#0 >> 1 -- vwuz1=vwuz2_ror_1 + // X is the driver lda.z dy+1 lsr sta.z e1+1 diff --git a/src/test/ref/bitmap-line-anim-2.asm b/src/test/ref/bitmap-line-anim-2.asm index d4810d52f..774352026 100644 --- a/src/test/ref/bitmap-line-anim-2.asm +++ b/src/test/ref/bitmap-line-anim-2.asm @@ -180,25 +180,23 @@ bitmap_line: { .label y = 4 .label x = $a .label x2 = 2 - // abs_u16(x2-x1) + // unsigned int dx = abs_u16(x2-x1) lda.z x2 sta.z abs_u16.w lda.z x2+1 sta.z abs_u16.w+1 jsr abs_u16 - // abs_u16(x2-x1) // unsigned int dx = abs_u16(x2-x1) lda.z abs_u16.return sta.z dx lda.z abs_u16.return+1 sta.z dx+1 - // abs_u16(y2-y1) + // unsigned int dy = abs_u16(y2-y1) lda #y2 sta.z abs_u16.w+1 jsr abs_u16 - // abs_u16(y2-y1) // unsigned int dy = abs_u16(y2-y1) // if(dx==0 && dy==0) lda.z dx @@ -210,25 +208,23 @@ bitmap_line: { jmp __b4 !__b4: __b1: - // sgn_u16(x2-x1) + // unsigned int sx = sgn_u16(x2-x1) lda.z x2 sta.z sgn_u16.w lda.z x2+1 sta.z sgn_u16.w+1 jsr sgn_u16 - // sgn_u16(x2-x1) // unsigned int sx = sgn_u16(x2-x1) lda.z sgn_u16.return sta.z sx lda.z sgn_u16.return+1 sta.z sx+1 - // sgn_u16(y2-y1) + // unsigned int sy = sgn_u16(y2-y1) lda #y2 sta.z sgn_u16.w+1 jsr sgn_u16 - // sgn_u16(y2-y1) // unsigned int sy = sgn_u16(y2-y1) // if(dx > dy) lda.z dy+1 @@ -240,6 +236,7 @@ bitmap_line: { bcc __b2 !: // unsigned int e = dx/2 + // Y is the driver lda.z dx+1 lsr sta.z e+1 @@ -314,6 +311,7 @@ bitmap_line: { rts __b2: // unsigned int e = dy/2 + // X is the driver lda.z dy+1 lsr sta.z e1+1 diff --git a/src/test/ref/bitmap-line-anim-2.log b/src/test/ref/bitmap-line-anim-2.log index 85afe4831..11b4be3ef 100644 --- a/src/test/ref/bitmap-line-anim-2.log +++ b/src/test/ref/bitmap-line-anim-2.log @@ -1,5 +1,13 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call __init +Eliminating unused variable with no statement bitmap_clear::$1 +Eliminating unused variable with no statement bitmap_line::$1 +Eliminating unused variable with no statement bitmap_line::$3 +Eliminating unused variable with no statement bitmap_line::$9 +Eliminating unused variable with no statement bitmap_line::$11 +Eliminating unused variable with no statement bitmap_line::$15 +Eliminating unused variable with no statement bitmap_line::$20 +Eliminating unused variable with no statement memset::$2 CONTROL FLOW GRAPH SSA @@ -96,8 +104,7 @@ bitmap_clear: scope:[bitmap_clear] from main::@4 bitmap_clear::bgcol#1 = phi( main::@4/bitmap_clear::bgcol#0 ) bitmap_clear::fgcol#1 = phi( main::@4/bitmap_clear::fgcol#0 ) bitmap_clear::$0 = bitmap_clear::fgcol#1 * $10 - bitmap_clear::$1 = bitmap_clear::$0 + bitmap_clear::bgcol#1 - bitmap_clear::col#0 = bitmap_clear::$1 + bitmap_clear::col#0 = bitmap_clear::$0 + bitmap_clear::bgcol#1 memset::str#0 = (void*)bitmap_screen#8 memset::c#0 = bitmap_clear::col#0 memset::num#0 = $3e8 @@ -154,8 +161,7 @@ bitmap_line::@12: scope:[bitmap_line] from bitmap_line bitmap_line::y1#2 = phi( bitmap_line/bitmap_line::y1#1 ) bitmap_line::y2#1 = phi( bitmap_line/bitmap_line::y2#4 ) abs_u16::return#5 = phi( bitmap_line/abs_u16::return#0 ) - bitmap_line::$1 = abs_u16::return#5 - bitmap_line::dx#0 = bitmap_line::$1 + bitmap_line::dx#0 = abs_u16::return#5 bitmap_line::$2 = bitmap_line::y2#1 - bitmap_line::y1#2 abs_u16::w#1 = bitmap_line::$2 call abs_u16 @@ -170,8 +176,7 @@ bitmap_line::@13: scope:[bitmap_line] from bitmap_line::@12 bitmap_line::x2#4 = phi( bitmap_line::@12/bitmap_line::x2#7 ) bitmap_line::dx#1 = phi( bitmap_line::@12/bitmap_line::dx#0 ) abs_u16::return#6 = phi( bitmap_line::@12/abs_u16::return#1 ) - bitmap_line::$3 = abs_u16::return#6 - bitmap_line::dy#0 = bitmap_line::$3 + bitmap_line::dy#0 = abs_u16::return#6 bitmap_line::$4 = bitmap_line::dx#1 == 0 bitmap_line::$5 = bitmap_line::dy#0 == 0 bitmap_line::$6 = bitmap_line::$4 && bitmap_line::$5 @@ -201,8 +206,7 @@ bitmap_line::@14: scope:[bitmap_line] from bitmap_line::@1 bitmap_line::y1#3 = phi( bitmap_line::@1/bitmap_line::y1#4 ) bitmap_line::y2#2 = phi( bitmap_line::@1/bitmap_line::y2#5 ) sgn_u16::return#5 = phi( bitmap_line::@1/sgn_u16::return#0 ) - bitmap_line::$9 = sgn_u16::return#5 - bitmap_line::sx#0 = bitmap_line::$9 + bitmap_line::sx#0 = sgn_u16::return#5 bitmap_line::$10 = bitmap_line::y2#2 - bitmap_line::y1#3 sgn_u16::w#1 = bitmap_line::$10 call sgn_u16 @@ -217,8 +221,7 @@ bitmap_line::@15: scope:[bitmap_line] from bitmap_line::@14 bitmap_line::dy#1 = phi( bitmap_line::@14/bitmap_line::dy#6 ) bitmap_line::dx#2 = phi( bitmap_line::@14/bitmap_line::dx#7 ) sgn_u16::return#6 = phi( bitmap_line::@14/sgn_u16::return#1 ) - bitmap_line::$11 = sgn_u16::return#6 - bitmap_line::sy#0 = bitmap_line::$11 + bitmap_line::sy#0 = sgn_u16::return#6 bitmap_line::$12 = bitmap_line::dx#2 > bitmap_line::dy#1 if(bitmap_line::$12) goto bitmap_line::@2 to:bitmap_line::@5 @@ -242,8 +245,7 @@ bitmap_line::@2: scope:[bitmap_line] from bitmap_line::@15 bitmap_line::y#14 = phi( bitmap_line::@15/bitmap_line::y#17 ) bitmap_line::x#14 = phi( bitmap_line::@15/bitmap_line::x#17 ) bitmap_line::dy#2 = phi( bitmap_line::@15/bitmap_line::dy#1 ) - bitmap_line::$20 = bitmap_line::dy#2 / 2 - bitmap_line::e1#0 = bitmap_line::$20 + bitmap_line::e1#0 = bitmap_line::dy#2 / 2 to:bitmap_line::@9 bitmap_line::@5: scope:[bitmap_line] from bitmap_line::@15 bitmap_line::sx#9 = phi( bitmap_line::@15/bitmap_line::sx#8 ) @@ -253,8 +255,7 @@ bitmap_line::@5: scope:[bitmap_line] from bitmap_line::@15 bitmap_line::y#11 = phi( bitmap_line::@15/bitmap_line::y#17 ) bitmap_line::x#11 = phi( bitmap_line::@15/bitmap_line::x#17 ) bitmap_line::dx#3 = phi( bitmap_line::@15/bitmap_line::dx#2 ) - bitmap_line::$15 = bitmap_line::dx#3 / 2 - bitmap_line::e#0 = bitmap_line::$15 + bitmap_line::e#0 = bitmap_line::dx#3 / 2 to:bitmap_line::@6 bitmap_line::@6: scope:[bitmap_line] from bitmap_line::@5 bitmap_line::@7 bitmap_line::sx#5 = phi( bitmap_line::@5/bitmap_line::sx#9, bitmap_line::@7/bitmap_line::sx#10 ) @@ -388,8 +389,7 @@ memset::@2: scope:[memset] from memset memset::num#3 = phi( memset/memset::num#2 ) memset::str#3 = phi( memset/memset::str#4 ) memset::$4 = (byte*)memset::str#3 - memset::$2 = memset::$4 + memset::num#3 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#3 memset::dst#0 = ((byte*)) memset::str#3 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -592,7 +592,6 @@ word abs_u16::w#3 word abs_u16::w#4 void bitmap_clear(byte bitmap_clear::bgcol , byte bitmap_clear::fgcol) number~ bitmap_clear::$0 -number~ bitmap_clear::$1 byte bitmap_clear::bgcol byte bitmap_clear::bgcol#0 byte bitmap_clear::bgcol#1 @@ -679,26 +678,20 @@ byte* bitmap_init::yoffs#3 byte* bitmap_init::yoffs#4 void bitmap_line(word bitmap_line::x1 , word bitmap_line::y1 , word bitmap_line::x2 , word bitmap_line::y2) word~ bitmap_line::$0 -word~ bitmap_line::$1 word~ bitmap_line::$10 -word~ bitmap_line::$11 bool~ bitmap_line::$12 -number~ bitmap_line::$15 bool~ bitmap_line::$17 bool~ bitmap_line::$18 bool~ bitmap_line::$19 word~ bitmap_line::$2 -number~ bitmap_line::$20 bool~ bitmap_line::$22 bool~ bitmap_line::$23 bool~ bitmap_line::$24 -word~ bitmap_line::$3 bool~ bitmap_line::$4 bool~ bitmap_line::$5 bool~ bitmap_line::$6 bool~ bitmap_line::$7 word~ bitmap_line::$8 -word~ bitmap_line::$9 word bitmap_line::dx word bitmap_line::dx#0 word bitmap_line::dx#1 @@ -908,7 +901,6 @@ bool~ main::$4 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -993,16 +985,13 @@ Adding number conversion cast (unumber) 7 in bitmap_init::$8 = bitmap_init::$7 = Adding number conversion cast (unumber) $28*8 in bitmap_init::$10 = bitmap_init::yoffs#3 + $28*8 Adding number conversion cast (unumber) $10 in bitmap_clear::$0 = bitmap_clear::fgcol#1 * $10 Adding number conversion cast (unumber) bitmap_clear::$0 in bitmap_clear::$0 = bitmap_clear::fgcol#1 * (unumber)$10 -Adding number conversion cast (unumber) bitmap_clear::$1 in bitmap_clear::$1 = bitmap_clear::$0 + bitmap_clear::bgcol#1 Adding number conversion cast (unumber) 0 in memset::c#1 = 0 Adding number conversion cast (unumber) $fff8 in bitmap_plot::$1 = bitmap_plot::x#4 & $fff8 Adding number conversion cast (unumber) bitmap_plot::$1 in bitmap_plot::$1 = bitmap_plot::x#4 & (unumber)$fff8 Adding number conversion cast (unumber) 0 in bitmap_line::$4 = bitmap_line::dx#1 == 0 Adding number conversion cast (unumber) 0 in bitmap_line::$5 = bitmap_line::dy#0 == 0 -Adding number conversion cast (unumber) 2 in bitmap_line::$20 = bitmap_line::dy#2 / 2 -Adding number conversion cast (unumber) bitmap_line::$20 in bitmap_line::$20 = bitmap_line::dy#2 / (unumber)2 -Adding number conversion cast (unumber) 2 in bitmap_line::$15 = bitmap_line::dx#3 / 2 -Adding number conversion cast (unumber) bitmap_line::$15 in bitmap_line::$15 = bitmap_line::dx#3 / (unumber)2 +Adding number conversion cast (unumber) 2 in bitmap_line::e1#0 = bitmap_line::dy#2 / 2 +Adding number conversion cast (unumber) 2 in bitmap_line::e#0 = bitmap_line::dx#3 / 2 Adding number conversion cast (unumber) 0 in memset::$0 = memset::num#2 > 0 Adding number conversion cast (unumber) $80 in abs_u16::$1 = abs_u16::$0 & $80 Adding number conversion cast (unumber) abs_u16::$1 in abs_u16::$1 = abs_u16::$0 & (unumber)$80 @@ -1117,18 +1106,15 @@ Inferred type updated to byte in bitmap_init::$3 = bitmap_init::y#2 & 7 Inferred type updated to byte in bitmap_init::$5 = bitmap_init::$3 | bitmap_init::$4 Inferred type updated to byte in bitmap_init::$7 = bitmap_init::y#2 & 7 Inferred type updated to byte in bitmap_clear::$0 = bitmap_clear::fgcol#1 * $10 -Inferred type updated to byte in bitmap_clear::$1 = bitmap_clear::$0 + bitmap_clear::bgcol#1 Inferred type updated to word in bitmap_plot::$1 = bitmap_plot::x#4 & $fff8 -Inferred type updated to word in bitmap_line::$20 = bitmap_line::dy#2 / 2 -Inferred type updated to word in bitmap_line::$15 = bitmap_line::dx#3 / 2 Inferred type updated to byte in abs_u16::$1 = abs_u16::$0 & $80 Inferred type updated to byte in sgn_u16::$1 = sgn_u16::$0 & $80 Inversing boolean not [9] bitmap_init::$1 = bitmap_init::bits#1 != 0 from [8] bitmap_init::$0 = bitmap_init::bits#1 == 0 Inversing boolean not [29] bitmap_init::$9 = bitmap_init::$7 != 7 from [28] bitmap_init::$8 = bitmap_init::$7 == 7 -Inversing boolean not [124] bitmap_line::$18 = bitmap_line::dy#3 >= bitmap_line::e#1 from [123] bitmap_line::$17 = bitmap_line::dy#3 < bitmap_line::e#1 -Inversing boolean not [144] bitmap_line::$23 = bitmap_line::dx#5 >= bitmap_line::e1#1 from [143] bitmap_line::$22 = bitmap_line::dx#5 < bitmap_line::e1#1 -Inversing boolean not [154] memset::$1 = memset::num#2 <= 0 from [153] memset::$0 = memset::num#2 > 0 -Inversing boolean not [219] main::$4 = next#0 != $140 from [218] main::$3 = next#0 == $140 +Inversing boolean not [117] bitmap_line::$18 = bitmap_line::dy#3 >= bitmap_line::e#1 from [116] bitmap_line::$17 = bitmap_line::dy#3 < bitmap_line::e#1 +Inversing boolean not [137] bitmap_line::$23 = bitmap_line::dx#5 >= bitmap_line::e1#1 from [136] bitmap_line::$22 = bitmap_line::dx#5 < bitmap_line::e1#1 +Inversing boolean not [147] memset::$1 = memset::num#2 <= 0 from [146] memset::$0 = memset::num#2 > 0 +Inversing boolean not [211] main::$4 = next#0 != $140 from [210] main::$3 = next#0 == $140 Successful SSA optimization Pass2UnaryNotSimplification Alias bitmap_init::x#2 = bitmap_init::x#4 Alias bitmap_init::gfx#4 = bitmap_init::gfx#5 @@ -1144,7 +1130,6 @@ Alias bitmap_screen#17 = bitmap_screen#18 Alias bitmap_init::yoffs#1 = bitmap_init::$10 Alias bitmap_gfx#1 = bitmap_gfx#7 bitmap_gfx#13 Alias bitmap_screen#1 = bitmap_screen#7 bitmap_screen#13 -Alias bitmap_clear::col#0 = bitmap_clear::$1 Alias bitmap_gfx#14 = bitmap_gfx#8 Alias bitmap_line::x#0 = bitmap_line::x1#1 bitmap_line::x1#4 bitmap_line::x#16 bitmap_line::x1#3 bitmap_line::x#10 bitmap_line::x1#2 bitmap_line::x#19 bitmap_line::x#18 bitmap_line::x#17 bitmap_line::x#3 bitmap_line::x#14 bitmap_line::x#11 Alias bitmap_line::y#0 = bitmap_line::y1#1 bitmap_line::y1#2 bitmap_line::y#16 bitmap_line::y#10 bitmap_line::y1#5 bitmap_line::y1#4 bitmap_line::y#19 bitmap_line::y1#3 bitmap_line::y#18 bitmap_line::y#17 bitmap_line::y#3 bitmap_line::y#14 bitmap_line::y#11 @@ -1152,18 +1137,16 @@ Alias abs_u16::w#0 = bitmap_line::$0 Alias abs_u16::return#0 = abs_u16::return#5 Alias bitmap_line::y2#1 = bitmap_line::y2#4 bitmap_line::y2#8 bitmap_line::y2#5 bitmap_line::y2#2 bitmap_line::y2#11 bitmap_line::y2#10 Alias bitmap_line::x2#1 = bitmap_line::x2#7 bitmap_line::x2#4 bitmap_line::x2#2 bitmap_line::x2#11 bitmap_line::x2#10 bitmap_line::x2#9 -Alias bitmap_line::dx#0 = bitmap_line::$1 bitmap_line::dx#1 bitmap_line::dx#10 bitmap_line::dx#7 bitmap_line::dx#2 bitmap_line::dx#13 bitmap_line::dx#3 Alias abs_u16::w#1 = bitmap_line::$2 Alias abs_u16::return#1 = abs_u16::return#6 -Alias bitmap_line::dy#0 = bitmap_line::$3 bitmap_line::dy#9 bitmap_line::dy#6 bitmap_line::dy#1 bitmap_line::dy#2 bitmap_line::dy#10 +Alias bitmap_line::dx#0 = bitmap_line::dx#1 bitmap_line::dx#10 bitmap_line::dx#7 bitmap_line::dx#2 bitmap_line::dx#13 bitmap_line::dx#3 +Alias bitmap_line::dy#0 = bitmap_line::dy#9 bitmap_line::dy#6 bitmap_line::dy#1 bitmap_line::dy#2 bitmap_line::dy#10 Alias sgn_u16::w#0 = bitmap_line::$8 Alias sgn_u16::return#0 = sgn_u16::return#5 -Alias bitmap_line::sx#0 = bitmap_line::$9 bitmap_line::sx#8 bitmap_line::sx#7 bitmap_line::sx#9 Alias sgn_u16::w#1 = bitmap_line::$10 Alias sgn_u16::return#1 = sgn_u16::return#6 -Alias bitmap_line::sy#0 = bitmap_line::$11 bitmap_line::sy#10 bitmap_line::sy#5 -Alias bitmap_line::e1#0 = bitmap_line::$20 -Alias bitmap_line::e#0 = bitmap_line::$15 +Alias bitmap_line::sx#0 = bitmap_line::sx#8 bitmap_line::sx#7 bitmap_line::sx#9 +Alias bitmap_line::sy#0 = bitmap_line::sy#10 bitmap_line::sy#5 Alias bitmap_line::y#4 = bitmap_line::y#5 Alias bitmap_line::sy#1 = bitmap_line::sy#3 bitmap_line::sy#8 Alias bitmap_line::e#3 = bitmap_line::e#5 @@ -1188,7 +1171,6 @@ Alias memset::return#2 = memset::str#2 memset::return#4 memset::return#3 Alias memset::str#3 = memset::str#4 Alias memset::num#2 = memset::num#3 Alias memset::c#4 = memset::c#5 -Alias memset::end#0 = memset::$2 Alias memset::c#2 = memset::c#3 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -2644,6 +2626,7 @@ bitmap_line: { // bitmap_line::@5 __b5: // [58] bitmap_line::e#0 = bitmap_line::dx#0 >> 1 -- vwuz1=vwuz2_ror_1 + // Y is the driver lda.z dx+1 lsr sta.z e+1 @@ -2768,6 +2751,7 @@ bitmap_line: { // bitmap_line::@2 __b2: // [75] bitmap_line::e1#0 = bitmap_line::dy#0 >> 1 -- vwuz1=vwuz2_ror_1 + // X is the driver lda.z dy+1 lsr sta.z e1+1 @@ -3669,7 +3653,7 @@ bitmap_line: { .label y = 4 .label x = $a .label x2 = 2 - // abs_u16(x2-x1) + // unsigned int dx = abs_u16(x2-x1) // [41] abs_u16::w#0 = bitmap_line::x2#0 -- vwuz1=vwuz2 lda.z x2 sta.z abs_u16.w @@ -3679,16 +3663,15 @@ bitmap_line: { // [98] phi from bitmap_line to abs_u16 [phi:bitmap_line->abs_u16] // [98] phi abs_u16::w#2 = abs_u16::w#0 [phi:bitmap_line->abs_u16#0] -- register_copy jsr abs_u16 - // abs_u16(x2-x1) + // unsigned int dx = abs_u16(x2-x1) // [43] abs_u16::return#0 = abs_u16::return#4 // bitmap_line::@12 - // unsigned int dx = abs_u16(x2-x1) // [44] bitmap_line::dx#0 = abs_u16::return#0 -- vwuz1=vwuz2 lda.z abs_u16.return sta.z dx lda.z abs_u16.return+1 sta.z dx+1 - // abs_u16(y2-y1) + // unsigned int dy = abs_u16(y2-y1) // [45] call abs_u16 // [98] phi from bitmap_line::@12 to abs_u16 [phi:bitmap_line::@12->abs_u16] // [98] phi abs_u16::w#2 = bitmap_line::y2#0 [phi:bitmap_line::@12->abs_u16#0] -- vwuz1=vwuc1 @@ -3697,10 +3680,9 @@ bitmap_line: { lda #>y2 sta.z abs_u16.w+1 jsr abs_u16 - // abs_u16(y2-y1) + // unsigned int dy = abs_u16(y2-y1) // [46] abs_u16::return#1 = abs_u16::return#4 // bitmap_line::@13 - // unsigned int dy = abs_u16(y2-y1) // [47] bitmap_line::dy#0 = abs_u16::return#1 // if(dx==0 && dy==0) // [48] if(bitmap_line::dx#0!=0) goto bitmap_line::@1 -- vwuz1_neq_0_then_la1 @@ -3716,7 +3698,7 @@ bitmap_line: { !__b4: // bitmap_line::@1 __b1: - // sgn_u16(x2-x1) + // unsigned int sx = sgn_u16(x2-x1) // [50] sgn_u16::w#0 = bitmap_line::x2#0 -- vwuz1=vwuz2 lda.z x2 sta.z sgn_u16.w @@ -3726,16 +3708,15 @@ bitmap_line: { // [105] phi from bitmap_line::@1 to sgn_u16 [phi:bitmap_line::@1->sgn_u16] // [105] phi sgn_u16::w#2 = sgn_u16::w#0 [phi:bitmap_line::@1->sgn_u16#0] -- register_copy jsr sgn_u16 - // sgn_u16(x2-x1) + // unsigned int sx = sgn_u16(x2-x1) // [52] sgn_u16::return#0 = sgn_u16::return#4 // bitmap_line::@14 - // unsigned int sx = sgn_u16(x2-x1) // [53] bitmap_line::sx#0 = sgn_u16::return#0 -- vwuz1=vwuz2 lda.z sgn_u16.return sta.z sx lda.z sgn_u16.return+1 sta.z sx+1 - // sgn_u16(y2-y1) + // unsigned int sy = sgn_u16(y2-y1) // [54] call sgn_u16 // [105] phi from bitmap_line::@14 to sgn_u16 [phi:bitmap_line::@14->sgn_u16] // [105] phi sgn_u16::w#2 = bitmap_line::y2#0 [phi:bitmap_line::@14->sgn_u16#0] -- vwuz1=vwuc1 @@ -3744,10 +3725,9 @@ bitmap_line: { lda #>y2 sta.z sgn_u16.w+1 jsr sgn_u16 - // sgn_u16(y2-y1) + // unsigned int sy = sgn_u16(y2-y1) // [55] sgn_u16::return#1 = sgn_u16::return#4 // bitmap_line::@15 - // unsigned int sy = sgn_u16(y2-y1) // [56] bitmap_line::sy#0 = sgn_u16::return#1 // if(dx > dy) // [57] if(bitmap_line::dx#0>bitmap_line::dy#0) goto bitmap_line::@2 -- vwuz1_gt_vwuz2_then_la1 @@ -3762,6 +3742,7 @@ bitmap_line: { // bitmap_line::@5 // unsigned int e = dx/2 // [58] bitmap_line::e#0 = bitmap_line::dx#0 >> 1 -- vwuz1=vwuz2_ror_1 + // Y is the driver lda.z dx+1 lsr sta.z e+1 @@ -3877,6 +3858,7 @@ bitmap_line: { __b2: // unsigned int e = dy/2 // [75] bitmap_line::e1#0 = bitmap_line::dy#0 >> 1 -- vwuz1=vwuz2_ror_1 + // X is the driver lda.z dy+1 lsr sta.z e1+1 diff --git a/src/test/ref/bitmap-plot-0.log b/src/test/ref/bitmap-plot-0.log index bdfad167d..390369e17 100644 --- a/src/test/ref/bitmap-plot-0.log +++ b/src/test/ref/bitmap-plot-0.log @@ -5,6 +5,8 @@ Resolved forward reference irq to __interrupt(hardware_clobber) void irq() Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call main::$2 = call toD018 SCREEN BITMAP Inlined call call __init +Eliminating unused variable with no statement bitmap_clear::$1 +Eliminating unused variable with no statement memset::$2 CONTROL FLOW GRAPH SSA @@ -101,8 +103,7 @@ bitmap_clear: scope:[bitmap_clear] from main::@8 bitmap_clear::bgcol#1 = phi( main::@8/bitmap_clear::bgcol#0 ) bitmap_clear::fgcol#1 = phi( main::@8/bitmap_clear::fgcol#0 ) bitmap_clear::$0 = bitmap_clear::fgcol#1 * $10 - bitmap_clear::$1 = bitmap_clear::$0 + bitmap_clear::bgcol#1 - bitmap_clear::col#0 = bitmap_clear::$1 + bitmap_clear::col#0 = bitmap_clear::$0 + bitmap_clear::bgcol#1 memset::str#0 = (void*)bitmap_screen#8 memset::c#0 = bitmap_clear::col#0 memset::num#0 = $3e8 @@ -156,8 +157,7 @@ memset::@2: scope:[memset] from memset memset::num#3 = phi( memset/memset::num#2 ) memset::str#3 = phi( memset/memset::str#4 ) memset::$4 = (byte*)memset::str#3 - memset::$2 = memset::$4 + memset::num#3 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#3 memset::dst#0 = ((byte*)) memset::str#3 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -416,7 +416,6 @@ constant const byte WHITE = 1 void __start() void bitmap_clear(byte bitmap_clear::bgcol , byte bitmap_clear::fgcol) number~ bitmap_clear::$0 -number~ bitmap_clear::$1 byte bitmap_clear::bgcol byte bitmap_clear::bgcol#0 byte bitmap_clear::bgcol#1 @@ -638,7 +637,6 @@ byte main::y#8 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -690,7 +688,6 @@ Adding number conversion cast (unumber) 7 in bitmap_init::$8 = bitmap_init::$7 = Adding number conversion cast (unumber) $28*8 in bitmap_init::$10 = bitmap_init::yoffs#3 + $28*8 Adding number conversion cast (unumber) $10 in bitmap_clear::$0 = bitmap_clear::fgcol#1 * $10 Adding number conversion cast (unumber) bitmap_clear::$0 in bitmap_clear::$0 = bitmap_clear::fgcol#1 * (unumber)$10 -Adding number conversion cast (unumber) bitmap_clear::$1 in bitmap_clear::$1 = bitmap_clear::$0 + bitmap_clear::bgcol#1 Adding number conversion cast (unumber) 0 in memset::c#1 = 0 Adding number conversion cast (unumber) $fff8 in bitmap_plot::$1 = bitmap_plot::x#1 & $fff8 Adding number conversion cast (unumber) bitmap_plot::$1 in bitmap_plot::$1 = bitmap_plot::x#1 & (unumber)$fff8 @@ -784,7 +781,6 @@ Inferred type updated to byte in bitmap_init::$3 = bitmap_init::y#2 & 7 Inferred type updated to byte in bitmap_init::$5 = bitmap_init::$3 | bitmap_init::$4 Inferred type updated to byte in bitmap_init::$7 = bitmap_init::y#2 & 7 Inferred type updated to byte in bitmap_clear::$0 = bitmap_clear::fgcol#1 * $10 -Inferred type updated to byte in bitmap_clear::$1 = bitmap_clear::$0 + bitmap_clear::bgcol#1 Inferred type updated to word in bitmap_plot::$1 = bitmap_plot::x#1 & $fff8 Inferred type updated to word in main::toD0181_$0 = main::toD0181_$7 & $3fff Inferred type updated to word in main::toD0181_$1 = main::toD0181_$0 * 4 @@ -793,8 +789,8 @@ Inferred type updated to byte in main::toD0181_$5 = main::toD0181_$4 & $f Inferred type updated to byte in main::toD0181_$6 = main::toD0181_$2 | main::toD0181_$5 Inversing boolean not [9] bitmap_init::$1 = bitmap_init::bits#1 != 0 from [8] bitmap_init::$0 = bitmap_init::bits#1 == 0 Inversing boolean not [29] bitmap_init::$9 = bitmap_init::$7 != 7 from [28] bitmap_init::$8 = bitmap_init::$7 == 7 -Inversing boolean not [68] memset::$1 = memset::num#2 <= 0 from [67] memset::$0 = memset::num#2 > 0 -Inversing boolean not [165] irq::$0 = 0 == frame_cnt from [164] irq::$1 = 0 != frame_cnt +Inversing boolean not [67] memset::$1 = memset::num#2 <= 0 from [66] memset::$0 = memset::num#2 > 0 +Inversing boolean not [163] irq::$0 = 0 == frame_cnt from [162] irq::$1 = 0 != frame_cnt Successful SSA optimization Pass2UnaryNotSimplification Alias bitmap_init::x#2 = bitmap_init::x#4 Alias bitmap_init::gfx#4 = bitmap_init::gfx#5 @@ -810,13 +806,11 @@ Alias bitmap_screen#17 = bitmap_screen#18 Alias bitmap_init::yoffs#1 = bitmap_init::$10 Alias bitmap_gfx#1 = bitmap_gfx#7 bitmap_gfx#13 Alias bitmap_screen#1 = bitmap_screen#7 bitmap_screen#13 -Alias bitmap_clear::col#0 = bitmap_clear::$1 Alias bitmap_gfx#14 = bitmap_gfx#8 Alias memset::return#2 = memset::str#2 memset::return#4 memset::return#3 Alias memset::str#3 = memset::str#4 Alias memset::num#2 = memset::num#3 Alias memset::c#4 = memset::c#5 -Alias memset::end#0 = memset::$2 Alias memset::c#2 = memset::c#3 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 diff --git a/src/test/ref/bitmap-plot-3.asm b/src/test/ref/bitmap-plot-3.asm index 459d74446..19c9bd8fa 100644 --- a/src/test/ref/bitmap-plot-3.asm +++ b/src/test/ref/bitmap-plot-3.asm @@ -214,7 +214,7 @@ bitmap_line: { .label y1 = 8 .label x2 = $10 .label y2 = $12 - // abs_u16(x2-x1) + // unsigned int dx = abs_u16(x2-x1) lda.z x2 sec sbc.z x1 @@ -223,13 +223,12 @@ bitmap_line: { sbc.z x1+1 sta.z abs_u16.w+1 jsr abs_u16 - // abs_u16(x2-x1) // unsigned int dx = abs_u16(x2-x1) lda.z abs_u16.return sta.z dx lda.z abs_u16.return+1 sta.z dx+1 - // abs_u16(y2-y1) + // unsigned int dy = abs_u16(y2-y1) lda.z y2 sec sbc.z y1 @@ -238,7 +237,6 @@ bitmap_line: { sbc.z y1+1 sta.z abs_u16.w+1 jsr abs_u16 - // abs_u16(y2-y1) // unsigned int dy = abs_u16(y2-y1) // if(dx==0 && dy==0) lda.z dx @@ -250,7 +248,7 @@ bitmap_line: { jmp __b4 !__b4: __b1: - // sgn_u16(x2-x1) + // unsigned int sx = sgn_u16(x2-x1) lda.z x2 sec sbc.z x1 @@ -259,13 +257,12 @@ bitmap_line: { sbc.z x1+1 sta.z sgn_u16.w+1 jsr sgn_u16 - // sgn_u16(x2-x1) // unsigned int sx = sgn_u16(x2-x1) lda.z sgn_u16.return sta.z sx lda.z sgn_u16.return+1 sta.z sx+1 - // sgn_u16(y2-y1) + // unsigned int sy = sgn_u16(y2-y1) lda.z y2 sec sbc.z y1 @@ -274,7 +271,6 @@ bitmap_line: { sbc.z y1+1 sta.z sgn_u16.w+1 jsr sgn_u16 - // sgn_u16(y2-y1) // unsigned int sy = sgn_u16(y2-y1) // if(dx > dy) lda.z dy+1 @@ -286,6 +282,7 @@ bitmap_line: { bcc __b2 !: // unsigned int e = dx/2 + // Y is the driver lda.z dx+1 lsr sta.z e+1 @@ -352,6 +349,7 @@ bitmap_line: { rts __b2: // unsigned int e = dy/2 + // X is the driver lda.z dy+1 lsr sta.z e1+1 diff --git a/src/test/ref/bitmap-plot-3.log b/src/test/ref/bitmap-plot-3.log index ed4347c2f..bb73bb2d9 100644 --- a/src/test/ref/bitmap-plot-3.log +++ b/src/test/ref/bitmap-plot-3.log @@ -1,6 +1,14 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call main::$2 = call toD018 SCREEN BITMAP Inlined call call __init +Eliminating unused variable with no statement bitmap_clear::$1 +Eliminating unused variable with no statement bitmap_line::$1 +Eliminating unused variable with no statement bitmap_line::$3 +Eliminating unused variable with no statement bitmap_line::$9 +Eliminating unused variable with no statement bitmap_line::$11 +Eliminating unused variable with no statement bitmap_line::$15 +Eliminating unused variable with no statement bitmap_line::$20 +Eliminating unused variable with no statement memset::$2 CONTROL FLOW GRAPH SSA @@ -97,8 +105,7 @@ bitmap_clear: scope:[bitmap_clear] from main::@6 bitmap_clear::bgcol#1 = phi( main::@6/bitmap_clear::bgcol#0 ) bitmap_clear::fgcol#1 = phi( main::@6/bitmap_clear::fgcol#0 ) bitmap_clear::$0 = bitmap_clear::fgcol#1 * $10 - bitmap_clear::$1 = bitmap_clear::$0 + bitmap_clear::bgcol#1 - bitmap_clear::col#0 = bitmap_clear::$1 + bitmap_clear::col#0 = bitmap_clear::$0 + bitmap_clear::bgcol#1 memset::str#0 = (void*)bitmap_screen#8 memset::c#0 = bitmap_clear::col#0 memset::num#0 = $3e8 @@ -155,8 +162,7 @@ bitmap_line::@12: scope:[bitmap_line] from bitmap_line bitmap_line::y1#2 = phi( bitmap_line/bitmap_line::y1#1 ) bitmap_line::y2#1 = phi( bitmap_line/bitmap_line::y2#4 ) abs_u16::return#5 = phi( bitmap_line/abs_u16::return#0 ) - bitmap_line::$1 = abs_u16::return#5 - bitmap_line::dx#0 = bitmap_line::$1 + bitmap_line::dx#0 = abs_u16::return#5 bitmap_line::$2 = bitmap_line::y2#1 - bitmap_line::y1#2 abs_u16::w#1 = bitmap_line::$2 call abs_u16 @@ -171,8 +177,7 @@ bitmap_line::@13: scope:[bitmap_line] from bitmap_line::@12 bitmap_line::x2#4 = phi( bitmap_line::@12/bitmap_line::x2#7 ) bitmap_line::dx#1 = phi( bitmap_line::@12/bitmap_line::dx#0 ) abs_u16::return#6 = phi( bitmap_line::@12/abs_u16::return#1 ) - bitmap_line::$3 = abs_u16::return#6 - bitmap_line::dy#0 = bitmap_line::$3 + bitmap_line::dy#0 = abs_u16::return#6 bitmap_line::$4 = bitmap_line::dx#1 == 0 bitmap_line::$5 = bitmap_line::dy#0 == 0 bitmap_line::$6 = bitmap_line::$4 && bitmap_line::$5 @@ -202,8 +207,7 @@ bitmap_line::@14: scope:[bitmap_line] from bitmap_line::@1 bitmap_line::y1#3 = phi( bitmap_line::@1/bitmap_line::y1#4 ) bitmap_line::y2#2 = phi( bitmap_line::@1/bitmap_line::y2#5 ) sgn_u16::return#5 = phi( bitmap_line::@1/sgn_u16::return#0 ) - bitmap_line::$9 = sgn_u16::return#5 - bitmap_line::sx#0 = bitmap_line::$9 + bitmap_line::sx#0 = sgn_u16::return#5 bitmap_line::$10 = bitmap_line::y2#2 - bitmap_line::y1#3 sgn_u16::w#1 = bitmap_line::$10 call sgn_u16 @@ -218,8 +222,7 @@ bitmap_line::@15: scope:[bitmap_line] from bitmap_line::@14 bitmap_line::dy#1 = phi( bitmap_line::@14/bitmap_line::dy#6 ) bitmap_line::dx#2 = phi( bitmap_line::@14/bitmap_line::dx#7 ) sgn_u16::return#6 = phi( bitmap_line::@14/sgn_u16::return#1 ) - bitmap_line::$11 = sgn_u16::return#6 - bitmap_line::sy#0 = bitmap_line::$11 + bitmap_line::sy#0 = sgn_u16::return#6 bitmap_line::$12 = bitmap_line::dx#2 > bitmap_line::dy#1 if(bitmap_line::$12) goto bitmap_line::@2 to:bitmap_line::@5 @@ -243,8 +246,7 @@ bitmap_line::@2: scope:[bitmap_line] from bitmap_line::@15 bitmap_line::y#14 = phi( bitmap_line::@15/bitmap_line::y#17 ) bitmap_line::x#14 = phi( bitmap_line::@15/bitmap_line::x#17 ) bitmap_line::dy#2 = phi( bitmap_line::@15/bitmap_line::dy#1 ) - bitmap_line::$20 = bitmap_line::dy#2 / 2 - bitmap_line::e1#0 = bitmap_line::$20 + bitmap_line::e1#0 = bitmap_line::dy#2 / 2 to:bitmap_line::@9 bitmap_line::@5: scope:[bitmap_line] from bitmap_line::@15 bitmap_line::sx#9 = phi( bitmap_line::@15/bitmap_line::sx#8 ) @@ -254,8 +256,7 @@ bitmap_line::@5: scope:[bitmap_line] from bitmap_line::@15 bitmap_line::y#11 = phi( bitmap_line::@15/bitmap_line::y#17 ) bitmap_line::x#11 = phi( bitmap_line::@15/bitmap_line::x#17 ) bitmap_line::dx#3 = phi( bitmap_line::@15/bitmap_line::dx#2 ) - bitmap_line::$15 = bitmap_line::dx#3 / 2 - bitmap_line::e#0 = bitmap_line::$15 + bitmap_line::e#0 = bitmap_line::dx#3 / 2 to:bitmap_line::@6 bitmap_line::@6: scope:[bitmap_line] from bitmap_line::@5 bitmap_line::@7 bitmap_line::sx#5 = phi( bitmap_line::@5/bitmap_line::sx#9, bitmap_line::@7/bitmap_line::sx#10 ) @@ -389,8 +390,7 @@ memset::@2: scope:[memset] from memset memset::num#3 = phi( memset/memset::num#2 ) memset::str#3 = phi( memset/memset::str#4 ) memset::$4 = (byte*)memset::str#3 - memset::$2 = memset::$4 + memset::num#3 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#3 memset::dst#0 = ((byte*)) memset::str#3 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -629,7 +629,6 @@ word abs_u16::w#3 word abs_u16::w#4 void bitmap_clear(byte bitmap_clear::bgcol , byte bitmap_clear::fgcol) number~ bitmap_clear::$0 -number~ bitmap_clear::$1 byte bitmap_clear::bgcol byte bitmap_clear::bgcol#0 byte bitmap_clear::bgcol#1 @@ -720,26 +719,20 @@ byte* bitmap_init::yoffs#3 byte* bitmap_init::yoffs#4 void bitmap_line(word bitmap_line::x1 , word bitmap_line::y1 , word bitmap_line::x2 , word bitmap_line::y2) word~ bitmap_line::$0 -word~ bitmap_line::$1 word~ bitmap_line::$10 -word~ bitmap_line::$11 bool~ bitmap_line::$12 -number~ bitmap_line::$15 bool~ bitmap_line::$17 bool~ bitmap_line::$18 bool~ bitmap_line::$19 word~ bitmap_line::$2 -number~ bitmap_line::$20 bool~ bitmap_line::$22 bool~ bitmap_line::$23 bool~ bitmap_line::$24 -word~ bitmap_line::$3 bool~ bitmap_line::$4 bool~ bitmap_line::$5 bool~ bitmap_line::$6 bool~ bitmap_line::$7 word~ bitmap_line::$8 -word~ bitmap_line::$9 word bitmap_line::dx word bitmap_line::dx#0 word bitmap_line::dx#1 @@ -991,7 +984,6 @@ byte* main::toD0181_screen#1 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -1060,16 +1052,13 @@ Adding number conversion cast (unumber) 7 in bitmap_init::$8 = bitmap_init::$7 = Adding number conversion cast (unumber) $28*8 in bitmap_init::$10 = bitmap_init::yoffs#3 + $28*8 Adding number conversion cast (unumber) $10 in bitmap_clear::$0 = bitmap_clear::fgcol#1 * $10 Adding number conversion cast (unumber) bitmap_clear::$0 in bitmap_clear::$0 = bitmap_clear::fgcol#1 * (unumber)$10 -Adding number conversion cast (unumber) bitmap_clear::$1 in bitmap_clear::$1 = bitmap_clear::$0 + bitmap_clear::bgcol#1 Adding number conversion cast (unumber) 0 in memset::c#1 = 0 Adding number conversion cast (unumber) $fff8 in bitmap_plot::$1 = bitmap_plot::x#4 & $fff8 Adding number conversion cast (unumber) bitmap_plot::$1 in bitmap_plot::$1 = bitmap_plot::x#4 & (unumber)$fff8 Adding number conversion cast (unumber) 0 in bitmap_line::$4 = bitmap_line::dx#1 == 0 Adding number conversion cast (unumber) 0 in bitmap_line::$5 = bitmap_line::dy#0 == 0 -Adding number conversion cast (unumber) 2 in bitmap_line::$20 = bitmap_line::dy#2 / 2 -Adding number conversion cast (unumber) bitmap_line::$20 in bitmap_line::$20 = bitmap_line::dy#2 / (unumber)2 -Adding number conversion cast (unumber) 2 in bitmap_line::$15 = bitmap_line::dx#3 / 2 -Adding number conversion cast (unumber) bitmap_line::$15 in bitmap_line::$15 = bitmap_line::dx#3 / (unumber)2 +Adding number conversion cast (unumber) 2 in bitmap_line::e1#0 = bitmap_line::dy#2 / 2 +Adding number conversion cast (unumber) 2 in bitmap_line::e#0 = bitmap_line::dx#3 / 2 Adding number conversion cast (unumber) 0 in memset::$0 = memset::num#2 > 0 Adding number conversion cast (unumber) $80 in abs_u16::$1 = abs_u16::$0 & $80 Adding number conversion cast (unumber) abs_u16::$1 in abs_u16::$1 = abs_u16::$0 & (unumber)$80 @@ -1186,10 +1175,7 @@ Inferred type updated to byte in bitmap_init::$3 = bitmap_init::y#2 & 7 Inferred type updated to byte in bitmap_init::$5 = bitmap_init::$3 | bitmap_init::$4 Inferred type updated to byte in bitmap_init::$7 = bitmap_init::y#2 & 7 Inferred type updated to byte in bitmap_clear::$0 = bitmap_clear::fgcol#1 * $10 -Inferred type updated to byte in bitmap_clear::$1 = bitmap_clear::$0 + bitmap_clear::bgcol#1 Inferred type updated to word in bitmap_plot::$1 = bitmap_plot::x#4 & $fff8 -Inferred type updated to word in bitmap_line::$20 = bitmap_line::dy#2 / 2 -Inferred type updated to word in bitmap_line::$15 = bitmap_line::dx#3 / 2 Inferred type updated to byte in abs_u16::$1 = abs_u16::$0 & $80 Inferred type updated to byte in sgn_u16::$1 = sgn_u16::$0 & $80 Inferred type updated to word in main::toD0181_$0 = main::toD0181_$7 & $3fff @@ -1203,9 +1189,9 @@ Inferred type updated to word in main::$6 = main::$14 + $78 Inferred type updated to byte in main::$7 = main::a#2 + $20 Inversing boolean not [9] bitmap_init::$1 = bitmap_init::bits#1 != 0 from [8] bitmap_init::$0 = bitmap_init::bits#1 == 0 Inversing boolean not [29] bitmap_init::$9 = bitmap_init::$7 != 7 from [28] bitmap_init::$8 = bitmap_init::$7 == 7 -Inversing boolean not [124] bitmap_line::$18 = bitmap_line::dy#3 >= bitmap_line::e#1 from [123] bitmap_line::$17 = bitmap_line::dy#3 < bitmap_line::e#1 -Inversing boolean not [144] bitmap_line::$23 = bitmap_line::dx#5 >= bitmap_line::e1#1 from [143] bitmap_line::$22 = bitmap_line::dx#5 < bitmap_line::e1#1 -Inversing boolean not [154] memset::$1 = memset::num#2 <= 0 from [153] memset::$0 = memset::num#2 > 0 +Inversing boolean not [117] bitmap_line::$18 = bitmap_line::dy#3 >= bitmap_line::e#1 from [116] bitmap_line::$17 = bitmap_line::dy#3 < bitmap_line::e#1 +Inversing boolean not [137] bitmap_line::$23 = bitmap_line::dx#5 >= bitmap_line::e1#1 from [136] bitmap_line::$22 = bitmap_line::dx#5 < bitmap_line::e1#1 +Inversing boolean not [147] memset::$1 = memset::num#2 <= 0 from [146] memset::$0 = memset::num#2 > 0 Successful SSA optimization Pass2UnaryNotSimplification Alias bitmap_init::x#2 = bitmap_init::x#4 Alias bitmap_init::gfx#4 = bitmap_init::gfx#5 @@ -1221,7 +1207,6 @@ Alias bitmap_screen#17 = bitmap_screen#18 Alias bitmap_init::yoffs#1 = bitmap_init::$10 Alias bitmap_gfx#1 = bitmap_gfx#7 bitmap_gfx#13 Alias bitmap_screen#1 = bitmap_screen#7 bitmap_screen#13 -Alias bitmap_clear::col#0 = bitmap_clear::$1 Alias bitmap_gfx#14 = bitmap_gfx#8 Alias bitmap_line::x#0 = bitmap_line::x1#1 bitmap_line::x1#4 bitmap_line::x#16 bitmap_line::x1#3 bitmap_line::x#10 bitmap_line::x1#2 bitmap_line::x#19 bitmap_line::x#18 bitmap_line::x#17 bitmap_line::x#3 bitmap_line::x#14 bitmap_line::x#11 Alias bitmap_line::y#0 = bitmap_line::y1#1 bitmap_line::y1#2 bitmap_line::y#16 bitmap_line::y#10 bitmap_line::y1#5 bitmap_line::y1#4 bitmap_line::y#19 bitmap_line::y1#3 bitmap_line::y#18 bitmap_line::y#17 bitmap_line::y#3 bitmap_line::y#14 bitmap_line::y#11 @@ -1229,18 +1214,16 @@ Alias abs_u16::w#0 = bitmap_line::$0 Alias abs_u16::return#0 = abs_u16::return#5 Alias bitmap_line::y2#1 = bitmap_line::y2#4 bitmap_line::y2#8 bitmap_line::y2#5 bitmap_line::y2#2 bitmap_line::y2#11 bitmap_line::y2#10 Alias bitmap_line::x2#1 = bitmap_line::x2#7 bitmap_line::x2#4 bitmap_line::x2#2 bitmap_line::x2#11 bitmap_line::x2#10 bitmap_line::x2#9 -Alias bitmap_line::dx#0 = bitmap_line::$1 bitmap_line::dx#1 bitmap_line::dx#10 bitmap_line::dx#7 bitmap_line::dx#2 bitmap_line::dx#13 bitmap_line::dx#3 Alias abs_u16::w#1 = bitmap_line::$2 Alias abs_u16::return#1 = abs_u16::return#6 -Alias bitmap_line::dy#0 = bitmap_line::$3 bitmap_line::dy#9 bitmap_line::dy#6 bitmap_line::dy#1 bitmap_line::dy#2 bitmap_line::dy#10 +Alias bitmap_line::dx#0 = bitmap_line::dx#1 bitmap_line::dx#10 bitmap_line::dx#7 bitmap_line::dx#2 bitmap_line::dx#13 bitmap_line::dx#3 +Alias bitmap_line::dy#0 = bitmap_line::dy#9 bitmap_line::dy#6 bitmap_line::dy#1 bitmap_line::dy#2 bitmap_line::dy#10 Alias sgn_u16::w#0 = bitmap_line::$8 Alias sgn_u16::return#0 = sgn_u16::return#5 -Alias bitmap_line::sx#0 = bitmap_line::$9 bitmap_line::sx#8 bitmap_line::sx#7 bitmap_line::sx#9 Alias sgn_u16::w#1 = bitmap_line::$10 Alias sgn_u16::return#1 = sgn_u16::return#6 -Alias bitmap_line::sy#0 = bitmap_line::$11 bitmap_line::sy#10 bitmap_line::sy#5 -Alias bitmap_line::e1#0 = bitmap_line::$20 -Alias bitmap_line::e#0 = bitmap_line::$15 +Alias bitmap_line::sx#0 = bitmap_line::sx#8 bitmap_line::sx#7 bitmap_line::sx#9 +Alias bitmap_line::sy#0 = bitmap_line::sy#10 bitmap_line::sy#5 Alias bitmap_line::y#4 = bitmap_line::y#5 Alias bitmap_line::sy#1 = bitmap_line::sy#3 bitmap_line::sy#8 Alias bitmap_line::e#3 = bitmap_line::e#5 @@ -1265,7 +1248,6 @@ Alias memset::return#2 = memset::str#2 memset::return#4 memset::return#3 Alias memset::str#3 = memset::str#4 Alias memset::num#2 = memset::num#3 Alias memset::c#4 = memset::c#5 -Alias memset::end#0 = memset::$2 Alias memset::c#2 = memset::c#3 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -2932,6 +2914,7 @@ bitmap_line: { // bitmap_line::@5 __b5: // [65] bitmap_line::e#0 = bitmap_line::dx#0 >> 1 -- vwuz1=vwuz2_ror_1 + // Y is the driver lda.z dx+1 lsr sta.z e+1 @@ -3043,6 +3026,7 @@ bitmap_line: { // bitmap_line::@2 __b2: // [82] bitmap_line::e1#0 = bitmap_line::dy#0 >> 1 -- vwuz1=vwuz2_ror_1 + // X is the driver lda.z dy+1 lsr sta.z e1+1 @@ -3975,7 +3959,7 @@ bitmap_line: { .label y1 = 8 .label x2 = $10 .label y2 = $12 - // abs_u16(x2-x1) + // unsigned int dx = abs_u16(x2-x1) // [46] abs_u16::w#0 = bitmap_line::x2#0 - bitmap_line::x1#0 -- vwuz1=vwuz2_minus_vwuz3 lda.z x2 sec @@ -3988,16 +3972,15 @@ bitmap_line: { // [106] phi from bitmap_line to abs_u16 [phi:bitmap_line->abs_u16] // [106] phi abs_u16::w#2 = abs_u16::w#0 [phi:bitmap_line->abs_u16#0] -- register_copy jsr abs_u16 - // abs_u16(x2-x1) + // unsigned int dx = abs_u16(x2-x1) // [48] abs_u16::return#0 = abs_u16::return#4 // bitmap_line::@12 - // unsigned int dx = abs_u16(x2-x1) // [49] bitmap_line::dx#0 = abs_u16::return#0 -- vwuz1=vwuz2 lda.z abs_u16.return sta.z dx lda.z abs_u16.return+1 sta.z dx+1 - // abs_u16(y2-y1) + // unsigned int dy = abs_u16(y2-y1) // [50] abs_u16::w#1 = bitmap_line::y2#0 - bitmap_line::y1#0 -- vwuz1=vwuz2_minus_vwuz3 lda.z y2 sec @@ -4010,10 +3993,9 @@ bitmap_line: { // [106] phi from bitmap_line::@12 to abs_u16 [phi:bitmap_line::@12->abs_u16] // [106] phi abs_u16::w#2 = abs_u16::w#1 [phi:bitmap_line::@12->abs_u16#0] -- register_copy jsr abs_u16 - // abs_u16(y2-y1) + // unsigned int dy = abs_u16(y2-y1) // [52] abs_u16::return#1 = abs_u16::return#4 // bitmap_line::@13 - // unsigned int dy = abs_u16(y2-y1) // [53] bitmap_line::dy#0 = abs_u16::return#1 // if(dx==0 && dy==0) // [54] if(bitmap_line::dx#0!=0) goto bitmap_line::@1 -- vwuz1_neq_0_then_la1 @@ -4029,7 +4011,7 @@ bitmap_line: { !__b4: // bitmap_line::@1 __b1: - // sgn_u16(x2-x1) + // unsigned int sx = sgn_u16(x2-x1) // [56] sgn_u16::w#0 = bitmap_line::x2#0 - bitmap_line::x1#0 -- vwuz1=vwuz2_minus_vwuz3 lda.z x2 sec @@ -4042,16 +4024,15 @@ bitmap_line: { // [113] phi from bitmap_line::@1 to sgn_u16 [phi:bitmap_line::@1->sgn_u16] // [113] phi sgn_u16::w#2 = sgn_u16::w#0 [phi:bitmap_line::@1->sgn_u16#0] -- register_copy jsr sgn_u16 - // sgn_u16(x2-x1) + // unsigned int sx = sgn_u16(x2-x1) // [58] sgn_u16::return#0 = sgn_u16::return#4 // bitmap_line::@14 - // unsigned int sx = sgn_u16(x2-x1) // [59] bitmap_line::sx#0 = sgn_u16::return#0 -- vwuz1=vwuz2 lda.z sgn_u16.return sta.z sx lda.z sgn_u16.return+1 sta.z sx+1 - // sgn_u16(y2-y1) + // unsigned int sy = sgn_u16(y2-y1) // [60] sgn_u16::w#1 = bitmap_line::y2#0 - bitmap_line::y1#0 -- vwuz1=vwuz2_minus_vwuz3 lda.z y2 sec @@ -4064,10 +4045,9 @@ bitmap_line: { // [113] phi from bitmap_line::@14 to sgn_u16 [phi:bitmap_line::@14->sgn_u16] // [113] phi sgn_u16::w#2 = sgn_u16::w#1 [phi:bitmap_line::@14->sgn_u16#0] -- register_copy jsr sgn_u16 - // sgn_u16(y2-y1) + // unsigned int sy = sgn_u16(y2-y1) // [62] sgn_u16::return#1 = sgn_u16::return#4 // bitmap_line::@15 - // unsigned int sy = sgn_u16(y2-y1) // [63] bitmap_line::sy#0 = sgn_u16::return#1 // if(dx > dy) // [64] if(bitmap_line::dx#0>bitmap_line::dy#0) goto bitmap_line::@2 -- vwuz1_gt_vwuz2_then_la1 @@ -4082,6 +4062,7 @@ bitmap_line: { // bitmap_line::@5 // unsigned int e = dx/2 // [65] bitmap_line::e#0 = bitmap_line::dx#0 >> 1 -- vwuz1=vwuz2_ror_1 + // Y is the driver lda.z dx+1 lsr sta.z e+1 @@ -4185,6 +4166,7 @@ bitmap_line: { __b2: // unsigned int e = dy/2 // [82] bitmap_line::e1#0 = bitmap_line::dy#0 >> 1 -- vwuz1=vwuz2_ror_1 + // X is the driver lda.z dy+1 lsr sta.z e1+1 diff --git a/src/test/ref/bitmap-plotter.log b/src/test/ref/bitmap-plotter.log index 0fa6c345d..60381d144 100644 --- a/src/test/ref/bitmap-plotter.log +++ b/src/test/ref/bitmap-plotter.log @@ -1,4 +1,5 @@ Inlined call call __init +Eliminating unused variable with no statement plot::$4 CONTROL FLOW GRAPH SSA @@ -74,8 +75,7 @@ plot: scope:[plot] from plots::@2 plot::plotter_y#1 = plot::plotter_y#0 byte1= plot::$8 plot::$9 = plot_ylo[plot::y#1] plot::plotter_y#2 = plot::plotter_y#1 byte0= plot::$9 - plot::$4 = plot::plotter_x#2 + plot::plotter_y#2 - plot::plotter#0 = plot::$4 + plot::plotter#0 = plot::plotter_x#2 + plot::plotter_y#2 plot::$5 = *plot::plotter#0 | plot_bit[plot::x#1] *plot::plotter#0 = plot::$5 to:plot::@return @@ -267,7 +267,6 @@ number~ main::$3 number~ main::$4 bool~ main::$7 void plot(byte plot::x , byte plot::y) -byte*~ plot::$4 byte~ plot::$5 byte~ plot::$6 byte~ plot::$7 @@ -394,11 +393,10 @@ Inferred type updated to byte in init_plot_tables::$1 = init_plot_tables::bits#3 Inferred type updated to byte in init_plot_tables::$5 = init_plot_tables::y#2 & 7 Inferred type updated to byte in init_plot_tables::$7 = init_plot_tables::$5 | init_plot_tables::$6 Inferred type updated to byte in init_plot_tables::$9 = init_plot_tables::y#2 & 7 -Inversing boolean not [56] init_plot_tables::$3 = init_plot_tables::bits#1 != 0 from [55] init_plot_tables::$2 = init_plot_tables::bits#1 == 0 -Inversing boolean not [75] init_plot_tables::$11 = init_plot_tables::$9 != 7 from [74] init_plot_tables::$10 = init_plot_tables::$9 == 7 +Inversing boolean not [55] init_plot_tables::$3 = init_plot_tables::bits#1 != 0 from [54] init_plot_tables::$2 = init_plot_tables::bits#1 == 0 +Inversing boolean not [74] init_plot_tables::$11 = init_plot_tables::$9 != 7 from [73] init_plot_tables::$10 = init_plot_tables::$9 == 7 Successful SSA optimization Pass2UnaryNotSimplification Alias plots::i#2 = plots::i#3 plots::i#4 -Alias plot::plotter#0 = plot::$4 Alias init_plot_tables::bits#1 = init_plot_tables::$1 Alias init_plot_tables::x#2 = init_plot_tables::x#4 Alias init_plot_tables::yoffs#2 = init_plot_tables::yoffs#3 @@ -413,7 +411,7 @@ Successful SSA optimization Pass2AliasElimination Identical Phi Values plot::x#1 plot::x#0 Identical Phi Values plot::y#1 plot::y#0 Successful SSA optimization Pass2IdenticalPhiElimination -Identified duplicate assignment right side [73] init_plot_tables::$9 = init_plot_tables::y#2 & 7 +Identified duplicate assignment right side [72] init_plot_tables::$9 = init_plot_tables::y#2 & 7 Successful SSA optimization Pass2DuplicateRValueIdentification Simple Condition main::$7 [13] if(*RASTER!=$ff) goto main::@1 Simple Condition plots::$0 [22] if(plots::i#2= -8 - bool_const_vars::$6 = bool_const_vars::$4 || bool_const_vars::$5 - bool_const_vars::b2#0 = bool_const_vars::$6 + bool_const_vars::b2#0 = bool_const_vars::$4 || bool_const_vars::$5 bool_const_vars::$7 = ! bool_const_vars::b2#0 bool_const_vars::$8 = bool_const_vars::b1#0 && bool_const_vars::$7 - bool_const_vars::$9 = bool_const_vars::$8 || false - bool_const_vars::b#0 = bool_const_vars::$9 + bool_const_vars::b#0 = bool_const_vars::$8 || false if(bool_const_vars::b#0) goto bool_const_vars::@1 to:bool_const_vars::@2 bool_const_vars::@1: scope:[bool_const_vars] from bool_const_vars @@ -109,13 +109,10 @@ void bool_const_vars() bool~ bool_const_vars::$0 bool~ bool_const_vars::$1 bool~ bool_const_vars::$2 -bool~ bool_const_vars::$3 bool~ bool_const_vars::$4 bool~ bool_const_vars::$5 -bool~ bool_const_vars::$6 bool~ bool_const_vars::$7 bool~ bool_const_vars::$8 -bool~ bool_const_vars::$9 constant byte bool_const_vars::a = $e bool bool_const_vars::b bool bool_const_vars::b#0 @@ -172,12 +169,8 @@ Finalized unsigned number type (byte) 2 Finalized unsigned number type (byte) 2 Successful SSA optimization PassNFinalizeNumberTypeConversions Inversing boolean not [10] bool_const_vars::$2 = $15 >= bool_const_vars::a from [9] bool_const_vars::$1 = $15 < bool_const_vars::a -Inversing boolean not [31] bool_const_inline::$6 = $15 >= bool_const_inline::a from [30] bool_const_inline::$5 = $15 < bool_const_inline::a +Inversing boolean not [28] bool_const_inline::$6 = $15 >= bool_const_inline::a from [27] bool_const_inline::$5 = $15 < bool_const_inline::a Successful SSA optimization Pass2UnaryNotSimplification -Alias bool_const_vars::b1#0 = bool_const_vars::$3 -Alias bool_const_vars::b2#0 = bool_const_vars::$6 -Alias bool_const_vars::b#0 = bool_const_vars::$9 -Successful SSA optimization Pass2AliasElimination Rewriting || if()-condition to two if()s [16] bool_const_vars::b#0 = bool_const_vars::$8 || false Rewriting && if()-condition to two if()s [15] bool_const_vars::$8 = bool_const_vars::b1#0 && bool_const_vars::$7 Rewriting || if()-condition to two if()s [10] bool_const_vars::b1#0 = bool_const_vars::$0 || bool_const_vars::$2 diff --git a/src/test/ref/bool-not-operator-1.asm b/src/test/ref/bool-not-operator-1.asm index 2abca757c..ea5f03a60 100644 --- a/src/test/ref/bool-not-operator-1.asm +++ b/src/test/ref/bool-not-operator-1.asm @@ -20,12 +20,12 @@ main: { and #1 // !b ? 1 : 0 cmp #1 - beq __b2 - lda #1 + bne __b2 + lda #0 jmp __b3 __b2: // !b ? 1 : 0 - lda #0 + lda #1 __b3: // screen[i] = c sta screen,x diff --git a/src/test/ref/bool-not-operator-1.cfg b/src/test/ref/bool-not-operator-1.cfg index a06624cd2..c12814cb0 100644 --- a/src/test/ref/bool-not-operator-1.cfg +++ b/src/test/ref/bool-not-operator-1.cfg @@ -6,13 +6,13 @@ main: scope:[main] from main::@1: scope:[main] from main main::@3 [1] main::i#2 = phi( main/0, main::@3/main::i#1 ) [2] main::$0 = main::i#2 & 1 - [3] if(main::$0==1) goto main::@2 + [3] if(main::$0!=1) goto main::@2 to:main::@3 main::@2: scope:[main] from main::@1 [4] phi() to:main::@3 main::@3: scope:[main] from main::@1 main::@2 - [5] main::c#0 = phi( main::@1/1, main::@2/0 ) + [5] main::c#0 = phi( main::@2/1, main::@1/0 ) [6] main::screen[main::i#2] = main::c#0 [7] main::i#1 = ++ main::i#2 [8] if(main::i#1!=8) goto main::@1 diff --git a/src/test/ref/bool-not-operator-1.log b/src/test/ref/bool-not-operator-1.log index 889006d39..28be5c752 100644 --- a/src/test/ref/bool-not-operator-1.log +++ b/src/test/ref/bool-not-operator-1.log @@ -1,3 +1,4 @@ +Eliminating unused variable with no statement main::$1 CONTROL FLOW GRAPH SSA @@ -8,8 +9,7 @@ main: scope:[main] from __start main::@1: scope:[main] from main main::@4 main::i#2 = phi( main/main::i#0, main::@4/main::i#1 ) main::$0 = main::i#2 & 1 - main::$1 = main::$0 == 1 - main::b#0 = main::$1 + main::b#0 = main::$0 == 1 main::$2 = ! main::b#0 if(main::$2) goto main::@2 to:main::@3 @@ -48,7 +48,6 @@ SYMBOL TABLE SSA void __start() void main() number~ main::$0 -bool~ main::$1 bool~ main::$2 number~ main::$3 number~ main::$4 @@ -69,7 +68,7 @@ constant byte* const main::screen = (byte*)$400 Adding number conversion cast (unumber) 1 in main::$0 = main::i#2 & 1 Adding number conversion cast (unumber) main::$0 in main::$0 = main::i#2 & (unumber)1 -Adding number conversion cast (unumber) 1 in main::$1 = main::$0 == 1 +Adding number conversion cast (unumber) 1 in main::b#0 = main::$0 == 1 Adding number conversion cast (unumber) main::$5 in main::c#0 = main::$5 Successful SSA optimization PassNAddNumberTypeConversions Inlining cast main::c#0 = (unumber)main::$5 @@ -82,34 +81,32 @@ Finalized unsigned number type (byte) 1 Finalized unsigned number type (byte) 1 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in main::$0 = main::i#2 & 1 -Alias main::b#0 = main::$1 +Inversing boolean not [4] main::$2 = main::$0 != 1 from [3] main::b#0 = main::$0 == 1 +Successful SSA optimization Pass2UnaryNotSimplification Alias main::i#2 = main::i#4 main::i#5 Successful SSA optimization Pass2AliasElimination Alias main::i#2 = main::i#3 Successful SSA optimization Pass2AliasElimination -Simple Condition main::$6 [13] if(main::i#1!=rangelast(0,7)) goto main::@1 +Simple Condition main::$2 [4] if(main::$0!=1) goto main::@2 +Simple Condition main::$6 [12] if(main::i#1!=rangelast(0,7)) goto main::@1 Successful SSA optimization Pass2ConditionalJumpSimplification -Rewriting ! if()-condition to reversed if() [4] main::$2 = ! main::b#0 -Successful SSA optimization Pass2ConditionalAndOrRewriting Constant main::i#0 = 0 Constant main::$4 = 1 Constant main::$3 = 0 Successful SSA optimization Pass2ConstantIdentification -Resolved ranged next value [11] main::i#1 = ++ main::i#2 to ++ -Resolved ranged comparison value [13] if(main::i#1!=rangelast(0,7)) goto main::@1 to 8 +Resolved ranged next value [10] main::i#1 = ++ main::i#2 to ++ +Resolved ranged comparison value [12] if(main::i#1!=rangelast(0,7)) goto main::@1 to 8 Removing unused procedure __start Removing unused procedure block __start Removing unused procedure block __start::@1 Removing unused procedure block __start::@return Successful SSA optimization PassNEliminateEmptyStart -Adding number conversion cast (unumber) 8 in [8] if(main::i#1!=8) goto main::@1 +Adding number conversion cast (unumber) 8 in [7] if(main::i#1!=8) goto main::@1 Successful SSA optimization PassNAddNumberTypeConversions Simplifying constant integer cast 8 Successful SSA optimization PassNCastSimplification Finalized unsigned number type (byte) 8 Successful SSA optimization PassNFinalizeNumberTypeConversions -Simple Condition main::b#0 [3] if(main::$0==1) goto main::@3 -Successful SSA optimization Pass2ConditionalJumpSimplification Inlining constant with var siblings main::i#0 Constant inlined main::i#0 = 0 Constant inlined main::$3 = 0 @@ -127,16 +124,15 @@ Alias main::c#0 = main::$5 Successful SSA optimization Pass2AliasElimination Added new block during phi lifting main::@5(between main::@4 and main::@1) Adding NOP phi() at start of main -Adding NOP phi() at start of main::@2 Adding NOP phi() at start of main::@3 +Adding NOP phi() at start of main::@2 CALL GRAPH Created 2 initial phi equivalence classes Coalesced [10] main::i#6 = main::i#1 Coalesced down to 2 phi equivalence classes -Culled Empty Block label main::@2 +Culled Empty Block label main::@3 Culled Empty Block label main::@5 -Renumbering block main::@3 to main::@2 Renumbering block main::@4 to main::@3 Adding NOP phi() at start of main Adding NOP phi() at start of main::@2 @@ -150,13 +146,13 @@ main: scope:[main] from main::@1: scope:[main] from main main::@3 [1] main::i#2 = phi( main/0, main::@3/main::i#1 ) [2] main::$0 = main::i#2 & 1 - [3] if(main::$0==1) goto main::@2 + [3] if(main::$0!=1) goto main::@2 to:main::@3 main::@2: scope:[main] from main::@1 [4] phi() to:main::@3 main::@3: scope:[main] from main::@1 main::@2 - [5] main::c#0 = phi( main::@1/1, main::@2/0 ) + [5] main::c#0 = phi( main::@2/1, main::@1/0 ) [6] main::screen[main::i#2] = main::c#0 [7] main::i#1 = ++ main::i#2 [8] if(main::i#1!=8) goto main::@1 @@ -233,13 +229,13 @@ main: { // [2] main::$0 = main::i#2 & 1 -- vbuaa=vbuxx_band_vbuc1 txa and #1 - // [3] if(main::$0==1) goto main::@2 -- vbuaa_eq_vbuc1_then_la1 + // [3] if(main::$0!=1) goto main::@2 -- vbuaa_neq_vbuc1_then_la1 cmp #1 - beq __b2_from___b1 + bne __b2_from___b1 // [5] phi from main::@1 to main::@3 [phi:main::@1->main::@3] __b3_from___b1: - // [5] phi main::c#0 = 1 [phi:main::@1->main::@3#0] -- vbuaa=vbuc1 - lda #1 + // [5] phi main::c#0 = 0 [phi:main::@1->main::@3#0] -- vbuaa=vbuc1 + lda #0 jmp __b3 // [4] phi from main::@1 to main::@2 [phi:main::@1->main::@2] __b2_from___b1: @@ -248,8 +244,8 @@ main: { __b2: // [5] phi from main::@2 to main::@3 [phi:main::@2->main::@3] __b3_from___b2: - // [5] phi main::c#0 = 0 [phi:main::@2->main::@3#0] -- vbuaa=vbuc1 - lda #0 + // [5] phi main::c#0 = 1 [phi:main::@2->main::@3#0] -- vbuaa=vbuc1 + lda #1 jmp __b3 // main::@3 __b3: @@ -337,20 +333,20 @@ main: { txa and #1 // !b ? 1 : 0 - // [3] if(main::$0==1) goto main::@2 -- vbuaa_eq_vbuc1_then_la1 + // [3] if(main::$0!=1) goto main::@2 -- vbuaa_neq_vbuc1_then_la1 cmp #1 - beq __b2 + bne __b2 // [5] phi from main::@1 to main::@3 [phi:main::@1->main::@3] - // [5] phi main::c#0 = 1 [phi:main::@1->main::@3#0] -- vbuaa=vbuc1 - lda #1 + // [5] phi main::c#0 = 0 [phi:main::@1->main::@3#0] -- vbuaa=vbuc1 + lda #0 jmp __b3 // [4] phi from main::@1 to main::@2 [phi:main::@1->main::@2] // main::@2 __b2: // !b ? 1 : 0 // [5] phi from main::@2 to main::@3 [phi:main::@2->main::@3] - // [5] phi main::c#0 = 0 [phi:main::@2->main::@3#0] -- vbuaa=vbuc1 - lda #0 + // [5] phi main::c#0 = 1 [phi:main::@2->main::@3#0] -- vbuaa=vbuc1 + lda #1 // main::@3 __b3: // screen[i] = c diff --git a/src/test/ref/bool-not-operator-2.log b/src/test/ref/bool-not-operator-2.log index ae213391f..cdb4b98a9 100644 --- a/src/test/ref/bool-not-operator-2.log +++ b/src/test/ref/bool-not-operator-2.log @@ -1,3 +1,4 @@ +Eliminating unused variable with no statement main::$0 CONTROL FLOW GRAPH SSA @@ -7,8 +8,7 @@ main: scope:[main] from __start to:main::@1 main::@1: scope:[main] from main main::@4 main::i#2 = phi( main/main::i#0, main::@4/main::i#1 ) - main::$0 = main::i#2 & 1 - main::b#0 = main::$0 + main::b#0 = main::i#2 & 1 main::$6 = 0 != main::b#0 main::$1 = ! main::$6 if(main::$1) goto main::@2 @@ -47,7 +47,6 @@ __start::@return: scope:[__start] from __start::@1 SYMBOL TABLE SSA void __start() void main() -number~ main::$0 bool~ main::$1 number~ main::$2 number~ main::$3 @@ -67,8 +66,7 @@ byte main::i#4 byte main::i#5 constant byte* const main::screen = (byte*)$400 -Adding number conversion cast (unumber) 1 in main::$0 = main::i#2 & 1 -Adding number conversion cast (unumber) main::$0 in main::$0 = main::i#2 & (unumber)1 +Adding number conversion cast (unumber) 1 in main::b#0 = main::i#2 & 1 Adding number conversion cast (unumber) 0 in main::$6 = 0 != main::b#0 Adding number conversion cast (unumber) main::$4 in main::c#0 = main::$4 Successful SSA optimization PassNAddNumberTypeConversions @@ -81,10 +79,8 @@ Successful SSA optimization PassNCastSimplification Finalized unsigned number type (byte) 1 Finalized unsigned number type (byte) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to byte in main::$0 = main::i#2 & 1 -Inversing boolean not [5] main::$1 = 0 == main::b#0 from [4] main::$6 = 0 != main::b#0 +Inversing boolean not [4] main::$1 = 0 == main::b#0 from [3] main::$6 = 0 != main::b#0 Successful SSA optimization Pass2UnaryNotSimplification -Alias main::b#0 = main::$0 Alias main::i#2 = main::i#4 main::i#5 Successful SSA optimization Pass2AliasElimination Alias main::i#2 = main::i#3 diff --git a/src/test/ref/bool-vars.log b/src/test/ref/bool-vars.log index 4f45e9a69..172a38bea 100644 --- a/src/test/ref/bool-vars.log +++ b/src/test/ref/bool-vars.log @@ -1,3 +1,17 @@ +Eliminating unused variable with no statement bool_and::$0 +Eliminating unused variable with no statement bool_and::$2 +Eliminating unused variable with no statement bool_and::$3 +Eliminating unused variable with no statement bool_or::$0 +Eliminating unused variable with no statement bool_or::$2 +Eliminating unused variable with no statement bool_or::$3 +Eliminating unused variable with no statement bool_not::$0 +Eliminating unused variable with no statement bool_not::$2 +Eliminating unused variable with no statement bool_not::$4 +Eliminating unused variable with no statement bool_complex::$0 +Eliminating unused variable with no statement bool_complex::$2 +Eliminating unused variable with no statement bool_complex::$3 +Eliminating unused variable with no statement bool_complex::$5 +Eliminating unused variable with no statement bool_complex::$6 CONTROL FLOW GRAPH SSA @@ -26,13 +40,10 @@ bool_and: scope:[bool_and] from main to:bool_and::@1 bool_and::@1: scope:[bool_and] from bool_and bool_and::@3 bool_and::i#2 = phi( bool_and/bool_and::i#0, bool_and::@3/bool_and::i#1 ) - bool_and::$0 = bool_and::i#2 < $a - bool_and::o1#0 = bool_and::$0 + bool_and::o1#0 = bool_and::i#2 < $a bool_and::$1 = bool_and::i#2 & 1 - bool_and::$2 = bool_and::$1 == 0 - bool_and::o2#0 = bool_and::$2 - bool_and::$3 = bool_and::o1#0 && bool_and::o2#0 - bool_and::o3#0 = bool_and::$3 + bool_and::o2#0 = bool_and::$1 == 0 + bool_and::o3#0 = bool_and::o1#0 && bool_and::o2#0 if(bool_and::o3#0) goto bool_and::@2 to:bool_and::@4 bool_and::@2: scope:[bool_and] from bool_and::@1 @@ -59,13 +70,10 @@ bool_or: scope:[bool_or] from main::@1 to:bool_or::@1 bool_or::@1: scope:[bool_or] from bool_or bool_or::@3 bool_or::i#2 = phi( bool_or/bool_or::i#0, bool_or::@3/bool_or::i#1 ) - bool_or::$0 = bool_or::i#2 < $a - bool_or::o1#0 = bool_or::$0 + bool_or::o1#0 = bool_or::i#2 < $a bool_or::$1 = bool_or::i#2 & 1 - bool_or::$2 = bool_or::$1 == 0 - bool_or::o2#0 = bool_or::$2 - bool_or::$3 = bool_or::o1#0 || bool_or::o2#0 - bool_or::o3#0 = bool_or::$3 + bool_or::o2#0 = bool_or::$1 == 0 + bool_or::o3#0 = bool_or::o1#0 || bool_or::o2#0 if(bool_or::o3#0) goto bool_or::@2 to:bool_or::@4 bool_or::@2: scope:[bool_or] from bool_or::@1 @@ -92,14 +100,11 @@ bool_not: scope:[bool_not] from main::@2 to:bool_not::@1 bool_not::@1: scope:[bool_not] from bool_not bool_not::@3 bool_not::i#2 = phi( bool_not/bool_not::i#0, bool_not::@3/bool_not::i#1 ) - bool_not::$0 = bool_not::i#2 < $a - bool_not::o1#0 = bool_not::$0 + bool_not::o1#0 = bool_not::i#2 < $a bool_not::$1 = bool_not::i#2 & 1 - bool_not::$2 = bool_not::$1 == 0 - bool_not::o2#0 = bool_not::$2 + bool_not::o2#0 = bool_not::$1 == 0 bool_not::$3 = bool_not::o1#0 || bool_not::o2#0 - bool_not::$4 = ! bool_not::$3 - bool_not::o3#0 = bool_not::$4 + bool_not::o3#0 = ! bool_not::$3 if(bool_not::o3#0) goto bool_not::@2 to:bool_not::@4 bool_not::@2: scope:[bool_not] from bool_not::@1 @@ -126,18 +131,13 @@ bool_complex: scope:[bool_complex] from main::@3 to:bool_complex::@1 bool_complex::@1: scope:[bool_complex] from bool_complex bool_complex::@3 bool_complex::i#2 = phi( bool_complex/bool_complex::i#0, bool_complex::@3/bool_complex::i#1 ) - bool_complex::$0 = bool_complex::i#2 < $a - bool_complex::o1#0 = bool_complex::$0 + bool_complex::o1#0 = bool_complex::i#2 < $a bool_complex::$1 = bool_complex::i#2 & 1 - bool_complex::$2 = bool_complex::$1 == 0 - bool_complex::o2#0 = bool_complex::$2 - bool_complex::$3 = bool_complex::o1#0 && bool_complex::o2#0 - bool_complex::o3#0 = bool_complex::$3 + bool_complex::o2#0 = bool_complex::$1 == 0 + bool_complex::o3#0 = bool_complex::o1#0 && bool_complex::o2#0 bool_complex::$4 = bool_complex::o1#0 || bool_complex::o2#0 - bool_complex::$5 = ! bool_complex::$4 - bool_complex::o4#0 = bool_complex::$5 - bool_complex::$6 = bool_complex::o3#0 || bool_complex::o4#0 - bool_complex::o5#0 = bool_complex::$6 + bool_complex::o4#0 = ! bool_complex::$4 + bool_complex::o5#0 = bool_complex::o3#0 || bool_complex::o4#0 if(bool_complex::o5#0) goto bool_complex::@2 to:bool_complex::@4 bool_complex::@2: scope:[bool_complex] from bool_complex::@1 @@ -171,10 +171,7 @@ __start::@return: scope:[__start] from __start::@1 SYMBOL TABLE SSA void __start() void bool_and() -bool~ bool_and::$0 number~ bool_and::$1 -bool~ bool_and::$2 -bool~ bool_and::$3 bool~ bool_and::$4 byte bool_and::i byte bool_and::i#0 @@ -191,13 +188,8 @@ bool bool_and::o3 bool bool_and::o3#0 constant byte* const bool_and::screen = (byte*)$400 void bool_complex() -bool~ bool_complex::$0 number~ bool_complex::$1 -bool~ bool_complex::$2 -bool~ bool_complex::$3 bool~ bool_complex::$4 -bool~ bool_complex::$5 -bool~ bool_complex::$6 bool~ bool_complex::$7 byte bool_complex::i byte bool_complex::i#0 @@ -218,11 +210,8 @@ bool bool_complex::o5 bool bool_complex::o5#0 constant byte* const bool_complex::screen = (byte*)$478 void bool_not() -bool~ bool_not::$0 number~ bool_not::$1 -bool~ bool_not::$2 bool~ bool_not::$3 -bool~ bool_not::$4 bool~ bool_not::$5 byte bool_not::i byte bool_not::i#0 @@ -239,10 +228,7 @@ bool bool_not::o3 bool bool_not::o3#0 constant byte* const bool_not::screen = (byte*)$450 void bool_or() -bool~ bool_or::$0 number~ bool_or::$1 -bool~ bool_or::$2 -bool~ bool_or::$3 bool~ bool_or::$4 byte bool_or::i byte bool_or::i#0 @@ -260,22 +246,22 @@ bool bool_or::o3#0 constant byte* const bool_or::screen = (byte*)$428 void main() -Adding number conversion cast (unumber) $a in bool_and::$0 = bool_and::i#2 < $a +Adding number conversion cast (unumber) $a in bool_and::o1#0 = bool_and::i#2 < $a Adding number conversion cast (unumber) 1 in bool_and::$1 = bool_and::i#2 & 1 Adding number conversion cast (unumber) bool_and::$1 in bool_and::$1 = bool_and::i#2 & (unumber)1 -Adding number conversion cast (unumber) 0 in bool_and::$2 = bool_and::$1 == 0 -Adding number conversion cast (unumber) $a in bool_or::$0 = bool_or::i#2 < $a +Adding number conversion cast (unumber) 0 in bool_and::o2#0 = bool_and::$1 == 0 +Adding number conversion cast (unumber) $a in bool_or::o1#0 = bool_or::i#2 < $a Adding number conversion cast (unumber) 1 in bool_or::$1 = bool_or::i#2 & 1 Adding number conversion cast (unumber) bool_or::$1 in bool_or::$1 = bool_or::i#2 & (unumber)1 -Adding number conversion cast (unumber) 0 in bool_or::$2 = bool_or::$1 == 0 -Adding number conversion cast (unumber) $a in bool_not::$0 = bool_not::i#2 < $a +Adding number conversion cast (unumber) 0 in bool_or::o2#0 = bool_or::$1 == 0 +Adding number conversion cast (unumber) $a in bool_not::o1#0 = bool_not::i#2 < $a Adding number conversion cast (unumber) 1 in bool_not::$1 = bool_not::i#2 & 1 Adding number conversion cast (unumber) bool_not::$1 in bool_not::$1 = bool_not::i#2 & (unumber)1 -Adding number conversion cast (unumber) 0 in bool_not::$2 = bool_not::$1 == 0 -Adding number conversion cast (unumber) $a in bool_complex::$0 = bool_complex::i#2 < $a +Adding number conversion cast (unumber) 0 in bool_not::o2#0 = bool_not::$1 == 0 +Adding number conversion cast (unumber) $a in bool_complex::o1#0 = bool_complex::i#2 < $a Adding number conversion cast (unumber) 1 in bool_complex::$1 = bool_complex::i#2 & 1 Adding number conversion cast (unumber) bool_complex::$1 in bool_complex::$1 = bool_complex::i#2 & (unumber)1 -Adding number conversion cast (unumber) 0 in bool_complex::$2 = bool_complex::$1 == 0 +Adding number conversion cast (unumber) 0 in bool_complex::o2#0 = bool_complex::$1 == 0 Successful SSA optimization PassNAddNumberTypeConversions Simplifying constant pointer cast (byte*) 1024 Simplifying constant pointer cast (byte*) 1064 @@ -311,23 +297,9 @@ Inferred type updated to byte in bool_and::$1 = bool_and::i#2 & 1 Inferred type updated to byte in bool_or::$1 = bool_or::i#2 & 1 Inferred type updated to byte in bool_not::$1 = bool_not::i#2 & 1 Inferred type updated to byte in bool_complex::$1 = bool_complex::i#2 & 1 -Alias bool_and::o1#0 = bool_and::$0 -Alias bool_and::o2#0 = bool_and::$2 -Alias bool_and::o3#0 = bool_and::$3 Alias bool_and::i#2 = bool_and::i#3 bool_and::i#4 -Alias bool_or::o1#0 = bool_or::$0 -Alias bool_or::o2#0 = bool_or::$2 -Alias bool_or::o3#0 = bool_or::$3 Alias bool_or::i#2 = bool_or::i#3 bool_or::i#4 -Alias bool_not::o1#0 = bool_not::$0 -Alias bool_not::o2#0 = bool_not::$2 -Alias bool_not::o3#0 = bool_not::$4 Alias bool_not::i#2 = bool_not::i#3 bool_not::i#4 -Alias bool_complex::o1#0 = bool_complex::$0 -Alias bool_complex::o2#0 = bool_complex::$2 -Alias bool_complex::o3#0 = bool_complex::$3 -Alias bool_complex::o4#0 = bool_complex::$5 -Alias bool_complex::o5#0 = bool_complex::$6 Alias bool_complex::i#2 = bool_complex::i#3 bool_complex::i#4 Successful SSA optimization Pass2AliasElimination Alias bool_and::i#2 = bool_and::i#5 diff --git a/src/test/ref/bresenham.log b/src/test/ref/bresenham.log index 214c25194..b38915a3b 100644 --- a/src/test/ref/bresenham.log +++ b/src/test/ref/bresenham.log @@ -1,21 +1,21 @@ Inlined call call __init +Eliminating unused variable with no statement main::$0 +Eliminating unused variable with no statement main::$1 +Eliminating unused variable with no statement main::$2 +Eliminating unused variable with no statement main::$5 CONTROL FLOW GRAPH SSA void main() main: scope:[main] from __start::@1 - main::$0 = main::x1 - main::x0 - main::xd#0 = main::$0 - main::$1 = main::y1 - main::y0 - main::yd#0 = main::$1 + main::xd#0 = main::x1 - main::x0 + main::yd#0 = main::y1 - main::y0 main::x#0 = main::x0 main::y#0 = main::y0 - main::$2 = main::yd#0 / 2 - main::e#0 = main::$2 + main::e#0 = main::yd#0 / 2 main::$3 = main::y#0 * $28 main::$4 = SCREEN + main::$3 - main::$5 = main::$4 + main::x#0 - main::cursor#0 = main::$5 + main::cursor#0 = main::$4 + main::x#0 to:main::@1 main::@1: scope:[main] from main main::@2 main::y#3 = phi( main/main::y#0, main::@2/main::y#4 ) @@ -83,18 +83,14 @@ constant byte* SCREEN[$28*$19] = (byte*)$400 constant byte STAR = $51 void __start() void main() -byte~ main::$0 -byte~ main::$1 bool~ main::$10 number~ main::$11 byte*~ main::$12 byte~ main::$13 number~ main::$14 bool~ main::$15 -number~ main::$2 number~ main::$3 byte*~ main::$4 -byte*~ main::$5 number~ main::$6 byte*~ main::$7 byte~ main::$8 @@ -140,8 +136,7 @@ byte main::yd#1 byte main::yd#2 byte main::yd#3 -Adding number conversion cast (unumber) 2 in main::$2 = main::yd#0 / 2 -Adding number conversion cast (unumber) main::$2 in main::$2 = main::yd#0 / (unumber)2 +Adding number conversion cast (unumber) 2 in main::e#0 = main::yd#0 / 2 Adding number conversion cast (unumber) $28 in main::$3 = main::y#0 * $28 Adding number conversion cast (unumber) main::$3 in main::$3 = main::y#0 * (unumber)$28 Adding number conversion cast (unumber) 1 in main::$6 = main::x#2 + 1 @@ -170,17 +165,12 @@ Finalized unsigned number type (byte) 1 Finalized unsigned number type (byte) 1 Finalized unsigned number type (byte) $28 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to byte in main::$2 = main::yd#0 / 2 Inferred type updated to byte in main::$3 = main::y#0 * $28 Inferred type updated to byte in main::$6 = main::x#2 + 1 Inferred type updated to byte in main::$14 = main::x1 + 1 Inferred type updated to byte in main::$11 = main::y#2 + 1 -Inversing boolean not [21] main::$10 = main::xd#1 > main::e#1 from [20] main::$9 = main::xd#1 <= main::e#1 +Inversing boolean not [17] main::$10 = main::xd#1 > main::e#1 from [16] main::$9 = main::xd#1 <= main::e#1 Successful SSA optimization Pass2UnaryNotSimplification -Alias main::xd#0 = main::$0 -Alias main::yd#0 = main::$1 -Alias main::e#0 = main::$2 -Alias main::cursor#0 = main::$5 Alias main::x#1 = main::$6 main::x#4 Alias main::cursor#1 = main::$7 main::cursor#4 Alias main::e#1 = main::$8 main::e#4 diff --git a/src/test/ref/bresenhamarr.log b/src/test/ref/bresenhamarr.log index 31d025583..4b819d15b 100644 --- a/src/test/ref/bresenhamarr.log +++ b/src/test/ref/bresenhamarr.log @@ -1,19 +1,19 @@ +Eliminating unused variable with no statement main::$0 +Eliminating unused variable with no statement main::$1 +Eliminating unused variable with no statement main::$2 +Eliminating unused variable with no statement main::$4 CONTROL FLOW GRAPH SSA void main() main: scope:[main] from __start - main::$0 = main::x1 - main::x0 - main::xd#0 = main::$0 - main::$1 = main::y1 - main::y0 - main::yd#0 = main::$1 + main::xd#0 = main::x1 - main::x0 + main::yd#0 = main::y1 - main::y0 main::x#0 = main::x0 main::y#0 = main::y0 - main::$2 = main::yd#0 / 2 - main::e#0 = main::$2 + main::e#0 = main::yd#0 / 2 main::$3 = main::y#0 * $28 - main::$4 = main::x#0 + main::$3 - main::idx#0 = main::$4 + main::idx#0 = main::x#0 + main::$3 to:main::@1 main::@1: scope:[main] from main main::@2 main::y#3 = phi( main/main::y#0, main::@2/main::y#4 ) @@ -75,16 +75,12 @@ __start::@return: scope:[__start] from __start::@1 SYMBOL TABLE SSA void __start() void main() -byte~ main::$0 -byte~ main::$1 number~ main::$10 number~ main::$11 byte~ main::$12 number~ main::$13 bool~ main::$14 -number~ main::$2 number~ main::$3 -number~ main::$4 number~ main::$5 number~ main::$6 byte~ main::$7 @@ -133,11 +129,9 @@ byte main::yd#1 byte main::yd#2 byte main::yd#3 -Adding number conversion cast (unumber) 2 in main::$2 = main::yd#0 / 2 -Adding number conversion cast (unumber) main::$2 in main::$2 = main::yd#0 / (unumber)2 +Adding number conversion cast (unumber) 2 in main::e#0 = main::yd#0 / 2 Adding number conversion cast (unumber) $28 in main::$3 = main::y#0 * $28 Adding number conversion cast (unumber) main::$3 in main::$3 = main::y#0 * (unumber)$28 -Adding number conversion cast (unumber) main::$4 in main::$4 = main::x#0 + main::$3 Adding number conversion cast (unumber) 1 in main::$5 = main::x#2 + 1 Adding number conversion cast (unumber) main::$5 in main::$5 = main::x#2 + (unumber)1 Adding number conversion cast (unumber) 1 in main::$6 = main::idx#3 + 1 @@ -166,20 +160,14 @@ Finalized unsigned number type (byte) 1 Finalized unsigned number type (byte) 1 Finalized unsigned number type (byte) $28 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to byte in main::$2 = main::yd#0 / 2 Inferred type updated to byte in main::$3 = main::y#0 * $28 -Inferred type updated to byte in main::$4 = main::x#0 + main::$3 Inferred type updated to byte in main::$5 = main::x#2 + 1 Inferred type updated to word in main::$6 = main::idx#3 + 1 Inferred type updated to byte in main::$13 = main::x1 + 1 Inferred type updated to byte in main::$10 = main::y#2 + 1 Inferred type updated to word in main::$11 = main::idx#4 + $28 -Inversing boolean not [20] main::$9 = main::xd#1 >= main::e#1 from [19] main::$8 = main::xd#1 < main::e#1 +Inversing boolean not [16] main::$9 = main::xd#1 >= main::e#1 from [15] main::$8 = main::xd#1 < main::e#1 Successful SSA optimization Pass2UnaryNotSimplification -Alias main::xd#0 = main::$0 -Alias main::yd#0 = main::$1 -Alias main::e#0 = main::$2 -Alias main::idx#0 = main::$4 Alias main::x#1 = main::$5 main::x#4 Alias main::idx#1 = main::$6 main::idx#4 Alias main::e#1 = main::$7 main::e#4 diff --git a/src/test/ref/c-types.log b/src/test/ref/c-types.log index 4bc23e20d..e4fd68c51 100644 --- a/src/test/ref/c-types.log +++ b/src/test/ref/c-types.log @@ -1,4 +1,5 @@ Inlined call call __init +Eliminating unused variable with no statement memset::$2 CONTROL FLOW GRAPH SSA @@ -328,8 +329,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -692,7 +692,6 @@ void main() void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -1179,7 +1178,6 @@ Alias memset::return#1 = memset::str#1 memset::return#3 memset::return#2 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 diff --git a/src/test/ref/cast-not-needed.log b/src/test/ref/cast-not-needed.log index fc00910f3..6ab0bf1ab 100644 --- a/src/test/ref/cast-not-needed.log +++ b/src/test/ref/cast-not-needed.log @@ -1,11 +1,11 @@ Inlined call call __init +Eliminating unused variable with no statement main::$0 CONTROL FLOW GRAPH SSA void main() main: scope:[main] from __start::@1 - main::$0 = SCREEN + $378 - main::sprite_ptr#0 = main::$0 + main::sprite_ptr#0 = SCREEN + $378 main::$1 = sprite / $40 main::sprite_ptr#0[0] = (byte)main::$1 to:main::@return @@ -31,13 +31,12 @@ SYMBOL TABLE SSA constant byte* SCREEN = (byte*)$4400 void __start() void main() -byte*~ main::$0 byte*~ main::$1 byte* main::sprite_ptr byte* main::sprite_ptr#0 constant byte* sprite = (byte*)$5000 -Adding number conversion cast (unumber) $378 in main::$0 = SCREEN + $378 +Adding number conversion cast (unumber) $378 in main::sprite_ptr#0 = SCREEN + $378 Adding number conversion cast (unumber) $40 in main::$1 = sprite / $40 Adding number conversion cast (unumber) 0 in main::sprite_ptr#0[0] = (byte)main::$1 Successful SSA optimization PassNAddNumberTypeConversions @@ -51,8 +50,6 @@ Finalized unsigned number type (word) $378 Finalized unsigned number type (byte) $40 Finalized unsigned number type (byte) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions -Alias main::sprite_ptr#0 = main::$0 -Successful SSA optimization Pass2AliasElimination Constant right-side identified [0] main::sprite_ptr#0 = SCREEN + $378 Constant right-side identified [1] main::$1 = sprite / $40 Successful SSA optimization Pass2ConstantRValueConsolidation diff --git a/src/test/ref/cast-precedence-problem.log b/src/test/ref/cast-precedence-problem.log index ac6883be4..d1d98c818 100644 --- a/src/test/ref/cast-precedence-problem.log +++ b/src/test/ref/cast-precedence-problem.log @@ -1,20 +1,20 @@ +Eliminating unused variable with no statement main::$0 +Eliminating unused variable with no statement main::$2 +Eliminating unused variable with no statement main::$3 +Eliminating unused variable with no statement main::$5 CONTROL FLOW GRAPH SSA void main() main: scope:[main] from __start - main::$0 = main::min + main::max - main::sumw#0 = main::$0 + main::sumw#0 = main::min + main::max main::$1 = main::sumw#0 >> 1 main::$7 = (byte)main::$1 - main::$2 = main::$7 + 1 - main::midw#0 = main::$2 + main::midw#0 = main::$7 + 1 main::SCREEN[0] = main::midw#0 - main::$3 = main::min + main::max - main::sumb#0 = main::$3 + main::sumb#0 = main::min + main::max main::$4 = main::sumb#0 >> 1 - main::$5 = main::$4 + 1 - main::midb#0 = main::$5 + main::midb#0 = main::$4 + 1 main::SCREEN[1] = main::midb#0 main::$6 = main::SCREEN[0] == main::SCREEN[1] if(main::$6) goto main::@1 @@ -42,12 +42,8 @@ __start::@return: scope:[__start] from __start::@1 SYMBOL TABLE SSA void __start() void main() -byte~ main::$0 word~ main::$1 -number~ main::$2 -byte~ main::$3 byte~ main::$4 -number~ main::$5 bool~ main::$6 byte~ main::$7 constant byte* main::BG_COLOR = (byte*)$d021 @@ -64,12 +60,10 @@ word main::sumw word main::sumw#0 Adding number conversion cast (unumber) 1 in main::$1 = main::sumw#0 >> 1 -Adding number conversion cast (unumber) 1 in main::$2 = main::$7 + 1 -Adding number conversion cast (unumber) main::$2 in main::$2 = main::$7 + (unumber)1 +Adding number conversion cast (unumber) 1 in main::midw#0 = main::$7 + 1 Adding number conversion cast (unumber) 0 in main::SCREEN[0] = main::midw#0 Adding number conversion cast (unumber) 1 in main::$4 = main::sumb#0 >> 1 -Adding number conversion cast (unumber) 1 in main::$5 = main::$4 + 1 -Adding number conversion cast (unumber) main::$5 in main::$5 = main::$4 + (unumber)1 +Adding number conversion cast (unumber) 1 in main::midb#0 = main::$4 + 1 Adding number conversion cast (unumber) 1 in main::SCREEN[1] = main::midb#0 Adding number conversion cast (unumber) 0 in main::$6 = main::SCREEN[0] == main::SCREEN[1] Adding number conversion cast (unumber) 1 in main::$6 = main::SCREEN[(unumber)0] == main::SCREEN[1] @@ -103,13 +97,6 @@ Finalized unsigned number type (byte) 1 Finalized unsigned number type (byte) 5 Finalized unsigned number type (byte) 2 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to byte in main::$2 = main::$7 + 1 -Inferred type updated to byte in main::$5 = main::$4 + 1 -Alias main::sumw#0 = main::$0 -Alias main::midw#0 = main::$2 -Alias main::sumb#0 = main::$3 -Alias main::midb#0 = main::$5 -Successful SSA optimization Pass2AliasElimination Simple Condition main::$6 [10] if(main::SCREEN[0]==main::SCREEN[1]) goto main::@1 Successful SSA optimization Pass2ConditionalJumpSimplification Constant right-side identified [0] main::sumw#0 = main::min + main::max diff --git a/src/test/ref/casting-negative.asm b/src/test/ref/casting-negative.asm index 399e4a3a4..e49bf3de6 100644 --- a/src/test/ref/casting-negative.asm +++ b/src/test/ref/casting-negative.asm @@ -109,12 +109,11 @@ gotoxy: { sta.z conio_cursor_x // conio_cursor_y = y stx.z conio_cursor_y - // (unsigned int)y*CONIO_WIDTH + // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH txa sta.z __7 lda #0 sta.z __7+1 - // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH lda.z __7 asl sta.z __8 diff --git a/src/test/ref/casting-negative.log b/src/test/ref/casting-negative.log index 8d9a72412..24e88356f 100644 --- a/src/test/ref/casting-negative.log +++ b/src/test/ref/casting-negative.log @@ -6,6 +6,9 @@ Fixing struct type SIZE_OF struct printf_buffer_number to 12 Added struct type cast to parameter value list call printf_sint test_casting::signed_short_value (struct printf_format_number){ 0, 0, 0, 0, 0, DECIMAL } Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call __init +Eliminating unused variable with no statement gotoxy::$4 +Eliminating unused variable with no statement memcpy::$0 +Eliminating unused variable with no statement memset::$2 Eliminating unused variable with no statement test_casting::$0 CONTROL FLOW GRAPH SSA @@ -89,8 +92,7 @@ gotoxy::@2: scope:[gotoxy] from gotoxy::@1 gotoxy::@4 conio_cursor_x = gotoxy::x#4 conio_cursor_y = gotoxy::y#4 gotoxy::$7 = (word)gotoxy::y#4 - gotoxy::$4 = gotoxy::$7 * $28 - gotoxy::line_offset#0 = gotoxy::$4 + gotoxy::line_offset#0 = gotoxy::$7 * $28 gotoxy::$5 = CONIO_SCREEN_TEXT + gotoxy::line_offset#0 conio_line_text = gotoxy::$5 gotoxy::$6 = CONIO_SCREEN_COLORS + gotoxy::line_offset#0 @@ -182,8 +184,7 @@ memcpy: scope:[memcpy] from cscroll::@3 cscroll::@4 memcpy::src#0 = ((byte*)) memcpy::source#2 memcpy::dst#0 = ((byte*)) memcpy::destination#2 memcpy::$2 = (byte*)memcpy::source#2 - memcpy::$0 = memcpy::$2 + memcpy::num#2 - memcpy::src_end#0 = memcpy::$0 + memcpy::src_end#0 = memcpy::$2 + memcpy::num#2 to:memcpy::@1 memcpy::@1: scope:[memcpy] from memcpy memcpy::@2 memcpy::destination#4 = phi( memcpy/memcpy::destination#2, memcpy::@2/memcpy::destination#5 ) @@ -230,8 +231,7 @@ memset::@2: scope:[memset] from memset memset::num#3 = phi( memset/memset::num#2 ) memset::str#3 = phi( memset/memset::str#4 ) memset::$4 = (byte*)memset::str#3 - memset::$2 = memset::$4 + memset::num#3 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#3 memset::dst#0 = ((byte*)) memset::str#3 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -1103,7 +1103,6 @@ bool~ gotoxy::$0 bool~ gotoxy::$1 bool~ gotoxy::$2 bool~ gotoxy::$3 -number~ gotoxy::$4 byte*~ gotoxy::$5 byte*~ gotoxy::$6 word~ gotoxy::$7 @@ -1134,7 +1133,6 @@ signed byte main::signed_char_value#2 signed byte main::signed_char_value#3 signed byte main::signed_char_value#4 void* memcpy(void* memcpy::destination , void* memcpy::source , word memcpy::num) -byte*~ memcpy::$0 bool~ memcpy::$1 byte*~ memcpy::$2 void* memcpy::destination @@ -1175,7 +1173,6 @@ byte* memcpy::src_end#2 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -1669,8 +1666,7 @@ Adding number conversion cast (unumber) $28 in clrscr::line_cols#1 = clrscr::lin Adding number conversion cast (unumber) $19 in gotoxy::$0 = gotoxy::y#3 > $19 Adding number conversion cast (unumber) $28 in gotoxy::$2 = gotoxy::x#3 >= $28 Adding number conversion cast (unumber) 0 in gotoxy::y#0 = 0 -Adding number conversion cast (unumber) $28 in gotoxy::$4 = gotoxy::$7 * $28 -Adding number conversion cast (unumber) gotoxy::$4 in gotoxy::$4 = gotoxy::$7 * (unumber)$28 +Adding number conversion cast (unumber) $28 in gotoxy::line_offset#0 = gotoxy::$7 * $28 Adding number conversion cast (unumber) 0 in gotoxy::x#0 = 0 Adding number conversion cast (unumber) $28 in cputc::$1 = conio_cursor_x == $28 Adding number conversion cast (unumber) $28 in conio_line_text = conio_line_text + $28 @@ -1861,23 +1857,22 @@ Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) 0 Finalized signed number type (signed byte) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to word in gotoxy::$4 = gotoxy::$7 * $28 Inferred type updated to byte in utoa::$4 = utoa::max_digits#5 - 1 Inversing boolean not [26] gotoxy::$1 = gotoxy::y#3 <= $19 from [25] gotoxy::$0 = gotoxy::y#3 > $19 Inversing boolean not [30] gotoxy::$3 = gotoxy::x#3 < $28 from [29] gotoxy::$2 = gotoxy::x#3 >= $28 -Inversing boolean not [56] cputc::$2 = conio_cursor_x != $28 from [55] cputc::$1 = conio_cursor_x == $28 -Inversing boolean not [99] memset::$1 = memset::num#2 <= 0 from [98] memset::$0 = memset::num#2 > 0 -Inversing boolean not [162] cscroll::$1 = conio_cursor_y != $19 from [161] cscroll::$0 = conio_cursor_y == $19 -Inversing boolean not [195] conio_c64_init::$1 = conio_c64_init::line#0 < $19 from [194] conio_c64_init::$0 = conio_c64_init::line#0 >= $19 -Inversing boolean not [305] printf_sint::$3 = 0 == printf_sint::format_sign_always#1 from [304] printf_sint::$5 = 0 != printf_sint::format_sign_always#1 -Inversing boolean not [329] printf_number_buffer::$0 = 0 == printf_number_buffer::format_min_length#1 from [328] printf_number_buffer::$26 = 0 != printf_number_buffer::format_min_length#1 -Inversing boolean not [333] printf_number_buffer::$1 = 0 == printf_number_buffer::format_justify_left#1 from [332] printf_number_buffer::$27 = 0 != printf_number_buffer::format_justify_left#1 -Inversing boolean not [335] printf_number_buffer::$2 = 0 == printf_number_buffer::format_zero_padding#1 from [334] printf_number_buffer::$28 = 0 != printf_number_buffer::format_zero_padding#1 -Inversing boolean not [348] printf_number_buffer::$20 = 0 == printf_number_buffer::buffer_sign#1 from [347] printf_number_buffer::$29 = 0 != printf_number_buffer::buffer_sign#1 -Inversing boolean not [355] printf_number_buffer::$23 = printf_number_buffer::padding#1 >= 0 from [354] printf_number_buffer::$22 = printf_number_buffer::padding#1 < 0 -Inversing boolean not [363] printf_number_buffer::$7 = 0 == printf_number_buffer::buffer_sign#2 from [362] printf_number_buffer::$30 = 0 != printf_number_buffer::buffer_sign#2 -Inversing boolean not [380] printf_number_buffer::$12 = 0 == printf_number_buffer::format_upper_case#1 from [379] printf_number_buffer::$31 = 0 != printf_number_buffer::format_upper_case#1 -Inversing boolean not [392] printf_number_buffer::$14 = 0 == printf_number_buffer::format_zero_padding#3 from [391] printf_number_buffer::$32 = 0 != printf_number_buffer::format_zero_padding#3 +Inversing boolean not [55] cputc::$2 = conio_cursor_x != $28 from [54] cputc::$1 = conio_cursor_x == $28 +Inversing boolean not [97] memset::$1 = memset::num#2 <= 0 from [96] memset::$0 = memset::num#2 > 0 +Inversing boolean not [159] cscroll::$1 = conio_cursor_y != $19 from [158] cscroll::$0 = conio_cursor_y == $19 +Inversing boolean not [192] conio_c64_init::$1 = conio_c64_init::line#0 < $19 from [191] conio_c64_init::$0 = conio_c64_init::line#0 >= $19 +Inversing boolean not [302] printf_sint::$3 = 0 == printf_sint::format_sign_always#1 from [301] printf_sint::$5 = 0 != printf_sint::format_sign_always#1 +Inversing boolean not [326] printf_number_buffer::$0 = 0 == printf_number_buffer::format_min_length#1 from [325] printf_number_buffer::$26 = 0 != printf_number_buffer::format_min_length#1 +Inversing boolean not [330] printf_number_buffer::$1 = 0 == printf_number_buffer::format_justify_left#1 from [329] printf_number_buffer::$27 = 0 != printf_number_buffer::format_justify_left#1 +Inversing boolean not [332] printf_number_buffer::$2 = 0 == printf_number_buffer::format_zero_padding#1 from [331] printf_number_buffer::$28 = 0 != printf_number_buffer::format_zero_padding#1 +Inversing boolean not [345] printf_number_buffer::$20 = 0 == printf_number_buffer::buffer_sign#1 from [344] printf_number_buffer::$29 = 0 != printf_number_buffer::buffer_sign#1 +Inversing boolean not [352] printf_number_buffer::$23 = printf_number_buffer::padding#1 >= 0 from [351] printf_number_buffer::$22 = printf_number_buffer::padding#1 < 0 +Inversing boolean not [360] printf_number_buffer::$7 = 0 == printf_number_buffer::buffer_sign#2 from [359] printf_number_buffer::$30 = 0 != printf_number_buffer::buffer_sign#2 +Inversing boolean not [377] printf_number_buffer::$12 = 0 == printf_number_buffer::format_upper_case#1 from [376] printf_number_buffer::$31 = 0 != printf_number_buffer::format_upper_case#1 +Inversing boolean not [389] printf_number_buffer::$14 = 0 == printf_number_buffer::format_zero_padding#3 from [388] printf_number_buffer::$32 = 0 != printf_number_buffer::format_zero_padding#3 Successful SSA optimization Pass2UnaryNotSimplification Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 @@ -1889,12 +1884,10 @@ Alias clrscr::c#2 = clrscr::c#3 Alias clrscr::line_cols#2 = clrscr::line_cols#4 clrscr::line_cols#3 Alias clrscr::l#3 = clrscr::l#6 clrscr::l#4 Alias gotoxy::x#5 = gotoxy::x#6 -Alias gotoxy::line_offset#0 = gotoxy::$4 Alias gotoxy::y#5 = gotoxy::y#6 Alias cputc::c#3 = cputc::c#4 Alias cputs::c#1 = cputs::$0 cputs::c#2 Alias cputs::s#0 = cputs::s#6 cputs::s#5 -Alias memcpy::src_end#0 = memcpy::$0 Alias memcpy::src#2 = memcpy::src#3 Alias memcpy::dst#2 = memcpy::dst#3 Alias memcpy::src_end#1 = memcpy::src_end#2 @@ -1903,7 +1896,6 @@ Alias memset::return#0 = memset::str#2 memset::return#4 memset::return#1 Alias memset::str#3 = memset::str#4 Alias memset::num#2 = memset::num#3 Alias memset::c#4 = memset::c#5 -Alias memset::end#0 = memset::$2 Alias memset::c#2 = memset::c#3 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -5171,13 +5163,12 @@ gotoxy: { // conio_cursor_y = y // [28] conio_cursor_y = gotoxy::y#4 -- vbuz1=vbuxx stx.z conio_cursor_y - // (unsigned int)y*CONIO_WIDTH + // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH // [29] gotoxy::$7 = (word)gotoxy::y#4 -- vwuz1=_word_vbuxx txa sta.z __7 lda #0 sta.z __7+1 - // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH // [30] gotoxy::$8 = gotoxy::$7 << 2 -- vwuz1=vwuz2_rol_2 lda.z __7 asl diff --git a/src/test/ref/casting.asm b/src/test/ref/casting.asm index 555494055..88623f56d 100644 --- a/src/test/ref/casting.asm +++ b/src/test/ref/casting.asm @@ -15,6 +15,7 @@ main: { ldx #0 __b1: // byte b2 = 200-b + //Subtract unsigned byte from unsigned byte txa eor #$ff sec @@ -22,6 +23,7 @@ main: { // SCREEN[b] = b2 sta SCREEN,x // signed byte sb = - (signed byte)b + // Cast unsigned byte to signed byte & negate txa eor #$ff clc diff --git a/src/test/ref/casting.log b/src/test/ref/casting.log index 392b877f6..b2c3848a1 100644 --- a/src/test/ref/casting.log +++ b/src/test/ref/casting.log @@ -1,4 +1,10 @@ Inlined call call __init +Eliminating unused variable with no statement main::$1 +Eliminating unused variable with no statement main::$2 +Eliminating unused variable with no statement w::$1 +Eliminating unused variable with no statement __start::__init1_$0 +Eliminating unused variable with no statement __start::__init1_$1 +Eliminating unused variable with no statement __start::__init1_$2 CONTROL FLOW GRAPH SSA @@ -14,11 +20,9 @@ main::@1: scope:[main] from main main::@1 SCREEN3#8 = phi( main/SCREEN3#9, main::@1/SCREEN3#8 ) SCREEN2#2 = phi( main/SCREEN2#4, main::@1/SCREEN2#2 ) main::b#2 = phi( main/main::b#0, main::@1/main::b#1 ) - main::$1 = $c8 - main::b#2 - main::b2#0 = main::$1 + main::b2#0 = $c8 - main::b#2 SCREEN[main::b#2] = main::b2#0 - main::$2 = - (signed byte)main::b#2 - main::sb#0 = main::$2 + main::sb#0 = - (signed byte)main::b#2 SCREEN2#2[main::b#2] = (byte)main::sb#0 main::b#1 = main::b#2 + rangenext(0,$64) main::$3 = main::b#1 != rangelast(0,$64) @@ -47,8 +51,7 @@ w::@1: scope:[w] from w w::@1 w::i#2 = phi( w/w::i#0, w::@1/w::i#1 ) w::$0 = w::w1 - w::w2 w::b#0 = (byte)w::$0 - w::$1 = $578-$546 + w::i#2 - w::b2#0 = w::$1 + w::b2#0 = $578-$546 + w::i#2 SCREEN3#2[w::i#2] = w::b#0 SCREEN4#2[w::i#2] = w::b2#0 w::i#1 = w::i#2 + rangenext(0,$a) @@ -63,12 +66,9 @@ void __start() __start: scope:[__start] from to:__start::__init1 __start::__init1: scope:[__start] from __start - __start::__init1_$0 = SCREEN + $28*3 - SCREEN2#0 = __start::__init1_$0 - __start::__init1_$1 = SCREEN + $28*6 - SCREEN3#0 = __start::__init1_$1 - __start::__init1_$2 = SCREEN + $28*9 - SCREEN4#0 = __start::__init1_$2 + SCREEN2#0 = SCREEN + $28*3 + SCREEN3#0 = SCREEN + $28*6 + SCREEN4#0 = SCREEN + $28*9 to:__start::@1 __start::@1: scope:[__start] from __start::__init1 SCREEN4#7 = phi( __start::__init1/SCREEN4#0 ) @@ -124,12 +124,7 @@ byte* SCREEN4#7 byte* SCREEN4#8 byte* SCREEN4#9 void __start() -byte*~ __start::__init1_$0 -byte*~ __start::__init1_$1 -byte*~ __start::__init1_$2 void main() -number~ main::$1 -signed byte~ main::$2 bool~ main::$3 byte main::b byte main::b#0 @@ -141,7 +136,6 @@ signed byte main::sb signed byte main::sb#0 void w() word~ w::$0 -number~ w::$1 bool~ w::$2 byte w::b byte w::b#0 @@ -154,29 +148,22 @@ byte w::i#2 constant word w::w1 = $514 constant word w::w2 = $4e2 -Adding number conversion cast (unumber) $c8 in main::$1 = $c8 - main::b#2 -Adding number conversion cast (unumber) main::$1 in main::$1 = (unumber)$c8 - main::b#2 -Adding number conversion cast (unumber) $578-$546 in w::$1 = $578-$546 + w::i#2 -Adding number conversion cast (unumber) w::$1 in w::$1 = (unumber)$578-$546 + w::i#2 -Adding number conversion cast (unumber) $28*3 in __start::__init1_$0 = SCREEN + $28*3 -Adding number conversion cast (unumber) $28*6 in __start::__init1_$1 = SCREEN + $28*6 -Adding number conversion cast (unumber) $28*9 in __start::__init1_$2 = SCREEN + $28*9 +Adding number conversion cast (unumber) $c8 in main::b2#0 = $c8 - main::b#2 +Adding number conversion cast (unumber) $578-$546 in w::b2#0 = $578-$546 + w::i#2 +Adding number conversion cast (unumber) $28*3 in SCREEN2#0 = SCREEN + $28*3 +Adding number conversion cast (unumber) $28*6 in SCREEN3#0 = SCREEN + $28*6 +Adding number conversion cast (unumber) $28*9 in SCREEN4#0 = SCREEN + $28*9 Successful SSA optimization PassNAddNumberTypeConversions Simplifying constant pointer cast (byte*) 1024 Simplifying constant integer cast $c8 Successful SSA optimization PassNCastSimplification Finalized unsigned number type (byte) $c8 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to byte in main::$1 = $c8 - main::b#2 -Inferred type updated to byte in w::$1 = (byte)$578-$546 + w::i#2 -Alias main::b2#0 = main::$1 -Alias main::sb#0 = main::$2 Alias SCREEN3#6 = SCREEN3#8 Alias SCREEN4#6 = SCREEN4#8 -Alias w::b2#0 = w::$1 -Alias SCREEN2#0 = __start::__init1_$0 SCREEN2#6 SCREEN2#5 SCREEN2#3 SCREEN2#1 -Alias SCREEN3#0 = __start::__init1_$1 SCREEN3#7 SCREEN3#5 SCREEN3#3 SCREEN3#1 -Alias SCREEN4#0 = __start::__init1_$2 SCREEN4#7 SCREEN4#5 SCREEN4#3 SCREEN4#1 +Alias SCREEN2#0 = SCREEN2#6 SCREEN2#5 SCREEN2#3 SCREEN2#1 +Alias SCREEN3#0 = SCREEN3#7 SCREEN3#5 SCREEN3#3 SCREEN3#1 +Alias SCREEN4#0 = SCREEN4#7 SCREEN4#5 SCREEN4#3 SCREEN4#1 Successful SSA optimization Pass2AliasElimination Identical Phi Values SCREEN2#4 SCREEN2#0 Identical Phi Values SCREEN3#9 SCREEN3#0 @@ -400,6 +387,7 @@ main: { // main::@1 __b1: // [2] main::b2#0 = $c8 - main::b#2 -- vbuaa=vbuc1_minus_vbuxx + //Subtract unsigned byte from unsigned byte txa eor #$ff sec @@ -407,6 +395,7 @@ main: { // [3] SCREEN[main::b#2] = main::b2#0 -- pbuc1_derefidx_vbuxx=vbuaa sta SCREEN,x // [4] main::sb#0 = - (signed byte)main::b#2 -- vbsaa=_neg_vbsxx + // Cast unsigned byte to signed byte & negate txa eor #$ff clc @@ -560,6 +549,7 @@ main: { __b1: // byte b2 = 200-b // [2] main::b2#0 = $c8 - main::b#2 -- vbuaa=vbuc1_minus_vbuxx + //Subtract unsigned byte from unsigned byte txa eor #$ff sec @@ -569,6 +559,7 @@ main: { sta SCREEN,x // signed byte sb = - (signed byte)b // [4] main::sb#0 = - (signed byte)main::b#2 -- vbsaa=_neg_vbsxx + // Cast unsigned byte to signed byte & negate txa eor #$ff clc diff --git a/src/test/ref/chargen.log b/src/test/ref/chargen.log index 3fe35a7a4..1b92748e0 100644 --- a/src/test/ref/chargen.log +++ b/src/test/ref/chargen.log @@ -1,12 +1,12 @@ Inlined call call __init +Eliminating unused variable with no statement main::$0 CONTROL FLOW GRAPH SSA void main() main: scope:[main] from __start::@1 asm { sei } - main::$0 = CHARGEN + 8 - main::CHAR_A#0 = main::$0 + main::CHAR_A#0 = CHARGEN + 8 *PROCPORT = $32 main::sc#0 = SCREEN main::y#0 = 0 @@ -91,7 +91,6 @@ constant byte* PROCPORT = (byte*)1 constant byte* SCREEN = (byte*)$400 void __start() void main() -byte*~ main::$0 number~ main::$1 bool~ main::$2 bool~ main::$3 @@ -140,7 +139,7 @@ byte main::y#4 byte main::y#5 byte main::y#6 -Adding number conversion cast (unumber) 8 in main::$0 = CHARGEN + 8 +Adding number conversion cast (unumber) 8 in main::CHAR_A#0 = CHARGEN + 8 Adding number conversion cast (unumber) $32 in *PROCPORT = $32 Adding number conversion cast (unumber) $80 in main::$1 = main::bits#2 & $80 Adding number conversion cast (unumber) main::$1 in main::$1 = main::bits#2 & (unumber)$80 @@ -174,9 +173,8 @@ Finalized unsigned number type (byte) $37 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in main::$1 = main::bits#2 & $80 Inferred type updated to byte in main::$4 = main::bits#3 * 2 -Inversing boolean not [13] main::$3 = main::$1 == 0 from [12] main::$2 = main::$1 != 0 +Inversing boolean not [12] main::$3 = main::$1 == 0 from [11] main::$2 = main::$1 != 0 Successful SSA optimization Pass2UnaryNotSimplification -Alias main::CHAR_A#0 = main::$0 Alias main::bits#1 = main::$4 Alias main::sc#5 = main::sc#6 Alias main::bits#2 = main::bits#4 diff --git a/src/test/ref/cia-timer-cyclecount.asm b/src/test/ref/cia-timer-cyclecount.asm index b1f7a228e..99c2c1352 100644 --- a/src/test/ref/cia-timer-cyclecount.asm +++ b/src/test/ref/cia-timer-cyclecount.asm @@ -34,6 +34,7 @@ main: { // clock() jsr clock // dword cyclecount = clock()-CLOCKS_PER_INIT + // Calculate the cycle count - 0x12 is the base usage of start/read lda.z cyclecount sec sbc # 0 Adding number conversion cast (unumber) 0 in assert_byte::c#0 = 0 -Adding number conversion cast (unumber) 2 in test_bytes::$1 = test_bytes::bb + 2 -Adding number conversion cast (unumber) test_bytes::$1 in test_bytes::$1 = test_bytes::bb + (unumber)2 +Adding number conversion cast (unumber) 2 in test_bytes::bc#0 = test_bytes::bb + 2 Adding number conversion cast (unumber) 2 in assert_byte::c#1 = 2 Adding number conversion cast (snumber) 4 in test_bytes::$3 = test_bytes::$5 - 4 Adding number conversion cast (snumber) test_bytes::$3 in test_bytes::$3 = test_bytes::$5 - (snumber)4 Adding number conversion cast (unumber) $fe in assert_byte::c#2 = $fe Adding number conversion cast (snumber) 0 in assert_sbyte::c#0 = 0 -Adding number conversion cast (snumber) 2 in test_sbytes::$1 = test_sbytes::bb + 2 -Adding number conversion cast (snumber) test_sbytes::$1 in test_sbytes::$1 = test_sbytes::bb + (snumber)2 +Adding number conversion cast (snumber) 2 in test_sbytes::bc#0 = test_sbytes::bb + 2 Adding number conversion cast (snumber) 2 in assert_sbyte::c#1 = 2 -Adding number conversion cast (snumber) 4 in test_sbytes::$3 = test_sbytes::bc#1 - 4 -Adding number conversion cast (snumber) test_sbytes::$3 in test_sbytes::$3 = test_sbytes::bc#1 - (snumber)4 +Adding number conversion cast (snumber) 4 in test_sbytes::bd#0 = test_sbytes::bc#1 - 4 Adding number conversion cast (snumber) -2 in assert_sbyte::c#2 = -2 Adding number conversion cast (snumber) 2 in assert_sbyte::c#3 = 2 Adding number conversion cast (snumber) 2 in assert_sbyte::c#4 = 2 @@ -857,10 +849,7 @@ Finalized signed number type (signed byte) -2 Finalized signed number type (signed byte) 2 Finalized signed number type (signed byte) 2 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to byte in test_bytes::$1 = test_bytes::bb + 2 Inferred type updated to signed byte in test_bytes::$3 = test_bytes::$5 - 4 -Inferred type updated to signed byte in test_sbytes::$1 = test_sbytes::bb + 2 -Inferred type updated to signed byte in test_sbytes::$3 = test_sbytes::bc#1 - 4 Inversing boolean not [46] memset::$1 = memset::num#1 <= 0 from [45] memset::$0 = memset::num#1 > 0 Successful SSA optimization Pass2UnaryNotSimplification Alias print_str::str#10 = print_str::str#9 print_str::str#11 @@ -873,7 +862,6 @@ Alias memset::return#1 = memset::str#1 memset::return#3 memset::return#2 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -886,7 +874,7 @@ Alias print_char_cursor#10 = print_char_cursor#46 print_char_cursor#47 print_cha Alias print_line_cursor#31 = print_line_cursor#6 print_line_cursor#32 print_line_cursor#7 Alias print_char_cursor#12 = print_char_cursor#48 Alias print_line_cursor#33 = print_line_cursor#8 -Alias test_bytes::bc#0 = test_bytes::$1 test_bytes::bc#1 +Alias test_bytes::bc#0 = test_bytes::bc#1 Alias print_char_cursor#13 = print_char_cursor#49 Alias print_line_cursor#34 = print_line_cursor#9 Alias print_char_cursor#14 = print_char_cursor#50 print_char_cursor#51 print_char_cursor#15 @@ -902,13 +890,12 @@ Alias print_line_cursor#12 = print_line_cursor#37 print_line_cursor#38 print_lin Alias print_char_cursor#20 = print_char_cursor#56 print_char_cursor#57 print_char_cursor#21 Alias print_char_cursor#22 = print_char_cursor#58 Alias print_line_cursor#14 = print_line_cursor#39 -Alias test_sbytes::bc#0 = test_sbytes::$1 test_sbytes::bc#1 +Alias test_sbytes::bc#0 = test_sbytes::bc#1 Alias print_char_cursor#23 = print_char_cursor#59 Alias print_line_cursor#15 = print_line_cursor#40 -Alias test_sbytes::bd#0 = test_sbytes::$3 test_sbytes::bd#1 +Alias test_sbytes::bd#0 = test_sbytes::bd#1 Alias print_char_cursor#24 = print_char_cursor#60 Alias print_line_cursor#16 = print_line_cursor#41 -Alias test_sbytes::be#0 = test_sbytes::$5 Alias print_char_cursor#25 = print_char_cursor#61 Alias print_line_cursor#17 = print_line_cursor#42 Alias print_char_cursor#26 = print_char_cursor#62 print_char_cursor#63 print_char_cursor#27 diff --git a/src/test/ref/cordic-atan2-16.asm b/src/test/ref/cordic-atan2-16.asm index a5f0197e5..731932a27 100644 --- a/src/test/ref/cordic-atan2-16.asm +++ b/src/test/ref/cordic-atan2-16.asm @@ -52,9 +52,8 @@ main: { ldy.z y sty.z yw+1 sta.z yw - // atan2_16(xw, yw) - jsr atan2_16 // word angle_w = atan2_16(xw, yw) + jsr atan2_16 // angle_w+0x0080 lda #$80 clc diff --git a/src/test/ref/cordic-atan2-16.log b/src/test/ref/cordic-atan2-16.log index a1d65e5c9..8bea24f32 100644 --- a/src/test/ref/cordic-atan2-16.log +++ b/src/test/ref/cordic-atan2-16.log @@ -2,6 +2,8 @@ Resolved forward reference FONT_HEX_PROTO to FONT_HEX_PROTO Resolved forward reference FONT_HEX_PROTO to FONT_HEX_PROTO Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call main::$1 = call toD018 SCREEN CHARSET +Eliminating unused variable with no statement main::$4 +Eliminating unused variable with no statement main::$6 CONTROL FLOW GRAPH SSA @@ -345,11 +347,9 @@ main::@8: scope:[main] from main::@2 main::x#3 = phi( main::@2/main::x#2 ) main::screen#2 = phi( main::@2/main::screen#3 ) atan2_16::return#4 = phi( main::@2/atan2_16::return#2 ) - main::$4 = atan2_16::return#4 - main::angle_w#0 = main::$4 + main::angle_w#0 = atan2_16::return#4 main::$5 = main::angle_w#0 + $80 - main::$6 = byte1 main::$5 - main::ang_w#0 = main::$6 + main::ang_w#0 = byte1 main::$5 *main::screen#2 = main::ang_w#0 main::screen#1 = ++ main::screen#2 main::x#1 = main::x#3 + rangenext(-$13,$14) @@ -625,9 +625,7 @@ byte~ main::$10 byte~ main::$11 word~ main::$2 word~ main::$3 -word~ main::$4 number~ main::$5 -byte~ main::$6 bool~ main::$7 bool~ main::$8 byte main::ang_w @@ -856,8 +854,6 @@ Alias atan2_16::return#2 = atan2_16::return#4 Alias main::screen#2 = main::screen#3 Alias main::x#2 = main::x#3 Alias main::y#2 = main::y#5 main::y#3 -Alias main::angle_w#0 = main::$4 -Alias main::ang_w#0 = main::$6 Alias main::screen#1 = main::screen#5 Successful SSA optimization Pass2AliasElimination Alias atan2_16::x#1 = atan2_16::x#5 atan2_16::x#10 @@ -2681,14 +2677,13 @@ main: { ldy.z y sty.z yw+1 sta.z yw - // atan2_16(xw, yw) + // word angle_w = atan2_16(xw, yw) // [8] atan2_16::x#0 = (signed word)main::xw#0 // [9] atan2_16::y#0 = (signed word)main::yw#0 // [10] call atan2_16 jsr atan2_16 // [11] atan2_16::return#2 = atan2_16::return#0 // main::@6 - // word angle_w = atan2_16(xw, yw) // [12] main::angle_w#0 = atan2_16::return#2 // angle_w+0x0080 // [13] main::$5 = main::angle_w#0 + $80 -- vwuz1=vwuz1_plus_vbuc1 diff --git a/src/test/ref/cordic-atan2-clear.asm b/src/test/ref/cordic-atan2-clear.asm index 01c7ffebd..46cbfc0ce 100644 --- a/src/test/ref/cordic-atan2-clear.asm +++ b/src/test/ref/cordic-atan2-clear.asm @@ -239,9 +239,8 @@ init_angle_screen: { // MAKEWORD( y*2, 0 ) sta.z yw+1 sty.z yw - // atan2_16(xw, yw) - jsr atan2_16 // word angle_w = atan2_16(xw, yw) + jsr atan2_16 // angle_w+0x0080 lda #$80 clc diff --git a/src/test/ref/cordic-atan2-clear.log b/src/test/ref/cordic-atan2-clear.log index 7e6ba484c..507e08435 100644 --- a/src/test/ref/cordic-atan2-clear.log +++ b/src/test/ref/cordic-atan2-clear.log @@ -2,6 +2,10 @@ Resolved forward reference FONT_HEX_PROTO to FONT_HEX_PROTO Resolved forward reference FONT_HEX_PROTO to FONT_HEX_PROTO Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call main::$1 = call toD018 SCREEN CHARSET +Eliminating unused variable with no statement init_angle_screen::$0 +Eliminating unused variable with no statement init_angle_screen::$1 +Eliminating unused variable with no statement init_angle_screen::$8 +Eliminating unused variable with no statement init_angle_screen::$10 CONTROL FLOW GRAPH SSA @@ -350,10 +354,8 @@ main::@return: scope:[main] from main::@1 void init_angle_screen(byte* init_angle_screen::screen) init_angle_screen: scope:[init_angle_screen] from main::@5 init_angle_screen::screen#1 = phi( main::@5/init_angle_screen::screen#0 ) - init_angle_screen::$0 = init_angle_screen::screen#1 + $28*$c - init_angle_screen::screen_topline#0 = init_angle_screen::$0 - init_angle_screen::$1 = init_angle_screen::screen#1 + $28*$c - init_angle_screen::screen_bottomline#0 = init_angle_screen::$1 + init_angle_screen::screen_topline#0 = init_angle_screen::screen#1 + $28*$c + init_angle_screen::screen_bottomline#0 = init_angle_screen::screen#1 + $28*$c init_angle_screen::y#0 = 0 to:init_angle_screen::@1 init_angle_screen::@1: scope:[init_angle_screen] from init_angle_screen init_angle_screen::@4 @@ -397,11 +399,9 @@ init_angle_screen::@5: scope:[init_angle_screen] from init_angle_screen::@3 init_angle_screen::x#4 = phi( init_angle_screen::@3/init_angle_screen::x#3 ) init_angle_screen::screen_topline#2 = phi( init_angle_screen::@3/init_angle_screen::screen_topline#4 ) atan2_16::return#4 = phi( init_angle_screen::@3/atan2_16::return#2 ) - init_angle_screen::$8 = atan2_16::return#4 - init_angle_screen::angle_w#0 = init_angle_screen::$8 + init_angle_screen::angle_w#0 = atan2_16::return#4 init_angle_screen::$9 = init_angle_screen::angle_w#0 + $80 - init_angle_screen::$10 = byte1 init_angle_screen::$9 - init_angle_screen::ang_w#0 = init_angle_screen::$10 + init_angle_screen::ang_w#0 = byte1 init_angle_screen::$9 init_angle_screen::$11 = $80 + init_angle_screen::ang_w#0 init_angle_screen::screen_topline#2[init_angle_screen::x#4] = init_angle_screen::$11 init_angle_screen::$12 = $80 - init_angle_screen::ang_w#0 @@ -617,9 +617,6 @@ signed word atan2_16::yi#7 signed word atan2_16::yi#8 signed word atan2_16::yi#9 void init_angle_screen(byte* init_angle_screen::screen) -byte*~ init_angle_screen::$0 -byte*~ init_angle_screen::$1 -byte~ init_angle_screen::$10 number~ init_angle_screen::$11 number~ init_angle_screen::$12 byte~ init_angle_screen::$13 @@ -630,7 +627,6 @@ number~ init_angle_screen::$4 word~ init_angle_screen::$5 number~ init_angle_screen::$6 word~ init_angle_screen::$7 -word~ init_angle_screen::$8 number~ init_angle_screen::$9 byte init_angle_screen::ang_w byte init_angle_screen::ang_w#0 @@ -804,8 +800,8 @@ Adding number conversion cast (unumber) main::toD0181_$6 in main::toD0181_$6 = m Adding number conversion cast (unumber) $ff in main::$3 = *RASTER != $ff Adding number conversion cast (unumber) $800 in main::$4 = main::clear_char#2 < CHARSET+$800 Adding number conversion cast (unumber) 0 in *main::clear_char#3 = 0 -Adding number conversion cast (unumber) $28*$c in init_angle_screen::$0 = init_angle_screen::screen#1 + $28*$c -Adding number conversion cast (unumber) $28*$c in init_angle_screen::$1 = init_angle_screen::screen#1 + $28*$c +Adding number conversion cast (unumber) $28*$c in init_angle_screen::screen_topline#0 = init_angle_screen::screen#1 + $28*$c +Adding number conversion cast (unumber) $28*$c in init_angle_screen::screen_bottomline#0 = init_angle_screen::screen#1 + $28*$c Adding number conversion cast (unumber) $13 in init_angle_screen::$2 = init_angle_screen::x#2 <= $13 Adding number conversion cast (unumber) 2 in init_angle_screen::$3 = init_angle_screen::x#3 * 2 Adding number conversion cast (unumber) init_angle_screen::$3 in init_angle_screen::$3 = init_angle_screen::x#3 * (unumber)2 @@ -985,16 +981,12 @@ Alias main::toD0181_screen#0 = main::toD0181_screen#1 Alias main::toD0181_gfx#0 = main::toD0181_gfx#1 Alias main::toD0181_return#0 = main::toD0181_$6 main::toD0181_return#2 main::toD0181_return#1 main::toD0181_return#3 main::$1 Alias main::clear_char#2 = main::clear_char#4 main::clear_char#3 -Alias init_angle_screen::screen_topline#0 = init_angle_screen::$0 -Alias init_angle_screen::screen_bottomline#0 = init_angle_screen::$1 Alias init_angle_screen::x#2 = init_angle_screen::x#3 init_angle_screen::x#4 Alias init_angle_screen::y#2 = init_angle_screen::y#4 init_angle_screen::y#6 init_angle_screen::y#3 Alias init_angle_screen::screen_topline#2 = init_angle_screen::screen_topline#4 init_angle_screen::screen_topline#5 init_angle_screen::screen_topline#3 Alias init_angle_screen::screen_bottomline#2 = init_angle_screen::screen_bottomline#4 init_angle_screen::screen_bottomline#5 init_angle_screen::screen_bottomline#3 Alias init_angle_screen::xb#2 = init_angle_screen::xb#3 init_angle_screen::xb#4 Alias atan2_16::return#2 = atan2_16::return#4 -Alias init_angle_screen::angle_w#0 = init_angle_screen::$8 -Alias init_angle_screen::ang_w#0 = init_angle_screen::$10 Successful SSA optimization Pass2AliasElimination Alias atan2_16::x#1 = atan2_16::x#5 atan2_16::x#10 Alias atan2_16::y#1 = atan2_16::y#12 atan2_16::y#9 @@ -1034,7 +1026,7 @@ Identical Phi Values atan2_16::y#19 atan2_16::y#0 Identical Phi Values atan2_16::x#4 atan2_16::x#17 Identical Phi Values atan2_16::y#4 atan2_16::y#19 Successful SSA optimization Pass2IdenticalPhiElimination -Identified duplicate assignment right side [154] init_angle_screen::screen_bottomline#0 = init_angle_screen::screen#0 + (word)$28*$c +Identified duplicate assignment right side [153] init_angle_screen::screen_bottomline#0 = init_angle_screen::screen#0 + (word)$28*$c Successful SSA optimization Pass2DuplicateRValueIdentification Simple Condition init_font_hex::$3 [19] if(init_font_hex::i#1!=rangelast(0,4)) goto init_font_hex::@3 Simple Condition init_font_hex::$4 [28] if(init_font_hex::c1#1!=rangelast(0,$f)) goto init_font_hex::@2 @@ -3375,14 +3367,13 @@ init_angle_screen: { // [46] init_angle_screen::yw#0 = init_angle_screen::$6 w= 0 -- vwuz1=vbuaa_word_vbuc1 sta.z yw+1 sty.z yw - // atan2_16(xw, yw) + // word angle_w = atan2_16(xw, yw) // [47] atan2_16::x#0 = (signed word)init_angle_screen::xw#0 // [48] atan2_16::y#0 = (signed word)init_angle_screen::yw#0 // [49] call atan2_16 jsr atan2_16 // [50] atan2_16::return#2 = atan2_16::return#0 // init_angle_screen::@5 - // word angle_w = atan2_16(xw, yw) // [51] init_angle_screen::angle_w#0 = atan2_16::return#2 // angle_w+0x0080 // [52] init_angle_screen::$9 = init_angle_screen::angle_w#0 + $80 -- vwuz1=vwuz1_plus_vbuc1 diff --git a/src/test/ref/cordic-atan2.asm b/src/test/ref/cordic-atan2.asm index 9854bc71a..d6f0bed37 100644 --- a/src/test/ref/cordic-atan2.asm +++ b/src/test/ref/cordic-atan2.asm @@ -39,10 +39,9 @@ main: { lda #-$13 sta.z x __b2: - // atan2_8(x, y) + // byte angle = atan2_8(x, y) jsr atan2_8 txa - // byte angle = atan2_8(x, y) // *screen++ = angle ldy #0 sta (screen),y diff --git a/src/test/ref/cordic-atan2.log b/src/test/ref/cordic-atan2.log index 054f38d77..a9685ac47 100644 --- a/src/test/ref/cordic-atan2.log +++ b/src/test/ref/cordic-atan2.log @@ -2,6 +2,9 @@ Resolved forward reference FONT_HEX_PROTO to FONT_HEX_PROTO Resolved forward reference FONT_HEX_PROTO to FONT_HEX_PROTO Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call main::$1 = call toD018 SCREEN CHARSET +Eliminating unused variable with no statement atan2_8::$19 +Eliminating unused variable with no statement atan2_8::$20 +Eliminating unused variable with no statement main::$2 CONTROL FLOW GRAPH SSA @@ -142,10 +145,8 @@ atan2_8::@11: scope:[atan2_8] from atan2_8::@10 atan2_8::yi#4 = phi( atan2_8::@10/atan2_8::yi#3 ) atan2_8::i#2 = phi( atan2_8::@10/atan2_8::i#6 ) atan2_8::xi#3 = phi( atan2_8::@10/atan2_8::xi#6 ) - atan2_8::$19 = atan2_8::xi#3 >> atan2_8::i#2 - atan2_8::xd#0 = atan2_8::$19 - atan2_8::$20 = atan2_8::yi#4 >> atan2_8::i#2 - atan2_8::yd#0 = atan2_8::$20 + atan2_8::xd#0 = atan2_8::xi#3 >> atan2_8::i#2 + atan2_8::yd#0 = atan2_8::yi#4 >> atan2_8::i#2 atan2_8::$21 = atan2_8::yi#4 > 0 if(atan2_8::$21) goto atan2_8::@13 to:atan2_8::@15 @@ -276,8 +277,7 @@ main::@8: scope:[main] from main::@2 main::x#3 = phi( main::@2/main::x#2 ) main::screen#2 = phi( main::@2/main::screen#3 ) atan2_8::return#4 = phi( main::@2/atan2_8::return#2 ) - main::$2 = atan2_8::return#4 - main::angle#0 = main::$2 + main::angle#0 = atan2_8::return#4 *main::screen#2 = main::angle#0 main::screen#1 = ++ main::screen#2 main::x#1 = main::x#3 + rangenext(-$13,$14) @@ -333,9 +333,7 @@ bool~ atan2_8::$15 byte~ atan2_8::$16 bool~ atan2_8::$17 bool~ atan2_8::$18 -signed byte~ atan2_8::$19 signed byte~ atan2_8::$2 -signed byte~ atan2_8::$20 bool~ atan2_8::$21 bool~ atan2_8::$22 signed byte~ atan2_8::$3 @@ -495,7 +493,6 @@ byte* init_font_hex::proto_lo#3 byte* init_font_hex::proto_lo#4 void main() byte~ main::$1 -byte~ main::$2 bool~ main::$3 bool~ main::$4 byte main::angle @@ -633,8 +630,8 @@ Inferred type updated to byte in main::toD0181_$4 = main::toD0181_$3 / 4 Inferred type updated to byte in main::toD0181_$5 = main::toD0181_$4 & $f Inferred type updated to byte in main::toD0181_$6 = main::toD0181_$2 | main::toD0181_$5 Inversing boolean not [59] atan2_8::$18 = atan2_8::yi#3 != 0 from [58] atan2_8::$17 = atan2_8::yi#3 == 0 -Inversing boolean not [72] atan2_8::$12 = atan2_8::x#4 >= 0 from [71] atan2_8::$11 = atan2_8::x#4 < 0 -Inversing boolean not [88] atan2_8::$15 = atan2_8::y#4 >= 0 from [87] atan2_8::$14 = atan2_8::y#4 < 0 +Inversing boolean not [70] atan2_8::$12 = atan2_8::x#4 >= 0 from [69] atan2_8::$11 = atan2_8::x#4 < 0 +Inversing boolean not [86] atan2_8::$15 = atan2_8::y#4 >= 0 from [85] atan2_8::$14 = atan2_8::y#4 < 0 Successful SSA optimization Pass2UnaryNotSimplification Alias init_font_hex::charset#3 = init_font_hex::charset#4 Alias init_font_hex::idx#2 = init_font_hex::idx#6 @@ -657,9 +654,9 @@ Alias atan2_8::yi#3 = atan2_8::yi#4 atan2_8::yi#5 atan2_8::yi#6 Alias atan2_8::angle#12 = atan2_8::angle#14 atan2_8::angle#7 atan2_8::angle#8 Alias atan2_8::x#11 = atan2_8::x#13 atan2_8::x#7 atan2_8::x#12 Alias atan2_8::y#10 = atan2_8::y#14 atan2_8::y#7 atan2_8::y#11 -Alias atan2_8::xd#0 = atan2_8::$19 atan2_8::xd#1 atan2_8::xd#2 -Alias atan2_8::yd#0 = atan2_8::$20 atan2_8::yd#1 atan2_8::yd#2 Alias atan2_8::angle#1 = atan2_8::$10 atan2_8::angle#9 +Alias atan2_8::yd#0 = atan2_8::yd#1 atan2_8::yd#2 +Alias atan2_8::xd#0 = atan2_8::xd#1 atan2_8::xd#2 Alias atan2_8::y#5 = atan2_8::y#6 Alias atan2_8::angle#4 = atan2_8::$13 Alias atan2_8::return#0 = atan2_8::angle#10 atan2_8::return#3 atan2_8::return#1 @@ -672,7 +669,6 @@ Alias atan2_8::return#2 = atan2_8::return#4 Alias main::screen#2 = main::screen#3 Alias main::x#2 = main::x#3 Alias main::y#2 = main::y#5 main::y#3 -Alias main::angle#0 = main::$2 Alias main::screen#1 = main::screen#5 Successful SSA optimization Pass2AliasElimination Alias atan2_8::x#1 = atan2_8::x#5 atan2_8::x#10 @@ -2205,7 +2201,7 @@ main: { // [5] phi main::x#2 = main::x#1 [phi:main::@6->main::@2#1] -- register_copy // main::@2 __b2: - // atan2_8(x, y) + // byte angle = atan2_8(x, y) // [6] atan2_8::x#0 = main::x#2 // [7] atan2_8::y#0 = main::y#4 // [8] call atan2_8 @@ -2213,7 +2209,6 @@ main: { // [9] atan2_8::return#2 = atan2_8::return#0 -- vbuaa=vbuxx txa // main::@6 - // byte angle = atan2_8(x, y) // [10] main::angle#0 = atan2_8::return#2 // *screen++ = angle // [11] *main::screen#2 = main::angle#0 -- _deref_pbuz1=vbuaa diff --git a/src/test/ref/default-font.log b/src/test/ref/default-font.log index a6d1652a8..4caac3455 100644 --- a/src/test/ref/default-font.log +++ b/src/test/ref/default-font.log @@ -1,4 +1,6 @@ Inlined call call __init +Eliminating unused variable with no statement memset::$2 +Eliminating unused variable with no statement main::$2 CONTROL FLOW GRAPH SSA @@ -20,8 +22,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -56,8 +57,7 @@ main: scope:[main] from __start::@1 to:main::@4 main::@4: scope:[main] from main main::$1 = SCREEN + $28 - main::$2 = main::$1 + 1 - main::screen#0 = main::$2 + main::screen#0 = main::$1 + 1 main::ch#0 = 0 main::x#0 = 0 to:main::@1 @@ -111,7 +111,6 @@ constant byte* SCREEN = (byte*)$400 void __start() void main() byte*~ main::$1 -byte*~ main::$2 bool~ main::$3 bool~ main::$4 byte main::ch @@ -140,7 +139,6 @@ byte main::y#2 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -178,7 +176,7 @@ void* memset::str#5 Adding number conversion cast (unumber) 0 in memset::$0 = memset::num#1 > 0 Adding number conversion cast (unumber) $3e8 in memset::num#0 = $3e8 Adding number conversion cast (unumber) $28 in main::$1 = SCREEN + $28 -Adding number conversion cast (unumber) 1 in main::$2 = main::$1 + 1 +Adding number conversion cast (unumber) 1 in main::screen#0 = main::$1 + 1 Adding number conversion cast (unumber) $28-$10 in main::screen#2 = main::screen#4 + $28-$10 Successful SSA optimization PassNAddNumberTypeConversions Inlining cast memset::dst#0 = (byte*)memset::str#2 @@ -201,12 +199,10 @@ Alias memset::return#0 = memset::str#1 memset::return#3 memset::return#1 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 Alias memset::str#4 = memset::str#5 -Alias main::screen#0 = main::$2 Alias main::screen#1 = main::screen#4 Alias main::x#2 = main::x#3 Alias main::ch#1 = main::ch#4 diff --git a/src/test/ref/divide-2s.asm b/src/test/ref/divide-2s.asm index 1823c3698..9d7919b04 100644 --- a/src/test/ref/divide-2s.asm +++ b/src/test/ref/divide-2s.asm @@ -34,6 +34,7 @@ main: { // (SCREEN+40*3)[i] = i/8 sta SCREEN+$28*3,x // signed byte sb = -(signed byte)i + // And a single signed byte txa eor #$ff clc diff --git a/src/test/ref/divide-2s.log b/src/test/ref/divide-2s.log index 7f45c49cc..3f7cb3937 100644 --- a/src/test/ref/divide-2s.log +++ b/src/test/ref/divide-2s.log @@ -1,3 +1,4 @@ +Eliminating unused variable with no statement main::$4 CONTROL FLOW GRAPH SSA @@ -15,8 +16,7 @@ main::@1: scope:[main] from main main::@1 (main::SCREEN+$28*2)[main::i#2] = main::$2 main::$3 = main::i#2 / 8 (main::SCREEN+$28*3)[main::i#2] = main::$3 - main::$4 = - (signed byte)main::i#2 - main::sb#0 = main::$4 + main::sb#0 = - (signed byte)main::i#2 main::$5 = main::sb#0 / 2 (main::SCREEN+$28*5)[main::i#2] = (byte)main::$5 main::i#1 = main::i#2 + rangenext(0,$a) @@ -44,7 +44,6 @@ number~ main::$0 number~ main::$1 number~ main::$2 number~ main::$3 -signed byte~ main::$4 number~ main::$5 bool~ main::$6 constant byte* const main::SCREEN = (byte*)$400 @@ -89,8 +88,6 @@ Inferred type updated to byte in main::$1 = main::i#2 / 2 Inferred type updated to byte in main::$2 = main::i#2 / 4 Inferred type updated to byte in main::$3 = main::i#2 / 8 Inferred type updated to signed byte in main::$5 = main::sb#0 / 2 -Alias main::sb#0 = main::$4 -Successful SSA optimization Pass2AliasElimination Simple Condition main::$6 [15] if(main::i#1!=rangelast(0,$a)) goto main::@1 Successful SSA optimization Pass2ConditionalJumpSimplification Constant main::i#0 = 0 @@ -287,6 +284,7 @@ main: { // [8] (main::SCREEN+$28*3)[main::i#2] = main::$3 -- pbuc1_derefidx_vbuxx=vbuaa sta SCREEN+$28*3,x // [9] main::sb#0 = - (signed byte)main::i#2 -- vbsaa=_neg_vbsxx + // And a single signed byte txa eor #$ff clc @@ -399,6 +397,7 @@ main: { sta SCREEN+$28*3,x // signed byte sb = -(signed byte)i // [9] main::sb#0 = - (signed byte)main::i#2 -- vbsaa=_neg_vbsxx + // And a single signed byte txa eor #$ff clc diff --git a/src/test/ref/dword.log b/src/test/ref/dword.log index 6feac872f..35585affe 100644 --- a/src/test/ref/dword.log +++ b/src/test/ref/dword.log @@ -1,3 +1,4 @@ +Eliminating unused variable with no statement main::$0 CONTROL FLOW GRAPH SSA @@ -7,8 +8,7 @@ main: scope:[main] from __start to:main::@1 main::@1: scope:[main] from main main::@1 main::i#2 = phi( main/main::i#0, main::@1/main::i#1 ) - main::$0 = main::a + main::i#2 - main::b#0 = main::$0 + main::b#0 = main::a + main::i#2 main::c#0 = (byte)main::b#0 main::SCREEN[main::i#2] = main::c#0 main::i#1 = main::i#2 + rangenext(0,$64) @@ -32,7 +32,6 @@ __start::@return: scope:[__start] from __start::@1 SYMBOL TABLE SSA void __start() void main() -dword~ main::$0 bool~ main::$1 constant byte* const main::SCREEN = (byte*)$400 constant dword main::a = $ee6b2800 @@ -47,8 +46,6 @@ byte main::i#2 Simplifying constant pointer cast (byte*) 1024 Successful SSA optimization PassNCastSimplification -Alias main::b#0 = main::$0 -Successful SSA optimization Pass2AliasElimination Simple Condition main::$1 [7] if(main::i#1!=rangelast(0,$64)) goto main::@1 Successful SSA optimization Pass2ConditionalJumpSimplification Constant main::i#0 = 0 diff --git a/src/test/ref/euclid-3.log b/src/test/ref/euclid-3.log index b36031cfd..67a3ac6b3 100644 --- a/src/test/ref/euclid-3.log +++ b/src/test/ref/euclid-3.log @@ -1,4 +1,5 @@ Inlined call call __init +Eliminating unused variable with no statement memset::$2 CONTROL FLOW GRAPH SSA @@ -106,8 +107,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -390,7 +390,6 @@ void main() void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -668,7 +667,6 @@ Alias memset::return#1 = memset::str#1 memset::return#3 memset::return#2 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 diff --git a/src/test/ref/examples/c64/3d/perspective.log b/src/test/ref/examples/c64/3d/perspective.log index 8189877f6..27b90f30d 100644 --- a/src/test/ref/examples/c64/3d/perspective.log +++ b/src/test/ref/examples/c64/3d/perspective.log @@ -8,6 +8,8 @@ Setting inferred volatile on symbol affected by address-of: yr in asm { ldazr st Setting inferred volatile on symbol affected by address-of: xr in asm { ldazr staPP+1 PP: ldaPERSP_Z stapsp1 eor#$ff stapsp2 clc ldyyr lda(psp1),y sbc(psp2),y adc#$80 stayr clc ldyxr lda(psp1),y sbc(psp2),y adc#$80 staxr } Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call __init +Eliminating unused variable with no statement memset::$2 +Eliminating unused variable with no statement mulf_init::$0 CONTROL FLOW GRAPH SSA @@ -191,8 +193,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -410,8 +411,7 @@ mulf_init::@1: scope:[mulf_init] from mulf_init mulf_init::@1 mulf_init::add#2 = phi( mulf_init/mulf_init::add#0, mulf_init::@1/mulf_init::add#1 ) mulf_init::i#2 = phi( mulf_init/mulf_init::i#0, mulf_init::@1/mulf_init::i#1 ) mulf_init::sqr#2 = phi( mulf_init/mulf_init::sqr#0, mulf_init::@1/mulf_init::sqr#1 ) - mulf_init::$0 = byte1 mulf_init::sqr#2 - mulf_init::val#0 = mulf_init::$0 + mulf_init::val#0 = byte1 mulf_init::sqr#2 mulf_sqr1[mulf_init::i#2] = mulf_init::val#0 (mulf_sqr1+$100)[mulf_init::i#2] = mulf_init::val#0 mulf_init::$1 = - mulf_init::i#2 @@ -531,7 +531,6 @@ void main() void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -566,7 +565,6 @@ void* memset::str#3 void* memset::str#4 void* memset::str#5 void mulf_init() -byte~ mulf_init::$0 byte~ mulf_init::$1 byte~ mulf_init::$2 number~ mulf_init::$3 @@ -886,7 +884,6 @@ Alias memset::return#1 = memset::str#1 memset::return#3 memset::return#2 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -915,7 +912,6 @@ Alias print_char_cursor#27 = print_char_cursor#60 Alias print_char_cursor#28 = print_char_cursor#61 Alias print_line_cursor#19 = print_line_cursor#7 print_line_cursor#20 print_line_cursor#8 Alias print_char_cursor#29 = print_char_cursor#62 print_char_cursor#63 print_char_cursor#30 -Alias mulf_init::val#0 = mulf_init::$0 Alias print_screen#0 = print_line_cursor#9 print_char_cursor#31 print_line_cursor#26 print_char_cursor#76 print_screen#8 print_screen#6 print_screen#4 print_screen#1 Alias print_line_cursor#10 = print_line_cursor#21 print_line_cursor#22 print_line_cursor#11 Alias print_char_cursor#32 = print_char_cursor#64 print_char_cursor#65 print_char_cursor#33 @@ -971,8 +967,8 @@ Identical Phi Values print_char_cursor#69 print_char_cursor#1 Identical Phi Values print_char_cursor#71 print_char_cursor#11 Identical Phi Values memset::return#1 memset::str#0 Successful SSA optimization Pass2IdenticalPhiElimination -Identified duplicate assignment right side [196] mulf_init::$2 = - mulf_init::i#2 -Identified duplicate assignment right side [204] mulf_init::$6 = 1 - mulf_init::i#2 +Identified duplicate assignment right side [194] mulf_init::$2 = - mulf_init::i#2 +Identified duplicate assignment right side [202] mulf_init::$6 = 1 - mulf_init::i#2 Successful SSA optimization Pass2DuplicateRValueIdentification Simple Condition print_str::$1 [3] if(0!=*print_str::str#7) goto print_str::@2 Simple Condition print_ln::$1 [13] if(print_line_cursor#0 dy) lda.z dy+1 @@ -346,6 +342,7 @@ bitmap_line: { bcc __b2 !: // unsigned int e = dx/2 + // Y is the driver lda.z dx+1 lsr sta.z e+1 @@ -412,6 +409,7 @@ bitmap_line: { rts __b2: // unsigned int e = dy/2 + // X is the driver lda.z dy+1 lsr sta.z e1+1 diff --git a/src/test/ref/examples/c64/bresenham/bitmap-bresenham.log b/src/test/ref/examples/c64/bresenham/bitmap-bresenham.log index b739a1d0f..74c7cdb0b 100644 --- a/src/test/ref/examples/c64/bresenham/bitmap-bresenham.log +++ b/src/test/ref/examples/c64/bresenham/bitmap-bresenham.log @@ -1,5 +1,13 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call __init +Eliminating unused variable with no statement bitmap_clear::$1 +Eliminating unused variable with no statement bitmap_line::$1 +Eliminating unused variable with no statement bitmap_line::$3 +Eliminating unused variable with no statement bitmap_line::$9 +Eliminating unused variable with no statement bitmap_line::$11 +Eliminating unused variable with no statement bitmap_line::$15 +Eliminating unused variable with no statement bitmap_line::$20 +Eliminating unused variable with no statement memset::$2 CONTROL FLOW GRAPH SSA @@ -96,8 +104,7 @@ bitmap_clear: scope:[bitmap_clear] from main::@2 bitmap_clear::bgcol#1 = phi( main::@2/bitmap_clear::bgcol#0 ) bitmap_clear::fgcol#1 = phi( main::@2/bitmap_clear::fgcol#0 ) bitmap_clear::$0 = bitmap_clear::fgcol#1 * $10 - bitmap_clear::$1 = bitmap_clear::$0 + bitmap_clear::bgcol#1 - bitmap_clear::col#0 = bitmap_clear::$1 + bitmap_clear::col#0 = bitmap_clear::$0 + bitmap_clear::bgcol#1 memset::str#0 = (void*)bitmap_screen#8 memset::c#0 = bitmap_clear::col#0 memset::num#0 = $3e8 @@ -154,8 +161,7 @@ bitmap_line::@12: scope:[bitmap_line] from bitmap_line bitmap_line::y1#2 = phi( bitmap_line/bitmap_line::y1#1 ) bitmap_line::y2#1 = phi( bitmap_line/bitmap_line::y2#4 ) abs_u16::return#5 = phi( bitmap_line/abs_u16::return#0 ) - bitmap_line::$1 = abs_u16::return#5 - bitmap_line::dx#0 = bitmap_line::$1 + bitmap_line::dx#0 = abs_u16::return#5 bitmap_line::$2 = bitmap_line::y2#1 - bitmap_line::y1#2 abs_u16::w#1 = bitmap_line::$2 call abs_u16 @@ -170,8 +176,7 @@ bitmap_line::@13: scope:[bitmap_line] from bitmap_line::@12 bitmap_line::x2#4 = phi( bitmap_line::@12/bitmap_line::x2#7 ) bitmap_line::dx#1 = phi( bitmap_line::@12/bitmap_line::dx#0 ) abs_u16::return#6 = phi( bitmap_line::@12/abs_u16::return#1 ) - bitmap_line::$3 = abs_u16::return#6 - bitmap_line::dy#0 = bitmap_line::$3 + bitmap_line::dy#0 = abs_u16::return#6 bitmap_line::$4 = bitmap_line::dx#1 == 0 bitmap_line::$5 = bitmap_line::dy#0 == 0 bitmap_line::$6 = bitmap_line::$4 && bitmap_line::$5 @@ -201,8 +206,7 @@ bitmap_line::@14: scope:[bitmap_line] from bitmap_line::@1 bitmap_line::y1#3 = phi( bitmap_line::@1/bitmap_line::y1#4 ) bitmap_line::y2#2 = phi( bitmap_line::@1/bitmap_line::y2#5 ) sgn_u16::return#5 = phi( bitmap_line::@1/sgn_u16::return#0 ) - bitmap_line::$9 = sgn_u16::return#5 - bitmap_line::sx#0 = bitmap_line::$9 + bitmap_line::sx#0 = sgn_u16::return#5 bitmap_line::$10 = bitmap_line::y2#2 - bitmap_line::y1#3 sgn_u16::w#1 = bitmap_line::$10 call sgn_u16 @@ -217,8 +221,7 @@ bitmap_line::@15: scope:[bitmap_line] from bitmap_line::@14 bitmap_line::dy#1 = phi( bitmap_line::@14/bitmap_line::dy#6 ) bitmap_line::dx#2 = phi( bitmap_line::@14/bitmap_line::dx#7 ) sgn_u16::return#6 = phi( bitmap_line::@14/sgn_u16::return#1 ) - bitmap_line::$11 = sgn_u16::return#6 - bitmap_line::sy#0 = bitmap_line::$11 + bitmap_line::sy#0 = sgn_u16::return#6 bitmap_line::$12 = bitmap_line::dx#2 > bitmap_line::dy#1 if(bitmap_line::$12) goto bitmap_line::@2 to:bitmap_line::@5 @@ -242,8 +245,7 @@ bitmap_line::@2: scope:[bitmap_line] from bitmap_line::@15 bitmap_line::y#14 = phi( bitmap_line::@15/bitmap_line::y#17 ) bitmap_line::x#14 = phi( bitmap_line::@15/bitmap_line::x#17 ) bitmap_line::dy#2 = phi( bitmap_line::@15/bitmap_line::dy#1 ) - bitmap_line::$20 = bitmap_line::dy#2 / 2 - bitmap_line::e1#0 = bitmap_line::$20 + bitmap_line::e1#0 = bitmap_line::dy#2 / 2 to:bitmap_line::@9 bitmap_line::@5: scope:[bitmap_line] from bitmap_line::@15 bitmap_line::sx#9 = phi( bitmap_line::@15/bitmap_line::sx#8 ) @@ -253,8 +255,7 @@ bitmap_line::@5: scope:[bitmap_line] from bitmap_line::@15 bitmap_line::y#11 = phi( bitmap_line::@15/bitmap_line::y#17 ) bitmap_line::x#11 = phi( bitmap_line::@15/bitmap_line::x#17 ) bitmap_line::dx#3 = phi( bitmap_line::@15/bitmap_line::dx#2 ) - bitmap_line::$15 = bitmap_line::dx#3 / 2 - bitmap_line::e#0 = bitmap_line::$15 + bitmap_line::e#0 = bitmap_line::dx#3 / 2 to:bitmap_line::@6 bitmap_line::@6: scope:[bitmap_line] from bitmap_line::@5 bitmap_line::@7 bitmap_line::sx#5 = phi( bitmap_line::@5/bitmap_line::sx#9, bitmap_line::@7/bitmap_line::sx#10 ) @@ -388,8 +389,7 @@ memset::@2: scope:[memset] from memset memset::num#3 = phi( memset/memset::num#2 ) memset::str#3 = phi( memset/memset::str#4 ) memset::$4 = (byte*)memset::str#3 - memset::$2 = memset::$4 + memset::num#3 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#3 memset::dst#0 = ((byte*)) memset::str#3 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -613,7 +613,6 @@ word abs_u16::w#3 word abs_u16::w#4 void bitmap_clear(byte bitmap_clear::bgcol , byte bitmap_clear::fgcol) number~ bitmap_clear::$0 -number~ bitmap_clear::$1 byte bitmap_clear::bgcol byte bitmap_clear::bgcol#0 byte bitmap_clear::bgcol#1 @@ -699,26 +698,20 @@ byte* bitmap_init::yoffs#3 byte* bitmap_init::yoffs#4 void bitmap_line(word bitmap_line::x1 , word bitmap_line::y1 , word bitmap_line::x2 , word bitmap_line::y2) word~ bitmap_line::$0 -word~ bitmap_line::$1 word~ bitmap_line::$10 -word~ bitmap_line::$11 bool~ bitmap_line::$12 -number~ bitmap_line::$15 bool~ bitmap_line::$17 bool~ bitmap_line::$18 bool~ bitmap_line::$19 word~ bitmap_line::$2 -number~ bitmap_line::$20 bool~ bitmap_line::$22 bool~ bitmap_line::$23 bool~ bitmap_line::$24 -word~ bitmap_line::$3 bool~ bitmap_line::$4 bool~ bitmap_line::$5 bool~ bitmap_line::$6 bool~ bitmap_line::$7 word~ bitmap_line::$8 -word~ bitmap_line::$9 word bitmap_line::dx word bitmap_line::dx#0 word bitmap_line::dx#1 @@ -944,7 +937,6 @@ void main() void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -1014,16 +1006,13 @@ Adding number conversion cast (unumber) 7 in bitmap_init::$8 = bitmap_init::$7 = Adding number conversion cast (unumber) $28*8 in bitmap_init::$10 = bitmap_init::yoffs#3 + $28*8 Adding number conversion cast (unumber) $10 in bitmap_clear::$0 = bitmap_clear::fgcol#1 * $10 Adding number conversion cast (unumber) bitmap_clear::$0 in bitmap_clear::$0 = bitmap_clear::fgcol#1 * (unumber)$10 -Adding number conversion cast (unumber) bitmap_clear::$1 in bitmap_clear::$1 = bitmap_clear::$0 + bitmap_clear::bgcol#1 Adding number conversion cast (unumber) 0 in memset::c#1 = 0 Adding number conversion cast (unumber) $fff8 in bitmap_plot::$1 = bitmap_plot::x#4 & $fff8 Adding number conversion cast (unumber) bitmap_plot::$1 in bitmap_plot::$1 = bitmap_plot::x#4 & (unumber)$fff8 Adding number conversion cast (unumber) 0 in bitmap_line::$4 = bitmap_line::dx#1 == 0 Adding number conversion cast (unumber) 0 in bitmap_line::$5 = bitmap_line::dy#0 == 0 -Adding number conversion cast (unumber) 2 in bitmap_line::$20 = bitmap_line::dy#2 / 2 -Adding number conversion cast (unumber) bitmap_line::$20 in bitmap_line::$20 = bitmap_line::dy#2 / (unumber)2 -Adding number conversion cast (unumber) 2 in bitmap_line::$15 = bitmap_line::dx#3 / 2 -Adding number conversion cast (unumber) bitmap_line::$15 in bitmap_line::$15 = bitmap_line::dx#3 / (unumber)2 +Adding number conversion cast (unumber) 2 in bitmap_line::e1#0 = bitmap_line::dy#2 / 2 +Adding number conversion cast (unumber) 2 in bitmap_line::e#0 = bitmap_line::dx#3 / 2 Adding number conversion cast (unumber) 0 in memset::$0 = memset::num#2 > 0 Adding number conversion cast (unumber) $80 in abs_u16::$1 = abs_u16::$0 & $80 Adding number conversion cast (unumber) abs_u16::$1 in abs_u16::$1 = abs_u16::$0 & (unumber)$80 @@ -1137,19 +1126,16 @@ Inferred type updated to byte in bitmap_init::$3 = bitmap_init::y#2 & 7 Inferred type updated to byte in bitmap_init::$5 = bitmap_init::$3 | bitmap_init::$4 Inferred type updated to byte in bitmap_init::$7 = bitmap_init::y#2 & 7 Inferred type updated to byte in bitmap_clear::$0 = bitmap_clear::fgcol#1 * $10 -Inferred type updated to byte in bitmap_clear::$1 = bitmap_clear::$0 + bitmap_clear::bgcol#1 Inferred type updated to word in bitmap_plot::$1 = bitmap_plot::x#4 & $fff8 -Inferred type updated to word in bitmap_line::$20 = bitmap_line::dy#2 / 2 -Inferred type updated to word in bitmap_line::$15 = bitmap_line::dx#3 / 2 Inferred type updated to byte in abs_u16::$1 = abs_u16::$0 & $80 Inferred type updated to byte in sgn_u16::$1 = sgn_u16::$0 & $80 Inferred type updated to byte in lines::$1 = lines::l#3 + 1 Inferred type updated to byte in lines::$2 = lines::l#3 + 1 Inversing boolean not [9] bitmap_init::$1 = bitmap_init::bits#1 != 0 from [8] bitmap_init::$0 = bitmap_init::bits#1 == 0 Inversing boolean not [29] bitmap_init::$9 = bitmap_init::$7 != 7 from [28] bitmap_init::$8 = bitmap_init::$7 == 7 -Inversing boolean not [124] bitmap_line::$18 = bitmap_line::dy#3 >= bitmap_line::e#1 from [123] bitmap_line::$17 = bitmap_line::dy#3 < bitmap_line::e#1 -Inversing boolean not [144] bitmap_line::$23 = bitmap_line::dx#5 >= bitmap_line::e1#1 from [143] bitmap_line::$22 = bitmap_line::dx#5 < bitmap_line::e1#1 -Inversing boolean not [154] memset::$1 = memset::num#2 <= 0 from [153] memset::$0 = memset::num#2 > 0 +Inversing boolean not [117] bitmap_line::$18 = bitmap_line::dy#3 >= bitmap_line::e#1 from [116] bitmap_line::$17 = bitmap_line::dy#3 < bitmap_line::e#1 +Inversing boolean not [137] bitmap_line::$23 = bitmap_line::dx#5 >= bitmap_line::e1#1 from [136] bitmap_line::$22 = bitmap_line::dx#5 < bitmap_line::e1#1 +Inversing boolean not [147] memset::$1 = memset::num#2 <= 0 from [146] memset::$0 = memset::num#2 > 0 Successful SSA optimization Pass2UnaryNotSimplification Alias bitmap_init::x#2 = bitmap_init::x#4 Alias bitmap_init::gfx#4 = bitmap_init::gfx#5 @@ -1165,7 +1151,6 @@ Alias bitmap_screen#17 = bitmap_screen#18 Alias bitmap_init::yoffs#1 = bitmap_init::$10 Alias bitmap_gfx#1 = bitmap_gfx#7 bitmap_gfx#13 Alias bitmap_screen#1 = bitmap_screen#7 bitmap_screen#13 -Alias bitmap_clear::col#0 = bitmap_clear::$1 Alias bitmap_gfx#14 = bitmap_gfx#8 Alias bitmap_line::x#0 = bitmap_line::x1#1 bitmap_line::x1#4 bitmap_line::x#16 bitmap_line::x1#3 bitmap_line::x#10 bitmap_line::x1#2 bitmap_line::x#19 bitmap_line::x#18 bitmap_line::x#17 bitmap_line::x#3 bitmap_line::x#14 bitmap_line::x#11 Alias bitmap_line::y#0 = bitmap_line::y1#1 bitmap_line::y1#2 bitmap_line::y#16 bitmap_line::y#10 bitmap_line::y1#5 bitmap_line::y1#4 bitmap_line::y#19 bitmap_line::y1#3 bitmap_line::y#18 bitmap_line::y#17 bitmap_line::y#3 bitmap_line::y#14 bitmap_line::y#11 @@ -1173,18 +1158,16 @@ Alias abs_u16::w#0 = bitmap_line::$0 Alias abs_u16::return#0 = abs_u16::return#5 Alias bitmap_line::y2#1 = bitmap_line::y2#4 bitmap_line::y2#8 bitmap_line::y2#5 bitmap_line::y2#2 bitmap_line::y2#11 bitmap_line::y2#10 Alias bitmap_line::x2#1 = bitmap_line::x2#7 bitmap_line::x2#4 bitmap_line::x2#2 bitmap_line::x2#11 bitmap_line::x2#10 bitmap_line::x2#9 -Alias bitmap_line::dx#0 = bitmap_line::$1 bitmap_line::dx#1 bitmap_line::dx#10 bitmap_line::dx#7 bitmap_line::dx#2 bitmap_line::dx#13 bitmap_line::dx#3 Alias abs_u16::w#1 = bitmap_line::$2 Alias abs_u16::return#1 = abs_u16::return#6 -Alias bitmap_line::dy#0 = bitmap_line::$3 bitmap_line::dy#9 bitmap_line::dy#6 bitmap_line::dy#1 bitmap_line::dy#2 bitmap_line::dy#10 +Alias bitmap_line::dx#0 = bitmap_line::dx#1 bitmap_line::dx#10 bitmap_line::dx#7 bitmap_line::dx#2 bitmap_line::dx#13 bitmap_line::dx#3 +Alias bitmap_line::dy#0 = bitmap_line::dy#9 bitmap_line::dy#6 bitmap_line::dy#1 bitmap_line::dy#2 bitmap_line::dy#10 Alias sgn_u16::w#0 = bitmap_line::$8 Alias sgn_u16::return#0 = sgn_u16::return#5 -Alias bitmap_line::sx#0 = bitmap_line::$9 bitmap_line::sx#8 bitmap_line::sx#7 bitmap_line::sx#9 Alias sgn_u16::w#1 = bitmap_line::$10 Alias sgn_u16::return#1 = sgn_u16::return#6 -Alias bitmap_line::sy#0 = bitmap_line::$11 bitmap_line::sy#10 bitmap_line::sy#5 -Alias bitmap_line::e1#0 = bitmap_line::$20 -Alias bitmap_line::e#0 = bitmap_line::$15 +Alias bitmap_line::sx#0 = bitmap_line::sx#8 bitmap_line::sx#7 bitmap_line::sx#9 +Alias bitmap_line::sy#0 = bitmap_line::sy#10 bitmap_line::sy#5 Alias bitmap_line::y#4 = bitmap_line::y#5 Alias bitmap_line::sy#1 = bitmap_line::sy#3 bitmap_line::sy#8 Alias bitmap_line::e#3 = bitmap_line::e#5 @@ -1209,7 +1192,6 @@ Alias memset::return#2 = memset::str#2 memset::return#4 memset::return#3 Alias memset::str#3 = memset::str#4 Alias memset::num#2 = memset::num#3 Alias memset::c#4 = memset::c#5 -Alias memset::end#0 = memset::$2 Alias memset::c#2 = memset::c#3 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -2870,6 +2852,7 @@ bitmap_line: { // bitmap_line::@5 __b5: // [82] bitmap_line::e#0 = bitmap_line::dx#0 >> 1 -- vwuz1=vwuz2_ror_1 + // Y is the driver lda.z dx+1 lsr sta.z e+1 @@ -2981,6 +2964,7 @@ bitmap_line: { // bitmap_line::@2 __b2: // [99] bitmap_line::e1#0 = bitmap_line::dy#0 >> 1 -- vwuz1=vwuz2_ror_1 + // X is the driver lda.z dy+1 lsr sta.z e1+1 @@ -3946,7 +3930,7 @@ bitmap_line: { .label y1 = 6 .label x2 = $f .label y2 = $11 - // abs_u16(x2-x1) + // unsigned int dx = abs_u16(x2-x1) // [63] abs_u16::w#0 = bitmap_line::x2#0 - bitmap_line::x1#0 -- vwuz1=vwuz2_minus_vwuz3 lda.z x2 sec @@ -3959,16 +3943,15 @@ bitmap_line: { // [114] phi from bitmap_line to abs_u16 [phi:bitmap_line->abs_u16] // [114] phi abs_u16::w#2 = abs_u16::w#0 [phi:bitmap_line->abs_u16#0] -- register_copy jsr abs_u16 - // abs_u16(x2-x1) + // unsigned int dx = abs_u16(x2-x1) // [65] abs_u16::return#0 = abs_u16::return#4 // bitmap_line::@12 - // unsigned int dx = abs_u16(x2-x1) // [66] bitmap_line::dx#0 = abs_u16::return#0 -- vwuz1=vwuz2 lda.z abs_u16.return sta.z dx lda.z abs_u16.return+1 sta.z dx+1 - // abs_u16(y2-y1) + // unsigned int dy = abs_u16(y2-y1) // [67] abs_u16::w#1 = bitmap_line::y2#0 - bitmap_line::y1#0 -- vwuz1=vwuz2_minus_vwuz3 lda.z y2 sec @@ -3981,10 +3964,9 @@ bitmap_line: { // [114] phi from bitmap_line::@12 to abs_u16 [phi:bitmap_line::@12->abs_u16] // [114] phi abs_u16::w#2 = abs_u16::w#1 [phi:bitmap_line::@12->abs_u16#0] -- register_copy jsr abs_u16 - // abs_u16(y2-y1) + // unsigned int dy = abs_u16(y2-y1) // [69] abs_u16::return#1 = abs_u16::return#4 // bitmap_line::@13 - // unsigned int dy = abs_u16(y2-y1) // [70] bitmap_line::dy#0 = abs_u16::return#1 // if(dx==0 && dy==0) // [71] if(bitmap_line::dx#0!=0) goto bitmap_line::@1 -- vwuz1_neq_0_then_la1 @@ -4000,7 +3982,7 @@ bitmap_line: { !__b4: // bitmap_line::@1 __b1: - // sgn_u16(x2-x1) + // unsigned int sx = sgn_u16(x2-x1) // [73] sgn_u16::w#0 = bitmap_line::x2#0 - bitmap_line::x1#0 -- vwuz1=vwuz2_minus_vwuz3 lda.z x2 sec @@ -4013,16 +3995,15 @@ bitmap_line: { // [121] phi from bitmap_line::@1 to sgn_u16 [phi:bitmap_line::@1->sgn_u16] // [121] phi sgn_u16::w#2 = sgn_u16::w#0 [phi:bitmap_line::@1->sgn_u16#0] -- register_copy jsr sgn_u16 - // sgn_u16(x2-x1) + // unsigned int sx = sgn_u16(x2-x1) // [75] sgn_u16::return#0 = sgn_u16::return#4 // bitmap_line::@14 - // unsigned int sx = sgn_u16(x2-x1) // [76] bitmap_line::sx#0 = sgn_u16::return#0 -- vwuz1=vwuz2 lda.z sgn_u16.return sta.z sx lda.z sgn_u16.return+1 sta.z sx+1 - // sgn_u16(y2-y1) + // unsigned int sy = sgn_u16(y2-y1) // [77] sgn_u16::w#1 = bitmap_line::y2#0 - bitmap_line::y1#0 -- vwuz1=vwuz2_minus_vwuz3 lda.z y2 sec @@ -4035,10 +4016,9 @@ bitmap_line: { // [121] phi from bitmap_line::@14 to sgn_u16 [phi:bitmap_line::@14->sgn_u16] // [121] phi sgn_u16::w#2 = sgn_u16::w#1 [phi:bitmap_line::@14->sgn_u16#0] -- register_copy jsr sgn_u16 - // sgn_u16(y2-y1) + // unsigned int sy = sgn_u16(y2-y1) // [79] sgn_u16::return#1 = sgn_u16::return#4 // bitmap_line::@15 - // unsigned int sy = sgn_u16(y2-y1) // [80] bitmap_line::sy#0 = sgn_u16::return#1 // if(dx > dy) // [81] if(bitmap_line::dx#0>bitmap_line::dy#0) goto bitmap_line::@2 -- vwuz1_gt_vwuz2_then_la1 @@ -4053,6 +4033,7 @@ bitmap_line: { // bitmap_line::@5 // unsigned int e = dx/2 // [82] bitmap_line::e#0 = bitmap_line::dx#0 >> 1 -- vwuz1=vwuz2_ror_1 + // Y is the driver lda.z dx+1 lsr sta.z e+1 @@ -4156,6 +4137,7 @@ bitmap_line: { __b2: // unsigned int e = dy/2 // [99] bitmap_line::e1#0 = bitmap_line::dy#0 >> 1 -- vwuz1=vwuz2_ror_1 + // X is the driver lda.z dy+1 lsr sta.z e1+1 diff --git a/src/test/ref/examples/c64/fastmultiply/fastmultiply8.asm b/src/test/ref/examples/c64/fastmultiply/fastmultiply8.asm index 8da72f4c0..d585c26b1 100644 --- a/src/test/ref/examples/c64/fastmultiply/fastmultiply8.asm +++ b/src/test/ref/examples/c64/fastmultiply/fastmultiply8.asm @@ -93,7 +93,7 @@ main: { bcc !+ inc.z at_2+1 !: - // fmul8(vals[i], vals[j]) + // signed char r = fmul8(vals[i], vals[j]) ldy.z i lda vals,y sta.z fmul8.aa @@ -101,7 +101,6 @@ main: { lda vals,y sta.z fmul8.bb jsr fmul8 - // signed char r = fmul8(vals[i], vals[j]) // print_schar_at(r, at) sta.z print_schar_at.b lda.z at_2 diff --git a/src/test/ref/examples/c64/fastmultiply/fastmultiply8.log b/src/test/ref/examples/c64/fastmultiply/fastmultiply8.log index 0fc1154a1..7f5d0d61c 100644 --- a/src/test/ref/examples/c64/fastmultiply/fastmultiply8.log +++ b/src/test/ref/examples/c64/fastmultiply/fastmultiply8.log @@ -4,6 +4,9 @@ Setting inferred volatile on symbol affected by address-of: fmul8::aa in asm { l Setting inferred volatile on symbol affected by address-of: fmul8::bb in asm { ldaaa staA1+1 eor#$ff staA2+1 ldxbb sec A1: ldamulf_sqr1,x A2: sbcmulf_sqr2,x stacc } Setting inferred volatile on symbol affected by address-of: fmul8::cc in asm { ldaaa staA1+1 eor#$ff staA2+1 ldxbb sec A1: ldamulf_sqr1,x A2: sbcmulf_sqr2,x stacc } Inlined call call __init +Eliminating unused variable with no statement memset::$2 +Eliminating unused variable with no statement main::$1 +Eliminating unused variable with no statement main::$5 CONTROL FLOW GRAPH SSA @@ -119,8 +122,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -152,8 +154,7 @@ main: scope:[main] from __start::@1 to:main::@6 main::@6: scope:[main] from main main::at_line#0 = (byte*)$400 - main::$1 = main::at_line#0 + 4 - main::at#0 = main::$1 + main::at#0 = main::at_line#0 + 4 main::k#0 = 0 to:main::@1 main::@1: scope:[main] from main::@6 main::@7 @@ -209,8 +210,7 @@ main::@9: scope:[main] from main::@4 main::j#4 = phi( main::@4/main::j#2 ) main::at#7 = phi( main::@4/main::at#3 ) fmul8::return#3 = phi( main::@4/fmul8::return#0 ) - main::$5 = fmul8::return#3 - main::r#0 = main::$5 + main::r#0 = fmul8::return#3 print_schar_at::b#3 = main::r#0 print_schar_at::at#2 = main::at#7 call print_schar_at @@ -338,9 +338,7 @@ byte init_screen::m#0 byte init_screen::m#1 byte init_screen::m#2 void main() -byte*~ main::$1 bool~ main::$3 -signed byte~ main::$5 bool~ main::$7 bool~ main::$8 byte* main::at @@ -391,7 +389,6 @@ signed byte main::r#0 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -508,7 +505,7 @@ Adding number conversion cast (unumber) print_uchar_at::$2 in print_uchar_at::$2 Adding number conversion cast (unumber) 1 in print_uchar_at::$3 = print_uchar_at::at#2 + 1 Adding number conversion cast (unumber) $3e8 in memset::num#0 = $3e8 Adding number conversion cast (unumber) 0 in memset::$0 = memset::num#1 > 0 -Adding number conversion cast (unumber) 4 in main::$1 = main::at_line#0 + 4 +Adding number conversion cast (unumber) 4 in main::at#0 = main::at_line#0 + 4 Adding number conversion cast (unumber) 4 in main::at#1 = main::at#5 + 4 Adding number conversion cast (unumber) $28 in main::at_line#1 = main::at_line#2 + $28 Adding number conversion cast (unumber) 4 in main::at#3 = main::at#6 + 4 @@ -573,12 +570,10 @@ Alias memset::return#1 = memset::str#1 memset::return#3 memset::return#2 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 Alias memset::str#4 = memset::str#5 -Alias main::at#0 = main::$1 Alias main::at#4 = main::at#5 Alias main::k#2 = main::k#3 Alias main::at_line#3 = main::at_line#5 main::at_line#7 @@ -589,7 +584,6 @@ Alias main::at#3 = main::at#7 main::at#8 Alias main::j#2 = main::j#4 main::j#3 Alias main::i#3 = main::i#7 main::i#5 main::i#4 Alias main::at_line#4 = main::at_line#8 main::at_line#9 main::at_line#6 -Alias main::r#0 = main::$5 Alias init_screen::COLS#2 = init_screen::COLS#4 Alias print_screen#0 = print_screen#7 print_screen#5 print_screen#3 print_screen#1 Successful SSA optimization Pass2AliasElimination @@ -2182,7 +2176,7 @@ main: { bcc !+ inc.z at_2+1 !: - // fmul8(vals[i], vals[j]) + // signed char r = fmul8(vals[i], vals[j]) // [17] fmul8::aa = vals[main::i#2] -- vbsz1=pbsc1_derefidx_vbuz2 ldy.z i lda vals,y @@ -2195,7 +2189,6 @@ main: { jsr fmul8 // [20] fmul8::return#0 = fmul8::return#2 // main::@7 - // signed char r = fmul8(vals[i], vals[j]) // [21] main::r#0 = fmul8::return#0 // print_schar_at(r, at) // [22] print_schar_at::b#3 = main::r#0 -- vbsz1=vbsaa diff --git a/src/test/ref/examples/c64/fire/fire.log b/src/test/ref/examples/c64/fire/fire.log index 74a511d80..f36204e9e 100644 --- a/src/test/ref/examples/c64/fire/fire.log +++ b/src/test/ref/examples/c64/fire/fire.log @@ -4,6 +4,8 @@ Inlined call main::$7 = call toD018 SCREEN1 CHARSET Inlined call main::$9 = call toD018 SCREEN2 CHARSET Inlined call fire::$12 = call sid_rnd Inlined call call __init +Eliminating unused variable with no statement fire::$7 +Eliminating unused variable with no statement makecharset::$2 CONTROL FLOW GRAPH SSA @@ -129,8 +131,7 @@ fire::@2: scope:[fire] from fire::@1 fire::$4 = fire::buffer#5[$28-1] + fire::buffer#5[$28-1] fire::$5 = fire::$4 + fire::buffer#5[$28] fire::$6 = fire::$5 + fire::buffer#5[$29] - fire::$7 = fire::$6 / 4 - fire::c#0 = fire::$7 + fire::c#0 = fire::$6 / 4 fire::$8 = fire::c#0 > 2 fire::$9 = ! fire::$8 if(fire::$9) goto fire::@4 @@ -213,8 +214,7 @@ makecharset::@2: scope:[makecharset] from makecharset::@1 to:makecharset::@1 makecharset::@3: scope:[makecharset] from makecharset::@1 makecharset::charset#3 = phi( makecharset::@1/makecharset::charset#2 ) - makecharset::$2 = makecharset::charset#3 + $40*8 - makecharset::font1#0 = makecharset::$2 + makecharset::font1#0 = makecharset::charset#3 + $40*8 to:makecharset::@4 makecharset::@4: scope:[makecharset] from makecharset::@3 makecharset::@5 makecharset::font1#2 = phi( makecharset::@3/makecharset::font1#0, makecharset::@5/makecharset::font1#1 ) @@ -414,7 +414,6 @@ bool~ fire::$3 byte~ fire::$4 byte~ fire::$5 byte~ fire::$6 -number~ fire::$7 bool~ fire::$8 bool~ fire::$9 byte* fire::buffer @@ -514,7 +513,6 @@ byte*~ makecharset::$14 word~ makecharset::$15 word~ makecharset::$16 word~ makecharset::$17 -byte*~ makecharset::$2 byte*~ makecharset::$3 bool~ makecharset::$4 bool~ makecharset::$5 @@ -629,8 +627,7 @@ Adding number conversion cast (unumber) $28-1 in fire::$4 = fire::buffer#5[$28-1 Adding number conversion cast (unumber) $28-1 in fire::$4 = fire::buffer#5[(unumber)$28-1] + fire::buffer#5[$28-1] Adding number conversion cast (unumber) $28 in fire::$5 = fire::$4 + fire::buffer#5[$28] Adding number conversion cast (unumber) $29 in fire::$6 = fire::$5 + fire::buffer#5[$29] -Adding number conversion cast (unumber) 4 in fire::$7 = fire::$6 / 4 -Adding number conversion cast (unumber) fire::$7 in fire::$7 = fire::$6 / (unumber)4 +Adding number conversion cast (unumber) 4 in fire::c#0 = fire::$6 / 4 Adding number conversion cast (unumber) 2 in fire::$8 = fire::c#0 > 2 Adding number conversion cast (unumber) $18*$28 in fire::$0 = fire::screenbase#3 + $18*$28 Adding number conversion cast (unumber) $18*$28 in fire::$1 = BUFFER + $18*$28 @@ -642,7 +639,7 @@ Adding number conversion cast (unumber) $30 in fire::$14 = $30 + fire::$13 Adding number conversion cast (unumber) fire::$14 in fire::$14 = (unumber)$30 + fire::$13 Adding number conversion cast (unumber) 1*8 in makecharset::$0 = makecharset::charset#2 + 1*8 Adding number conversion cast (unumber) 0 in *makecharset::font#3 = 0 -Adding number conversion cast (unumber) $40*8 in makecharset::$2 = makecharset::charset#3 + $40*8 +Adding number conversion cast (unumber) $40*8 in makecharset::font1#0 = makecharset::charset#3 + $40*8 Adding number conversion cast (unumber) $100*8 in makecharset::$3 = makecharset::charset#4 + $100*8 Adding number conversion cast (unumber) $ff in *makecharset::font1#3 = $ff Adding number conversion cast (unumber) $40 in makecharset::$5 = makecharset::c#2 < $40 @@ -744,15 +741,14 @@ Inferred type updated to word in main::toD0182_$1 = main::toD0182_$0 * 4 Inferred type updated to byte in main::toD0182_$4 = main::toD0182_$3 / 4 Inferred type updated to byte in main::toD0182_$5 = main::toD0182_$4 & $f Inferred type updated to byte in main::toD0182_$6 = main::toD0182_$2 | main::toD0182_$5 -Inferred type updated to byte in fire::$7 = fire::$6 / 4 Inferred type updated to byte in fire::$13 = fire::$12 / $10 Inferred type updated to byte in fire::$14 = $30 + fire::$13 Inferred type updated to byte in makecharset::$10 = makecharset::bc#4 - $40 Inferred type updated to byte in makecharset::$11 = makecharset::i#4 & 1 Inferred type updated to byte in makecharset::$12 = makecharset::ii#4 + makecharset::$11 Inferred type updated to byte in makecharset::$13 = makecharset::$12 & 7 -Inversing boolean not [73] fire::$9 = fire::c#0 <= 2 from [72] fire::$8 = fire::c#0 > 2 -Inversing boolean not [145] makecharset::$9 = makecharset::bc#1 <= $3f from [144] makecharset::$8 = makecharset::bc#1 > $3f +Inversing boolean not [72] fire::$9 = fire::c#0 <= 2 from [71] fire::$8 = fire::c#0 > 2 +Inversing boolean not [143] makecharset::$9 = makecharset::bc#1 <= $3f from [142] makecharset::$8 = makecharset::bc#1 > $3f Successful SSA optimization Pass2UnaryNotSimplification Alias main::toD0181_screen#0 = main::toD0181_screen#1 Alias main::toD0181_gfx#0 = main::toD0181_gfx#1 @@ -764,16 +760,15 @@ Alias fire::screen#0 = fire::screenbase#2 Alias fire::buffer#4 = fire::buffer#5 fire::buffer#9 Alias fire::screen#6 = fire::screen#9 fire::screen#7 Alias fire::screenbase#3 = fire::screenbase#6 fire::screenbase#4 fire::screenbase#7 -Alias fire::c#0 = fire::$7 fire::c#3 Alias fire::screen#1 = fire::$0 Alias fire::buffer#1 = fire::$1 +Alias fire::c#0 = fire::c#3 Alias fire::buffer#10 = fire::buffer#11 fire::buffer#7 fire::buffer#8 Alias fire::screen#10 = fire::screen#11 fire::screen#8 fire::screen#5 Alias fire::sid_rnd1_return#0 = fire::sid_rnd1_return#2 fire::sid_rnd1_return#1 fire::sid_rnd1_return#3 fire::$12 Alias makecharset::font#0 = makecharset::charset#1 Alias makecharset::font#2 = makecharset::font#3 Alias makecharset::charset#2 = makecharset::charset#6 makecharset::charset#3 -Alias makecharset::font1#0 = makecharset::$2 Alias makecharset::font1#2 = makecharset::font1#3 Alias makecharset::charset#17 = makecharset::charset#7 makecharset::charset#4 Alias makecharset::c#2 = makecharset::c#8 @@ -813,7 +808,7 @@ Identical Phi Values makecharset::charset#11 makecharset::charset#14 Successful SSA optimization Pass2IdenticalPhiElimination Identical Phi Values makecharset::charset#14 makecharset::charset#0 Successful SSA optimization Pass2IdenticalPhiElimination -Identified duplicate assignment right side [148] makecharset::$14 = makecharset::charset#0 + (byte)1*8 +Identified duplicate assignment right side [146] makecharset::$14 = makecharset::charset#0 + (byte)1*8 Successful SSA optimization Pass2DuplicateRValueIdentification Simple Condition fire::$3 [52] if(fire::buffer#4!=fire::$2) goto fire::@2 Simple Condition fire::$9 [58] if(fire::c#0<=2) goto fire::@4 diff --git a/src/test/ref/examples/c64/font-2x2/font-2x2.asm b/src/test/ref/examples/c64/font-2x2/font-2x2.asm index fe38c30be..61dad120e 100644 --- a/src/test/ref/examples/c64/font-2x2/font-2x2.asm +++ b/src/test/ref/examples/c64/font-2x2/font-2x2.asm @@ -40,7 +40,8 @@ main: { sta PROCPORT // asm cli - // font_compress(FONT_ORIGINAL, FONT_COMPRESSED, FONT_COMPRESSED_MAP) + // char size = font_compress(FONT_ORIGINAL, FONT_COMPRESSED, FONT_COMPRESSED_MAP) + // Compress the font finding identical characters jsr font_compress // *D018 = toD018(SCREEN, FONT_COMPRESSED) // Show compressed font @@ -260,11 +261,11 @@ font_compress: { lda #>FONT_ORIGINAL sta.z next_original+1 __b1: - // font_find(next_original, font_compressed, font_size) - jsr font_find - // font_find(next_original, font_compressed, font_size) - txa // char found = font_find(next_original, font_compressed, font_size) + // Look for the char in font_compressed + jsr font_find + // char found = font_find(next_original, font_compressed, font_size) + txa // if(found==0xff) cmp #$ff bne __b7 diff --git a/src/test/ref/examples/c64/font-2x2/font-2x2.log b/src/test/ref/examples/c64/font-2x2/font-2x2.log index e82672403..c6c8432c8 100644 --- a/src/test/ref/examples/c64/font-2x2/font-2x2.log +++ b/src/test/ref/examples/c64/font-2x2/font-2x2.log @@ -1,5 +1,10 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call main::$2 = call toD018 SCREEN FONT_COMPRESSED +Eliminating unused variable with no statement memset::$2 +Eliminating unused variable with no statement main::$1 +Eliminating unused variable with no statement show::$3 +Eliminating unused variable with no statement font_2x2::$0 +Eliminating unused variable with no statement font_compress::$0 CONTROL FLOW GRAPH SSA @@ -21,8 +26,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -150,8 +154,7 @@ show: scope:[show] from main::@2 show::$0 = show::$7 * $50 show::$1 = SCREEN + show::$0 show::$2 = show::x#1 * 2 - show::$3 = show::$1 + show::$2 - show::ptr#0 = show::$3 + show::ptr#0 = show::$1 + show::$2 show::ptr#0[0] = show::font_mapping#1[show::c#1] show::$4 = show::c#1 + $40 show::ptr#0[1] = show::font_mapping#1[show::$4] @@ -177,8 +180,7 @@ font_2x2::@1: scope:[font_2x2] from font_2x2 font_2x2::@10 font_2x2::next_original#4 = phi( font_2x2/font_2x2::next_original#0, font_2x2::@10/font_2x2::next_original#1 ) font_2x2::next_2x2#2 = phi( font_2x2/font_2x2::next_2x2#0, font_2x2::@10/font_2x2::next_2x2#1 ) font_2x2::next_2x2_left#0 = font_2x2::next_2x2#2 - font_2x2::$0 = font_2x2::next_2x2#2 + $40*8 - font_2x2::next_2x2_right#0 = font_2x2::$0 + font_2x2::next_2x2_right#0 = font_2x2::next_2x2#2 + $40*8 font_2x2::l2#0 = 0 font_2x2::l#0 = 0 to:font_2x2::@2 @@ -351,8 +353,7 @@ font_compress::@7: scope:[font_compress] from font_compress::@1 font_compress::i#4 = phi( font_compress::@1/font_compress::i#5 ) font_compress::compress_mapping#3 = phi( font_compress::@1/font_compress::compress_mapping#4 ) font_find::return#4 = phi( font_compress::@1/font_find::return#0 ) - font_compress::$0 = font_find::return#4 - font_compress::found#0 = font_compress::$0 + font_compress::found#0 = font_find::return#4 font_compress::$1 = font_compress::found#0 == $ff font_compress::$2 = ! font_compress::$1 if(font_compress::$2) goto font_compress::@2 @@ -519,7 +520,6 @@ constant const byte PROCPORT_RAM_CHARROM = 1 constant byte* const SCREEN = (byte*)$400 void __start() void font_2x2(byte* font_2x2::font_original , byte* font_2x2::font_2x2) -byte*~ font_2x2::$0 number~ font_2x2::$1 byte~ font_2x2::$10 number~ font_2x2::$11 @@ -655,7 +655,6 @@ byte* font_2x2::next_original#7 byte* font_2x2::next_original#8 byte* font_2x2::next_original#9 byte font_compress(byte* font_compress::font_original , byte* font_compress::font_compressed , byte* font_compress::compress_mapping) -byte~ font_compress::$0 bool~ font_compress::$1 bool~ font_compress::$2 bool~ font_compress::$3 @@ -843,7 +842,6 @@ byte main::y#5 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -881,7 +879,6 @@ void show(byte show::c , byte show::x , byte show::y , byte* show::font_mapping) number~ show::$0 byte*~ show::$1 number~ show::$2 -byte*~ show::$3 number~ show::$4 number~ show::$5 number~ show::$6 @@ -927,7 +924,7 @@ Adding number conversion cast (unumber) $28 in show::ptr#0[$28] = show::font_map Adding number conversion cast (unumber) $c0 in show::$6 = show::c#1 + $c0 Adding number conversion cast (unumber) show::$6 in show::$6 = show::c#1 + (unumber)$c0 Adding number conversion cast (unumber) $29 in show::ptr#0[$29] = show::font_mapping#1[show::$6] -Adding number conversion cast (unumber) $40*8 in font_2x2::$0 = font_2x2::next_2x2#2 + $40*8 +Adding number conversion cast (unumber) $40*8 in font_2x2::next_2x2_right#0 = font_2x2::next_2x2#2 + $40*8 Adding number conversion cast (unumber) $80 in font_2x2::$1 = font_2x2::glyph_bits#2 & $80 Adding number conversion cast (unumber) font_2x2::$1 in font_2x2::$1 = font_2x2::glyph_bits#2 & (unumber)$80 Adding number conversion cast (unumber) 0 in font_2x2::$22 = 0 != font_2x2::$1 @@ -1051,16 +1048,15 @@ Inferred type updated to byte in font_2x2::$1 = font_2x2::glyph_bits#2 & $80 Inferred type updated to byte in font_2x2::$11 = font_2x2::l2#3 + 1 Inferred type updated to byte in font_2x2::$14 = font_2x2::l2#3 + 1 Inversing boolean not [2] memset::$1 = memset::num#1 <= 0 from [1] memset::$0 = memset::num#1 > 0 -Inversing boolean not [138] font_2x2::$17 = font_2x2::l2#1 != 8 from [137] font_2x2::$16 = font_2x2::l2#1 == 8 -Inversing boolean not [172] font_compress::$2 = font_compress::found#0 != $ff from [171] font_compress::$1 = font_compress::found#0 == $ff -Inversing boolean not [207] font_find::$2 = font_find::glyph#1[font_find::l#2] == font_find::font#2[font_find::l#2] from [206] font_find::$1 = font_find::glyph#1[font_find::l#2] != font_find::font#2[font_find::l#2] -Inversing boolean not [217] font_find::$4 = 0 == font_find::found#2 from [216] font_find::$5 = 0 != font_find::found#2 +Inversing boolean not [135] font_2x2::$17 = font_2x2::l2#1 != 8 from [134] font_2x2::$16 = font_2x2::l2#1 == 8 +Inversing boolean not [168] font_compress::$2 = font_compress::found#0 != $ff from [167] font_compress::$1 = font_compress::found#0 == $ff +Inversing boolean not [203] font_find::$2 = font_find::glyph#1[font_find::l#2] == font_find::font#2[font_find::l#2] from [202] font_find::$1 = font_find::glyph#1[font_find::l#2] != font_find::font#2[font_find::l#2] +Inversing boolean not [213] font_find::$4 = 0 == font_find::found#2 from [212] font_find::$5 = 0 != font_find::found#2 Successful SSA optimization Pass2UnaryNotSimplification Alias memset::return#0 = memset::str#1 memset::return#3 memset::return#1 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -1072,11 +1068,9 @@ Alias main::c#2 = main::c#3 Alias main::x#2 = main::x#3 Alias main::y#2 = main::y#5 main::y#3 Alias main::c#1 = main::c#5 -Alias show::ptr#0 = show::$3 Alias font_2x2::next_original#0 = font_2x2::font_original#1 Alias font_2x2::next_2x2#0 = font_2x2::font_2x2#1 Alias font_2x2::next_2x2_left#0 = font_2x2::next_2x2#2 -Alias font_2x2::next_2x2_right#0 = font_2x2::$0 Alias font_2x2::glyph_bits_2x2#5 = font_2x2::glyph_bits_2x2#7 font_2x2::glyph_bits_2x2#6 Alias font_2x2::glyph_bits#2 = font_2x2::glyph_bits#4 font_2x2::glyph_bits#5 Alias font_2x2::b#3 = font_2x2::b#5 font_2x2::b#4 @@ -1111,7 +1105,6 @@ Alias font_compress::next_original#2 = font_compress::next_original#6 font_compr Alias font_compress::font_compressed#2 = font_compress::font_compressed#5 font_compress::font_compressed#7 Alias font_compress::font_size#2 = font_compress::font_size#7 font_compress::font_size#8 Alias font_compress::next_compressed#4 = font_compress::next_compressed#5 font_compress::next_compressed#6 -Alias font_compress::found#0 = font_compress::$0 Alias font_compress::next_compressed#2 = font_compress::next_compressed#3 Alias font_compress::font_size#3 = font_compress::font_size#6 font_compress::found#1 Alias font_compress::compress_mapping#2 = font_compress::compress_mapping#5 @@ -2366,6 +2359,7 @@ main: { // asm { cli } cli // [5] call font_compress + // Compress the font finding identical characters // [62] phi from main::@6 to font_compress [phi:main::@6->font_compress] font_compress_from___b6: jsr font_compress @@ -2735,6 +2729,7 @@ font_compress: { // [64] font_find::glyph#0 = font_compress::next_original#2 // [65] font_find::font_size#0 = font_compress::font_size#2 // [66] call font_find + // Look for the char in font_compressed // [106] phi from font_compress::@1 to font_find [phi:font_compress::@1->font_find] font_find_from___b1: jsr font_find @@ -3129,7 +3124,6 @@ Removing instruction __b3_from___b5: Removing instruction __b4_from___b3: Removing instruction __b5_from___b4: Removing instruction __b8_from___b6: -Removing instruction font_find_from___b1: Removing instruction __b3_from___b3: Removing instruction __b2_from___b4: Removing instruction __b2_from___b7: @@ -3153,6 +3147,7 @@ Removing instruction __b8_from___b7: Removing instruction __b9: Removing instruction __breturn: Removing instruction __b1_from_font_compress: +Removing instruction font_find_from___b1: Removing instruction __b5: Removing instruction __b3_from___b5: Removing instruction __b4: @@ -3187,7 +3182,7 @@ Removing instruction lda #8 Succesful ASM optimization Pass5UnnecesaryLoadElimination Removing instruction __breturn: Succesful ASM optimization Pass5UnusedLabelElimination -Fixing long branch [193] bne __b1 to beq +Fixing long branch [194] bne __b1 to beq FINAL SYMBOL TABLE constant byte* const CHARGEN = (byte*) 53248 @@ -3438,8 +3433,9 @@ main: { // asm // asm { cli } cli - // font_compress(FONT_ORIGINAL, FONT_COMPRESSED, FONT_COMPRESSED_MAP) + // char size = font_compress(FONT_ORIGINAL, FONT_COMPRESSED, FONT_COMPRESSED_MAP) // [5] call font_compress + // Compress the font finding identical characters // [62] phi from main::@6 to font_compress [phi:main::@6->font_compress] jsr font_compress // [6] phi from main::@6 to main::toD0181 [phi:main::@6->main::toD0181] @@ -3784,17 +3780,17 @@ font_compress: { sta.z next_original+1 // font_compress::@1 __b1: - // font_find(next_original, font_compressed, font_size) + // char found = font_find(next_original, font_compressed, font_size) // [64] font_find::glyph#0 = font_compress::next_original#2 // [65] font_find::font_size#0 = font_compress::font_size#2 // [66] call font_find + // Look for the char in font_compressed // [106] phi from font_compress::@1 to font_find [phi:font_compress::@1->font_find] jsr font_find - // font_find(next_original, font_compressed, font_size) + // char found = font_find(next_original, font_compressed, font_size) // [67] font_find::return#0 = font_find::return#3 -- vbuaa=vbuxx txa // font_compress::@5 - // char found = font_find(next_original, font_compressed, font_size) // [68] font_compress::found#0 = font_find::return#0 // if(found==0xff) // [69] if(font_compress::found#0!=$ff) goto font_compress::@7 -- vbuaa_neq_vbuc1_then_la1 diff --git a/src/test/ref/examples/c64/kernalload/kernalload.asm b/src/test/ref/examples/c64/kernalload/kernalload.asm index a842a491c..8df7ce85e 100644 --- a/src/test/ref/examples/c64/kernalload/kernalload.asm +++ b/src/test/ref/examples/c64/kernalload/kernalload.asm @@ -34,9 +34,9 @@ .segment Code main: { .const toSpritePtr1_return = LOAD_SPRITE/$40 - // loadFileToMemory(8, "SPRITE", LOAD_SPRITE) - jsr loadFileToMemory // char status = loadFileToMemory(8, "SPRITE", LOAD_SPRITE) + // Load sprite file into memory + jsr loadFileToMemory tax // if(status!=0xff) cpx #$ff diff --git a/src/test/ref/examples/c64/kernalload/kernalload.log b/src/test/ref/examples/c64/kernalload/kernalload.log index 6134ad77f..966dbeea3 100644 --- a/src/test/ref/examples/c64/kernalload/kernalload.log +++ b/src/test/ref/examples/c64/kernalload/kernalload.log @@ -8,6 +8,7 @@ Setting inferred volatile on symbol affected by address-of: load::verify in asm Setting inferred volatile on symbol affected by address-of: load::status in asm { ldxaddress ldyaddress+1 ldaverify jsr$ffd5 bcserror lda#$ff error: stastatus } Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call main::$3 = call toSpritePtr LOAD_SPRITE +Eliminating unused variable with no statement main::$0 CONTROL FLOW GRAPH SSA @@ -48,8 +49,7 @@ main: scope:[main] from __start to:main::@4 main::@4: scope:[main] from main loadFileToMemory::return#3 = phi( main/loadFileToMemory::return#0 ) - main::$0 = loadFileToMemory::return#3 - main::status#0 = main::$0 + main::status#0 = loadFileToMemory::return#3 main::$1 = main::status#0 != $ff main::$2 = ! main::$1 if(main::$2) goto main::@1 @@ -225,7 +225,6 @@ byte loadFileToMemory::return#2 byte loadFileToMemory::return#3 byte loadFileToMemory::return#4 void main() -byte~ main::$0 bool~ main::$1 bool~ main::$2 byte~ main::$3 @@ -327,15 +326,15 @@ Finalized unsigned number type (byte) 2 Finalized unsigned number type (byte) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to word in main::toSpritePtr1_$0 = main::toSpritePtr1_$1 / $40 -Inversing boolean not [22] main::$2 = main::status#0 == $ff from [21] main::$1 = main::status#0 != $ff +Inversing boolean not [21] main::$2 = main::status#0 == $ff from [20] main::$1 = main::status#0 != $ff Successful SSA optimization Pass2UnaryNotSimplification Alias candidate removed (volatile)load::return#1 = load::status load::return#4 load::return#2 Alias strlen::len#2 = strlen::len#4 strlen::len#3 strlen::return#0 strlen::return#3 strlen::return#1 Alias strlen::str#2 = strlen::str#3 Alias loadFileToMemory::return#0 = loadFileToMemory::return#3 -Alias main::status#0 = main::$0 main::status#1 Alias main::toSpritePtr1_sprite#0 = main::toSpritePtr1_sprite#1 Alias main::toSpritePtr1_return#0 = main::toSpritePtr1_return#2 main::toSpritePtr1_return#1 main::toSpritePtr1_return#3 main::$3 +Alias main::status#0 = main::status#1 Alias loadFileToMemory::device#1 = loadFileToMemory::device#2 Alias loadFileToMemory::address#1 = loadFileToMemory::address#2 loadFileToMemory::address#3 Alias load::return#0 = load::return#3 @@ -765,6 +764,7 @@ ASSEMBLER BEFORE OPTIMIZATION main: { .const toSpritePtr1_return = LOAD_SPRITE/$40 // [1] call loadFileToMemory + // Load sprite file into memory jsr loadFileToMemory // [2] loadFileToMemory::return#0 = loadFileToMemory::return#1 jmp __b4 @@ -1185,12 +1185,12 @@ Score: 720 // main main: { .const toSpritePtr1_return = LOAD_SPRITE/$40 - // loadFileToMemory(8, "SPRITE", LOAD_SPRITE) + // char status = loadFileToMemory(8, "SPRITE", LOAD_SPRITE) // [1] call loadFileToMemory + // Load sprite file into memory jsr loadFileToMemory // [2] loadFileToMemory::return#0 = loadFileToMemory::return#1 // main::@4 - // char status = loadFileToMemory(8, "SPRITE", LOAD_SPRITE) // [3] main::status#0 = loadFileToMemory::return#0 -- vbuxx=vbuaa tax // if(status!=0xff) diff --git a/src/test/ref/examples/c64/krillload/krillload.asm b/src/test/ref/examples/c64/krillload/krillload.asm index 2be080827..32e94c648 100644 --- a/src/test/ref/examples/c64/krillload/krillload.asm +++ b/src/test/ref/examples/c64/krillload/krillload.asm @@ -34,9 +34,9 @@ .segment Code main: { .const toSpritePtr1_return = $ff&SPRITE/$40 - // krill_install() - jsr krill_install // char status = krill_install() + // Install the Krill drive code + jsr krill_install // if(status!=KRILL_OK) cmp #KRILL_OK beq __b1 diff --git a/src/test/ref/examples/c64/krillload/krillload.log b/src/test/ref/examples/c64/krillload/krillload.log index 41116b835..3ed1d6186 100644 --- a/src/test/ref/examples/c64/krillload/krillload.log +++ b/src/test/ref/examples/c64/krillload/krillload.log @@ -1,6 +1,7 @@ Loading link script "krillload.ld" Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call main::$6 = call toSpritePtr SPRITE +Eliminating unused variable with no statement main::$0 CONTROL FLOW GRAPH SSA @@ -35,8 +36,7 @@ main: scope:[main] from __start to:main::@6 main::@6: scope:[main] from main krill_install::return#4 = phi( main/krill_install::return#2 ) - main::$0 = krill_install::return#4 - main::status#0 = main::$0 + main::status#0 = krill_install::return#4 main::$1 = main::status#0 != KRILL_OK main::$2 = ! main::$1 if(main::$2) goto main::@1 @@ -145,7 +145,6 @@ byte krill_loadraw::return#3 byte krill_loadraw::return#4 constant byte* const krill_loadraw::status = (byte*)$ff void main() -byte~ main::$0 bool~ main::$1 bool~ main::$2 byte~ main::$3 @@ -216,13 +215,12 @@ Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) 2 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to word in main::toSpritePtr1_$0 = main::toSpritePtr1_$1 / $40 -Inversing boolean not [18] main::$2 = main::status#0 == KRILL_OK from [17] main::$1 = main::status#0 != KRILL_OK -Inversing boolean not [27] main::$5 = main::status#1 == KRILL_OK from [26] main::$4 = main::status#1 != KRILL_OK +Inversing boolean not [17] main::$2 = main::status#0 == KRILL_OK from [16] main::$1 = main::status#0 != KRILL_OK +Inversing boolean not [26] main::$5 = main::status#1 == KRILL_OK from [25] main::$4 = main::status#1 != KRILL_OK Successful SSA optimization Pass2UnaryNotSimplification Alias krill_install::return#0 = krill_install::return#3 krill_install::return#1 Alias krill_loadraw::return#0 = krill_loadraw::return#3 krill_loadraw::return#1 Alias krill_install::return#2 = krill_install::return#4 -Alias main::status#0 = main::$0 Alias krill_loadraw::return#2 = krill_loadraw::return#4 Alias main::status#1 = main::$3 Alias main::toSpritePtr1_sprite#0 = main::toSpritePtr1_sprite#1 @@ -464,6 +462,7 @@ ASSEMBLER BEFORE OPTIMIZATION main: { .const toSpritePtr1_return = $ff&SPRITE/$40 // [1] call krill_install + // Install the Krill drive code jsr krill_install // [2] krill_install::return#2 = krill_install::return#0 jmp __b6 @@ -743,12 +742,12 @@ Score: 130 // main main: { .const toSpritePtr1_return = $ff&SPRITE/$40 - // krill_install() + // char status = krill_install() // [1] call krill_install + // Install the Krill drive code jsr krill_install // [2] krill_install::return#2 = krill_install::return#0 // main::@6 - // char status = krill_install() // [3] main::status#0 = krill_install::return#2 // if(status!=KRILL_OK) // [4] if(main::status#0==KRILL_OK) goto main::@1 -- vbuaa_eq_vbuc1_then_la1 diff --git a/src/test/ref/examples/c64/multiplexer/simple-multiplexer.log b/src/test/ref/examples/c64/multiplexer/simple-multiplexer.log index eeffdbb8e..f2474633b 100644 --- a/src/test/ref/examples/c64/multiplexer/simple-multiplexer.log +++ b/src/test/ref/examples/c64/multiplexer/simple-multiplexer.log @@ -2,8 +2,10 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call plexSetScreen plexInit::screen Inlined call call plexFreePrepare Inlined call call plexFreeAdd plexShowSprite::ypos -Inlined call loop::$7 = call plexFreeNextYpos +Inlined call loop::rasterY = call plexFreeNextYpos Inlined call call __init +Eliminating unused variable with no statement plexShowSprite::$0 +Eliminating unused variable with no statement loop::$7 CONTROL FLOW GRAPH SSA @@ -100,8 +102,7 @@ plexSort::@return: scope:[plexSort] from plexSort::plexFreePrepare1_@2 void plexShowSprite() plexShowSprite: scope:[plexShowSprite] from loop::@10 - plexShowSprite::$0 = plex_sprite_idx * 2 - plexShowSprite::plex_sprite_idx2#0 = plexShowSprite::$0 + plexShowSprite::plex_sprite_idx2#0 = plex_sprite_idx * 2 plexShowSprite::ypos#0 = PLEX_YPOS[PLEX_SORTED_IDX[plex_show_idx]] SPRITES_YPOS[plexShowSprite::plex_sprite_idx2#0] = plexShowSprite::ypos#0 plexShowSprite::plexFreeAdd1_ypos#0 = plexShowSprite::ypos#0 @@ -269,8 +270,7 @@ loop::@12: scope:[loop] from loop::plexFreeNextYpos1_@return loop::sin_idx#11 = phi( loop::plexFreeNextYpos1_@return/loop::sin_idx#12 ) loop::ss#5 = phi( loop::plexFreeNextYpos1_@return/loop::ss#6 ) loop::plexFreeNextYpos1_return#3 = phi( loop::plexFreeNextYpos1_@return/loop::plexFreeNextYpos1_return#1 ) - loop::$7 = loop::plexFreeNextYpos1_return#3 - loop::rasterY#0 = loop::$7 + loop::rasterY#0 = loop::plexFreeNextYpos1_return#3 to:loop::@9 loop::@9: scope:[loop] from loop::@12 loop::@9 loop::sin_idx#10 = phi( loop::@12/loop::sin_idx#11, loop::@9/loop::sin_idx#10 ) @@ -377,7 +377,6 @@ bool~ loop::$11 bool~ loop::$2 byte~ loop::$5 bool~ loop::$6 -byte~ loop::$7 bool~ loop::$8 byte loop::plexFreeNextYpos1_return byte loop::plexFreeNextYpos1_return#0 @@ -439,7 +438,6 @@ byte* plexInit::screen byte* plexInit::screen#0 byte* plexInit::screen#1 void plexShowSprite() -number~ plexShowSprite::$0 byte~ plexShowSprite::$10 byte~ plexShowSprite::$2 bool~ plexShowSprite::$3 @@ -518,8 +516,7 @@ Adding number conversion cast (unumber) 0 in plex_sprite_idx = 0 Adding number conversion cast (unumber) 1 in plex_sprite_msb = 1 Adding number conversion cast (unumber) 0 in PLEX_FREE_YPOS[plexSort::plexFreePrepare1_s#2] = 0 Adding number conversion cast (unumber) 0 in plex_free_next = 0 -Adding number conversion cast (unumber) 2 in plexShowSprite::$0 = plex_sprite_idx * 2 -Adding number conversion cast (unumber) plexShowSprite::$0 in plexShowSprite::$0 = plex_sprite_idx * (unumber)2 +Adding number conversion cast (unumber) 2 in plexShowSprite::plex_sprite_idx2#0 = plex_sprite_idx * 2 Adding number conversion cast (unumber) $16 in plexShowSprite::plexFreeAdd1_$0 = plexShowSprite::plexFreeAdd1_ypos#1 + $16 Adding number conversion cast (unumber) plexShowSprite::plexFreeAdd1_$0 in plexShowSprite::plexFreeAdd1_$0 = plexShowSprite::plexFreeAdd1_ypos#1 + (unumber)$16 Adding number conversion cast (unumber) 1 in plexShowSprite::plexFreeAdd1_$1 = plex_free_next + 1 @@ -640,7 +637,6 @@ Finalized unsigned number type (word) $3f8 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in plexSort::$1 = plexSort::m#2 + 1 Inferred type updated to byte in plexSort::$4 = plexSort::s#3 + 1 -Inferred type updated to byte in plexShowSprite::$0 = plex_sprite_idx * 2 Inferred type updated to byte in plexShowSprite::plexFreeAdd1_$0 = plexShowSprite::plexFreeAdd1_ypos#1 + $16 Inferred type updated to byte in plexShowSprite::plexFreeAdd1_$1 = plex_free_next + 1 Inferred type updated to byte in plexShowSprite::plexFreeAdd1_$2 = plexShowSprite::plexFreeAdd1_$1 & 7 @@ -648,7 +644,7 @@ Inferred type updated to byte in plexShowSprite::$8 = $ff ^ plex_sprite_msb Inferred type updated to byte in plexShowSprite::$4 = plex_sprite_idx + 1 Inferred type updated to byte in plexShowSprite::$5 = plexShowSprite::$4 & 7 Inversing boolean not [18] plexSort::$3 = plexSort::nxt_y#0 >= PLEX_YPOS[PLEX_SORTED_IDX[plexSort::m#2]] from [17] plexSort::$2 = plexSort::nxt_y#0 < PLEX_YPOS[PLEX_SORTED_IDX[plexSort::m#2]] -Inversing boolean not [77] plexShowSprite::$7 = plex_sprite_msb != 0 from [76] plexShowSprite::$6 = plex_sprite_msb == 0 +Inversing boolean not [76] plexShowSprite::$7 = plex_sprite_msb != 0 from [75] plexShowSprite::$6 = plex_sprite_msb == 0 Successful SSA optimization Pass2UnaryNotSimplification Alias candidate removed (volatile)PLEX_SCREEN_PTR = plexInit::plexSetScreen1_$0 Alias candidate removed (volatile)plex_free_next = plexShowSprite::plexFreeAdd1_$2 @@ -660,15 +656,15 @@ Alias plexSort::nxt_idx#0 = plexSort::nxt_idx#3 Alias plexSort::s#1 = plexSort::s#4 Alias plexSort::nxt_idx#1 = plexSort::nxt_idx#2 Alias plexSort::m#5 = plexSort::m#6 -Alias plexShowSprite::plex_sprite_idx2#0 = plexShowSprite::$0 plexShowSprite::plex_sprite_idx2#2 plexShowSprite::plex_sprite_idx2#1 Alias plexShowSprite::plexFreeAdd1_ypos#0 = plexShowSprite::ypos#0 plexShowSprite::plexFreeAdd1_ypos#1 +Alias plexShowSprite::plex_sprite_idx2#0 = plexShowSprite::plex_sprite_idx2#2 plexShowSprite::plex_sprite_idx2#1 Alias loop::sin_idx#2 = loop::sin_idx#4 loop::y_idx#0 Alias loop::sin_idx#3 = loop::sin_idx#5 Alias loop::sin_idx#1 = loop::sin_idx#17 Alias loop::sin_idx#15 = loop::sin_idx#16 Alias loop::ss#5 = loop::ss#7 loop::ss#8 loop::ss#6 Alias loop::sin_idx#11 = loop::sin_idx#13 loop::sin_idx#14 loop::sin_idx#12 -Alias loop::plexFreeNextYpos1_return#0 = loop::plexFreeNextYpos1_return#2 loop::plexFreeNextYpos1_return#1 loop::plexFreeNextYpos1_return#3 loop::$7 loop::rasterY#0 +Alias loop::plexFreeNextYpos1_return#0 = loop::plexFreeNextYpos1_return#2 loop::plexFreeNextYpos1_return#1 loop::plexFreeNextYpos1_return#3 loop::rasterY#0 Alias loop::ss#2 = loop::ss#3 loop::ss#4 Alias loop::sin_idx#10 = loop::sin_idx#9 loop::sin_idx#8 loop::sin_idx#7 Successful SSA optimization Pass2AliasElimination @@ -689,7 +685,7 @@ Successful SSA optimization Pass2IdenticalPhiElimination Identical Phi Values plexSort::m#3 plexSort::m#2 Identical Phi Values loop::sin_idx#11 loop::sin_idx#1 Successful SSA optimization Pass2IdenticalPhiElimination -Identified duplicate assignment right side [64] plexShowSprite::$10 = plexShowSprite::xpos_idx#0 * SIZEOF_WORD +Identified duplicate assignment right side [63] plexShowSprite::$10 = plexShowSprite::xpos_idx#0 * SIZEOF_WORD Successful SSA optimization Pass2DuplicateRValueIdentification Simple Condition plexInit::$1 [8] if(plexInit::i#1!=rangelast(0,PLEX_COUNT-1)) goto plexInit::@1 Simple Condition plexSort::$3 [16] if(plexSort::nxt_y#0>=PLEX_YPOS[PLEX_SORTED_IDX[plexSort::m#2]]) goto plexSort::@2 diff --git a/src/test/ref/examples/c64/scrollbig/scrollbig.asm b/src/test/ref/examples/c64/scrollbig/scrollbig.asm index dc2469ea2..bc5eb1f32 100644 --- a/src/test/ref/examples/c64/scrollbig/scrollbig.asm +++ b/src/test/ref/examples/c64/scrollbig/scrollbig.asm @@ -116,10 +116,9 @@ scroll_bit: { // if(current_bit==0) lda.z current_bit bne __b1 - // next_char() + // unsigned int c = next_char() jsr next_char txa - // unsigned int c = next_char() sta.z c lda #0 sta.z c+1 diff --git a/src/test/ref/examples/c64/scrollbig/scrollbig.log b/src/test/ref/examples/c64/scrollbig/scrollbig.log index 3c755d6c7..26245b79b 100644 --- a/src/test/ref/examples/c64/scrollbig/scrollbig.log +++ b/src/test/ref/examples/c64/scrollbig/scrollbig.log @@ -1,5 +1,7 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call __init +Eliminating unused variable with no statement scroll_bit::$5 +Eliminating unused variable with no statement scroll_bit::$6 CONTROL FLOW GRAPH SSA @@ -137,8 +139,7 @@ scroll_bit::@7: scope:[scroll_bit] from scroll_bit::@1 asm { sei } *PROCPORT = $32 scroll_bit::$4 = SCREEN + $28 - scroll_bit::$5 = scroll_bit::$4 + $27 - scroll_bit::sc#0 = scroll_bit::$5 + scroll_bit::sc#0 = scroll_bit::$4 + $27 scroll_bit::r#0 = 0 to:scroll_bit::@3 scroll_bit::@2: scope:[scroll_bit] from scroll_bit @@ -149,9 +150,8 @@ scroll_bit::@2: scope:[scroll_bit] from scroll_bit scroll_bit::@8: scope:[scroll_bit] from scroll_bit::@2 nxt#16 = phi( scroll_bit::@2/nxt#8 ) next_char::return#3 = phi( scroll_bit::@2/next_char::return#0 ) - scroll_bit::$6 = next_char::return#3 + scroll_bit::c#0 = next_char::return#3 nxt#4 = nxt#16 - scroll_bit::c#0 = scroll_bit::$6 scroll_bit::$7 = scroll_bit::c#0 * 8 scroll_bit::$8 = CHARGEN + scroll_bit::$7 current_chargen#4 = scroll_bit::$8 @@ -531,8 +531,6 @@ byte*~ scroll_bit::$12 bool~ scroll_bit::$13 bool~ scroll_bit::$2 byte*~ scroll_bit::$4 -byte*~ scroll_bit::$5 -byte~ scroll_bit::$6 number~ scroll_bit::$7 byte*~ scroll_bit::$8 byte~ scroll_bit::$9 @@ -601,7 +599,7 @@ Adding number conversion cast (unumber) scroll_bit::$0 in scroll_bit::$0 = curre Adding number conversion cast (unumber) 0 in scroll_bit::$1 = current_bit#4 == 0 Adding number conversion cast (unumber) $32 in *PROCPORT = $32 Adding number conversion cast (unumber) $28 in scroll_bit::$4 = SCREEN + $28 -Adding number conversion cast (unumber) $27 in scroll_bit::$5 = scroll_bit::$4 + $27 +Adding number conversion cast (unumber) $27 in scroll_bit::sc#0 = scroll_bit::$4 + $27 Adding number conversion cast (unumber) 8 in scroll_bit::$7 = scroll_bit::c#0 * 8 Adding number conversion cast (unumber) scroll_bit::$7 in scroll_bit::$7 = scroll_bit::c#0 * (unumber)8 Adding number conversion cast (unumber) $80 in current_bit#5 = $80 @@ -726,8 +724,8 @@ Inferred type updated to byte in scroll_hard::$21 = scroll_hard::i#3 + 1 Inferred type updated to byte in scroll_hard::$24 = scroll_hard::i#3 + 1 Inversing boolean not [30] scroll_soft::$1 = scroll#2 != $ff from [29] scroll_soft::$0 = scroll#2 == $ff Inversing boolean not [51] scroll_bit::$2 = current_bit#4 != 0 from [50] scroll_bit::$1 = current_bit#4 == 0 -Inversing boolean not [78] scroll_bit::$11 = scroll_bit::$9 == 0 from [77] scroll_bit::$10 = scroll_bit::$9 != 0 -Inversing boolean not [100] next_char::$1 = next_char::c#0 != 0 from [99] next_char::$0 = next_char::c#0 == 0 +Inversing boolean not [76] scroll_bit::$11 = scroll_bit::$9 == 0 from [75] scroll_bit::$10 = scroll_bit::$9 != 0 +Inversing boolean not [98] next_char::$1 = next_char::c#0 != 0 from [97] next_char::$0 = next_char::c#0 == 0 Successful SSA optimization Pass2UnaryNotSimplification Alias scroll#20 = scroll#21 Alias current_bit#31 = current_bit#32 @@ -756,11 +754,9 @@ Alias current_bit#4 = scroll_bit::$0 Alias current_chargen#21 = current_chargen#26 Alias current_bit#23 = current_bit#28 Alias nxt#37 = nxt#39 -Alias scroll_bit::sc#0 = scroll_bit::$5 Alias nxt#26 = nxt#31 Alias next_char::return#0 = next_char::return#3 Alias nxt#16 = nxt#4 -Alias scroll_bit::c#0 = scroll_bit::$6 Alias current_chargen#4 = scroll_bit::$8 Alias scroll_bit::sc#1 = scroll_bit::$12 Alias scroll_bit::sc#3 = scroll_bit::sc#4 @@ -2190,13 +2186,12 @@ scroll_bit: { bne __b1 // [23] phi from scroll_bit to scroll_bit::@2 [phi:scroll_bit->scroll_bit::@2] // scroll_bit::@2 - // next_char() + // unsigned int c = next_char() // [24] call next_char jsr next_char // [25] next_char::return#0 = next_char::return#1 -- vbuaa=vbuxx txa // scroll_bit::@8 - // unsigned int c = next_char() // [26] scroll_bit::c#0 = next_char::return#0 -- vwuz1=vbuaa sta.z c lda #0 diff --git a/src/test/ref/examples/c64/showlogo/showlogo.log b/src/test/ref/examples/c64/showlogo/showlogo.log index 1cc61eb0d..b3eca9110 100644 --- a/src/test/ref/examples/c64/showlogo/showlogo.log +++ b/src/test/ref/examples/c64/showlogo/showlogo.log @@ -1,6 +1,7 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call main::$0 = call toD018 SCREEN LOGO Inlined call call __init +Eliminating unused variable with no statement memset::$2 CONTROL FLOW GRAPH SSA @@ -22,8 +23,7 @@ memset::@2: scope:[memset] from memset memset::num#3 = phi( memset/memset::num#2 ) memset::str#3 = phi( memset/memset::str#4 ) memset::$4 = (byte*)memset::str#3 - memset::$2 = memset::$4 + memset::num#3 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#3 memset::dst#0 = ((byte*)) memset::str#3 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -180,7 +180,6 @@ byte* main::toD0181_screen#1 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -273,7 +272,6 @@ Alias memset::return#0 = memset::str#2 memset::return#4 memset::return#1 Alias memset::str#3 = memset::str#4 Alias memset::num#2 = memset::num#3 Alias memset::c#4 = memset::c#5 -Alias memset::end#0 = memset::$2 Alias memset::c#2 = memset::c#3 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 diff --git a/src/test/ref/examples/cx16/cx16-rasterbars.log b/src/test/ref/examples/cx16/cx16-rasterbars.log index a0b062020..c33ef33e2 100644 --- a/src/test/ref/examples/cx16/cx16-rasterbars.log +++ b/src/test/ref/examples/cx16/cx16-rasterbars.log @@ -9,6 +9,8 @@ Setting inferred volatile on symbol affected by address-of: getin::ch in asm { j Inlined call call SEI Inlined call call CLI Inlined call call __init +Eliminating unused variable with no statement memset::$2 +Eliminating unused variable with no statement irq_line::$10 CONTROL FLOW GRAPH SSA @@ -30,8 +32,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -168,8 +169,7 @@ irq_line::@13: scope:[irq_line] from irq_line::@18 irq_line::@19 irq_line::@14: scope:[irq_line] from irq_line::@13 irq_line::b#5 = phi( irq_line::@13/irq_line::b#2 ) irq_line::idx#2 = phi( irq_line::@13/irq_line::idx#4 ) - irq_line::$10 = BARS + SIN[irq_line::idx#2] - irq_line::bar#0 = irq_line::$10 + irq_line::bar#0 = BARS + SIN[irq_line::idx#2] irq_line::i2#0 = 0 to:irq_line::@16 irq_line::@15: scope:[irq_line] from irq_line::@13 @@ -246,7 +246,6 @@ volatile byte hstop loadstore __interrupt(rom_min_cx16) void irq_line() bool~ irq_line::$0 bool~ irq_line::$1 -byte*~ irq_line::$10 word~ irq_line::$11 bool~ irq_line::$12 word~ irq_line::$2 @@ -306,7 +305,6 @@ void main() void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -398,14 +396,13 @@ Finalized unsigned number type (byte) 8 Finalized unsigned number type (byte) $d Successful SSA optimization PassNFinalizeNumberTypeConversions Inversing boolean not [2] memset::$1 = memset::num#1 <= 0 from [1] memset::$0 = memset::num#1 > 0 -Inversing boolean not [41] irq_line::$1 = cnt != 0 from [40] irq_line::$0 = cnt == 0 -Inversing boolean not [70] irq_line::$8 = hstart > (byte)$140/4 from [69] irq_line::$7 = hstart <= (byte)$140/4 +Inversing boolean not [40] irq_line::$1 = cnt != 0 from [39] irq_line::$0 = cnt == 0 +Inversing boolean not [69] irq_line::$8 = hstart > (byte)$140/4 from [68] irq_line::$7 = hstart <= (byte)$140/4 Successful SSA optimization Pass2UnaryNotSimplification Alias memset::return#0 = memset::str#1 memset::return#3 memset::return#1 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -418,7 +415,6 @@ Alias irq_line::l#4 = irq_line::l#7 irq_line::l#5 Alias memset::num#0 = irq_line::$2 Alias irq_line::idx#2 = irq_line::idx#4 Alias irq_line::b#2 = irq_line::b#5 -Alias irq_line::bar#0 = irq_line::$10 Alias irq_line::i2#2 = irq_line::i2#3 Alias irq_line::bar#1 = irq_line::bar#2 Alias irq_line::idx#3 = irq_line::idx#6 irq_line::idx#5 diff --git a/src/test/ref/examples/helloworld/helloworld.asm b/src/test/ref/examples/helloworld/helloworld.asm index e5f54a73e..26951653c 100644 --- a/src/test/ref/examples/helloworld/helloworld.asm +++ b/src/test/ref/examples/helloworld/helloworld.asm @@ -90,12 +90,11 @@ gotoxy: { sta.z conio_cursor_x // conio_cursor_y = y stx.z conio_cursor_y - // (unsigned int)y*CONIO_WIDTH + // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH txa sta.z __7 lda #0 sta.z __7+1 - // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH lda.z __7 asl sta.z __8 diff --git a/src/test/ref/examples/helloworld/helloworld.log b/src/test/ref/examples/helloworld/helloworld.log index 9a41efe46..b1ed0bd9b 100644 --- a/src/test/ref/examples/helloworld/helloworld.log +++ b/src/test/ref/examples/helloworld/helloworld.log @@ -5,6 +5,9 @@ Fixing struct type SIZE_OF struct printf_buffer_number to 12 Fixing struct type SIZE_OF struct printf_buffer_number to 12 Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call __init +Eliminating unused variable with no statement memcpy::$0 +Eliminating unused variable with no statement memset::$2 +Eliminating unused variable with no statement gotoxy::$4 Eliminating unused variable with no statement printf_buffer Eliminating unused variable with no statement main::$0 @@ -18,8 +21,7 @@ memcpy: scope:[memcpy] from cscroll::@3 cscroll::@4 memcpy::src#0 = ((byte*)) memcpy::source#2 memcpy::dst#0 = ((byte*)) memcpy::destination#2 memcpy::$2 = (byte*)memcpy::source#2 - memcpy::$0 = memcpy::$2 + memcpy::num#2 - memcpy::src_end#0 = memcpy::$0 + memcpy::src_end#0 = memcpy::$2 + memcpy::num#2 to:memcpy::@1 memcpy::@1: scope:[memcpy] from memcpy memcpy::@2 memcpy::destination#4 = phi( memcpy/memcpy::destination#2, memcpy::@2/memcpy::destination#5 ) @@ -66,8 +68,7 @@ memset::@2: scope:[memset] from memset memset::num#3 = phi( memset/memset::num#2 ) memset::str#3 = phi( memset/memset::str#4 ) memset::$4 = (byte*)memset::str#3 - memset::$2 = memset::$4 + memset::num#3 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#3 memset::dst#0 = ((byte*)) memset::str#3 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -117,8 +118,7 @@ gotoxy::@2: scope:[gotoxy] from gotoxy::@1 gotoxy::@4 conio_cursor_x = gotoxy::x#4 conio_cursor_y = gotoxy::y#4 gotoxy::$7 = (word)gotoxy::y#4 - gotoxy::$4 = gotoxy::$7 * $28 - gotoxy::line_offset#0 = gotoxy::$4 + gotoxy::line_offset#0 = gotoxy::$7 * $28 gotoxy::$5 = CONIO_SCREEN_TEXT + gotoxy::line_offset#0 conio_line_text = gotoxy::$5 gotoxy::$6 = CONIO_SCREEN_COLORS + gotoxy::line_offset#0 @@ -370,7 +370,6 @@ bool~ gotoxy::$0 bool~ gotoxy::$1 bool~ gotoxy::$2 bool~ gotoxy::$3 -number~ gotoxy::$4 byte*~ gotoxy::$5 byte*~ gotoxy::$6 word~ gotoxy::$7 @@ -396,7 +395,6 @@ void main() constant byte* main::s[$e] = "hello world! " void* memcpy(void* memcpy::destination , void* memcpy::source , word memcpy::num) -byte*~ memcpy::$0 bool~ memcpy::$1 byte*~ memcpy::$2 void* memcpy::destination @@ -437,7 +435,6 @@ byte* memcpy::src_end#2 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -480,8 +477,7 @@ Adding number conversion cast (unumber) 0 in memset::$0 = memset::num#2 > 0 Adding number conversion cast (unumber) $19 in gotoxy::$0 = gotoxy::y#3 > $19 Adding number conversion cast (unumber) $28 in gotoxy::$2 = gotoxy::x#3 >= $28 Adding number conversion cast (unumber) 0 in gotoxy::y#0 = 0 -Adding number conversion cast (unumber) $28 in gotoxy::$4 = gotoxy::$7 * $28 -Adding number conversion cast (unumber) gotoxy::$4 in gotoxy::$4 = gotoxy::$7 * (unumber)$28 +Adding number conversion cast (unumber) $28 in gotoxy::line_offset#0 = gotoxy::$7 * $28 Adding number conversion cast (unumber) 0 in gotoxy::x#0 = 0 Adding number conversion cast (unumber) $28 in cputc::$1 = conio_cursor_x == $28 Adding number conversion cast (unumber) $28 in conio_line_text = conio_line_text + $28 @@ -578,17 +574,15 @@ Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) $19 Finalized unsigned number type (byte) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to word in gotoxy::$4 = gotoxy::$7 * $28 -Inversing boolean not [20] memset::$1 = memset::num#2 <= 0 from [19] memset::$0 = memset::num#2 > 0 -Inversing boolean not [40] gotoxy::$1 = gotoxy::y#3 <= $19 from [39] gotoxy::$0 = gotoxy::y#3 > $19 -Inversing boolean not [44] gotoxy::$3 = gotoxy::x#3 < $28 from [43] gotoxy::$2 = gotoxy::x#3 >= $28 -Inversing boolean not [70] cputc::$2 = conio_cursor_x != $28 from [69] cputc::$1 = conio_cursor_x == $28 -Inversing boolean not [94] cscroll::$1 = conio_cursor_y != $19 from [93] cscroll::$0 = conio_cursor_y == $19 -Inversing boolean not [127] conio_c64_init::$1 = conio_c64_init::line#0 < $19 from [126] conio_c64_init::$0 = conio_c64_init::line#0 >= $19 +Inversing boolean not [19] memset::$1 = memset::num#2 <= 0 from [18] memset::$0 = memset::num#2 > 0 +Inversing boolean not [38] gotoxy::$1 = gotoxy::y#3 <= $19 from [37] gotoxy::$0 = gotoxy::y#3 > $19 +Inversing boolean not [42] gotoxy::$3 = gotoxy::x#3 < $28 from [41] gotoxy::$2 = gotoxy::x#3 >= $28 +Inversing boolean not [67] cputc::$2 = conio_cursor_x != $28 from [66] cputc::$1 = conio_cursor_x == $28 +Inversing boolean not [91] cscroll::$1 = conio_cursor_y != $19 from [90] cscroll::$0 = conio_cursor_y == $19 +Inversing boolean not [124] conio_c64_init::$1 = conio_c64_init::line#0 < $19 from [123] conio_c64_init::$0 = conio_c64_init::line#0 >= $19 Successful SSA optimization Pass2UnaryNotSimplification Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 -Alias memcpy::src_end#0 = memcpy::$0 Alias memcpy::src#2 = memcpy::src#3 Alias memcpy::dst#2 = memcpy::dst#3 Alias memcpy::src_end#1 = memcpy::src_end#2 @@ -597,13 +591,11 @@ Alias memset::return#0 = memset::str#2 memset::return#4 memset::return#1 Alias memset::str#3 = memset::str#4 Alias memset::num#2 = memset::num#3 Alias memset::c#4 = memset::c#5 -Alias memset::end#0 = memset::$2 Alias memset::c#2 = memset::c#3 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 Alias memset::str#5 = memset::str#6 Alias gotoxy::x#5 = gotoxy::x#6 -Alias gotoxy::line_offset#0 = gotoxy::$4 Alias gotoxy::y#5 = gotoxy::y#6 Alias cputc::c#1 = cputc::c#2 Alias cputs::c#1 = cputs::$0 cputs::c#2 @@ -2239,13 +2231,12 @@ gotoxy: { // conio_cursor_y = y // [23] conio_cursor_y = gotoxy::y#4 -- vbuz1=vbuxx stx.z conio_cursor_y - // (unsigned int)y*CONIO_WIDTH + // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH // [24] gotoxy::$7 = (word)gotoxy::y#4 -- vwuz1=_word_vbuxx txa sta.z __7 lda #0 sta.z __7+1 - // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH // [25] gotoxy::$8 = gotoxy::$7 << 2 -- vwuz1=vwuz2_rol_2 lda.z __7 asl diff --git a/src/test/ref/examples/mega65/banked-music.asm b/src/test/ref/examples/mega65/banked-music.asm index 62e6afe24..5bea5d29f 100644 --- a/src/test/ref/examples/mega65/banked-music.asm +++ b/src/test/ref/examples/mega65/banked-music.asm @@ -231,7 +231,9 @@ main: { // memoryPage: Page address of the memory that the block should point to in the 1MB memory space of the MEGA65. // Ie. the memory that will be pointed to is $100 * the passed page address. Only the lower 12bits of the passed value is used. memoryRemapBlock: { + // Find the page offset (the number of pages to offset the block) .const pageOffset = $100-$40 + // Which block is being remapped? (0-7) .const block = $40>>5 .const blockBits = 1<> 5 +Constant right-side identified [14] memoryRemapBlock::pageOffset#0 = $100 - $40 +Constant right-side identified [15] memoryRemapBlock::block#0 = $40 >> 5 Successful SSA optimization Pass2ConstantRValueConsolidation Constant memoryRemapBlock::pageOffset#0 = $100-$40 Constant memoryRemapBlock::block#0 = $40>>5 @@ -649,11 +615,7 @@ Inlining constant with var siblings memoryRemap::upperPageOffset#0 Constant inlined memoryRemap::lowerPageOffset#0 = memoryRemapBlock::pageOffset#0 Constant inlined memoryRemap::upperPageOffset#0 = memoryRemapBlock::pageOffset#0 Successful SSA optimization Pass2ConstantInlining -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 -Constant right-side identified [17] memoryRemapBlock::blockBits#0 = 1 << memoryRemapBlock::block#0 +Constant right-side identified [13] memoryRemapBlock::blockBits#0 = 1 << memoryRemapBlock::block#0 Successful SSA optimization Pass2ConstantRValueConsolidation Constant memoryRemapBlock::blockBits#0 = 1<>5 .const blockBits = 1<num sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_COUNT+1 - // [59] *((byte*)&memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_SRC_BANK) = memcpy_dma4::src_bank#0 -- _deref_pbuc1=vbuc2 + // [55] *((byte*)&memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_SRC_BANK) = memcpy_dma4::src_bank#0 -- _deref_pbuc1=vbuc2 lda #src_bank sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_SRC_BANK - // [60] *((byte**)&memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_SRC) = (byte*)memcpy_dma4::src#0 -- _deref_qbuc1=pbuc2 + // [56] *((byte**)&memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_SRC) = (byte*)memcpy_dma4::src#0 -- _deref_qbuc1=pbuc2 lda #src sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_SRC+1 - // [61] *((byte*)&memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK) = memcpy_dma4::dest_bank#0 -- _deref_pbuc1=vbuc2 + // [57] *((byte*)&memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK) = memcpy_dma4::dest_bank#0 -- _deref_pbuc1=vbuc2 lda #dest_bank sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK - // [62] *((byte**)&memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_DEST) = (byte*)memcpy_dma4::dest#0 -- _deref_qbuc1=pbuc2 + // [58] *((byte**)&memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_DEST) = (byte*)memcpy_dma4::dest#0 -- _deref_qbuc1=pbuc2 lda #dest sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_DEST+1 - // [63] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B) = 1 -- _deref_pbuc1=vbuc2 + // [59] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B) = 1 -- _deref_pbuc1=vbuc2 // Set F018B mode lda #1 sta DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B - // [64] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMB) = 0 -- _deref_pbuc1=vbuc2 + // [60] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMB) = 0 -- _deref_pbuc1=vbuc2 // Set address of DMA list lda #0 sta DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMB - // [65] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRBANK) = 0 -- _deref_pbuc1=vbuc2 + // [61] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRBANK) = 0 -- _deref_pbuc1=vbuc2 lda #0 sta DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRBANK - // [66] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMSB) = byte1 &memcpy_dma_command4 -- _deref_pbuc1=vbuc2 + // [62] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMSB) = byte1 &memcpy_dma_command4 -- _deref_pbuc1=vbuc2 lda #>memcpy_dma_command4 sta DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMSB - // [67] *((byte*)DMA) = byte0 &memcpy_dma_command4 -- _deref_pbuc1=vbuc2 + // [63] *((byte*)DMA) = byte0 &memcpy_dma_command4 -- _deref_pbuc1=vbuc2 // Trigger the DMA (without option lists) lda #>5 .const blockBits = 1<EN018B - // [57] memcpy_dma4::dmaMode#0 = *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B) -- vbuxx=_deref_pbuc1 + // [53] memcpy_dma4::dmaMode#0 = *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B) -- vbuxx=_deref_pbuc1 // Remember current F018 A/B mode ldx DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B // memcpy_dma_command4.count = num - // [58] *((word*)&memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_COUNT) = memcpy_dma4::num#0 -- _deref_pwuc1=vwuc2 + // [54] *((word*)&memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_COUNT) = memcpy_dma4::num#0 -- _deref_pwuc1=vwuc2 // Set up command lda #num sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_COUNT+1 // memcpy_dma_command4.src_bank = src_bank - // [59] *((byte*)&memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_SRC_BANK) = memcpy_dma4::src_bank#0 -- _deref_pbuc1=vbuc2 + // [55] *((byte*)&memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_SRC_BANK) = memcpy_dma4::src_bank#0 -- _deref_pbuc1=vbuc2 lda #src_bank sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_SRC_BANK // memcpy_dma_command4.src = src - // [60] *((byte**)&memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_SRC) = (byte*)memcpy_dma4::src#0 -- _deref_qbuc1=pbuc2 + // [56] *((byte**)&memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_SRC) = (byte*)memcpy_dma4::src#0 -- _deref_qbuc1=pbuc2 lda #src sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_SRC+1 // memcpy_dma_command4.dest_bank = dest_bank - // [61] *((byte*)&memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK) = memcpy_dma4::dest_bank#0 -- _deref_pbuc1=vbuc2 + // [57] *((byte*)&memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK) = memcpy_dma4::dest_bank#0 -- _deref_pbuc1=vbuc2 lda #dest_bank sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK // memcpy_dma_command4.dest = dest - // [62] *((byte**)&memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_DEST) = (byte*)memcpy_dma4::dest#0 -- _deref_qbuc1=pbuc2 + // [58] *((byte**)&memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_DEST) = (byte*)memcpy_dma4::dest#0 -- _deref_qbuc1=pbuc2 lda #dest sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_DEST+1 // DMA->EN018B = 1 - // [63] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B) = 1 -- _deref_pbuc1=vbuc2 + // [59] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B) = 1 -- _deref_pbuc1=vbuc2 // Set F018B mode lda #1 sta DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B // DMA->ADDRMB = 0 - // [64] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMB) = 0 -- _deref_pbuc1=vbuc2 + // [60] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMB) = 0 -- _deref_pbuc1=vbuc2 // Set address of DMA list lda #0 sta DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMB // DMA->ADDRBANK = 0 - // [65] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRBANK) = 0 -- _deref_pbuc1=vbuc2 + // [61] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRBANK) = 0 -- _deref_pbuc1=vbuc2 sta DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRBANK // DMA-> ADDRMSB = BYTE1(&memcpy_dma_command4) - // [66] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMSB) = byte1 &memcpy_dma_command4 -- _deref_pbuc1=vbuc2 + // [62] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMSB) = byte1 &memcpy_dma_command4 -- _deref_pbuc1=vbuc2 lda #>memcpy_dma_command4 sta DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMSB // DMA-> ADDRLSBTRIG = BYTE0(&memcpy_dma_command4) - // [67] *((byte*)DMA) = byte0 &memcpy_dma_command4 -- _deref_pbuc1=vbuc2 + // [63] *((byte*)DMA) = byte0 &memcpy_dma_command4 -- _deref_pbuc1=vbuc2 // Trigger the DMA (without option lists) lda #EN018B = dmaMode - // [68] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B) = memcpy_dma4::dmaMode#0 -- _deref_pbuc1=vbuxx + // [64] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B) = memcpy_dma4::dmaMode#0 -- _deref_pbuc1=vbuxx // Re-enable F018A mode stx DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B // memcpy_dma4::@return // } - // [69] return + // [65] return rts } // File Data diff --git a/src/test/ref/examples/mega65/banked-music.sym b/src/test/ref/examples/mega65/banked-music.sym index fba2cc3d7..e0eb0b53d 100644 --- a/src/test/ref/examples/mega65/banked-music.sym +++ b/src/test/ref/examples/mega65/banked-music.sym @@ -60,25 +60,21 @@ byte memcpy_dma4::src_bank constant byte memcpy_dma4::src_bank#0 src_bank = 0 volatile struct DMA_LIST_F018B memcpy_dma_command4 loadstore mem[12] = { command: DMA_COMMAND_COPY, count: 0, src: 0, src_bank: 0, dest: 0, dest_bank: 0, sub_command: 0, modulo: 0 } void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset) -byte~ memoryRemap::$0 reg byte a 202.0 byte~ memoryRemap::$1 zp[1]:7 67.33333333333333 byte~ memoryRemap::$2 reg byte a 202.0 byte~ memoryRemap::$3 reg byte a 202.0 -byte~ memoryRemap::$4 reg byte a 202.0 -byte~ memoryRemap::$5 reg byte a 202.0 byte~ memoryRemap::$6 zp[1]:10 67.33333333333333 byte~ memoryRemap::$7 reg byte a 202.0 byte~ memoryRemap::$8 reg byte a 202.0 -byte~ memoryRemap::$9 reg byte a 202.0 -volatile byte memoryRemap::aVal loadstore zp[1]:6 7.769230769230769 +volatile byte memoryRemap::aVal loadstore zp[1]:6 10.1 word memoryRemap::lowerPageOffset -word memoryRemap::lowerPageOffset#4 lowerPageOffset zp[2]:2 50.5 +word memoryRemap::lowerPageOffset#4 lowerPageOffset zp[2]:2 67.33333333333333 byte memoryRemap::remapBlocks -byte memoryRemap::remapBlocks#4 reg byte z 20.2 +byte memoryRemap::remapBlocks#4 reg byte z 28.857142857142858 word memoryRemap::upperPageOffset -word memoryRemap::upperPageOffset#4 upperPageOffset zp[2]:4 18.363636363636363 -volatile byte memoryRemap::xVal loadstore zp[1]:8 12.625 -volatile byte memoryRemap::yVal loadstore zp[1]:9 16.833333333333332 +word memoryRemap::upperPageOffset#4 upperPageOffset zp[2]:4 25.25 +volatile byte memoryRemap::xVal loadstore zp[1]:8 16.833333333333332 +volatile byte memoryRemap::yVal loadstore zp[1]:9 20.2 volatile byte memoryRemap::zVal loadstore zp[1]:11 101.0 void memoryRemapBlock(byte memoryRemapBlock::blockPage , word memoryRemapBlock::memoryPage) byte memoryRemapBlock::block @@ -100,19 +96,15 @@ zp[2]:2 [ memoryRemap::lowerPageOffset#4 ] reg byte z [ memoryRemap::remapBlocks#4 ] zp[2]:4 [ memoryRemap::upperPageOffset#4 ] reg byte a [ irq::raster#0 ] -reg byte a [ memoryRemap::$0 ] zp[1]:6 [ memoryRemap::aVal ] zp[1]:7 [ memoryRemap::$1 ] reg byte a [ memoryRemap::$2 ] reg byte a [ memoryRemap::$3 ] -reg byte a [ memoryRemap::$4 ] zp[1]:8 [ memoryRemap::xVal ] -reg byte a [ memoryRemap::$5 ] zp[1]:9 [ memoryRemap::yVal ] zp[1]:10 [ memoryRemap::$6 ] reg byte a [ memoryRemap::$7 ] reg byte a [ memoryRemap::$8 ] -reg byte a [ memoryRemap::$9 ] zp[1]:11 [ memoryRemap::zVal ] reg byte x [ memcpy_dma4::dmaMode#0 ] mem[12] [ memcpy_dma_command4 ] diff --git a/src/test/ref/examples/mega65/dma-test.log b/src/test/ref/examples/mega65/dma-test.log index 7bcac1d75..31ea77bca 100644 --- a/src/test/ref/examples/mega65/dma-test.log +++ b/src/test/ref/examples/mega65/dma-test.log @@ -15,6 +15,10 @@ Setting inferred volatile on symbol affected by address-of: memoryRemap256M::xVa Setting inferred volatile on symbol affected by address-of: memoryRemap256M::yVal in asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } Setting inferred volatile on symbol affected by address-of: memoryRemap256M::zVal in asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx +Eliminating unused variable with no statement memoryRemap::$0 +Eliminating unused variable with no statement memoryRemap::$4 +Eliminating unused variable with no statement memoryRemap::$5 +Eliminating unused variable with no statement memoryRemap::$9 CONTROL FLOW GRAPH SSA @@ -23,20 +27,16 @@ memoryRemap: scope:[memoryRemap] from main memoryRemap::upperPageOffset#1 = phi( main/memoryRemap::upperPageOffset#0 ) memoryRemap::remapBlocks#1 = phi( main/memoryRemap::remapBlocks#0 ) memoryRemap::lowerPageOffset#1 = phi( main/memoryRemap::lowerPageOffset#0 ) - memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#1 - memoryRemap::aVal = memoryRemap::$0 + memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#1 memoryRemap::$1 = memoryRemap::remapBlocks#1 << 4 memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#1 memoryRemap::$3 = memoryRemap::$2 & $f - memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 - memoryRemap::xVal = memoryRemap::$4 - memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#1 - memoryRemap::yVal = memoryRemap::$5 + memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 + memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#1 memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#1 memoryRemap::$8 = memoryRemap::$7 & $f - memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 - memoryRemap::zVal = memoryRemap::$9 + memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } to:memoryRemap::@return memoryRemap::@return: scope:[memoryRemap] from memoryRemap @@ -85,16 +85,12 @@ constant byte OFFSET_STRUCT_F018_DMAGIC_EN018B = 3 void __start() void main() void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset) -byte~ memoryRemap::$0 byte~ memoryRemap::$1 byte~ memoryRemap::$2 number~ memoryRemap::$3 -number~ memoryRemap::$4 -byte~ memoryRemap::$5 number~ memoryRemap::$6 byte~ memoryRemap::$7 number~ memoryRemap::$8 -number~ memoryRemap::$9 volatile byte memoryRemap::aVal loadstore word memoryRemap::lowerPageOffset word memoryRemap::lowerPageOffset#0 @@ -113,12 +109,10 @@ Adding number conversion cast (unumber) $50 in Adding number conversion cast (unumber) 4 in memoryRemap::$1 = memoryRemap::remapBlocks#1 << 4 Adding number conversion cast (unumber) $f in memoryRemap::$3 = memoryRemap::$2 & $f Adding number conversion cast (unumber) memoryRemap::$3 in memoryRemap::$3 = memoryRemap::$2 & (unumber)$f -Adding number conversion cast (unumber) memoryRemap::$4 in memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 Adding number conversion cast (unumber) $f0 in memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 Adding number conversion cast (unumber) memoryRemap::$6 in memoryRemap::$6 = memoryRemap::remapBlocks#1 & (unumber)$f0 Adding number conversion cast (unumber) $f in memoryRemap::$8 = memoryRemap::$7 & $f Adding number conversion cast (unumber) memoryRemap::$8 in memoryRemap::$8 = memoryRemap::$7 & (unumber)$f -Adding number conversion cast (unumber) memoryRemap::$9 in memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 Adding number conversion cast (unumber) 0 in memoryRemap::remapBlocks#0 = 0 Adding number conversion cast (unumber) 0 in memoryRemap::lowerPageOffset#0 = 0 Adding number conversion cast (unumber) 0 in memoryRemap::upperPageOffset#0 = 0 @@ -164,14 +158,8 @@ Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in memoryRemap::$3 = memoryRemap::$2 & $f -Inferred type updated to byte in memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 Inferred type updated to byte in memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 Inferred type updated to byte in memoryRemap::$8 = memoryRemap::$7 & $f -Inferred type updated to byte in memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 Identical Phi Values memoryRemap::lowerPageOffset#1 memoryRemap::lowerPageOffset#0 Identical Phi Values memoryRemap::remapBlocks#1 memoryRemap::remapBlocks#0 Identical Phi Values memoryRemap::upperPageOffset#1 memoryRemap::upperPageOffset#0 @@ -180,7 +168,7 @@ Constant memoryRemap::remapBlocks#0 = 0 Constant memoryRemap::lowerPageOffset#0 = 0 Constant memoryRemap::upperPageOffset#0 = 0 Successful SSA optimization Pass2ConstantIdentification -Simplifying expression containing zero (byte*)DMA in [25] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRLSBTRIG) = byte0 &DMA_SCREEN_UP +Simplifying expression containing zero (byte*)DMA in [21] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRLSBTRIG) = byte0 &DMA_SCREEN_UP Successful SSA optimization PassNSimplifyExpressionWithZero Eliminating unused constant OFFSET_STRUCT_F018_DMAGIC_ADDRLSBTRIG Successful SSA optimization PassNEliminateUnusedVars @@ -189,33 +177,27 @@ Removing unused procedure block __start Removing unused procedure block __start::@1 Removing unused procedure block __start::@return Successful SSA optimization PassNEliminateEmptyStart -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 -Constant right-side identified [0] memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#0 -Constant right-side identified [2] memoryRemap::$1 = memoryRemap::remapBlocks#0 << 4 -Constant right-side identified [3] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 -Constant right-side identified [7] memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#0 -Constant right-side identified [9] memoryRemap::$6 = memoryRemap::remapBlocks#0 & $f0 -Constant right-side identified [10] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 +Constant right-side identified [0] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#0 +Constant right-side identified [1] memoryRemap::$1 = memoryRemap::remapBlocks#0 << 4 +Constant right-side identified [2] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 +Constant right-side identified [5] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#0 +Constant right-side identified [6] memoryRemap::$6 = memoryRemap::remapBlocks#0 & $f0 +Constant right-side identified [7] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 Successful SSA optimization Pass2ConstantRValueConsolidation -Constant memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#0 Constant memoryRemap::$1 = memoryRemap::remapBlocks#0<<4 Constant memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 -Constant memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#0 Constant memoryRemap::$6 = memoryRemap::remapBlocks#0&$f0 Constant memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 Successful SSA optimization Pass2ConstantIdentification -Simplifying constant evaluating to zero byte0 memoryRemap::lowerPageOffset#0 in Simplifying constant evaluating to zero memoryRemap::remapBlocks#0<<4 in Simplifying constant evaluating to zero byte1 memoryRemap::lowerPageOffset#0 in -Simplifying constant evaluating to zero byte0 memoryRemap::upperPageOffset#0 in Simplifying constant evaluating to zero memoryRemap::remapBlocks#0&$f0 in Simplifying constant evaluating to zero byte1 memoryRemap::upperPageOffset#0 in +Simplifying constant evaluating to zero byte0 memoryRemap::lowerPageOffset#0 in [0] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#0 +Simplifying constant evaluating to zero byte0 memoryRemap::upperPageOffset#0 in [5] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#0 Successful SSA optimization PassNSimplifyConstantZero -Simplifying expression containing zero memoryRemap::$3 in [5] memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 -Simplifying expression containing zero memoryRemap::$8 in [12] memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 +Simplifying expression containing zero memoryRemap::$3 in [4] memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 +Simplifying expression containing zero memoryRemap::$8 in [9] memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 Successful SSA optimization PassNSimplifyExpressionWithZero Eliminating unused constant memoryRemap::remapBlocks#0 Eliminating unused constant memoryRemap::lowerPageOffset#0 @@ -223,28 +205,21 @@ Eliminating unused constant memoryRemap::upperPageOffset#0 Eliminating unused constant memoryRemap::$1 Eliminating unused constant memoryRemap::$6 Successful SSA optimization PassNEliminateUnusedVars -Alias candidate removed (volatile)memoryRemap::$4 = memoryRemap::$3 memoryRemap::xVal -Alias candidate removed (volatile)memoryRemap::$9 = memoryRemap::$8 memoryRemap::zVal +Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$3 +Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$8 Constant right-side identified [1] memoryRemap::$3 = memoryRemap::$2 & $f -Constant right-side identified [5] memoryRemap::$8 = memoryRemap::$7 & $f +Constant right-side identified [4] memoryRemap::$8 = memoryRemap::$7 & $f Successful SSA optimization Pass2ConstantRValueConsolidation Constant memoryRemap::$3 = memoryRemap::$2&$f Constant memoryRemap::$8 = memoryRemap::$7&$f Successful SSA optimization Pass2ConstantIdentification -Constant memoryRemap::$4 = memoryRemap::$3 -Constant memoryRemap::$9 = memoryRemap::$8 -Successful SSA optimization Pass2ConstantIdentification Simplifying constant evaluating to zero memoryRemap::$2&$f in Simplifying constant evaluating to zero memoryRemap::$7&$f in Successful SSA optimization PassNSimplifyConstantZero Eliminating unused constant memoryRemap::$2 Eliminating unused constant memoryRemap::$7 Successful SSA optimization PassNEliminateUnusedVars -Constant inlined memoryRemap::$4 = 0 -Constant inlined memoryRemap::$5 = 0 Constant inlined memoryRemap::$8 = 0 -Constant inlined memoryRemap::$0 = 0 -Constant inlined memoryRemap::$9 = 0 Constant inlined memoryRemap::$3 = 0 Successful SSA optimization Pass2ConstantInlining Finalized unsigned number type (byte) 8 diff --git a/src/test/ref/examples/mega65/dma-test2.log b/src/test/ref/examples/mega65/dma-test2.log index 8a1bc20b2..d6b23b971 100644 --- a/src/test/ref/examples/mega65/dma-test2.log +++ b/src/test/ref/examples/mega65/dma-test2.log @@ -41,6 +41,10 @@ Setting inferred volatile on symbol affected by address-of: memoryRemap256M::xVa Setting inferred volatile on symbol affected by address-of: memoryRemap256M::yVal in asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } Setting inferred volatile on symbol affected by address-of: memoryRemap256M::zVal in asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx +Eliminating unused variable with no statement memoryRemap::$0 +Eliminating unused variable with no statement memoryRemap::$4 +Eliminating unused variable with no statement memoryRemap::$5 +Eliminating unused variable with no statement memoryRemap::$9 Eliminating unused variable with no statement memcpy_dma_command4 Eliminating unused variable with no statement memset_dma_command @@ -51,20 +55,16 @@ memoryRemap: scope:[memoryRemap] from main memoryRemap::upperPageOffset#1 = phi( main/memoryRemap::upperPageOffset#0 ) memoryRemap::remapBlocks#1 = phi( main/memoryRemap::remapBlocks#0 ) memoryRemap::lowerPageOffset#1 = phi( main/memoryRemap::lowerPageOffset#0 ) - memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#1 - memoryRemap::aVal = memoryRemap::$0 + memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#1 memoryRemap::$1 = memoryRemap::remapBlocks#1 << 4 memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#1 memoryRemap::$3 = memoryRemap::$2 & $f - memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 - memoryRemap::xVal = memoryRemap::$4 - memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#1 - memoryRemap::yVal = memoryRemap::$5 + memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 + memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#1 memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#1 memoryRemap::$8 = memoryRemap::$7 & $f - memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 - memoryRemap::zVal = memoryRemap::$9 + memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } to:memoryRemap::@return memoryRemap::@return: scope:[memoryRemap] from memoryRemap @@ -148,16 +148,12 @@ void* memcpy_dma::src#0 void* memcpy_dma::src#1 volatile struct DMA_LIST_F018B memcpy_dma_command loadstore = { command: DMA_COMMAND_COPY, count: 0, src: 0, src_bank: 0, dest: 0, dest_bank: 0, sub_command: 0, modulo: 0 } void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset) -byte~ memoryRemap::$0 byte~ memoryRemap::$1 byte~ memoryRemap::$2 number~ memoryRemap::$3 -number~ memoryRemap::$4 -byte~ memoryRemap::$5 number~ memoryRemap::$6 byte~ memoryRemap::$7 number~ memoryRemap::$8 -number~ memoryRemap::$9 volatile byte memoryRemap::aVal loadstore word memoryRemap::lowerPageOffset word memoryRemap::lowerPageOffset#0 @@ -175,12 +171,10 @@ volatile byte memoryRemap::zVal loadstore Adding number conversion cast (unumber) 4 in memoryRemap::$1 = memoryRemap::remapBlocks#1 << 4 Adding number conversion cast (unumber) $f in memoryRemap::$3 = memoryRemap::$2 & $f Adding number conversion cast (unumber) memoryRemap::$3 in memoryRemap::$3 = memoryRemap::$2 & (unumber)$f -Adding number conversion cast (unumber) memoryRemap::$4 in memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 Adding number conversion cast (unumber) $f0 in memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 Adding number conversion cast (unumber) memoryRemap::$6 in memoryRemap::$6 = memoryRemap::remapBlocks#1 & (unumber)$f0 Adding number conversion cast (unumber) $f in memoryRemap::$8 = memoryRemap::$7 & $f Adding number conversion cast (unumber) memoryRemap::$8 in memoryRemap::$8 = memoryRemap::$7 & (unumber)$f -Adding number conversion cast (unumber) memoryRemap::$9 in memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 Adding number conversion cast (unumber) 1 in *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B) = 1 Adding number conversion cast (unumber) 0 in *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMB) = 0 Adding number conversion cast (unumber) 0 in *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRBANK) = 0 @@ -227,14 +221,8 @@ Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) $50 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in memoryRemap::$3 = memoryRemap::$2 & $f -Inferred type updated to byte in memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 Inferred type updated to byte in memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 Inferred type updated to byte in memoryRemap::$8 = memoryRemap::$7 & $f -Inferred type updated to byte in memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 Identical Phi Values memoryRemap::lowerPageOffset#1 memoryRemap::lowerPageOffset#0 Identical Phi Values memoryRemap::remapBlocks#1 memoryRemap::remapBlocks#0 Identical Phi Values memoryRemap::upperPageOffset#1 memoryRemap::upperPageOffset#0 @@ -242,7 +230,7 @@ Identical Phi Values memcpy_dma::num#1 memcpy_dma::num#0 Identical Phi Values memcpy_dma::src#1 memcpy_dma::src#0 Identical Phi Values memcpy_dma::dest#1 memcpy_dma::dest#0 Successful SSA optimization Pass2IdenticalPhiElimination -Constant right-side identified [35] memcpy_dma::num#0 = (unumber)$18*$50 +Constant right-side identified [31] memcpy_dma::num#0 = (unumber)$18*$50 Successful SSA optimization Pass2ConstantRValueConsolidation Constant memoryRemap::remapBlocks#0 = 0 Constant memoryRemap::lowerPageOffset#0 = 0 @@ -251,10 +239,10 @@ Constant memcpy_dma::dest#0 = (void*)DEFAULT_SCREEN Constant memcpy_dma::src#0 = (void*)DEFAULT_SCREEN+$50 Constant memcpy_dma::num#0 = (unumber)$18*$50 Successful SSA optimization Pass2ConstantIdentification -Constant value identified (byte*)memcpy_dma::src#0 in [20] *((byte**)&memcpy_dma_command+OFFSET_STRUCT_DMA_LIST_F018B_SRC) = (byte*)memcpy_dma::src#0 -Constant value identified (byte*)memcpy_dma::dest#0 in [21] *((byte**)&memcpy_dma_command+OFFSET_STRUCT_DMA_LIST_F018B_DEST) = (byte*)memcpy_dma::dest#0 +Constant value identified (byte*)memcpy_dma::src#0 in [16] *((byte**)&memcpy_dma_command+OFFSET_STRUCT_DMA_LIST_F018B_SRC) = (byte*)memcpy_dma::src#0 +Constant value identified (byte*)memcpy_dma::dest#0 in [17] *((byte**)&memcpy_dma_command+OFFSET_STRUCT_DMA_LIST_F018B_DEST) = (byte*)memcpy_dma::dest#0 Successful SSA optimization Pass2ConstantValues -Simplifying expression containing zero (byte*)DMA in [26] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRLSBTRIG) = byte0 &memcpy_dma_command +Simplifying expression containing zero (byte*)DMA in [22] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRLSBTRIG) = byte0 &memcpy_dma_command Successful SSA optimization PassNSimplifyExpressionWithZero Eliminating unused constant OFFSET_STRUCT_F018_DMAGIC_ADDRLSBTRIG Successful SSA optimization PassNEliminateUnusedVars @@ -263,33 +251,27 @@ Removing unused procedure block __start Removing unused procedure block __start::@1 Removing unused procedure block __start::@return Successful SSA optimization PassNEliminateEmptyStart -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 -Constant right-side identified [0] memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#0 -Constant right-side identified [2] memoryRemap::$1 = memoryRemap::remapBlocks#0 << 4 -Constant right-side identified [3] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 -Constant right-side identified [7] memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#0 -Constant right-side identified [9] memoryRemap::$6 = memoryRemap::remapBlocks#0 & $f0 -Constant right-side identified [10] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 +Constant right-side identified [0] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#0 +Constant right-side identified [1] memoryRemap::$1 = memoryRemap::remapBlocks#0 << 4 +Constant right-side identified [2] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 +Constant right-side identified [5] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#0 +Constant right-side identified [6] memoryRemap::$6 = memoryRemap::remapBlocks#0 & $f0 +Constant right-side identified [7] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 Successful SSA optimization Pass2ConstantRValueConsolidation -Constant memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#0 Constant memoryRemap::$1 = memoryRemap::remapBlocks#0<<4 Constant memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 -Constant memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#0 Constant memoryRemap::$6 = memoryRemap::remapBlocks#0&$f0 Constant memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 Successful SSA optimization Pass2ConstantIdentification -Simplifying constant evaluating to zero byte0 memoryRemap::lowerPageOffset#0 in Simplifying constant evaluating to zero memoryRemap::remapBlocks#0<<4 in Simplifying constant evaluating to zero byte1 memoryRemap::lowerPageOffset#0 in -Simplifying constant evaluating to zero byte0 memoryRemap::upperPageOffset#0 in Simplifying constant evaluating to zero memoryRemap::remapBlocks#0&$f0 in Simplifying constant evaluating to zero byte1 memoryRemap::upperPageOffset#0 in +Simplifying constant evaluating to zero byte0 memoryRemap::lowerPageOffset#0 in [0] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#0 +Simplifying constant evaluating to zero byte0 memoryRemap::upperPageOffset#0 in [5] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#0 Successful SSA optimization PassNSimplifyConstantZero -Simplifying expression containing zero memoryRemap::$3 in [5] memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 -Simplifying expression containing zero memoryRemap::$8 in [12] memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 +Simplifying expression containing zero memoryRemap::$3 in [4] memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 +Simplifying expression containing zero memoryRemap::$8 in [9] memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 Successful SSA optimization PassNSimplifyExpressionWithZero Eliminating unused constant memoryRemap::remapBlocks#0 Eliminating unused constant memoryRemap::lowerPageOffset#0 @@ -297,28 +279,21 @@ Eliminating unused constant memoryRemap::upperPageOffset#0 Eliminating unused constant memoryRemap::$1 Eliminating unused constant memoryRemap::$6 Successful SSA optimization PassNEliminateUnusedVars -Alias candidate removed (volatile)memoryRemap::$4 = memoryRemap::$3 memoryRemap::xVal -Alias candidate removed (volatile)memoryRemap::$9 = memoryRemap::$8 memoryRemap::zVal +Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$3 +Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$8 Constant right-side identified [1] memoryRemap::$3 = memoryRemap::$2 & $f -Constant right-side identified [5] memoryRemap::$8 = memoryRemap::$7 & $f +Constant right-side identified [4] memoryRemap::$8 = memoryRemap::$7 & $f Successful SSA optimization Pass2ConstantRValueConsolidation Constant memoryRemap::$3 = memoryRemap::$2&$f Constant memoryRemap::$8 = memoryRemap::$7&$f Successful SSA optimization Pass2ConstantIdentification -Constant memoryRemap::$4 = memoryRemap::$3 -Constant memoryRemap::$9 = memoryRemap::$8 -Successful SSA optimization Pass2ConstantIdentification Simplifying constant evaluating to zero memoryRemap::$2&$f in Simplifying constant evaluating to zero memoryRemap::$7&$f in Successful SSA optimization PassNSimplifyConstantZero Eliminating unused constant memoryRemap::$2 Eliminating unused constant memoryRemap::$7 Successful SSA optimization PassNEliminateUnusedVars -Constant inlined memoryRemap::$4 = 0 -Constant inlined memoryRemap::$5 = 0 Constant inlined memoryRemap::$8 = 0 -Constant inlined memoryRemap::$0 = 0 -Constant inlined memoryRemap::$9 = 0 Constant inlined memoryRemap::$3 = 0 Successful SSA optimization Pass2ConstantInlining Finalized unsigned number type (byte) 8 diff --git a/src/test/ref/examples/mega65/dma-test3.log b/src/test/ref/examples/mega65/dma-test3.log index 7d4f553cd..2c402c0d6 100644 --- a/src/test/ref/examples/mega65/dma-test3.log +++ b/src/test/ref/examples/mega65/dma-test3.log @@ -41,6 +41,10 @@ Setting inferred volatile on symbol affected by address-of: memoryRemap256M::xVa Setting inferred volatile on symbol affected by address-of: memoryRemap256M::yVal in asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } Setting inferred volatile on symbol affected by address-of: memoryRemap256M::zVal in asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx +Eliminating unused variable with no statement memoryRemap::$0 +Eliminating unused variable with no statement memoryRemap::$4 +Eliminating unused variable with no statement memoryRemap::$5 +Eliminating unused variable with no statement memoryRemap::$9 Eliminating unused variable with no statement memcpy_dma_command Eliminating unused variable with no statement memset_dma_command @@ -51,20 +55,16 @@ memoryRemap: scope:[memoryRemap] from main memoryRemap::upperPageOffset#1 = phi( main/memoryRemap::upperPageOffset#0 ) memoryRemap::remapBlocks#1 = phi( main/memoryRemap::remapBlocks#0 ) memoryRemap::lowerPageOffset#1 = phi( main/memoryRemap::lowerPageOffset#0 ) - memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#1 - memoryRemap::aVal = memoryRemap::$0 + memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#1 memoryRemap::$1 = memoryRemap::remapBlocks#1 << 4 memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#1 memoryRemap::$3 = memoryRemap::$2 & $f - memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 - memoryRemap::xVal = memoryRemap::$4 - memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#1 - memoryRemap::yVal = memoryRemap::$5 + memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 + memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#1 memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#1 memoryRemap::$8 = memoryRemap::$7 & $f - memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 - memoryRemap::zVal = memoryRemap::$9 + memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } to:memoryRemap::@return memoryRemap::@return: scope:[memoryRemap] from memoryRemap @@ -162,16 +162,12 @@ byte memcpy_dma4::src_bank#0 byte memcpy_dma4::src_bank#1 volatile struct DMA_LIST_F018B memcpy_dma_command4 loadstore = { command: DMA_COMMAND_COPY, count: 0, src: 0, src_bank: 0, dest: 0, dest_bank: 0, sub_command: 0, modulo: 0 } void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset) -byte~ memoryRemap::$0 byte~ memoryRemap::$1 byte~ memoryRemap::$2 number~ memoryRemap::$3 -number~ memoryRemap::$4 -byte~ memoryRemap::$5 number~ memoryRemap::$6 byte~ memoryRemap::$7 number~ memoryRemap::$8 -number~ memoryRemap::$9 volatile byte memoryRemap::aVal loadstore word memoryRemap::lowerPageOffset word memoryRemap::lowerPageOffset#0 @@ -189,12 +185,10 @@ volatile byte memoryRemap::zVal loadstore Adding number conversion cast (unumber) 4 in memoryRemap::$1 = memoryRemap::remapBlocks#1 << 4 Adding number conversion cast (unumber) $f in memoryRemap::$3 = memoryRemap::$2 & $f Adding number conversion cast (unumber) memoryRemap::$3 in memoryRemap::$3 = memoryRemap::$2 & (unumber)$f -Adding number conversion cast (unumber) memoryRemap::$4 in memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 Adding number conversion cast (unumber) $f0 in memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 Adding number conversion cast (unumber) memoryRemap::$6 in memoryRemap::$6 = memoryRemap::remapBlocks#1 & (unumber)$f0 Adding number conversion cast (unumber) $f in memoryRemap::$8 = memoryRemap::$7 & $f Adding number conversion cast (unumber) memoryRemap::$8 in memoryRemap::$8 = memoryRemap::$7 & (unumber)$f -Adding number conversion cast (unumber) memoryRemap::$9 in memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 Adding number conversion cast (unumber) 1 in *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B) = 1 Adding number conversion cast (unumber) 0 in *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMB) = 0 Adding number conversion cast (unumber) 0 in *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRBANK) = 0 @@ -249,14 +243,8 @@ Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) $50 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in memoryRemap::$3 = memoryRemap::$2 & $f -Inferred type updated to byte in memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 Inferred type updated to byte in memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 Inferred type updated to byte in memoryRemap::$8 = memoryRemap::$7 & $f -Inferred type updated to byte in memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 Identical Phi Values memoryRemap::lowerPageOffset#1 memoryRemap::lowerPageOffset#0 Identical Phi Values memoryRemap::remapBlocks#1 memoryRemap::remapBlocks#0 Identical Phi Values memoryRemap::upperPageOffset#1 memoryRemap::upperPageOffset#0 @@ -266,7 +254,7 @@ Identical Phi Values memcpy_dma4::src#1 memcpy_dma4::src#0 Identical Phi Values memcpy_dma4::dest_bank#1 memcpy_dma4::dest_bank#0 Identical Phi Values memcpy_dma4::dest#1 memcpy_dma4::dest#0 Successful SSA optimization Pass2IdenticalPhiElimination -Constant right-side identified [39] memcpy_dma4::num#0 = (unumber)$18*$50 +Constant right-side identified [35] memcpy_dma4::num#0 = (unumber)$18*$50 Successful SSA optimization Pass2ConstantRValueConsolidation Constant memoryRemap::remapBlocks#0 = 0 Constant memoryRemap::lowerPageOffset#0 = 0 @@ -277,10 +265,10 @@ Constant memcpy_dma4::src_bank#0 = 0 Constant memcpy_dma4::src#0 = (void*)DEFAULT_SCREEN+$50 Constant memcpy_dma4::num#0 = (unumber)$18*$50 Successful SSA optimization Pass2ConstantIdentification -Constant value identified (byte*)memcpy_dma4::src#0 in [21] *((byte**)&memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_SRC) = (byte*)memcpy_dma4::src#0 -Constant value identified (byte*)memcpy_dma4::dest#0 in [23] *((byte**)&memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_DEST) = (byte*)memcpy_dma4::dest#0 +Constant value identified (byte*)memcpy_dma4::src#0 in [17] *((byte**)&memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_SRC) = (byte*)memcpy_dma4::src#0 +Constant value identified (byte*)memcpy_dma4::dest#0 in [19] *((byte**)&memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_DEST) = (byte*)memcpy_dma4::dest#0 Successful SSA optimization Pass2ConstantValues -Simplifying expression containing zero (byte*)DMA in [28] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRLSBTRIG) = byte0 &memcpy_dma_command4 +Simplifying expression containing zero (byte*)DMA in [24] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRLSBTRIG) = byte0 &memcpy_dma_command4 Successful SSA optimization PassNSimplifyExpressionWithZero Eliminating unused constant OFFSET_STRUCT_F018_DMAGIC_ADDRLSBTRIG Successful SSA optimization PassNEliminateUnusedVars @@ -289,33 +277,27 @@ Removing unused procedure block __start Removing unused procedure block __start::@1 Removing unused procedure block __start::@return Successful SSA optimization PassNEliminateEmptyStart -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 -Constant right-side identified [0] memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#0 -Constant right-side identified [2] memoryRemap::$1 = memoryRemap::remapBlocks#0 << 4 -Constant right-side identified [3] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 -Constant right-side identified [7] memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#0 -Constant right-side identified [9] memoryRemap::$6 = memoryRemap::remapBlocks#0 & $f0 -Constant right-side identified [10] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 +Constant right-side identified [0] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#0 +Constant right-side identified [1] memoryRemap::$1 = memoryRemap::remapBlocks#0 << 4 +Constant right-side identified [2] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 +Constant right-side identified [5] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#0 +Constant right-side identified [6] memoryRemap::$6 = memoryRemap::remapBlocks#0 & $f0 +Constant right-side identified [7] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 Successful SSA optimization Pass2ConstantRValueConsolidation -Constant memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#0 Constant memoryRemap::$1 = memoryRemap::remapBlocks#0<<4 Constant memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 -Constant memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#0 Constant memoryRemap::$6 = memoryRemap::remapBlocks#0&$f0 Constant memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 Successful SSA optimization Pass2ConstantIdentification -Simplifying constant evaluating to zero byte0 memoryRemap::lowerPageOffset#0 in Simplifying constant evaluating to zero memoryRemap::remapBlocks#0<<4 in Simplifying constant evaluating to zero byte1 memoryRemap::lowerPageOffset#0 in -Simplifying constant evaluating to zero byte0 memoryRemap::upperPageOffset#0 in Simplifying constant evaluating to zero memoryRemap::remapBlocks#0&$f0 in Simplifying constant evaluating to zero byte1 memoryRemap::upperPageOffset#0 in +Simplifying constant evaluating to zero byte0 memoryRemap::lowerPageOffset#0 in [0] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#0 +Simplifying constant evaluating to zero byte0 memoryRemap::upperPageOffset#0 in [5] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#0 Successful SSA optimization PassNSimplifyConstantZero -Simplifying expression containing zero memoryRemap::$3 in [5] memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 -Simplifying expression containing zero memoryRemap::$8 in [12] memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 +Simplifying expression containing zero memoryRemap::$3 in [4] memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 +Simplifying expression containing zero memoryRemap::$8 in [9] memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 Successful SSA optimization PassNSimplifyExpressionWithZero Eliminating unused constant memoryRemap::remapBlocks#0 Eliminating unused constant memoryRemap::lowerPageOffset#0 @@ -323,28 +305,21 @@ Eliminating unused constant memoryRemap::upperPageOffset#0 Eliminating unused constant memoryRemap::$1 Eliminating unused constant memoryRemap::$6 Successful SSA optimization PassNEliminateUnusedVars -Alias candidate removed (volatile)memoryRemap::$4 = memoryRemap::$3 memoryRemap::xVal -Alias candidate removed (volatile)memoryRemap::$9 = memoryRemap::$8 memoryRemap::zVal +Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$3 +Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$8 Constant right-side identified [1] memoryRemap::$3 = memoryRemap::$2 & $f -Constant right-side identified [5] memoryRemap::$8 = memoryRemap::$7 & $f +Constant right-side identified [4] memoryRemap::$8 = memoryRemap::$7 & $f Successful SSA optimization Pass2ConstantRValueConsolidation Constant memoryRemap::$3 = memoryRemap::$2&$f Constant memoryRemap::$8 = memoryRemap::$7&$f Successful SSA optimization Pass2ConstantIdentification -Constant memoryRemap::$4 = memoryRemap::$3 -Constant memoryRemap::$9 = memoryRemap::$8 -Successful SSA optimization Pass2ConstantIdentification Simplifying constant evaluating to zero memoryRemap::$2&$f in Simplifying constant evaluating to zero memoryRemap::$7&$f in Successful SSA optimization PassNSimplifyConstantZero Eliminating unused constant memoryRemap::$2 Eliminating unused constant memoryRemap::$7 Successful SSA optimization PassNEliminateUnusedVars -Constant inlined memoryRemap::$4 = 0 -Constant inlined memoryRemap::$5 = 0 Constant inlined memoryRemap::$8 = 0 -Constant inlined memoryRemap::$0 = 0 -Constant inlined memoryRemap::$9 = 0 Constant inlined memoryRemap::$3 = 0 Successful SSA optimization Pass2ConstantInlining Finalized unsigned number type (byte) 8 diff --git a/src/test/ref/examples/mega65/dma-test4.log b/src/test/ref/examples/mega65/dma-test4.log index 83a6e6e50..d5ea10de9 100644 --- a/src/test/ref/examples/mega65/dma-test4.log +++ b/src/test/ref/examples/mega65/dma-test4.log @@ -41,6 +41,10 @@ Setting inferred volatile on symbol affected by address-of: memoryRemap256M::xVa Setting inferred volatile on symbol affected by address-of: memoryRemap256M::yVal in asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } Setting inferred volatile on symbol affected by address-of: memoryRemap256M::zVal in asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx +Eliminating unused variable with no statement memoryRemap::$0 +Eliminating unused variable with no statement memoryRemap::$4 +Eliminating unused variable with no statement memoryRemap::$5 +Eliminating unused variable with no statement memoryRemap::$9 Eliminating unused variable with no statement memcpy_dma_command Eliminating unused variable with no statement memcpy_dma_command4 Eliminating unused variable with no statement memset_dma_command @@ -52,20 +56,16 @@ memoryRemap: scope:[memoryRemap] from main memoryRemap::upperPageOffset#1 = phi( main/memoryRemap::upperPageOffset#0 ) memoryRemap::remapBlocks#1 = phi( main/memoryRemap::remapBlocks#0 ) memoryRemap::lowerPageOffset#1 = phi( main/memoryRemap::lowerPageOffset#0 ) - memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#1 - memoryRemap::aVal = memoryRemap::$0 + memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#1 memoryRemap::$1 = memoryRemap::remapBlocks#1 << 4 memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#1 memoryRemap::$3 = memoryRemap::$2 & $f - memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 - memoryRemap::xVal = memoryRemap::$4 - memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#1 - memoryRemap::yVal = memoryRemap::$5 + memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 + memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#1 memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#1 memoryRemap::$8 = memoryRemap::$7 & $f - memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 - memoryRemap::zVal = memoryRemap::$9 + memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } to:memoryRemap::@return memoryRemap::@return: scope:[memoryRemap] from memoryRemap @@ -208,16 +208,12 @@ byte memcpy_dma256::src_mb#0 byte memcpy_dma256::src_mb#1 constant byte* memcpy_dma_command256[] = { DMA_OPTION_SRC_MB, 0, DMA_OPTION_DEST_MB, 0, DMA_OPTION_FORMAT_F018B, DMA_OPTION_END, DMA_COMMAND_COPY, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset) -byte~ memoryRemap::$0 byte~ memoryRemap::$1 byte~ memoryRemap::$2 number~ memoryRemap::$3 -number~ memoryRemap::$4 -byte~ memoryRemap::$5 number~ memoryRemap::$6 byte~ memoryRemap::$7 number~ memoryRemap::$8 -number~ memoryRemap::$9 volatile byte memoryRemap::aVal loadstore word memoryRemap::lowerPageOffset word memoryRemap::lowerPageOffset#0 @@ -235,12 +231,10 @@ volatile byte memoryRemap::zVal loadstore Adding number conversion cast (unumber) 4 in memoryRemap::$1 = memoryRemap::remapBlocks#1 << 4 Adding number conversion cast (unumber) $f in memoryRemap::$3 = memoryRemap::$2 & $f Adding number conversion cast (unumber) memoryRemap::$3 in memoryRemap::$3 = memoryRemap::$2 & (unumber)$f -Adding number conversion cast (unumber) memoryRemap::$4 in memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 Adding number conversion cast (unumber) $f0 in memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 Adding number conversion cast (unumber) memoryRemap::$6 in memoryRemap::$6 = memoryRemap::remapBlocks#1 & (unumber)$f0 Adding number conversion cast (unumber) $f in memoryRemap::$8 = memoryRemap::$7 & $f Adding number conversion cast (unumber) memoryRemap::$8 in memoryRemap::$8 = memoryRemap::$7 & (unumber)$f -Adding number conversion cast (unumber) memoryRemap::$9 in memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 Adding number conversion cast (unumber) 1 in memcpy_dma_command256[1] = memcpy_dma256::src_mb#1 Adding number conversion cast (unumber) 3 in memcpy_dma_command256[3] = memcpy_dma256::dest_mb#1 Adding number conversion cast (unumber) 6 in memcpy_dma256::$0 = & memcpy_dma_command256[6] @@ -312,14 +306,8 @@ Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) $50 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in memoryRemap::$3 = memoryRemap::$2 & $f -Inferred type updated to byte in memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 Inferred type updated to byte in memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 Inferred type updated to byte in memoryRemap::$8 = memoryRemap::$7 & $f -Inferred type updated to byte in memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 Identical Phi Values memoryRemap::lowerPageOffset#1 memoryRemap::lowerPageOffset#0 Identical Phi Values memoryRemap::remapBlocks#1 memoryRemap::remapBlocks#0 Identical Phi Values memoryRemap::upperPageOffset#1 memoryRemap::upperPageOffset#0 @@ -331,12 +319,12 @@ Identical Phi Values memcpy_dma256::src#1 memcpy_dma256::src#0 Identical Phi Values memcpy_dma256::dest_bank#1 memcpy_dma256::dest_bank#0 Identical Phi Values memcpy_dma256::dest#1 memcpy_dma256::dest#0 Successful SSA optimization Pass2IdenticalPhiElimination -Rewriting array member address-of to pointer addition [21] memcpy_dma256::$0 = memcpy_dma_command256 + 6 +Rewriting array member address-of to pointer addition [17] memcpy_dma256::$0 = memcpy_dma_command256 + 6 Successful SSA optimization PassNArrayElementAddressOfRewriting -Constant right-side identified [21] memcpy_dma256::$0 = memcpy_dma_command256 + 6 -Constant right-side identified [41] memcpy_dma256::$1 = byte1 memcpy_dma_command256 -Constant right-side identified [43] memcpy_dma256::$2 = byte0 memcpy_dma_command256 -Constant right-side identified [57] memcpy_dma256::num#0 = (unumber)$18*$50 +Constant right-side identified [17] memcpy_dma256::$0 = memcpy_dma_command256 + 6 +Constant right-side identified [37] memcpy_dma256::$1 = byte1 memcpy_dma_command256 +Constant right-side identified [39] memcpy_dma256::$2 = byte0 memcpy_dma_command256 +Constant right-side identified [53] memcpy_dma256::num#0 = (unumber)$18*$50 Successful SSA optimization Pass2ConstantRValueConsolidation Constant memcpy_dma256::$0 = memcpy_dma_command256+6 Constant memcpy_dma256::$1 = byte1 memcpy_dma_command256 @@ -360,53 +348,47 @@ Constant memcpy_dma256::$10 = (byte**)memcpy_dma256::f018b#0 Constant memcpy_dma256::$11 = (byte*)memcpy_dma256::f018b#0 Constant memcpy_dma256::$12 = (byte**)memcpy_dma256::f018b#0 Successful SSA optimization Pass2ConstantIdentification -Constant value identified (byte*)memcpy_dma256::src#0 in [31] *memcpy_dma256::$5 = (byte*)memcpy_dma256::src#0 -Constant value identified (byte*)memcpy_dma256::dest#0 in [37] *memcpy_dma256::$7 = (byte*)memcpy_dma256::dest#0 +Constant value identified (byte*)memcpy_dma256::src#0 in [27] *memcpy_dma256::$5 = (byte*)memcpy_dma256::src#0 +Constant value identified (byte*)memcpy_dma256::dest#0 in [33] *memcpy_dma256::$7 = (byte*)memcpy_dma256::dest#0 Successful SSA optimization Pass2ConstantValues -Converting *(pointer+n) to pointer[n] [25] *memcpy_dma256::$3 = memcpy_dma256::num#0 -- memcpy_dma256::$8[OFFSET_STRUCT_DMA_LIST_F018B_COUNT] -Converting *(pointer+n) to pointer[n] [28] *memcpy_dma256::$4 = memcpy_dma256::src_bank#0 -- memcpy_dma256::$9[OFFSET_STRUCT_DMA_LIST_F018B_SRC_BANK] -Converting *(pointer+n) to pointer[n] [31] *memcpy_dma256::$5 = (byte*)memcpy_dma256::src#0 -- memcpy_dma256::$10[OFFSET_STRUCT_DMA_LIST_F018B_SRC] -Converting *(pointer+n) to pointer[n] [34] *memcpy_dma256::$6 = memcpy_dma256::dest_bank#0 -- memcpy_dma256::$11[OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK] -Converting *(pointer+n) to pointer[n] [37] *memcpy_dma256::$7 = (byte*)memcpy_dma256::dest#0 -- memcpy_dma256::$12[OFFSET_STRUCT_DMA_LIST_F018B_DEST] +Converting *(pointer+n) to pointer[n] [21] *memcpy_dma256::$3 = memcpy_dma256::num#0 -- memcpy_dma256::$8[OFFSET_STRUCT_DMA_LIST_F018B_COUNT] +Converting *(pointer+n) to pointer[n] [24] *memcpy_dma256::$4 = memcpy_dma256::src_bank#0 -- memcpy_dma256::$9[OFFSET_STRUCT_DMA_LIST_F018B_SRC_BANK] +Converting *(pointer+n) to pointer[n] [27] *memcpy_dma256::$5 = (byte*)memcpy_dma256::src#0 -- memcpy_dma256::$10[OFFSET_STRUCT_DMA_LIST_F018B_SRC] +Converting *(pointer+n) to pointer[n] [30] *memcpy_dma256::$6 = memcpy_dma256::dest_bank#0 -- memcpy_dma256::$11[OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK] +Converting *(pointer+n) to pointer[n] [33] *memcpy_dma256::$7 = (byte*)memcpy_dma256::dest#0 -- memcpy_dma256::$12[OFFSET_STRUCT_DMA_LIST_F018B_DEST] Successful SSA optimization Pass2InlineDerefIdx -Eliminating unused variable memcpy_dma256::$3 and assignment [19] memcpy_dma256::$3 = memcpy_dma256::$8 + OFFSET_STRUCT_DMA_LIST_F018B_COUNT -Eliminating unused variable memcpy_dma256::$4 and assignment [21] memcpy_dma256::$4 = memcpy_dma256::$9 + OFFSET_STRUCT_DMA_LIST_F018B_SRC_BANK -Eliminating unused variable memcpy_dma256::$5 and assignment [23] memcpy_dma256::$5 = memcpy_dma256::$10 + OFFSET_STRUCT_DMA_LIST_F018B_SRC -Eliminating unused variable memcpy_dma256::$6 and assignment [25] memcpy_dma256::$6 = memcpy_dma256::$11 + OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK -Eliminating unused variable memcpy_dma256::$7 and assignment [27] memcpy_dma256::$7 = memcpy_dma256::$12 + OFFSET_STRUCT_DMA_LIST_F018B_DEST +Eliminating unused variable memcpy_dma256::$3 and assignment [15] memcpy_dma256::$3 = memcpy_dma256::$8 + OFFSET_STRUCT_DMA_LIST_F018B_COUNT +Eliminating unused variable memcpy_dma256::$4 and assignment [17] memcpy_dma256::$4 = memcpy_dma256::$9 + OFFSET_STRUCT_DMA_LIST_F018B_SRC_BANK +Eliminating unused variable memcpy_dma256::$5 and assignment [19] memcpy_dma256::$5 = memcpy_dma256::$10 + OFFSET_STRUCT_DMA_LIST_F018B_SRC +Eliminating unused variable memcpy_dma256::$6 and assignment [21] memcpy_dma256::$6 = memcpy_dma256::$11 + OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK +Eliminating unused variable memcpy_dma256::$7 and assignment [23] memcpy_dma256::$7 = memcpy_dma256::$12 + OFFSET_STRUCT_DMA_LIST_F018B_DEST Successful SSA optimization PassNEliminateUnusedVars Removing unused procedure __start Removing unused procedure block __start Removing unused procedure block __start::@1 Removing unused procedure block __start::@return Successful SSA optimization PassNEliminateEmptyStart -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 -Constant right-side identified [0] memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#0 -Constant right-side identified [2] memoryRemap::$1 = memoryRemap::remapBlocks#0 << 4 -Constant right-side identified [3] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 -Constant right-side identified [7] memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#0 -Constant right-side identified [9] memoryRemap::$6 = memoryRemap::remapBlocks#0 & $f0 -Constant right-side identified [10] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 +Constant right-side identified [0] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#0 +Constant right-side identified [1] memoryRemap::$1 = memoryRemap::remapBlocks#0 << 4 +Constant right-side identified [2] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 +Constant right-side identified [5] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#0 +Constant right-side identified [6] memoryRemap::$6 = memoryRemap::remapBlocks#0 & $f0 +Constant right-side identified [7] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 Successful SSA optimization Pass2ConstantRValueConsolidation -Constant memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#0 Constant memoryRemap::$1 = memoryRemap::remapBlocks#0<<4 Constant memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 -Constant memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#0 Constant memoryRemap::$6 = memoryRemap::remapBlocks#0&$f0 Constant memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 Successful SSA optimization Pass2ConstantIdentification -Simplifying constant evaluating to zero byte0 memoryRemap::lowerPageOffset#0 in Simplifying constant evaluating to zero memoryRemap::remapBlocks#0<<4 in Simplifying constant evaluating to zero byte1 memoryRemap::lowerPageOffset#0 in -Simplifying constant evaluating to zero byte0 memoryRemap::upperPageOffset#0 in Simplifying constant evaluating to zero memoryRemap::remapBlocks#0&$f0 in Simplifying constant evaluating to zero byte1 memoryRemap::upperPageOffset#0 in +Simplifying constant evaluating to zero byte0 memoryRemap::lowerPageOffset#0 in [0] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#0 +Simplifying constant evaluating to zero byte0 memoryRemap::upperPageOffset#0 in [5] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#0 Successful SSA optimization PassNSimplifyConstantZero -Simplifying expression containing zero memoryRemap::$3 in [5] memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 -Simplifying expression containing zero memoryRemap::$8 in [12] memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 +Simplifying expression containing zero memoryRemap::$3 in [4] memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 +Simplifying expression containing zero memoryRemap::$8 in [9] memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 Successful SSA optimization PassNSimplifyExpressionWithZero Eliminating unused constant memoryRemap::remapBlocks#0 Eliminating unused constant memoryRemap::lowerPageOffset#0 @@ -414,17 +396,14 @@ Eliminating unused constant memoryRemap::upperPageOffset#0 Eliminating unused constant memoryRemap::$1 Eliminating unused constant memoryRemap::$6 Successful SSA optimization PassNEliminateUnusedVars -Alias candidate removed (volatile)memoryRemap::$4 = memoryRemap::$3 memoryRemap::xVal -Alias candidate removed (volatile)memoryRemap::$9 = memoryRemap::$8 memoryRemap::zVal +Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$3 +Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$8 Constant right-side identified [1] memoryRemap::$3 = memoryRemap::$2 & $f -Constant right-side identified [5] memoryRemap::$8 = memoryRemap::$7 & $f +Constant right-side identified [4] memoryRemap::$8 = memoryRemap::$7 & $f Successful SSA optimization Pass2ConstantRValueConsolidation Constant memoryRemap::$3 = memoryRemap::$2&$f Constant memoryRemap::$8 = memoryRemap::$7&$f Successful SSA optimization Pass2ConstantIdentification -Constant memoryRemap::$4 = memoryRemap::$3 -Constant memoryRemap::$9 = memoryRemap::$8 -Successful SSA optimization Pass2ConstantIdentification Simplifying constant evaluating to zero memoryRemap::$2&$f in Simplifying constant evaluating to zero memoryRemap::$7&$f in Successful SSA optimization PassNSimplifyConstantZero @@ -432,19 +411,15 @@ Eliminating unused constant memoryRemap::$2 Eliminating unused constant memoryRemap::$7 Successful SSA optimization PassNEliminateUnusedVars Constant inlined memcpy_dma256::$9 = (byte*)memcpy_dma256::f018b#0 -Constant inlined memcpy_dma256::$2 = byte0 memcpy_dma_command256 -Constant inlined memcpy_dma256::$1 = byte1 memcpy_dma_command256 -Constant inlined memcpy_dma256::$8 = (word*)memcpy_dma256::f018b#0 -Constant inlined memoryRemap::$0 = 0 Constant inlined memcpy_dma256::$0 = memcpy_dma_command256+6 Constant inlined memoryRemap::$3 = 0 -Constant inlined memoryRemap::$4 = 0 Constant inlined memcpy_dma256::$12 = (byte**)memcpy_dma256::f018b#0 -Constant inlined memoryRemap::$5 = 0 +Constant inlined memcpy_dma256::$2 = byte0 memcpy_dma_command256 Constant inlined memcpy_dma256::$10 = (byte**)memcpy_dma256::f018b#0 +Constant inlined memcpy_dma256::$1 = byte1 memcpy_dma_command256 Constant inlined memcpy_dma256::$11 = (byte*)memcpy_dma256::f018b#0 Constant inlined memoryRemap::$8 = 0 -Constant inlined memoryRemap::$9 = 0 +Constant inlined memcpy_dma256::$8 = (word*)memcpy_dma256::f018b#0 Successful SSA optimization Pass2ConstantInlining Consolidated array index constant in *(memcpy_dma_command256+1) Consolidated array index constant in *(memcpy_dma_command256+3) diff --git a/src/test/ref/examples/mega65/dma-test5.log b/src/test/ref/examples/mega65/dma-test5.log index ea893d761..80f3e5d62 100644 --- a/src/test/ref/examples/mega65/dma-test5.log +++ b/src/test/ref/examples/mega65/dma-test5.log @@ -41,6 +41,10 @@ Setting inferred volatile on symbol affected by address-of: memoryRemap256M::xVa Setting inferred volatile on symbol affected by address-of: memoryRemap256M::yVal in asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } Setting inferred volatile on symbol affected by address-of: memoryRemap256M::zVal in asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx +Eliminating unused variable with no statement memoryRemap::$0 +Eliminating unused variable with no statement memoryRemap::$4 +Eliminating unused variable with no statement memoryRemap::$5 +Eliminating unused variable with no statement memoryRemap::$9 Eliminating unused variable with no statement memcpy_dma_command Eliminating unused variable with no statement memcpy_dma_command4 @@ -51,20 +55,16 @@ memoryRemap: scope:[memoryRemap] from main memoryRemap::upperPageOffset#1 = phi( main/memoryRemap::upperPageOffset#0 ) memoryRemap::remapBlocks#1 = phi( main/memoryRemap::remapBlocks#0 ) memoryRemap::lowerPageOffset#1 = phi( main/memoryRemap::lowerPageOffset#0 ) - memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#1 - memoryRemap::aVal = memoryRemap::$0 + memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#1 memoryRemap::$1 = memoryRemap::remapBlocks#1 << 4 memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#1 memoryRemap::$3 = memoryRemap::$2 & $f - memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 - memoryRemap::xVal = memoryRemap::$4 - memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#1 - memoryRemap::yVal = memoryRemap::$5 + memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 + memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#1 memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#1 memoryRemap::$8 = memoryRemap::$7 & $f - memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 - memoryRemap::zVal = memoryRemap::$9 + memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } to:memoryRemap::@return memoryRemap::@return: scope:[memoryRemap] from memoryRemap @@ -135,16 +135,12 @@ constant byte OFFSET_STRUCT_F018_DMAGIC_EN018B = 3 void __start() void main() void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset) -byte~ memoryRemap::$0 byte~ memoryRemap::$1 byte~ memoryRemap::$2 number~ memoryRemap::$3 -number~ memoryRemap::$4 -byte~ memoryRemap::$5 number~ memoryRemap::$6 byte~ memoryRemap::$7 number~ memoryRemap::$8 -number~ memoryRemap::$9 volatile byte memoryRemap::aVal loadstore word memoryRemap::lowerPageOffset word memoryRemap::lowerPageOffset#0 @@ -175,12 +171,10 @@ volatile struct DMA_LIST_F018B memset_dma_command loadstore = { command: DMA_COM Adding number conversion cast (unumber) 4 in memoryRemap::$1 = memoryRemap::remapBlocks#1 << 4 Adding number conversion cast (unumber) $f in memoryRemap::$3 = memoryRemap::$2 & $f Adding number conversion cast (unumber) memoryRemap::$3 in memoryRemap::$3 = memoryRemap::$2 & (unumber)$f -Adding number conversion cast (unumber) memoryRemap::$4 in memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 Adding number conversion cast (unumber) $f0 in memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 Adding number conversion cast (unumber) memoryRemap::$6 in memoryRemap::$6 = memoryRemap::remapBlocks#1 & (unumber)$f0 Adding number conversion cast (unumber) $f in memoryRemap::$8 = memoryRemap::$7 & $f Adding number conversion cast (unumber) memoryRemap::$8 in memoryRemap::$8 = memoryRemap::$7 & (unumber)$f -Adding number conversion cast (unumber) memoryRemap::$9 in memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 Adding number conversion cast (unumber) 1 in *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B) = 1 Adding number conversion cast (unumber) 0 in *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMB) = 0 Adding number conversion cast (unumber) 0 in *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRBANK) = 0 @@ -223,14 +217,8 @@ Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in memoryRemap::$3 = memoryRemap::$2 & $f -Inferred type updated to byte in memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 Inferred type updated to byte in memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 Inferred type updated to byte in memoryRemap::$8 = memoryRemap::$7 & $f -Inferred type updated to byte in memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 Identical Phi Values memoryRemap::lowerPageOffset#1 memoryRemap::lowerPageOffset#0 Identical Phi Values memoryRemap::remapBlocks#1 memoryRemap::remapBlocks#0 Identical Phi Values memoryRemap::upperPageOffset#1 memoryRemap::upperPageOffset#0 @@ -238,7 +226,7 @@ Identical Phi Values memset_dma::num#1 memset_dma::num#0 Identical Phi Values memset_dma::fill#1 memset_dma::fill#0 Identical Phi Values memset_dma::dest#1 memset_dma::dest#0 Successful SSA optimization Pass2IdenticalPhiElimination -Constant right-side identified [35] memset_dma::num#0 = (unumber)$50*$a +Constant right-side identified [31] memset_dma::num#0 = (unumber)$50*$a Successful SSA optimization Pass2ConstantRValueConsolidation Constant memoryRemap::remapBlocks#0 = 0 Constant memoryRemap::lowerPageOffset#0 = 0 @@ -247,10 +235,10 @@ Constant memset_dma::dest#0 = (void*)DEFAULT_SCREEN Constant memset_dma::fill#0 = '*' Constant memset_dma::num#0 = (unumber)$50*$a Successful SSA optimization Pass2ConstantIdentification -Constant value identified (byte*)memset_dma::fill#0 in [20] *((byte**)&memset_dma_command+OFFSET_STRUCT_DMA_LIST_F018B_SRC) = (byte*)memset_dma::fill#0 -Constant value identified (byte*)memset_dma::dest#0 in [21] *((byte**)&memset_dma_command+OFFSET_STRUCT_DMA_LIST_F018B_DEST) = (byte*)memset_dma::dest#0 +Constant value identified (byte*)memset_dma::fill#0 in [16] *((byte**)&memset_dma_command+OFFSET_STRUCT_DMA_LIST_F018B_SRC) = (byte*)memset_dma::fill#0 +Constant value identified (byte*)memset_dma::dest#0 in [17] *((byte**)&memset_dma_command+OFFSET_STRUCT_DMA_LIST_F018B_DEST) = (byte*)memset_dma::dest#0 Successful SSA optimization Pass2ConstantValues -Simplifying expression containing zero (byte*)DMA in [26] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRLSBTRIG) = byte0 &memset_dma_command +Simplifying expression containing zero (byte*)DMA in [22] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRLSBTRIG) = byte0 &memset_dma_command Successful SSA optimization PassNSimplifyExpressionWithZero Eliminating unused constant OFFSET_STRUCT_F018_DMAGIC_ADDRLSBTRIG Successful SSA optimization PassNEliminateUnusedVars @@ -259,33 +247,27 @@ Removing unused procedure block __start Removing unused procedure block __start::@1 Removing unused procedure block __start::@return Successful SSA optimization PassNEliminateEmptyStart -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 -Constant right-side identified [0] memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#0 -Constant right-side identified [2] memoryRemap::$1 = memoryRemap::remapBlocks#0 << 4 -Constant right-side identified [3] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 -Constant right-side identified [7] memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#0 -Constant right-side identified [9] memoryRemap::$6 = memoryRemap::remapBlocks#0 & $f0 -Constant right-side identified [10] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 +Constant right-side identified [0] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#0 +Constant right-side identified [1] memoryRemap::$1 = memoryRemap::remapBlocks#0 << 4 +Constant right-side identified [2] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 +Constant right-side identified [5] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#0 +Constant right-side identified [6] memoryRemap::$6 = memoryRemap::remapBlocks#0 & $f0 +Constant right-side identified [7] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 Successful SSA optimization Pass2ConstantRValueConsolidation -Constant memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#0 Constant memoryRemap::$1 = memoryRemap::remapBlocks#0<<4 Constant memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 -Constant memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#0 Constant memoryRemap::$6 = memoryRemap::remapBlocks#0&$f0 Constant memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 Successful SSA optimization Pass2ConstantIdentification -Simplifying constant evaluating to zero byte0 memoryRemap::lowerPageOffset#0 in Simplifying constant evaluating to zero memoryRemap::remapBlocks#0<<4 in Simplifying constant evaluating to zero byte1 memoryRemap::lowerPageOffset#0 in -Simplifying constant evaluating to zero byte0 memoryRemap::upperPageOffset#0 in Simplifying constant evaluating to zero memoryRemap::remapBlocks#0&$f0 in Simplifying constant evaluating to zero byte1 memoryRemap::upperPageOffset#0 in +Simplifying constant evaluating to zero byte0 memoryRemap::lowerPageOffset#0 in [0] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#0 +Simplifying constant evaluating to zero byte0 memoryRemap::upperPageOffset#0 in [5] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#0 Successful SSA optimization PassNSimplifyConstantZero -Simplifying expression containing zero memoryRemap::$3 in [5] memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 -Simplifying expression containing zero memoryRemap::$8 in [12] memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 +Simplifying expression containing zero memoryRemap::$3 in [4] memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 +Simplifying expression containing zero memoryRemap::$8 in [9] memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 Successful SSA optimization PassNSimplifyExpressionWithZero Eliminating unused constant memoryRemap::remapBlocks#0 Eliminating unused constant memoryRemap::lowerPageOffset#0 @@ -293,28 +275,21 @@ Eliminating unused constant memoryRemap::upperPageOffset#0 Eliminating unused constant memoryRemap::$1 Eliminating unused constant memoryRemap::$6 Successful SSA optimization PassNEliminateUnusedVars -Alias candidate removed (volatile)memoryRemap::$4 = memoryRemap::$3 memoryRemap::xVal -Alias candidate removed (volatile)memoryRemap::$9 = memoryRemap::$8 memoryRemap::zVal +Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$3 +Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$8 Constant right-side identified [1] memoryRemap::$3 = memoryRemap::$2 & $f -Constant right-side identified [5] memoryRemap::$8 = memoryRemap::$7 & $f +Constant right-side identified [4] memoryRemap::$8 = memoryRemap::$7 & $f Successful SSA optimization Pass2ConstantRValueConsolidation Constant memoryRemap::$3 = memoryRemap::$2&$f Constant memoryRemap::$8 = memoryRemap::$7&$f Successful SSA optimization Pass2ConstantIdentification -Constant memoryRemap::$4 = memoryRemap::$3 -Constant memoryRemap::$9 = memoryRemap::$8 -Successful SSA optimization Pass2ConstantIdentification Simplifying constant evaluating to zero memoryRemap::$2&$f in Simplifying constant evaluating to zero memoryRemap::$7&$f in Successful SSA optimization PassNSimplifyConstantZero Eliminating unused constant memoryRemap::$2 Eliminating unused constant memoryRemap::$7 Successful SSA optimization PassNEliminateUnusedVars -Constant inlined memoryRemap::$4 = 0 -Constant inlined memoryRemap::$5 = 0 Constant inlined memoryRemap::$8 = 0 -Constant inlined memoryRemap::$0 = 0 -Constant inlined memoryRemap::$9 = 0 Constant inlined memoryRemap::$3 = 0 Successful SSA optimization Pass2ConstantInlining Finalized unsigned number type (byte) 8 diff --git a/src/test/ref/examples/mega65/dma-test6.log b/src/test/ref/examples/mega65/dma-test6.log index 536f4c5ac..efe281dba 100644 --- a/src/test/ref/examples/mega65/dma-test6.log +++ b/src/test/ref/examples/mega65/dma-test6.log @@ -41,6 +41,10 @@ Setting inferred volatile on symbol affected by address-of: memoryRemap256M::xVa Setting inferred volatile on symbol affected by address-of: memoryRemap256M::yVal in asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } Setting inferred volatile on symbol affected by address-of: memoryRemap256M::zVal in asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx +Eliminating unused variable with no statement memoryRemap::$0 +Eliminating unused variable with no statement memoryRemap::$4 +Eliminating unused variable with no statement memoryRemap::$5 +Eliminating unused variable with no statement memoryRemap::$9 Eliminating unused variable with no statement memcpy_dma_command Eliminating unused variable with no statement memcpy_dma_command4 Eliminating unused variable with no statement memset_dma_command @@ -52,20 +56,16 @@ memoryRemap: scope:[memoryRemap] from main memoryRemap::upperPageOffset#1 = phi( main/memoryRemap::upperPageOffset#0 ) memoryRemap::remapBlocks#1 = phi( main/memoryRemap::remapBlocks#0 ) memoryRemap::lowerPageOffset#1 = phi( main/memoryRemap::lowerPageOffset#0 ) - memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#1 - memoryRemap::aVal = memoryRemap::$0 + memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#1 memoryRemap::$1 = memoryRemap::remapBlocks#1 << 4 memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#1 memoryRemap::$3 = memoryRemap::$2 & $f - memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 - memoryRemap::xVal = memoryRemap::$4 - memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#1 - memoryRemap::yVal = memoryRemap::$5 + memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 + memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#1 memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#1 memoryRemap::$8 = memoryRemap::$7 & $f - memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 - memoryRemap::zVal = memoryRemap::$9 + memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } to:memoryRemap::@return memoryRemap::@return: scope:[memoryRemap] from memoryRemap @@ -158,16 +158,12 @@ constant byte OFFSET_STRUCT_F018_DMAGIC_ETRIG = 5 void __start() void main() void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset) -byte~ memoryRemap::$0 byte~ memoryRemap::$1 byte~ memoryRemap::$2 number~ memoryRemap::$3 -number~ memoryRemap::$4 -byte~ memoryRemap::$5 number~ memoryRemap::$6 byte~ memoryRemap::$7 number~ memoryRemap::$8 -number~ memoryRemap::$9 volatile byte memoryRemap::aVal loadstore word memoryRemap::lowerPageOffset word memoryRemap::lowerPageOffset#0 @@ -217,12 +213,10 @@ constant byte* memset_dma_command256[] = { DMA_OPTION_DEST_MB, 0, DMA_OPTION_FO Adding number conversion cast (unumber) 4 in memoryRemap::$1 = memoryRemap::remapBlocks#1 << 4 Adding number conversion cast (unumber) $f in memoryRemap::$3 = memoryRemap::$2 & $f Adding number conversion cast (unumber) memoryRemap::$3 in memoryRemap::$3 = memoryRemap::$2 & (unumber)$f -Adding number conversion cast (unumber) memoryRemap::$4 in memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 Adding number conversion cast (unumber) $f0 in memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 Adding number conversion cast (unumber) memoryRemap::$6 in memoryRemap::$6 = memoryRemap::remapBlocks#1 & (unumber)$f0 Adding number conversion cast (unumber) $f in memoryRemap::$8 = memoryRemap::$7 & $f Adding number conversion cast (unumber) memoryRemap::$8 in memoryRemap::$8 = memoryRemap::$7 & (unumber)$f -Adding number conversion cast (unumber) memoryRemap::$9 in memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 Adding number conversion cast (unumber) 1 in memset_dma_command256[1] = memset_dma256::dest_mb#1 Adding number conversion cast (unumber) 4 in memset_dma256::$0 = & memset_dma_command256[4] Adding number conversion cast (unumber) 1 in *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B) = 1 @@ -279,14 +273,8 @@ Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in memoryRemap::$3 = memoryRemap::$2 & $f -Inferred type updated to byte in memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 Inferred type updated to byte in memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 Inferred type updated to byte in memoryRemap::$8 = memoryRemap::$7 & $f -Inferred type updated to byte in memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 Identical Phi Values memoryRemap::lowerPageOffset#1 memoryRemap::lowerPageOffset#0 Identical Phi Values memoryRemap::remapBlocks#1 memoryRemap::remapBlocks#0 Identical Phi Values memoryRemap::upperPageOffset#1 memoryRemap::upperPageOffset#0 @@ -296,12 +284,12 @@ Identical Phi Values memset_dma256::dest_bank#1 memset_dma256::dest_bank#0 Identical Phi Values memset_dma256::dest#1 memset_dma256::dest#0 Identical Phi Values memset_dma256::fill#1 memset_dma256::fill#0 Successful SSA optimization Pass2IdenticalPhiElimination -Rewriting array member address-of to pointer addition [20] memset_dma256::$0 = memset_dma_command256 + 4 +Rewriting array member address-of to pointer addition [16] memset_dma256::$0 = memset_dma_command256 + 4 Successful SSA optimization PassNArrayElementAddressOfRewriting -Constant right-side identified [20] memset_dma256::$0 = memset_dma_command256 + 4 -Constant right-side identified [37] memset_dma256::$1 = byte1 memset_dma_command256 -Constant right-side identified [39] memset_dma256::$2 = byte0 memset_dma_command256 -Constant right-side identified [51] memset_dma256::num#0 = (unumber)$50*$a +Constant right-side identified [16] memset_dma256::$0 = memset_dma_command256 + 4 +Constant right-side identified [33] memset_dma256::$1 = byte1 memset_dma_command256 +Constant right-side identified [35] memset_dma256::$2 = byte0 memset_dma_command256 +Constant right-side identified [47] memset_dma256::num#0 = (unumber)$50*$a Successful SSA optimization Pass2ConstantRValueConsolidation Constant memset_dma256::$0 = memset_dma_command256+4 Constant memset_dma256::$1 = byte1 memset_dma_command256 @@ -322,51 +310,45 @@ Constant memset_dma256::$8 = (byte*)memset_dma256::f018b#0 Constant memset_dma256::$9 = (byte**)memset_dma256::f018b#0 Constant memset_dma256::$10 = (byte**)memset_dma256::f018b#0 Successful SSA optimization Pass2ConstantIdentification -Constant value identified (byte*)memset_dma256::dest#0 in [30] *memset_dma256::$5 = (byte*)memset_dma256::dest#0 -Constant value identified (byte*)memset_dma256::fill#0 in [33] *memset_dma256::$6 = (byte*)memset_dma256::fill#0 +Constant value identified (byte*)memset_dma256::dest#0 in [26] *memset_dma256::$5 = (byte*)memset_dma256::dest#0 +Constant value identified (byte*)memset_dma256::fill#0 in [29] *memset_dma256::$6 = (byte*)memset_dma256::fill#0 Successful SSA optimization Pass2ConstantValues -Converting *(pointer+n) to pointer[n] [24] *memset_dma256::$3 = memset_dma256::num#0 -- memset_dma256::$7[OFFSET_STRUCT_DMA_LIST_F018B_COUNT] -Converting *(pointer+n) to pointer[n] [27] *memset_dma256::$4 = memset_dma256::dest_bank#0 -- memset_dma256::$8[OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK] -Converting *(pointer+n) to pointer[n] [30] *memset_dma256::$5 = (byte*)memset_dma256::dest#0 -- memset_dma256::$9[OFFSET_STRUCT_DMA_LIST_F018B_DEST] -Converting *(pointer+n) to pointer[n] [33] *memset_dma256::$6 = (byte*)memset_dma256::fill#0 -- memset_dma256::$10[OFFSET_STRUCT_DMA_LIST_F018B_SRC] +Converting *(pointer+n) to pointer[n] [20] *memset_dma256::$3 = memset_dma256::num#0 -- memset_dma256::$7[OFFSET_STRUCT_DMA_LIST_F018B_COUNT] +Converting *(pointer+n) to pointer[n] [23] *memset_dma256::$4 = memset_dma256::dest_bank#0 -- memset_dma256::$8[OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK] +Converting *(pointer+n) to pointer[n] [26] *memset_dma256::$5 = (byte*)memset_dma256::dest#0 -- memset_dma256::$9[OFFSET_STRUCT_DMA_LIST_F018B_DEST] +Converting *(pointer+n) to pointer[n] [29] *memset_dma256::$6 = (byte*)memset_dma256::fill#0 -- memset_dma256::$10[OFFSET_STRUCT_DMA_LIST_F018B_SRC] Successful SSA optimization Pass2InlineDerefIdx -Eliminating unused variable memset_dma256::$3 and assignment [18] memset_dma256::$3 = memset_dma256::$7 + OFFSET_STRUCT_DMA_LIST_F018B_COUNT -Eliminating unused variable memset_dma256::$4 and assignment [20] memset_dma256::$4 = memset_dma256::$8 + OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK -Eliminating unused variable memset_dma256::$5 and assignment [22] memset_dma256::$5 = memset_dma256::$9 + OFFSET_STRUCT_DMA_LIST_F018B_DEST -Eliminating unused variable memset_dma256::$6 and assignment [24] memset_dma256::$6 = memset_dma256::$10 + OFFSET_STRUCT_DMA_LIST_F018B_SRC +Eliminating unused variable memset_dma256::$3 and assignment [14] memset_dma256::$3 = memset_dma256::$7 + OFFSET_STRUCT_DMA_LIST_F018B_COUNT +Eliminating unused variable memset_dma256::$4 and assignment [16] memset_dma256::$4 = memset_dma256::$8 + OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK +Eliminating unused variable memset_dma256::$5 and assignment [18] memset_dma256::$5 = memset_dma256::$9 + OFFSET_STRUCT_DMA_LIST_F018B_DEST +Eliminating unused variable memset_dma256::$6 and assignment [20] memset_dma256::$6 = memset_dma256::$10 + OFFSET_STRUCT_DMA_LIST_F018B_SRC Successful SSA optimization PassNEliminateUnusedVars Removing unused procedure __start Removing unused procedure block __start Removing unused procedure block __start::@1 Removing unused procedure block __start::@return Successful SSA optimization PassNEliminateEmptyStart -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 -Constant right-side identified [0] memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#0 -Constant right-side identified [2] memoryRemap::$1 = memoryRemap::remapBlocks#0 << 4 -Constant right-side identified [3] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 -Constant right-side identified [7] memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#0 -Constant right-side identified [9] memoryRemap::$6 = memoryRemap::remapBlocks#0 & $f0 -Constant right-side identified [10] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 +Constant right-side identified [0] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#0 +Constant right-side identified [1] memoryRemap::$1 = memoryRemap::remapBlocks#0 << 4 +Constant right-side identified [2] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 +Constant right-side identified [5] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#0 +Constant right-side identified [6] memoryRemap::$6 = memoryRemap::remapBlocks#0 & $f0 +Constant right-side identified [7] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 Successful SSA optimization Pass2ConstantRValueConsolidation -Constant memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#0 Constant memoryRemap::$1 = memoryRemap::remapBlocks#0<<4 Constant memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 -Constant memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#0 Constant memoryRemap::$6 = memoryRemap::remapBlocks#0&$f0 Constant memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 Successful SSA optimization Pass2ConstantIdentification -Simplifying constant evaluating to zero byte0 memoryRemap::lowerPageOffset#0 in Simplifying constant evaluating to zero memoryRemap::remapBlocks#0<<4 in Simplifying constant evaluating to zero byte1 memoryRemap::lowerPageOffset#0 in -Simplifying constant evaluating to zero byte0 memoryRemap::upperPageOffset#0 in Simplifying constant evaluating to zero memoryRemap::remapBlocks#0&$f0 in Simplifying constant evaluating to zero byte1 memoryRemap::upperPageOffset#0 in +Simplifying constant evaluating to zero byte0 memoryRemap::lowerPageOffset#0 in [0] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#0 +Simplifying constant evaluating to zero byte0 memoryRemap::upperPageOffset#0 in [5] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#0 Successful SSA optimization PassNSimplifyConstantZero -Simplifying expression containing zero memoryRemap::$3 in [5] memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 -Simplifying expression containing zero memoryRemap::$8 in [12] memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 +Simplifying expression containing zero memoryRemap::$3 in [4] memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 +Simplifying expression containing zero memoryRemap::$8 in [9] memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 Successful SSA optimization PassNSimplifyExpressionWithZero Eliminating unused constant memoryRemap::remapBlocks#0 Eliminating unused constant memoryRemap::lowerPageOffset#0 @@ -374,17 +356,14 @@ Eliminating unused constant memoryRemap::upperPageOffset#0 Eliminating unused constant memoryRemap::$1 Eliminating unused constant memoryRemap::$6 Successful SSA optimization PassNEliminateUnusedVars -Alias candidate removed (volatile)memoryRemap::$4 = memoryRemap::$3 memoryRemap::xVal -Alias candidate removed (volatile)memoryRemap::$9 = memoryRemap::$8 memoryRemap::zVal +Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$3 +Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$8 Constant right-side identified [1] memoryRemap::$3 = memoryRemap::$2 & $f -Constant right-side identified [5] memoryRemap::$8 = memoryRemap::$7 & $f +Constant right-side identified [4] memoryRemap::$8 = memoryRemap::$7 & $f Successful SSA optimization Pass2ConstantRValueConsolidation Constant memoryRemap::$3 = memoryRemap::$2&$f Constant memoryRemap::$8 = memoryRemap::$7&$f Successful SSA optimization Pass2ConstantIdentification -Constant memoryRemap::$4 = memoryRemap::$3 -Constant memoryRemap::$9 = memoryRemap::$8 -Successful SSA optimization Pass2ConstantIdentification Simplifying constant evaluating to zero memoryRemap::$2&$f in Simplifying constant evaluating to zero memoryRemap::$7&$f in Successful SSA optimization PassNSimplifyConstantZero @@ -393,17 +372,13 @@ Eliminating unused constant memoryRemap::$7 Successful SSA optimization PassNEliminateUnusedVars Constant inlined memset_dma256::$1 = byte1 memset_dma_command256 Constant inlined memset_dma256::$2 = byte0 memset_dma_command256 -Constant inlined memset_dma256::$0 = memset_dma_command256+4 -Constant inlined memset_dma256::$10 = (byte**)memset_dma256::f018b#0 -Constant inlined memoryRemap::$0 = 0 Constant inlined memoryRemap::$3 = 0 -Constant inlined memoryRemap::$4 = 0 -Constant inlined memoryRemap::$5 = 0 +Constant inlined memset_dma256::$0 = memset_dma_command256+4 Constant inlined memoryRemap::$8 = 0 Constant inlined memset_dma256::$9 = (byte**)memset_dma256::f018b#0 -Constant inlined memoryRemap::$9 = 0 Constant inlined memset_dma256::$7 = (word*)memset_dma256::f018b#0 Constant inlined memset_dma256::$8 = (byte*)memset_dma256::f018b#0 +Constant inlined memset_dma256::$10 = (byte**)memset_dma256::f018b#0 Successful SSA optimization Pass2ConstantInlining Consolidated array index constant in *(memset_dma_command256+1) Consolidated array index constant in *((word*)memset_dma256::f018b#0+OFFSET_STRUCT_DMA_LIST_F018B_COUNT) diff --git a/src/test/ref/examples/mega65/dypp65.log b/src/test/ref/examples/mega65/dypp65.log index f9df5cab1..0eff829d8 100644 --- a/src/test/ref/examples/mega65/dypp65.log +++ b/src/test/ref/examples/mega65/dypp65.log @@ -42,6 +42,10 @@ Setting inferred volatile on symbol affected by address-of: memoryRemap256M::yVa Setting inferred volatile on symbol affected by address-of: memoryRemap256M::zVal in asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call SEI +Eliminating unused variable with no statement memoryRemap::$0 +Eliminating unused variable with no statement memoryRemap::$4 +Eliminating unused variable with no statement memoryRemap::$5 +Eliminating unused variable with no statement memoryRemap::$9 Eliminating unused variable with no statement memcpy_dma_command Eliminating unused variable with no statement memcpy_dma_command4 @@ -52,20 +56,16 @@ memoryRemap: scope:[memoryRemap] from main::@13 memoryRemap::upperPageOffset#1 = phi( main::@13/memoryRemap::upperPageOffset#0 ) memoryRemap::remapBlocks#1 = phi( main::@13/memoryRemap::remapBlocks#0 ) memoryRemap::lowerPageOffset#1 = phi( main::@13/memoryRemap::lowerPageOffset#0 ) - memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#1 - memoryRemap::aVal = memoryRemap::$0 + memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#1 memoryRemap::$1 = memoryRemap::remapBlocks#1 << 4 memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#1 memoryRemap::$3 = memoryRemap::$2 & $f - memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 - memoryRemap::xVal = memoryRemap::$4 - memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#1 - memoryRemap::yVal = memoryRemap::$5 + memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 + memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#1 memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#1 memoryRemap::$8 = memoryRemap::$7 & $f - memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 - memoryRemap::zVal = memoryRemap::$9 + memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } to:memoryRemap::@return memoryRemap::@return: scope:[memoryRemap] from memoryRemap @@ -399,16 +399,12 @@ byte main::y#1 byte main::y#2 byte main::y#3 void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset) -byte~ memoryRemap::$0 byte~ memoryRemap::$1 byte~ memoryRemap::$2 number~ memoryRemap::$3 -number~ memoryRemap::$4 -byte~ memoryRemap::$5 number~ memoryRemap::$6 byte~ memoryRemap::$7 number~ memoryRemap::$8 -number~ memoryRemap::$9 volatile byte memoryRemap::aVal loadstore word memoryRemap::lowerPageOffset word memoryRemap::lowerPageOffset#0 @@ -474,12 +470,10 @@ constant byte* memset_dma_command256[] = { DMA_OPTION_DEST_MB, 0, DMA_OPTION_FO Adding number conversion cast (unumber) 4 in memoryRemap::$1 = memoryRemap::remapBlocks#1 << 4 Adding number conversion cast (unumber) $f in memoryRemap::$3 = memoryRemap::$2 & $f Adding number conversion cast (unumber) memoryRemap::$3 in memoryRemap::$3 = memoryRemap::$2 & (unumber)$f -Adding number conversion cast (unumber) memoryRemap::$4 in memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 Adding number conversion cast (unumber) $f0 in memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 Adding number conversion cast (unumber) memoryRemap::$6 in memoryRemap::$6 = memoryRemap::remapBlocks#1 & (unumber)$f0 Adding number conversion cast (unumber) $f in memoryRemap::$8 = memoryRemap::$7 & $f Adding number conversion cast (unumber) memoryRemap::$8 in memoryRemap::$8 = memoryRemap::$7 & (unumber)$f -Adding number conversion cast (unumber) memoryRemap::$9 in memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 Adding number conversion cast (unumber) 1 in *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B) = 1 Adding number conversion cast (unumber) 0 in *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMB) = 0 Adding number conversion cast (unumber) 0 in *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRBANK) = 0 @@ -660,15 +654,9 @@ Finalized unsigned number type (byte) $2d Finalized unsigned number type (byte) $2d Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in memoryRemap::$3 = memoryRemap::$2 & $f -Inferred type updated to byte in memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 Inferred type updated to byte in memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 Inferred type updated to byte in memoryRemap::$8 = memoryRemap::$7 & $f -Inferred type updated to byte in memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 Inferred type updated to byte in main::$9 = $2d * SIZEOF_WORD -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 Alias main::r#2 = main::r#3 Alias main::erow#5 = main::erow#6 Alias main::i#2 = main::i#3 @@ -683,10 +671,6 @@ Alias main::y#2 = main::y#3 Alias main::logo_dest#2 = main::logo_dest#4 main::logo_dest#3 Alias main::col#3 = main::col#5 main::col#4 Successful SSA optimization Pass2AliasElimination -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 Identical Phi Values memoryRemap::lowerPageOffset#1 memoryRemap::lowerPageOffset#0 Identical Phi Values memoryRemap::remapBlocks#1 memoryRemap::remapBlocks#0 Identical Phi Values memoryRemap::upperPageOffset#1 memoryRemap::upperPageOffset#0 @@ -701,20 +685,20 @@ Identical Phi Values main::logo_src#2 main::logo_src#5 Identical Phi Values main::logo_dest#2 main::logo_dest#5 Identical Phi Values main::col#3 main::col#2 Successful SSA optimization Pass2IdenticalPhiElimination -Simple Condition main::$5 [102] if(main::r#2<$19) goto main::@2 -Simple Condition main::$6 [110] if(main::i#2<$2d) goto main::@5 -Simple Condition main::$7 [120] if(main::col#2<$2d) goto main::@8 -Simple Condition main::$8 [124] if(main::y#2<(byte)$19*8) goto main::@10 +Simple Condition main::$5 [98] if(main::r#2<$19) goto main::@2 +Simple Condition main::$6 [106] if(main::i#2<$2d) goto main::@5 +Simple Condition main::$7 [116] if(main::col#2<$2d) goto main::@8 +Simple Condition main::$8 [120] if(main::y#2<(byte)$19*8) goto main::@10 Successful SSA optimization Pass2ConditionalJumpSimplification -Rewriting array member address-of to pointer addition [32] memset_dma256::$0 = memset_dma_command256 + 4 +Rewriting array member address-of to pointer addition [28] memset_dma256::$0 = memset_dma_command256 + 4 Successful SSA optimization PassNArrayElementAddressOfRewriting -Constant right-side identified [32] memset_dma256::$0 = memset_dma_command256 + 4 -Constant right-side identified [49] memset_dma256::$1 = byte1 memset_dma_command256 -Constant right-side identified [51] memset_dma256::$2 = byte0 memset_dma_command256 -Constant right-side identified [86] memset_dma::num#0 = (unumber)$2d*$19*2 -Constant right-side identified [92] memset_dma256::num#0 = (unumber)$2d*$19*2 -Constant right-side identified [96] memset_dma::num#1 = (unumber)$2d*$20*8 -Constant right-side identified [115] main::$9 = $2d * SIZEOF_WORD +Constant right-side identified [28] memset_dma256::$0 = memset_dma_command256 + 4 +Constant right-side identified [45] memset_dma256::$1 = byte1 memset_dma_command256 +Constant right-side identified [47] memset_dma256::$2 = byte0 memset_dma_command256 +Constant right-side identified [82] memset_dma::num#0 = (unumber)$2d*$19*2 +Constant right-side identified [88] memset_dma256::num#0 = (unumber)$2d*$19*2 +Constant right-side identified [92] memset_dma::num#1 = (unumber)$2d*$20*8 +Constant right-side identified [111] main::$9 = $2d * SIZEOF_WORD Successful SSA optimization Pass2ConstantRValueConsolidation Constant memset_dma256::$0 = memset_dma_command256+4 Constant memset_dma256::$1 = byte1 memset_dma_command256 @@ -749,25 +733,25 @@ Constant memset_dma256::$8 = (byte*)memset_dma256::f018b#0 Constant memset_dma256::$9 = (byte**)memset_dma256::f018b#0 Constant memset_dma256::$10 = (byte**)memset_dma256::f018b#0 Successful SSA optimization Pass2ConstantIdentification -Constant value identified (byte*)memset_dma256::dest#0 in [42] *memset_dma256::$5 = (byte*)memset_dma256::dest#0 -Constant value identified (byte*)memset_dma256::fill#0 in [45] *memset_dma256::$6 = (byte*)memset_dma256::fill#0 +Constant value identified (byte*)memset_dma256::dest#0 in [38] *memset_dma256::$5 = (byte*)memset_dma256::dest#0 +Constant value identified (byte*)memset_dma256::fill#0 in [41] *memset_dma256::$6 = (byte*)memset_dma256::fill#0 Successful SSA optimization Pass2ConstantValues -Converting *(pointer+n) to pointer[n] [36] *memset_dma256::$3 = memset_dma256::num#0 -- memset_dma256::$7[OFFSET_STRUCT_DMA_LIST_F018B_COUNT] -Converting *(pointer+n) to pointer[n] [39] *memset_dma256::$4 = memset_dma256::dest_bank#0 -- memset_dma256::$8[OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK] -Converting *(pointer+n) to pointer[n] [42] *memset_dma256::$5 = (byte*)memset_dma256::dest#0 -- memset_dma256::$9[OFFSET_STRUCT_DMA_LIST_F018B_DEST] -Converting *(pointer+n) to pointer[n] [45] *memset_dma256::$6 = (byte*)memset_dma256::fill#0 -- memset_dma256::$10[OFFSET_STRUCT_DMA_LIST_F018B_SRC] +Converting *(pointer+n) to pointer[n] [32] *memset_dma256::$3 = memset_dma256::num#0 -- memset_dma256::$7[OFFSET_STRUCT_DMA_LIST_F018B_COUNT] +Converting *(pointer+n) to pointer[n] [35] *memset_dma256::$4 = memset_dma256::dest_bank#0 -- memset_dma256::$8[OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK] +Converting *(pointer+n) to pointer[n] [38] *memset_dma256::$5 = (byte*)memset_dma256::dest#0 -- memset_dma256::$9[OFFSET_STRUCT_DMA_LIST_F018B_DEST] +Converting *(pointer+n) to pointer[n] [41] *memset_dma256::$6 = (byte*)memset_dma256::fill#0 -- memset_dma256::$10[OFFSET_STRUCT_DMA_LIST_F018B_SRC] Successful SSA optimization Pass2InlineDerefIdx -Simplifying constant evaluating to zero byte0 SCREEN in [77] *((byte*)VICIV+OFFSET_STRUCT_MEGA65_VICIV_SCRNPTR_LOLO) = byte0 SCREEN -Simplifying constant evaluating to zero byte0 CHARSET in [81] *((byte*)VICIV+OFFSET_STRUCT_MEGA65_VICIV_CHARPTR_LOLO) = byte0 CHARSET +Simplifying constant evaluating to zero byte0 SCREEN in [73] *((byte*)VICIV+OFFSET_STRUCT_MEGA65_VICIV_SCRNPTR_LOLO) = byte0 SCREEN +Simplifying constant evaluating to zero byte0 CHARSET in [77] *((byte*)VICIV+OFFSET_STRUCT_MEGA65_VICIV_CHARPTR_LOLO) = byte0 CHARSET Successful SSA optimization PassNSimplifyConstantZero -Simplifying expression containing zero (byte*)DMA in [26] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRLSBTRIG) = byte0 &memset_dma_command +Simplifying expression containing zero (byte*)DMA in [22] *((byte*)DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRLSBTRIG) = byte0 &memset_dma_command Successful SSA optimization PassNSimplifyExpressionWithZero Removing unused block main::@return Successful SSA optimization Pass2EliminateUnusedBlocks -Eliminating unused variable memset_dma256::$3 and assignment [30] memset_dma256::$3 = memset_dma256::$7 + OFFSET_STRUCT_DMA_LIST_F018B_COUNT -Eliminating unused variable memset_dma256::$4 and assignment [32] memset_dma256::$4 = memset_dma256::$8 + OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK -Eliminating unused variable memset_dma256::$5 and assignment [34] memset_dma256::$5 = memset_dma256::$9 + OFFSET_STRUCT_DMA_LIST_F018B_DEST -Eliminating unused variable memset_dma256::$6 and assignment [36] memset_dma256::$6 = memset_dma256::$10 + OFFSET_STRUCT_DMA_LIST_F018B_SRC +Eliminating unused variable memset_dma256::$3 and assignment [26] memset_dma256::$3 = memset_dma256::$7 + OFFSET_STRUCT_DMA_LIST_F018B_COUNT +Eliminating unused variable memset_dma256::$4 and assignment [28] memset_dma256::$4 = memset_dma256::$8 + OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK +Eliminating unused variable memset_dma256::$5 and assignment [30] memset_dma256::$5 = memset_dma256::$9 + OFFSET_STRUCT_DMA_LIST_F018B_DEST +Eliminating unused variable memset_dma256::$6 and assignment [32] memset_dma256::$6 = memset_dma256::$10 + OFFSET_STRUCT_DMA_LIST_F018B_SRC Eliminating unused constant OFFSET_STRUCT_F018_DMAGIC_ADDRLSBTRIG Successful SSA optimization PassNEliminateUnusedVars Removing unused procedure __start @@ -775,33 +759,27 @@ Removing unused procedure block __start Removing unused procedure block __start::@1 Removing unused procedure block __start::@return Successful SSA optimization PassNEliminateEmptyStart -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 -Constant right-side identified [0] memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#0 -Constant right-side identified [2] memoryRemap::$1 = memoryRemap::remapBlocks#0 << 4 -Constant right-side identified [3] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 -Constant right-side identified [7] memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#0 -Constant right-side identified [9] memoryRemap::$6 = memoryRemap::remapBlocks#0 & $f0 -Constant right-side identified [10] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 +Constant right-side identified [0] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#0 +Constant right-side identified [1] memoryRemap::$1 = memoryRemap::remapBlocks#0 << 4 +Constant right-side identified [2] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 +Constant right-side identified [5] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#0 +Constant right-side identified [6] memoryRemap::$6 = memoryRemap::remapBlocks#0 & $f0 +Constant right-side identified [7] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 Successful SSA optimization Pass2ConstantRValueConsolidation -Constant memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#0 Constant memoryRemap::$1 = memoryRemap::remapBlocks#0<<4 Constant memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 -Constant memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#0 Constant memoryRemap::$6 = memoryRemap::remapBlocks#0&$f0 Constant memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 Successful SSA optimization Pass2ConstantIdentification -Simplifying constant evaluating to zero byte0 memoryRemap::lowerPageOffset#0 in Simplifying constant evaluating to zero memoryRemap::remapBlocks#0<<4 in Simplifying constant evaluating to zero byte1 memoryRemap::lowerPageOffset#0 in -Simplifying constant evaluating to zero byte0 memoryRemap::upperPageOffset#0 in Simplifying constant evaluating to zero memoryRemap::remapBlocks#0&$f0 in Simplifying constant evaluating to zero byte1 memoryRemap::upperPageOffset#0 in +Simplifying constant evaluating to zero byte0 memoryRemap::lowerPageOffset#0 in [0] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#0 +Simplifying constant evaluating to zero byte0 memoryRemap::upperPageOffset#0 in [5] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#0 Successful SSA optimization PassNSimplifyConstantZero -Simplifying expression containing zero memoryRemap::$3 in [5] memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 -Simplifying expression containing zero memoryRemap::$8 in [12] memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 +Simplifying expression containing zero memoryRemap::$3 in [4] memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 +Simplifying expression containing zero memoryRemap::$8 in [9] memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 Successful SSA optimization PassNSimplifyExpressionWithZero Eliminating unused constant memoryRemap::remapBlocks#0 Eliminating unused constant memoryRemap::lowerPageOffset#0 @@ -809,17 +787,14 @@ Eliminating unused constant memoryRemap::upperPageOffset#0 Eliminating unused constant memoryRemap::$1 Eliminating unused constant memoryRemap::$6 Successful SSA optimization PassNEliminateUnusedVars -Alias candidate removed (volatile)memoryRemap::$4 = memoryRemap::$3 memoryRemap::xVal -Alias candidate removed (volatile)memoryRemap::$9 = memoryRemap::$8 memoryRemap::zVal +Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$3 +Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$8 Constant right-side identified [1] memoryRemap::$3 = memoryRemap::$2 & $f -Constant right-side identified [5] memoryRemap::$8 = memoryRemap::$7 & $f +Constant right-side identified [4] memoryRemap::$8 = memoryRemap::$7 & $f Successful SSA optimization Pass2ConstantRValueConsolidation Constant memoryRemap::$3 = memoryRemap::$2&$f Constant memoryRemap::$8 = memoryRemap::$7&$f Successful SSA optimization Pass2ConstantIdentification -Constant memoryRemap::$4 = memoryRemap::$3 -Constant memoryRemap::$9 = memoryRemap::$8 -Successful SSA optimization Pass2ConstantIdentification Simplifying constant evaluating to zero memoryRemap::$2&$f in Simplifying constant evaluating to zero memoryRemap::$7&$f in Successful SSA optimization PassNSimplifyConstantZero @@ -862,14 +837,10 @@ Constant inlined memset_dma256::$2 = byte0 memset_dma_command256 Constant inlined memset_dma256::$0 = memset_dma_command256+4 Constant inlined main::erow#0 = SCREEN Constant inlined main::y#0 = 0 -Constant inlined memoryRemap::$0 = 0 Constant inlined memoryRemap::$3 = 0 Constant inlined main::logo_src#0 = LOGO -Constant inlined memoryRemap::$4 = 0 -Constant inlined memoryRemap::$5 = 0 Constant inlined memoryRemap::$8 = 0 Constant inlined main::$9 = $2d*SIZEOF_WORD -Constant inlined memoryRemap::$9 = 0 Successful SSA optimization Pass2ConstantInlining Consolidated array index constant in *(memset_dma_command256+1) Consolidated array index constant in *((word*)memset_dma256::f018b#0+OFFSET_STRUCT_DMA_LIST_F018B_COUNT) diff --git a/src/test/ref/examples/mega65/helloworld-mega65.asm b/src/test/ref/examples/mega65/helloworld-mega65.asm index 3f25b426c..77c8e6022 100644 --- a/src/test/ref/examples/mega65/helloworld-mega65.asm +++ b/src/test/ref/examples/mega65/helloworld-mega65.asm @@ -171,12 +171,11 @@ gotoxy: { sta.z conio_cursor_x // conio_cursor_y = y stx.z conio_cursor_y - // (unsigned int)y*CONIO_WIDTH + // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH txa sta.z __7 lda #0 sta.z __7+1 - // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH lda.z __7 asl sta.z __8 diff --git a/src/test/ref/examples/mega65/helloworld-mega65.log b/src/test/ref/examples/mega65/helloworld-mega65.log index 1918ac9bb..73dd790bb 100644 --- a/src/test/ref/examples/mega65/helloworld-mega65.log +++ b/src/test/ref/examples/mega65/helloworld-mega65.log @@ -19,6 +19,14 @@ Setting inferred volatile on symbol affected by address-of: memoryRemap256M::zVa Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call SEI Inlined call call __init +Eliminating unused variable with no statement memcpy::$0 +Eliminating unused variable with no statement memset::$2 +Eliminating unused variable with no statement gotoxy::$4 +Eliminating unused variable with no statement memoryRemap::$0 +Eliminating unused variable with no statement memoryRemap::$4 +Eliminating unused variable with no statement memoryRemap::$5 +Eliminating unused variable with no statement memoryRemap::$9 +Eliminating unused variable with no statement conio_mega65_init::$2 Eliminating unused variable with no statement printf_buffer Eliminating unused variable with no statement main::$0 @@ -32,8 +40,7 @@ memcpy: scope:[memcpy] from cscroll::@3 cscroll::@4 memcpy::src#0 = ((byte*)) memcpy::source#2 memcpy::dst#0 = ((byte*)) memcpy::destination#2 memcpy::$2 = (byte*)memcpy::source#2 - memcpy::$0 = memcpy::$2 + memcpy::num#2 - memcpy::src_end#0 = memcpy::$0 + memcpy::src_end#0 = memcpy::$2 + memcpy::num#2 to:memcpy::@1 memcpy::@1: scope:[memcpy] from memcpy memcpy::@2 memcpy::destination#4 = phi( memcpy/memcpy::destination#2, memcpy::@2/memcpy::destination#5 ) @@ -80,8 +87,7 @@ memset::@2: scope:[memset] from memset memset::num#3 = phi( memset/memset::num#2 ) memset::str#3 = phi( memset/memset::str#4 ) memset::$4 = (byte*)memset::str#3 - memset::$2 = memset::$4 + memset::num#3 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#3 memset::dst#0 = ((byte*)) memset::str#3 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -131,8 +137,7 @@ gotoxy::@2: scope:[gotoxy] from gotoxy::@1 gotoxy::@4 conio_cursor_x = gotoxy::x#4 conio_cursor_y = gotoxy::y#4 gotoxy::$7 = (word)gotoxy::y#4 - gotoxy::$4 = gotoxy::$7 * $50 - gotoxy::line_offset#0 = gotoxy::$4 + gotoxy::line_offset#0 = gotoxy::$7 * $50 gotoxy::$5 = CONIO_SCREEN_TEXT + gotoxy::line_offset#0 conio_line_text = gotoxy::$5 gotoxy::$6 = CONIO_SCREEN_COLORS + gotoxy::line_offset#0 @@ -221,20 +226,16 @@ memoryRemap: scope:[memoryRemap] from conio_mega65_init::@3 memoryRemap::upperPageOffset#1 = phi( conio_mega65_init::@3/memoryRemap::upperPageOffset#0 ) memoryRemap::remapBlocks#1 = phi( conio_mega65_init::@3/memoryRemap::remapBlocks#0 ) memoryRemap::lowerPageOffset#1 = phi( conio_mega65_init::@3/memoryRemap::lowerPageOffset#0 ) - memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#1 - memoryRemap::aVal = memoryRemap::$0 + memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#1 memoryRemap::$1 = memoryRemap::remapBlocks#1 << 4 memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#1 memoryRemap::$3 = memoryRemap::$2 & $f - memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 - memoryRemap::xVal = memoryRemap::$4 - memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#1 - memoryRemap::yVal = memoryRemap::$5 + memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 + memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#1 memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#1 memoryRemap::$8 = memoryRemap::$7 & $f - memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 - memoryRemap::zVal = memoryRemap::$9 + memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } to:memoryRemap::@return memoryRemap::@return: scope:[memoryRemap] from memoryRemap @@ -311,8 +312,7 @@ conio_mega65_init::@4: scope:[conio_mega65_init] from conio_mega65_init::@3 *IO_KEY = $47 *IO_KEY = $53 *IO_BANK = *IO_BANK | CRAM2K - conio_mega65_init::$2 = *conio_mega65_init::BASIC_CURSOR_LINE + 1 - conio_mega65_init::line#0 = conio_mega65_init::$2 + conio_mega65_init::line#0 = *conio_mega65_init::BASIC_CURSOR_LINE + 1 conio_mega65_init::$3 = conio_mega65_init::line#0 >= $19 conio_mega65_init::$4 = ! conio_mega65_init::$3 if(conio_mega65_init::$4) goto conio_mega65_init::@1 @@ -386,7 +386,6 @@ byte conio_cursor_y loadstore byte* conio_line_color loadstore byte* conio_line_text loadstore void conio_mega65_init() -number~ conio_mega65_init::$2 bool~ conio_mega65_init::$3 bool~ conio_mega65_init::$4 constant byte* const conio_mega65_init::BASIC_CURSOR_LINE = (byte*)$eb @@ -428,7 +427,6 @@ bool~ gotoxy::$0 bool~ gotoxy::$1 bool~ gotoxy::$2 bool~ gotoxy::$3 -number~ gotoxy::$4 byte*~ gotoxy::$5 byte*~ gotoxy::$6 word~ gotoxy::$7 @@ -453,7 +451,6 @@ byte gotoxy::y#6 void main() constant byte* main::s[$d] = "hello world!" void* memcpy(void* memcpy::destination , void* memcpy::source , word memcpy::num) -byte*~ memcpy::$0 bool~ memcpy::$1 byte*~ memcpy::$2 void* memcpy::destination @@ -492,16 +489,12 @@ byte* memcpy::src_end#0 byte* memcpy::src_end#1 byte* memcpy::src_end#2 void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset) -byte~ memoryRemap::$0 byte~ memoryRemap::$1 byte~ memoryRemap::$2 number~ memoryRemap::$3 -number~ memoryRemap::$4 -byte~ memoryRemap::$5 number~ memoryRemap::$6 byte~ memoryRemap::$7 number~ memoryRemap::$8 -number~ memoryRemap::$9 volatile byte memoryRemap::aVal loadstore word memoryRemap::lowerPageOffset word memoryRemap::lowerPageOffset#0 @@ -518,7 +511,6 @@ volatile byte memoryRemap::zVal loadstore void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -561,8 +553,7 @@ Adding number conversion cast (unumber) 0 in memset::$0 = memset::num#2 > 0 Adding number conversion cast (unumber) $19 in gotoxy::$0 = gotoxy::y#3 > $19 Adding number conversion cast (unumber) $50 in gotoxy::$2 = gotoxy::x#3 >= $50 Adding number conversion cast (unumber) 0 in gotoxy::y#0 = 0 -Adding number conversion cast (unumber) $50 in gotoxy::$4 = gotoxy::$7 * $50 -Adding number conversion cast (unumber) gotoxy::$4 in gotoxy::$4 = gotoxy::$7 * (unumber)$50 +Adding number conversion cast (unumber) $50 in gotoxy::line_offset#0 = gotoxy::$7 * $50 Adding number conversion cast (unumber) 0 in gotoxy::x#0 = 0 Adding number conversion cast (unumber) $50 in cputc::$1 = conio_cursor_x == $50 Adding number conversion cast (unumber) $50 in conio_line_text = conio_line_text + $50 @@ -572,12 +563,10 @@ Adding number conversion cast (unumber) 0 in cputs::$2 = 0 != cputs::$0 Adding number conversion cast (unumber) 4 in memoryRemap::$1 = memoryRemap::remapBlocks#1 << 4 Adding number conversion cast (unumber) $f in memoryRemap::$3 = memoryRemap::$2 & $f Adding number conversion cast (unumber) memoryRemap::$3 in memoryRemap::$3 = memoryRemap::$2 & (unumber)$f -Adding number conversion cast (unumber) memoryRemap::$4 in memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 Adding number conversion cast (unumber) $f0 in memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 Adding number conversion cast (unumber) memoryRemap::$6 in memoryRemap::$6 = memoryRemap::remapBlocks#1 & (unumber)$f0 Adding number conversion cast (unumber) $f in memoryRemap::$8 = memoryRemap::$7 & $f Adding number conversion cast (unumber) memoryRemap::$8 in memoryRemap::$8 = memoryRemap::$7 & (unumber)$f -Adding number conversion cast (unumber) memoryRemap::$9 in memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 Adding number conversion cast (unumber) $19 in cscroll::$0 = conio_cursor_y == $19 Adding number conversion cast (unumber) 0 in cscroll::$7 = 0 != conio_scroll_enable Adding number conversion cast (unumber) $50 in memcpy::source#0 = (void*)CONIO_SCREEN_TEXT+$50 @@ -599,8 +588,7 @@ Adding number conversion cast (unumber) 0 in memoryRemap::lowerPageOffset#0 = 0 Adding number conversion cast (unumber) 0 in memoryRemap::upperPageOffset#0 = 0 Adding number conversion cast (unumber) $47 in *IO_KEY = $47 Adding number conversion cast (unumber) $53 in *IO_KEY = $53 -Adding number conversion cast (unumber) 1 in conio_mega65_init::$2 = *conio_mega65_init::BASIC_CURSOR_LINE + 1 -Adding number conversion cast (unumber) conio_mega65_init::$2 in conio_mega65_init::$2 = *conio_mega65_init::BASIC_CURSOR_LINE + (unumber)1 +Adding number conversion cast (unumber) 1 in conio_mega65_init::line#0 = *conio_mega65_init::BASIC_CURSOR_LINE + 1 Adding number conversion cast (unumber) $19 in conio_mega65_init::$3 = conio_mega65_init::line#0 >= $19 Adding number conversion cast (unumber) 0 in gotoxy::x#2 = 0 Adding number conversion cast (unumber) $19-1 in conio_mega65_init::line#1 = $19-1 @@ -702,27 +690,18 @@ Finalized unsigned number type (byte) 1 Finalized unsigned number type (byte) $19 Finalized unsigned number type (byte) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to word in gotoxy::$4 = gotoxy::$7 * $50 Inferred type updated to byte in memoryRemap::$3 = memoryRemap::$2 & $f -Inferred type updated to byte in memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 Inferred type updated to byte in memoryRemap::$6 = memoryRemap::remapBlocks#1 & $f0 Inferred type updated to byte in memoryRemap::$8 = memoryRemap::$7 & $f -Inferred type updated to byte in memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 -Inferred type updated to byte in conio_mega65_init::$2 = *conio_mega65_init::BASIC_CURSOR_LINE + 1 -Inversing boolean not [20] memset::$1 = memset::num#2 <= 0 from [19] memset::$0 = memset::num#2 > 0 -Inversing boolean not [40] gotoxy::$1 = gotoxy::y#3 <= $19 from [39] gotoxy::$0 = gotoxy::y#3 > $19 -Inversing boolean not [44] gotoxy::$3 = gotoxy::x#3 < $50 from [43] gotoxy::$2 = gotoxy::x#3 >= $50 -Inversing boolean not [70] cputc::$2 = conio_cursor_x != $50 from [69] cputc::$1 = conio_cursor_x == $50 -Inversing boolean not [111] cscroll::$1 = conio_cursor_y != $19 from [110] cscroll::$0 = conio_cursor_y == $19 -Inversing boolean not [153] conio_mega65_init::$4 = conio_mega65_init::line#0 < $19 from [152] conio_mega65_init::$3 = conio_mega65_init::line#0 >= $19 +Inversing boolean not [19] memset::$1 = memset::num#2 <= 0 from [18] memset::$0 = memset::num#2 > 0 +Inversing boolean not [38] gotoxy::$1 = gotoxy::y#3 <= $19 from [37] gotoxy::$0 = gotoxy::y#3 > $19 +Inversing boolean not [42] gotoxy::$3 = gotoxy::x#3 < $50 from [41] gotoxy::$2 = gotoxy::x#3 >= $50 +Inversing boolean not [67] cputc::$2 = conio_cursor_x != $50 from [66] cputc::$1 = conio_cursor_x == $50 +Inversing boolean not [104] cscroll::$1 = conio_cursor_y != $19 from [103] cscroll::$0 = conio_cursor_y == $19 +Inversing boolean not [145] conio_mega65_init::$4 = conio_mega65_init::line#0 < $19 from [144] conio_mega65_init::$3 = conio_mega65_init::line#0 >= $19 Successful SSA optimization Pass2UnaryNotSimplification Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 -Alias memcpy::src_end#0 = memcpy::$0 Alias memcpy::src#2 = memcpy::src#3 Alias memcpy::dst#2 = memcpy::dst#3 Alias memcpy::src_end#1 = memcpy::src_end#2 @@ -731,34 +710,23 @@ Alias memset::return#0 = memset::str#2 memset::return#4 memset::return#1 Alias memset::str#3 = memset::str#4 Alias memset::num#2 = memset::num#3 Alias memset::c#4 = memset::c#5 -Alias memset::end#0 = memset::$2 Alias memset::c#2 = memset::c#3 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 Alias memset::str#5 = memset::str#6 Alias gotoxy::x#5 = gotoxy::x#6 -Alias gotoxy::line_offset#0 = gotoxy::$4 Alias gotoxy::y#5 = gotoxy::y#6 Alias cputc::c#1 = cputc::c#2 Alias cputs::c#1 = cputs::$0 cputs::c#2 Alias cputs::s#0 = cputs::s#5 cputs::s#4 -Alias conio_mega65_init::line#0 = conio_mega65_init::$2 Successful SSA optimization Pass2AliasElimination Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 Alias gotoxy::x#3 = gotoxy::x#5 Alias gotoxy::y#4 = gotoxy::y#5 Successful SSA optimization Pass2AliasElimination Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 Identical Phi Values memcpy::src_end#1 memcpy::src_end#0 Identical Phi Values memcpy::destination#3 memcpy::destination#2 Identical Phi Values memset::end#1 memset::end#0 @@ -781,13 +749,13 @@ Simple Condition cputc::$0 [45] if(cputc::c#0==' ') goto cputc::@1 Simple Condition cputc::$2 [51] if(conio_cursor_x!=$50) goto cputc::@return Simple Condition cputs::$2 [66] if(0!=cputs::c#1) goto cputs::@2 -Simple Condition cscroll::$1 [88] if(conio_cursor_y!=$19) goto cscroll::@return -Simple Condition cscroll::$7 [90] if(0!=conio_scroll_enable) goto cscroll::@3 -Simple Condition conio_mega65_init::$4 [128] if(conio_mega65_init::line#0<$19) goto conio_mega65_init::@1 +Simple Condition cscroll::$1 [84] if(conio_cursor_y!=$19) goto cscroll::@return +Simple Condition cscroll::$7 [86] if(0!=conio_scroll_enable) goto cscroll::@3 +Simple Condition conio_mega65_init::$4 [124] if(conio_mega65_init::line#0<$19) goto conio_mega65_init::@1 Successful SSA optimization Pass2ConditionalJumpSimplification -Constant right-side identified [93] memcpy::num#0 = (unumber)$19*$50-$50 -Constant right-side identified [98] memcpy::num#1 = (unumber)$19*$50-$50 -Constant right-side identified [133] conio_mega65_init::line#1 = (unumber)$19-1 +Constant right-side identified [89] memcpy::num#0 = (unumber)$19*$50-$50 +Constant right-side identified [94] memcpy::num#1 = (unumber)$19*$50-$50 +Constant right-side identified [129] conio_mega65_init::line#1 = (unumber)$19-1 Successful SSA optimization Pass2ConstantRValueConsolidation Constant gotoxy::y#0 = 0 Constant gotoxy::x#0 = 0 @@ -816,7 +784,7 @@ Constant conio_scroll_enable = 1 Successful SSA optimization Pass2ConstantIdentification Constant memset::c#1 = conio_textcolor Successful SSA optimization Pass2ConstantIdentification -if() condition always true - replacing block destination [90] if(0!=conio_scroll_enable) goto cscroll::@3 +if() condition always true - replacing block destination [86] if(0!=conio_scroll_enable) goto cscroll::@3 Successful SSA optimization Pass2ConstantIfs Rewriting conditional comparison [27] if(gotoxy::y#3<=$19) goto gotoxy::@1 Removing PHI-reference to removed block (cscroll::@2) in block gotoxy @@ -824,10 +792,10 @@ Removing PHI-reference to removed block (cscroll::@2) in block gotoxy Removing unused block cscroll::@2 Removing unused block cscroll::@8 Successful SSA optimization Pass2EliminateUnusedBlocks -Eliminating unused variable memcpy::return#2 and assignment [74] memcpy::return#2 = memcpy::destination#2 -Eliminating unused variable memcpy::return#3 and assignment [76] memcpy::return#3 = memcpy::destination#2 -Eliminating unused variable memset::return#2 and assignment [78] memset::return#2 = memset::str#3 -Eliminating unused variable memset::return#3 and assignment [80] memset::return#3 = memset::str#3 +Eliminating unused variable memcpy::return#2 and assignment [70] memcpy::return#2 = memcpy::destination#2 +Eliminating unused variable memcpy::return#3 and assignment [72] memcpy::return#3 = memcpy::destination#2 +Eliminating unused variable memset::return#2 and assignment [74] memset::return#2 = memset::str#3 +Eliminating unused variable memset::return#3 and assignment [76] memset::return#3 = memset::str#3 Eliminating unused constant gotoxy::x#1 Eliminating unused constant gotoxy::y#1 Eliminating unused constant cputs::c#0 @@ -843,38 +811,32 @@ Finalized unsigned number type (byte) 1 Successful SSA optimization PassNFinalizeNumberTypeConversions Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 Identical Phi Values gotoxy::y#3 gotoxy::y#2 Identical Phi Values gotoxy::x#3 gotoxy::x#2 Successful SSA optimization Pass2IdenticalPhiElimination -Constant right-side identified [56] memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#0 -Constant right-side identified [58] memoryRemap::$1 = memoryRemap::remapBlocks#0 << 4 -Constant right-side identified [59] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 -Constant right-side identified [63] memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#0 -Constant right-side identified [65] memoryRemap::$6 = memoryRemap::remapBlocks#0 & $f0 -Constant right-side identified [66] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 +Constant right-side identified [56] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#0 +Constant right-side identified [57] memoryRemap::$1 = memoryRemap::remapBlocks#0 << 4 +Constant right-side identified [58] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 +Constant right-side identified [61] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#0 +Constant right-side identified [62] memoryRemap::$6 = memoryRemap::remapBlocks#0 & $f0 +Constant right-side identified [63] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 Successful SSA optimization Pass2ConstantRValueConsolidation -Constant memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#0 Constant memoryRemap::$1 = memoryRemap::remapBlocks#0<<4 Constant memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#0 -Constant memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#0 Constant memoryRemap::$6 = memoryRemap::remapBlocks#0&$f0 Constant memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#0 Successful SSA optimization Pass2ConstantIdentification if() condition always true - replacing block destination [24] if(gotoxy::x#2<$50) goto gotoxy::@2 Successful SSA optimization Pass2ConstantIfs -Simplifying constant evaluating to zero byte0 memoryRemap::lowerPageOffset#0 in Simplifying constant evaluating to zero memoryRemap::remapBlocks#0<<4 in Simplifying constant evaluating to zero byte1 memoryRemap::lowerPageOffset#0 in -Simplifying constant evaluating to zero byte0 memoryRemap::upperPageOffset#0 in Simplifying constant evaluating to zero memoryRemap::remapBlocks#0&$f0 in Simplifying constant evaluating to zero byte1 memoryRemap::upperPageOffset#0 in +Simplifying constant evaluating to zero byte0 memoryRemap::lowerPageOffset#0 in [56] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#0 +Simplifying constant evaluating to zero byte0 memoryRemap::upperPageOffset#0 in [61] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#0 Successful SSA optimization PassNSimplifyConstantZero -Simplifying expression containing zero memoryRemap::$3 in [61] memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 -Simplifying expression containing zero memoryRemap::$8 in [68] memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 +Simplifying expression containing zero memoryRemap::$3 in [60] memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 +Simplifying expression containing zero memoryRemap::$8 in [65] memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 Successful SSA optimization PassNSimplifyExpressionWithZero Removing PHI-reference to removed block (gotoxy::@4) in block gotoxy::@2 Removing unused block gotoxy::@4 @@ -888,19 +850,16 @@ Eliminating unused constant memoryRemap::$6 Successful SSA optimization PassNEliminateUnusedVars Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 -Alias candidate removed (volatile)memoryRemap::$4 = memoryRemap::$3 memoryRemap::xVal -Alias candidate removed (volatile)memoryRemap::$9 = memoryRemap::$8 memoryRemap::zVal +Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$3 +Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$8 Identical Phi Values gotoxy::x#4 gotoxy::x#2 Successful SSA optimization Pass2IdenticalPhiElimination Constant right-side identified [55] memoryRemap::$3 = memoryRemap::$2 & $f -Constant right-side identified [59] memoryRemap::$8 = memoryRemap::$7 & $f +Constant right-side identified [58] memoryRemap::$8 = memoryRemap::$7 & $f Successful SSA optimization Pass2ConstantRValueConsolidation Constant memoryRemap::$3 = memoryRemap::$2&$f Constant memoryRemap::$8 = memoryRemap::$7&$f Successful SSA optimization Pass2ConstantIdentification -Constant memoryRemap::$4 = memoryRemap::$3 -Constant memoryRemap::$9 = memoryRemap::$8 -Successful SSA optimization Pass2ConstantIdentification Simplifying constant evaluating to zero memoryRemap::$2&$f in Simplifying constant evaluating to zero memoryRemap::$7&$f in Successful SSA optimization PassNSimplifyConstantZero @@ -931,31 +890,27 @@ Inlining constant with var siblings memset::c#1 Inlining constant with var siblings gotoxy::y#0 Inlining constant with var siblings cputs::s#1 Inlining constant with var siblings conio_mega65_init::line#1 +Constant inlined memset::str#1 = (void*)COLORRAM+(word)$19*$50-$50 +Constant inlined memset::str#0 = (void*)DEFAULT_SCREEN+(word)$19*$50-$50 +Constant inlined CONIO_SCREEN_COLORS = COLORRAM Constant inlined cputs::s#1 = main::s Constant inlined conio_textcolor = LIGHT_BLUE Constant inlined memcpy::destination#0 = (void*)DEFAULT_SCREEN Constant inlined memset::num#1 = $50 Constant inlined memcpy::destination#1 = (void*)COLORRAM Constant inlined memset::num#0 = $50 -Constant inlined conio_mega65_init::line#1 = (byte)$19-1 -Constant inlined memcpy::source#1 = (void*)COLORRAM+$50 -Constant inlined CONIO_SCREEN_TEXT = DEFAULT_SCREEN -Constant inlined CONIO_TEXTCOLOR_DEFAULT = LIGHT_BLUE -Constant inlined memset::str#1 = (void*)COLORRAM+(word)$19*$50-$50 -Constant inlined memset::str#0 = (void*)DEFAULT_SCREEN+(word)$19*$50-$50 -Constant inlined CONIO_SCREEN_COLORS = COLORRAM Constant inlined memcpy::source#0 = (void*)DEFAULT_SCREEN+$50 +Constant inlined conio_mega65_init::line#1 = (byte)$19-1 Constant inlined memcpy::num#1 = (word)$19*$50-$50 Constant inlined memcpy::num#0 = (word)$19*$50-$50 -Constant inlined memoryRemap::$0 = 0 +Constant inlined memcpy::source#1 = (void*)COLORRAM+$50 Constant inlined gotoxy::y#0 = 0 Constant inlined memoryRemap::$3 = 0 -Constant inlined memoryRemap::$4 = 0 -Constant inlined memoryRemap::$5 = 0 +Constant inlined CONIO_SCREEN_TEXT = DEFAULT_SCREEN Constant inlined memset::c#0 = ' ' Constant inlined memset::c#1 = LIGHT_BLUE Constant inlined memoryRemap::$8 = 0 -Constant inlined memoryRemap::$9 = 0 +Constant inlined CONIO_TEXTCOLOR_DEFAULT = LIGHT_BLUE Successful SSA optimization Pass2ConstantInlining Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 @@ -2753,13 +2708,12 @@ gotoxy: { // conio_cursor_y = y // [36] conio_cursor_y = gotoxy::y#4 -- vbuz1=vbuxx stx.z conio_cursor_y - // (unsigned int)y*CONIO_WIDTH + // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH // [37] gotoxy::$7 = (word)gotoxy::y#4 -- vwuz1=_word_vbuxx txa sta.z __7 lda #0 sta.z __7+1 - // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH // [38] gotoxy::$8 = gotoxy::$7 << 2 -- vwuz1=vwuz2_rol_2 lda.z __7 asl diff --git a/src/test/ref/examples/mega65/memorymap-test.asm b/src/test/ref/examples/mega65/memorymap-test.asm index 100178574..47b523953 100644 --- a/src/test/ref/examples/mega65/memorymap-test.asm +++ b/src/test/ref/examples/mega65/memorymap-test.asm @@ -132,6 +132,7 @@ main: { memoryRemapBlock: { .label pageOffset = 2 // unsigned int pageOffset = memoryPage-blockPage + // Find the page offset (the number of pages to offset the block) stx.z $ff lda #<$100 sec @@ -141,6 +142,7 @@ memoryRemapBlock: { sbc #0 sta.z pageOffset+1 // char block = blockPage / $20 + // Which block is being remapped? (0-7) txa lsr lsr @@ -201,10 +203,9 @@ memoryRemap: { .label __6 = $d .label lowerPageOffset = 2 .label upperPageOffset = 4 - // BYTE0(lowerPageOffset) - lda.z lowerPageOffset // char aVal = BYTE0(lowerPageOffset) // lower blocks offset page low + lda.z lowerPageOffset sta.z aVal // remapBlocks << 4 tza @@ -217,15 +218,13 @@ memoryRemap: { lda.z lowerPageOffset+1 // BYTE1(lowerPageOffset) & 0xf and #$f - // (remapBlocks << 4) | (BYTE1(lowerPageOffset) & 0xf) - ora.z __1 // char xVal = (remapBlocks << 4) | (BYTE1(lowerPageOffset) & 0xf) // lower blocks to map + lower blocks offset high nibble + ora.z __1 sta.z xVal - // BYTE0(upperPageOffset) - lda.z upperPageOffset // char yVal = BYTE0(upperPageOffset) // upper blocks offset page + lda.z upperPageOffset sta.z yVal // remapBlocks & 0xf0 tza @@ -235,10 +234,9 @@ memoryRemap: { lda.z upperPageOffset+1 // BYTE1(upperPageOffset) & 0xf and #$f - // (remapBlocks & 0xf0) | (BYTE1(upperPageOffset) & 0xf) - ora.z __6 // char zVal = (remapBlocks & 0xf0) | (BYTE1(upperPageOffset) & 0xf) // upper blocks to map + upper blocks offset page high nibble + ora.z __6 sta.z zVal // asm lda aVal @@ -311,19 +309,17 @@ memoryRemap256M: { ror.z __0+2 ror.z __0+1 ror.z __0 - // BYTE1((unsigned int)(lowerPageOffset>>4)) - lda.z __0+1 // char lMb = BYTE1((unsigned int)(lowerPageOffset>>4)) // lower blocks offset megabytes + lda.z __0+1 sta.z lMb // char uMb = BYTE1((unsigned int)(upperPageOffset>>4)) // upper blocks offset megabytes lda #0 sta.z uMb - // BYTE0(lowerPageOffset) - lda.z lowerPageOffset // char aVal = BYTE0(lowerPageOffset) // lower blocks offset page low + lda.z lowerPageOffset sta.z aVal // remapBlocks << 4 tza @@ -336,10 +332,9 @@ memoryRemap256M: { lda.z lowerPageOffset+1 // BYTE1(lowerPageOffset) & 0xf and #$f - // (remapBlocks << 4) | (BYTE1(lowerPageOffset) & 0xf) - ora.z __5 // char xVal = (remapBlocks << 4) | (BYTE1(lowerPageOffset) & 0xf) // lower blocks to map + lower blocks offset high nibble + ora.z __5 sta.z xVal // char yVal = BYTE0(upperPageOffset) // upper blocks offset page @@ -348,7 +343,6 @@ memoryRemap256M: { // remapBlocks & 0xf0 tza and #$f0 - // (remapBlocks & 0xf0) | (BYTE1(upperPageOffset) & 0xf) // char zVal = (remapBlocks & 0xf0) | (BYTE1(upperPageOffset) & 0xf) // upper blocks to map + upper blocks offset page high nibble sta.z zVal diff --git a/src/test/ref/examples/mega65/memorymap-test.cfg b/src/test/ref/examples/mega65/memorymap-test.cfg index 64fb3362e..1ca51dd95 100644 --- a/src/test/ref/examples/mega65/memorymap-test.cfg +++ b/src/test/ref/examples/mega65/memorymap-test.cfg @@ -67,47 +67,39 @@ memoryRemap: scope:[memoryRemap] from main::@8 memoryRemapBlock [33] memoryRemap::upperPageOffset#2 = phi( main::@8/$80, memoryRemapBlock/memoryRemap::upperPageOffset#0 ) [33] memoryRemap::remapBlocks#2 = phi( main::@8/MEMORYBLOCK_4000|MEMORYBLOCK_8000, memoryRemapBlock/memoryRemap::remapBlocks#0 ) [33] memoryRemap::lowerPageOffset#2 = phi( main::@8/$c0, memoryRemapBlock/memoryRemap::lowerPageOffset#0 ) - [34] memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#2 - [35] memoryRemap::aVal = memoryRemap::$0 - [36] memoryRemap::$1 = memoryRemap::remapBlocks#2 << 4 - [37] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#2 - [38] memoryRemap::$3 = memoryRemap::$2 & $f - [39] memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 - [40] memoryRemap::xVal = memoryRemap::$4 - [41] memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#2 - [42] memoryRemap::yVal = memoryRemap::$5 - [43] memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 - [44] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#2 - [45] memoryRemap::$8 = memoryRemap::$7 & $f - [46] memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 - [47] memoryRemap::zVal = memoryRemap::$9 + [34] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#2 + [35] memoryRemap::$1 = memoryRemap::remapBlocks#2 << 4 + [36] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#2 + [37] memoryRemap::$3 = memoryRemap::$2 & $f + [38] memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 + [39] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#2 + [40] memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 + [41] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#2 + [42] memoryRemap::$8 = memoryRemap::$7 & $f + [43] memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } to:memoryRemap::@return memoryRemap::@return: scope:[memoryRemap] from memoryRemap - [49] return + [45] return to:@return void memoryRemap256M(byte memoryRemap256M::remapBlocks , dword memoryRemap256M::lowerPageOffset , dword memoryRemap256M::upperPageOffset) memoryRemap256M: scope:[memoryRemap256M] from main::@3 main::@6 - [50] memoryRemap256M::remapBlocks#2 = phi( main::@3/MEMORYBLOCK_4000, main::@6/0 ) - [50] memoryRemap256M::lowerPageOffset#2 = phi( main::@3/$ff800-$40, main::@6/0 ) - [51] memoryRemap256M::$0 = memoryRemap256M::lowerPageOffset#2 >> 4 - [52] memoryRemap256M::$1 = byte1 (word)memoryRemap256M::$0 - [53] memoryRemap256M::lMb = memoryRemap256M::$1 - [54] memoryRemap256M::uMb = 0 - [55] memoryRemap256M::$4 = byte0 memoryRemap256M::lowerPageOffset#2 - [56] memoryRemap256M::aVal = memoryRemap256M::$4 - [57] memoryRemap256M::$5 = memoryRemap256M::remapBlocks#2 << 4 - [58] memoryRemap256M::$6 = byte1 memoryRemap256M::lowerPageOffset#2 - [59] memoryRemap256M::$7 = memoryRemap256M::$6 & $f - [60] memoryRemap256M::$8 = memoryRemap256M::$5 | memoryRemap256M::$7 - [61] memoryRemap256M::xVal = memoryRemap256M::$8 - [62] memoryRemap256M::yVal = 0 - [63] memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 - [64] memoryRemap256M::$13 = memoryRemap256M::$10 - [65] memoryRemap256M::zVal = memoryRemap256M::$13 + [46] memoryRemap256M::remapBlocks#2 = phi( main::@3/MEMORYBLOCK_4000, main::@6/0 ) + [46] memoryRemap256M::lowerPageOffset#2 = phi( main::@3/$ff800-$40, main::@6/0 ) + [47] memoryRemap256M::$0 = memoryRemap256M::lowerPageOffset#2 >> 4 + [48] memoryRemap256M::lMb = byte1 (word)memoryRemap256M::$0 + [49] memoryRemap256M::uMb = 0 + [50] memoryRemap256M::aVal = byte0 memoryRemap256M::lowerPageOffset#2 + [51] memoryRemap256M::$5 = memoryRemap256M::remapBlocks#2 << 4 + [52] memoryRemap256M::$6 = byte1 memoryRemap256M::lowerPageOffset#2 + [53] memoryRemap256M::$7 = memoryRemap256M::$6 & $f + [54] memoryRemap256M::xVal = memoryRemap256M::$5 | memoryRemap256M::$7 + [55] memoryRemap256M::yVal = 0 + [56] memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 + [57] memoryRemap256M::zVal = memoryRemap256M::$10 asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } to:memoryRemap256M::@return memoryRemap256M::@return: scope:[memoryRemap256M] from memoryRemap256M - [67] return + [59] return to:@return diff --git a/src/test/ref/examples/mega65/memorymap-test.log b/src/test/ref/examples/mega65/memorymap-test.log index 71702becc..d05f0f4e2 100644 --- a/src/test/ref/examples/mega65/memorymap-test.log +++ b/src/test/ref/examples/mega65/memorymap-test.log @@ -12,6 +12,19 @@ Setting inferred volatile on symbol affected by address-of: memoryRemap256M::xVa Setting inferred volatile on symbol affected by address-of: memoryRemap256M::yVal in asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } Setting inferred volatile on symbol affected by address-of: memoryRemap256M::zVal in asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx +Eliminating unused variable with no statement memoryRemap::$0 +Eliminating unused variable with no statement memoryRemap::$4 +Eliminating unused variable with no statement memoryRemap::$5 +Eliminating unused variable with no statement memoryRemap::$9 +Eliminating unused variable with no statement memoryRemapBlock::$0 +Eliminating unused variable with no statement memoryRemapBlock::$1 +Eliminating unused variable with no statement memoryRemapBlock::$2 +Eliminating unused variable with no statement memoryRemap256M::$1 +Eliminating unused variable with no statement memoryRemap256M::$3 +Eliminating unused variable with no statement memoryRemap256M::$4 +Eliminating unused variable with no statement memoryRemap256M::$8 +Eliminating unused variable with no statement memoryRemap256M::$9 +Eliminating unused variable with no statement memoryRemap256M::$13 CONTROL FLOW GRAPH SSA @@ -20,20 +33,16 @@ memoryRemap: scope:[memoryRemap] from main::@8 memoryRemapBlock memoryRemap::upperPageOffset#2 = phi( main::@8/memoryRemap::upperPageOffset#1, memoryRemapBlock/memoryRemap::upperPageOffset#0 ) memoryRemap::remapBlocks#2 = phi( main::@8/memoryRemap::remapBlocks#1, memoryRemapBlock/memoryRemap::remapBlocks#0 ) memoryRemap::lowerPageOffset#2 = phi( main::@8/memoryRemap::lowerPageOffset#1, memoryRemapBlock/memoryRemap::lowerPageOffset#0 ) - memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#2 - memoryRemap::aVal = memoryRemap::$0 + memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#2 memoryRemap::$1 = memoryRemap::remapBlocks#2 << 4 memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#2 memoryRemap::$3 = memoryRemap::$2 & $f - memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 - memoryRemap::xVal = memoryRemap::$4 - memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#2 - memoryRemap::yVal = memoryRemap::$5 + memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 + memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#2 memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#2 memoryRemap::$8 = memoryRemap::$7 & $f - memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 - memoryRemap::zVal = memoryRemap::$9 + memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } to:memoryRemap::@return memoryRemap::@return: scope:[memoryRemap] from memoryRemap @@ -44,12 +53,9 @@ void memoryRemapBlock(byte memoryRemapBlock::blockPage , word memoryRemapBlock:: memoryRemapBlock: scope:[memoryRemapBlock] from main main::@7 memoryRemapBlock::blockPage#2 = phi( main/memoryRemapBlock::blockPage#0, main::@7/memoryRemapBlock::blockPage#1 ) memoryRemapBlock::memoryPage#2 = phi( main/memoryRemapBlock::memoryPage#0, main::@7/memoryRemapBlock::memoryPage#1 ) - memoryRemapBlock::$0 = memoryRemapBlock::memoryPage#2 - memoryRemapBlock::blockPage#2 - memoryRemapBlock::pageOffset#0 = memoryRemapBlock::$0 - memoryRemapBlock::$1 = memoryRemapBlock::blockPage#2 / $20 - memoryRemapBlock::block#0 = memoryRemapBlock::$1 - memoryRemapBlock::$2 = 1 << memoryRemapBlock::block#0 - memoryRemapBlock::blockBits#0 = memoryRemapBlock::$2 + memoryRemapBlock::pageOffset#0 = memoryRemapBlock::memoryPage#2 - memoryRemapBlock::blockPage#2 + memoryRemapBlock::block#0 = memoryRemapBlock::blockPage#2 / $20 + memoryRemapBlock::blockBits#0 = 1 << memoryRemapBlock::block#0 memoryRemap::remapBlocks#0 = memoryRemapBlock::blockBits#0 memoryRemap::lowerPageOffset#0 = memoryRemapBlock::pageOffset#0 memoryRemap::upperPageOffset#0 = memoryRemapBlock::pageOffset#0 @@ -67,25 +73,19 @@ memoryRemap256M: scope:[memoryRemap256M] from main::@3 main::@6 memoryRemap256M::upperPageOffset#2 = phi( main::@3/memoryRemap256M::upperPageOffset#0, main::@6/memoryRemap256M::upperPageOffset#1 ) memoryRemap256M::lowerPageOffset#2 = phi( main::@3/memoryRemap256M::lowerPageOffset#0, main::@6/memoryRemap256M::lowerPageOffset#1 ) memoryRemap256M::$0 = memoryRemap256M::lowerPageOffset#2 >> 4 - memoryRemap256M::$1 = byte1 (word)memoryRemap256M::$0 - memoryRemap256M::lMb = memoryRemap256M::$1 + memoryRemap256M::lMb = byte1 (word)memoryRemap256M::$0 memoryRemap256M::$2 = memoryRemap256M::upperPageOffset#2 >> 4 - memoryRemap256M::$3 = byte1 (word)memoryRemap256M::$2 - memoryRemap256M::uMb = memoryRemap256M::$3 - memoryRemap256M::$4 = byte0 memoryRemap256M::lowerPageOffset#2 - memoryRemap256M::aVal = memoryRemap256M::$4 + memoryRemap256M::uMb = byte1 (word)memoryRemap256M::$2 + memoryRemap256M::aVal = byte0 memoryRemap256M::lowerPageOffset#2 memoryRemap256M::$5 = memoryRemap256M::remapBlocks#2 << 4 memoryRemap256M::$6 = byte1 memoryRemap256M::lowerPageOffset#2 memoryRemap256M::$7 = memoryRemap256M::$6 & $f - memoryRemap256M::$8 = memoryRemap256M::$5 | memoryRemap256M::$7 - memoryRemap256M::xVal = memoryRemap256M::$8 - memoryRemap256M::$9 = byte0 memoryRemap256M::upperPageOffset#2 - memoryRemap256M::yVal = memoryRemap256M::$9 + memoryRemap256M::xVal = memoryRemap256M::$5 | memoryRemap256M::$7 + memoryRemap256M::yVal = byte0 memoryRemap256M::upperPageOffset#2 memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 memoryRemap256M::$11 = byte1 memoryRemap256M::upperPageOffset#2 memoryRemap256M::$12 = memoryRemap256M::$11 & $f - memoryRemap256M::$13 = memoryRemap256M::$10 | memoryRemap256M::$12 - memoryRemap256M::zVal = memoryRemap256M::$13 + memoryRemap256M::zVal = memoryRemap256M::$10 | memoryRemap256M::$12 asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } to:memoryRemap256M::@return memoryRemap256M::@return: scope:[memoryRemap256M] from memoryRemap256M @@ -192,16 +192,12 @@ byte main::i1#1 byte main::i1#2 byte main::i1#3 void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset) -byte~ memoryRemap::$0 byte~ memoryRemap::$1 byte~ memoryRemap::$2 number~ memoryRemap::$3 -number~ memoryRemap::$4 -byte~ memoryRemap::$5 number~ memoryRemap::$6 byte~ memoryRemap::$7 number~ memoryRemap::$8 -number~ memoryRemap::$9 volatile byte memoryRemap::aVal loadstore word memoryRemap::lowerPageOffset word memoryRemap::lowerPageOffset#0 @@ -220,19 +216,13 @@ volatile byte memoryRemap::yVal loadstore volatile byte memoryRemap::zVal loadstore void memoryRemap256M(byte memoryRemap256M::remapBlocks , dword memoryRemap256M::lowerPageOffset , dword memoryRemap256M::upperPageOffset) dword~ memoryRemap256M::$0 -byte~ memoryRemap256M::$1 number~ memoryRemap256M::$10 byte~ memoryRemap256M::$11 number~ memoryRemap256M::$12 -number~ memoryRemap256M::$13 dword~ memoryRemap256M::$2 -byte~ memoryRemap256M::$3 -byte~ memoryRemap256M::$4 byte~ memoryRemap256M::$5 byte~ memoryRemap256M::$6 number~ memoryRemap256M::$7 -number~ memoryRemap256M::$8 -byte~ memoryRemap256M::$9 volatile byte memoryRemap256M::aVal loadstore volatile byte memoryRemap256M::lMb loadstore dword memoryRemap256M::lowerPageOffset @@ -252,9 +242,6 @@ volatile byte memoryRemap256M::xVal loadstore volatile byte memoryRemap256M::yVal loadstore volatile byte memoryRemap256M::zVal loadstore void memoryRemapBlock(byte memoryRemapBlock::blockPage , word memoryRemapBlock::memoryPage) -word~ memoryRemapBlock::$0 -number~ memoryRemapBlock::$1 -number~ memoryRemapBlock::$2 byte memoryRemapBlock::block byte memoryRemapBlock::block#0 byte memoryRemapBlock::blockBits @@ -273,27 +260,21 @@ word memoryRemapBlock::pageOffset#0 Adding number conversion cast (unumber) 4 in memoryRemap::$1 = memoryRemap::remapBlocks#2 << 4 Adding number conversion cast (unumber) $f in memoryRemap::$3 = memoryRemap::$2 & $f Adding number conversion cast (unumber) memoryRemap::$3 in memoryRemap::$3 = memoryRemap::$2 & (unumber)$f -Adding number conversion cast (unumber) memoryRemap::$4 in memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 Adding number conversion cast (unumber) $f0 in memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 Adding number conversion cast (unumber) memoryRemap::$6 in memoryRemap::$6 = memoryRemap::remapBlocks#2 & (unumber)$f0 Adding number conversion cast (unumber) $f in memoryRemap::$8 = memoryRemap::$7 & $f Adding number conversion cast (unumber) memoryRemap::$8 in memoryRemap::$8 = memoryRemap::$7 & (unumber)$f -Adding number conversion cast (unumber) memoryRemap::$9 in memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 -Adding number conversion cast (unumber) $20 in memoryRemapBlock::$1 = memoryRemapBlock::blockPage#2 / $20 -Adding number conversion cast (unumber) memoryRemapBlock::$1 in memoryRemapBlock::$1 = memoryRemapBlock::blockPage#2 / (unumber)$20 -Adding number conversion cast (unumber) 1 in memoryRemapBlock::$2 = 1 << memoryRemapBlock::block#0 -Adding number conversion cast (unumber) memoryRemapBlock::$2 in memoryRemapBlock::$2 = (unumber)1 << memoryRemapBlock::block#0 +Adding number conversion cast (unumber) $20 in memoryRemapBlock::block#0 = memoryRemapBlock::blockPage#2 / $20 +Adding number conversion cast (unumber) 1 in memoryRemapBlock::blockBits#0 = 1 << memoryRemapBlock::block#0 Adding number conversion cast (unumber) 4 in memoryRemap256M::$0 = memoryRemap256M::lowerPageOffset#2 >> 4 Adding number conversion cast (unumber) 4 in memoryRemap256M::$2 = memoryRemap256M::upperPageOffset#2 >> 4 Adding number conversion cast (unumber) 4 in memoryRemap256M::$5 = memoryRemap256M::remapBlocks#2 << 4 Adding number conversion cast (unumber) $f in memoryRemap256M::$7 = memoryRemap256M::$6 & $f Adding number conversion cast (unumber) memoryRemap256M::$7 in memoryRemap256M::$7 = memoryRemap256M::$6 & (unumber)$f -Adding number conversion cast (unumber) memoryRemap256M::$8 in memoryRemap256M::$8 = memoryRemap256M::$5 | memoryRemap256M::$7 Adding number conversion cast (unumber) $f0 in memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 Adding number conversion cast (unumber) memoryRemap256M::$10 in memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & (unumber)$f0 Adding number conversion cast (unumber) $f in memoryRemap256M::$12 = memoryRemap256M::$11 & $f Adding number conversion cast (unumber) memoryRemap256M::$12 in memoryRemap256M::$12 = memoryRemap256M::$11 & (unumber)$f -Adding number conversion cast (unumber) memoryRemap256M::$13 in memoryRemap256M::$13 = memoryRemap256M::$10 | memoryRemap256M::$12 Adding number conversion cast (unumber) $40 in memoryRemapBlock::blockPage#0 = $40 Adding number conversion cast (unumber) $100 in memoryRemapBlock::memoryPage#0 = $100 Adding number conversion cast (unumber) 0 in main::BLOCK_4000[0] = '-' @@ -408,48 +389,19 @@ Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in memoryRemap::$3 = memoryRemap::$2 & $f -Inferred type updated to byte in memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 Inferred type updated to byte in memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 Inferred type updated to byte in memoryRemap::$8 = memoryRemap::$7 & $f -Inferred type updated to byte in memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 -Inferred type updated to byte in memoryRemapBlock::$1 = memoryRemapBlock::blockPage#2 / $20 -Inferred type updated to byte in memoryRemapBlock::$2 = 1 << memoryRemapBlock::block#0 Inferred type updated to byte in memoryRemap256M::$7 = memoryRemap256M::$6 & $f -Inferred type updated to byte in memoryRemap256M::$8 = memoryRemap256M::$5 | memoryRemap256M::$7 Inferred type updated to byte in memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 Inferred type updated to byte in memoryRemap256M::$12 = memoryRemap256M::$11 & $f -Inferred type updated to byte in memoryRemap256M::$13 = memoryRemap256M::$10 | memoryRemap256M::$12 Inferred type updated to byte in main::$7 = $40 + main::i1#3 -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 -Alias candidate removed (volatile)memoryRemap256M::lMb = memoryRemap256M::$1 -Alias candidate removed (volatile)memoryRemap256M::uMb = memoryRemap256M::$3 -Alias candidate removed (volatile)memoryRemap256M::aVal = memoryRemap256M::$4 -Alias candidate removed (volatile)memoryRemap256M::xVal = memoryRemap256M::$8 -Alias candidate removed (volatile)memoryRemap256M::yVal = memoryRemap256M::$9 -Alias candidate removed (volatile)memoryRemap256M::zVal = memoryRemap256M::$13 -Alias memoryRemapBlock::pageOffset#0 = memoryRemapBlock::$0 -Alias memoryRemapBlock::block#0 = memoryRemapBlock::$1 -Alias memoryRemapBlock::blockBits#0 = memoryRemapBlock::$2 Alias main::i#2 = main::i#3 Alias main::i1#2 = main::i1#3 Successful SSA optimization Pass2AliasElimination -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 -Alias candidate removed (volatile)memoryRemap256M::lMb = memoryRemap256M::$1 -Alias candidate removed (volatile)memoryRemap256M::uMb = memoryRemap256M::$3 -Alias candidate removed (volatile)memoryRemap256M::aVal = memoryRemap256M::$4 -Alias candidate removed (volatile)memoryRemap256M::xVal = memoryRemap256M::$8 -Alias candidate removed (volatile)memoryRemap256M::yVal = memoryRemap256M::$9 -Alias candidate removed (volatile)memoryRemap256M::zVal = memoryRemap256M::$13 -Simple Condition main::$5 [68] if(main::i#2<6) goto main::@2 -Simple Condition main::$6 [78] if(main::i1#2<$10) goto main::@5 +Simple Condition main::$5 [58] if(main::i#2<6) goto main::@2 +Simple Condition main::$6 [68] if(main::i1#2<$10) goto main::@5 Successful SSA optimization Pass2ConditionalJumpSimplification -Constant right-side identified [72] memoryRemap256M::lowerPageOffset#0 = (unumber)$ff800-$40 +Constant right-side identified [62] memoryRemap256M::lowerPageOffset#0 = (unumber)$ff800-$40 Successful SSA optimization Pass2ConstantRValueConsolidation Constant memoryRemapBlock::blockPage#0 = $40 Constant memoryRemapBlock::memoryPage#0 = $100 @@ -467,24 +419,14 @@ Constant memoryRemap256M::remapBlocks#1 = 0 Constant memoryRemap256M::lowerPageOffset#1 = 0 Constant memoryRemap256M::upperPageOffset#1 = 0 Successful SSA optimization Pass2ConstantIdentification -Simplifying expression containing zero main::BLOCK_4000 in [52] main::BLOCK_4000[0] = '-' +Simplifying expression containing zero main::BLOCK_4000 in [42] main::BLOCK_4000[0] = '-' Successful SSA optimization PassNSimplifyExpressionWithZero Removing unused procedure __start Removing unused procedure block __start Removing unused procedure block __start::@1 Removing unused procedure block __start::@return Successful SSA optimization PassNEliminateEmptyStart -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 -Alias candidate removed (volatile)memoryRemap256M::lMb = memoryRemap256M::$1 -Alias candidate removed (volatile)memoryRemap256M::uMb = memoryRemap256M::$3 -Alias candidate removed (volatile)memoryRemap256M::aVal = memoryRemap256M::$4 -Alias candidate removed (volatile)memoryRemap256M::xVal = memoryRemap256M::$8 -Alias candidate removed (volatile)memoryRemap256M::yVal = memoryRemap256M::$9 -Alias candidate removed (volatile)memoryRemap256M::zVal = memoryRemap256M::$13 -Rewriting division to use shift [19] memoryRemapBlock::block#0 = memoryRemapBlock::blockPage#2 / $20 +Rewriting division to use shift [15] memoryRemapBlock::block#0 = memoryRemapBlock::blockPage#2 / $20 Successful SSA optimization Pass2MultiplyToShiftRewriting Inlining constant with var siblings memoryRemap::remapBlocks#1 Inlining constant with var siblings memoryRemap::lowerPageOffset#1 @@ -525,79 +467,40 @@ Consolidated array index constant in *(main::BLOCK_8000+4) Consolidated array index constant in *(main::BLOCK_8000+1) Consolidated array index constant in *(main::BLOCK_4000+5) Successful SSA optimization Pass2ConstantAdditionElimination -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 -Alias candidate removed (volatile)memoryRemap256M::lMb = memoryRemap256M::$1 -Alias candidate removed (volatile)memoryRemap256M::uMb = memoryRemap256M::$3 -Alias candidate removed (volatile)memoryRemap256M::aVal = memoryRemap256M::$4 -Alias candidate removed (volatile)memoryRemap256M::xVal = memoryRemap256M::$8 -Alias candidate removed (volatile)memoryRemap256M::yVal = memoryRemap256M::$9 -Alias candidate removed (volatile)memoryRemap256M::zVal = memoryRemap256M::$13 Identical Phi Values memoryRemapBlock::memoryPage#2 $100 Identical Phi Values memoryRemap256M::upperPageOffset#2 0 Successful SSA optimization Pass2IdenticalPhiElimination -Constant right-side identified [30] memoryRemap256M::$2 = 0 >> 4 -Constant right-side identified [40] memoryRemap256M::$9 = byte0 0 -Constant right-side identified [43] memoryRemap256M::$11 = byte1 0 +Constant right-side identified [25] memoryRemap256M::$2 = 0 >> 4 +Constant right-side identified [32] memoryRemap256M::yVal = byte0 0 +Constant right-side identified [34] memoryRemap256M::$11 = byte1 0 Successful SSA optimization Pass2ConstantRValueConsolidation Constant memoryRemap256M::$2 = 0>>4 -Constant memoryRemap256M::$9 = byte0 0 Constant memoryRemap256M::$11 = byte1 0 Successful SSA optimization Pass2ConstantIdentification -Constant value identified (word)memoryRemap256M::$2 in [31] memoryRemap256M::$3 = byte1 (word)memoryRemap256M::$2 +Constant value identified (word)memoryRemap256M::$2 in [26] memoryRemap256M::uMb = byte1 (word)memoryRemap256M::$2 Successful SSA optimization Pass2ConstantValues Simplifying constant evaluating to zero 0>>4 in -Simplifying constant evaluating to zero byte0 0 in Simplifying constant evaluating to zero byte1 0 in -Simplifying constant evaluating to zero (word)memoryRemap256M::$2 in [31] memoryRemap256M::$3 = byte1 (word)memoryRemap256M::$2 +Simplifying constant evaluating to zero (word)memoryRemap256M::$2 in [26] memoryRemap256M::uMb = byte1 (word)memoryRemap256M::$2 +Simplifying constant evaluating to zero byte0 0 in [32] memoryRemap256M::yVal = byte0 0 Successful SSA optimization PassNSimplifyConstantZero Eliminating unused constant memoryRemap256M::$2 Successful SSA optimization PassNEliminateUnusedVars Constant inlined memoryRemap256M::$11 = 0 -Constant inlined memoryRemap256M::$9 = 0 Successful SSA optimization Pass2ConstantInlining -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 -Alias candidate removed (volatile)memoryRemap256M::lMb = memoryRemap256M::$1 -Alias candidate removed (volatile)memoryRemap256M::uMb = memoryRemap256M::$3 -Alias candidate removed (volatile)memoryRemap256M::aVal = memoryRemap256M::$4 -Alias candidate removed (volatile)memoryRemap256M::xVal = memoryRemap256M::$8 -Alias candidate removed (volatile)memoryRemap256M::zVal = memoryRemap256M::$13 -Constant right-side identified [30] memoryRemap256M::$3 = byte1 0 -Constant right-side identified [41] memoryRemap256M::$12 = 0 & $f +Constant right-side identified [25] memoryRemap256M::uMb = byte1 0 +Constant right-side identified [33] memoryRemap256M::$12 = 0 & $f Successful SSA optimization Pass2ConstantRValueConsolidation -Constant memoryRemap256M::$3 = byte1 0 Constant memoryRemap256M::$12 = 0&$f Successful SSA optimization Pass2ConstantIdentification -Simplifying constant evaluating to zero byte1 0 in Simplifying constant evaluating to zero 0&$f in +Simplifying constant evaluating to zero byte1 0 in [25] memoryRemap256M::uMb = byte1 0 Successful SSA optimization PassNSimplifyConstantZero -Simplifying expression containing zero memoryRemap256M::$10 in [42] memoryRemap256M::$13 = memoryRemap256M::$10 | memoryRemap256M::$12 +Simplifying expression containing zero memoryRemap256M::$10 in [34] memoryRemap256M::zVal = memoryRemap256M::$10 | memoryRemap256M::$12 Successful SSA optimization PassNSimplifyExpressionWithZero Eliminating unused constant memoryRemap256M::$12 Successful SSA optimization PassNEliminateUnusedVars -Constant inlined memoryRemap256M::$3 = 0 -Successful SSA optimization Pass2ConstantInlining -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 -Alias candidate removed (volatile)memoryRemap256M::lMb = memoryRemap256M::$1 -Alias candidate removed (volatile)memoryRemap256M::aVal = memoryRemap256M::$4 -Alias candidate removed (volatile)memoryRemap256M::xVal = memoryRemap256M::$8 -Alias candidate removed (volatile)memoryRemap256M::$13 = memoryRemap256M::$10 memoryRemap256M::zVal -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 -Alias candidate removed (volatile)memoryRemap256M::lMb = memoryRemap256M::$1 -Alias candidate removed (volatile)memoryRemap256M::aVal = memoryRemap256M::$4 -Alias candidate removed (volatile)memoryRemap256M::xVal = memoryRemap256M::$8 -Alias candidate removed (volatile)memoryRemap256M::$13 = memoryRemap256M::$10 memoryRemap256M::zVal +Alias candidate removed (volatile)memoryRemap256M::zVal = memoryRemap256M::$10 Finalized unsigned number type (byte) 8 Finalized unsigned number type (byte) 8 Finalized unsigned number type (dword) $ff800 @@ -605,22 +508,8 @@ Finalized unsigned number type (byte) $40 Successful SSA optimization PassNFinalizeNumberTypeConversions Simplifying constant integer cast $ff800-$40 Successful SSA optimization PassNCastSimplification -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 -Alias candidate removed (volatile)memoryRemap256M::lMb = memoryRemap256M::$1 -Alias candidate removed (volatile)memoryRemap256M::aVal = memoryRemap256M::$4 -Alias candidate removed (volatile)memoryRemap256M::xVal = memoryRemap256M::$8 -Alias candidate removed (volatile)memoryRemap256M::$13 = memoryRemap256M::$10 memoryRemap256M::zVal -Alias candidate removed (volatile)memoryRemap::aVal = memoryRemap::$0 -Alias candidate removed (volatile)memoryRemap::xVal = memoryRemap::$4 -Alias candidate removed (volatile)memoryRemap::yVal = memoryRemap::$5 -Alias candidate removed (volatile)memoryRemap::zVal = memoryRemap::$9 -Alias candidate removed (volatile)memoryRemap256M::lMb = memoryRemap256M::$1 -Alias candidate removed (volatile)memoryRemap256M::aVal = memoryRemap256M::$4 -Alias candidate removed (volatile)memoryRemap256M::xVal = memoryRemap256M::$8 -Alias candidate removed (volatile)memoryRemap256M::$13 = memoryRemap256M::$10 memoryRemap256M::zVal +Alias candidate removed (volatile)memoryRemap256M::zVal = memoryRemap256M::$10 +Alias candidate removed (volatile)memoryRemap256M::zVal = memoryRemap256M::$10 Adding NOP phi() at start of main Adding NOP phi() at start of main::@3 Adding NOP phi() at start of main::@10 @@ -715,49 +604,41 @@ memoryRemap: scope:[memoryRemap] from main::@8 memoryRemapBlock [33] memoryRemap::upperPageOffset#2 = phi( main::@8/$80, memoryRemapBlock/memoryRemap::upperPageOffset#0 ) [33] memoryRemap::remapBlocks#2 = phi( main::@8/MEMORYBLOCK_4000|MEMORYBLOCK_8000, memoryRemapBlock/memoryRemap::remapBlocks#0 ) [33] memoryRemap::lowerPageOffset#2 = phi( main::@8/$c0, memoryRemapBlock/memoryRemap::lowerPageOffset#0 ) - [34] memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#2 - [35] memoryRemap::aVal = memoryRemap::$0 - [36] memoryRemap::$1 = memoryRemap::remapBlocks#2 << 4 - [37] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#2 - [38] memoryRemap::$3 = memoryRemap::$2 & $f - [39] memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 - [40] memoryRemap::xVal = memoryRemap::$4 - [41] memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#2 - [42] memoryRemap::yVal = memoryRemap::$5 - [43] memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 - [44] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#2 - [45] memoryRemap::$8 = memoryRemap::$7 & $f - [46] memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 - [47] memoryRemap::zVal = memoryRemap::$9 + [34] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#2 + [35] memoryRemap::$1 = memoryRemap::remapBlocks#2 << 4 + [36] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#2 + [37] memoryRemap::$3 = memoryRemap::$2 & $f + [38] memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 + [39] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#2 + [40] memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 + [41] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#2 + [42] memoryRemap::$8 = memoryRemap::$7 & $f + [43] memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } to:memoryRemap::@return memoryRemap::@return: scope:[memoryRemap] from memoryRemap - [49] return + [45] return to:@return void memoryRemap256M(byte memoryRemap256M::remapBlocks , dword memoryRemap256M::lowerPageOffset , dword memoryRemap256M::upperPageOffset) memoryRemap256M: scope:[memoryRemap256M] from main::@3 main::@6 - [50] memoryRemap256M::remapBlocks#2 = phi( main::@3/MEMORYBLOCK_4000, main::@6/0 ) - [50] memoryRemap256M::lowerPageOffset#2 = phi( main::@3/$ff800-$40, main::@6/0 ) - [51] memoryRemap256M::$0 = memoryRemap256M::lowerPageOffset#2 >> 4 - [52] memoryRemap256M::$1 = byte1 (word)memoryRemap256M::$0 - [53] memoryRemap256M::lMb = memoryRemap256M::$1 - [54] memoryRemap256M::uMb = 0 - [55] memoryRemap256M::$4 = byte0 memoryRemap256M::lowerPageOffset#2 - [56] memoryRemap256M::aVal = memoryRemap256M::$4 - [57] memoryRemap256M::$5 = memoryRemap256M::remapBlocks#2 << 4 - [58] memoryRemap256M::$6 = byte1 memoryRemap256M::lowerPageOffset#2 - [59] memoryRemap256M::$7 = memoryRemap256M::$6 & $f - [60] memoryRemap256M::$8 = memoryRemap256M::$5 | memoryRemap256M::$7 - [61] memoryRemap256M::xVal = memoryRemap256M::$8 - [62] memoryRemap256M::yVal = 0 - [63] memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 - [64] memoryRemap256M::$13 = memoryRemap256M::$10 - [65] memoryRemap256M::zVal = memoryRemap256M::$13 + [46] memoryRemap256M::remapBlocks#2 = phi( main::@3/MEMORYBLOCK_4000, main::@6/0 ) + [46] memoryRemap256M::lowerPageOffset#2 = phi( main::@3/$ff800-$40, main::@6/0 ) + [47] memoryRemap256M::$0 = memoryRemap256M::lowerPageOffset#2 >> 4 + [48] memoryRemap256M::lMb = byte1 (word)memoryRemap256M::$0 + [49] memoryRemap256M::uMb = 0 + [50] memoryRemap256M::aVal = byte0 memoryRemap256M::lowerPageOffset#2 + [51] memoryRemap256M::$5 = memoryRemap256M::remapBlocks#2 << 4 + [52] memoryRemap256M::$6 = byte1 memoryRemap256M::lowerPageOffset#2 + [53] memoryRemap256M::$7 = memoryRemap256M::$6 & $f + [54] memoryRemap256M::xVal = memoryRemap256M::$5 | memoryRemap256M::$7 + [55] memoryRemap256M::yVal = 0 + [56] memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 + [57] memoryRemap256M::zVal = memoryRemap256M::$10 asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } to:memoryRemap256M::@return memoryRemap256M::@return: scope:[memoryRemap256M] from memoryRemap256M - [67] return + [59] return to:@return @@ -771,49 +652,41 @@ byte main::i1 byte main::i1#1 22.0 byte main::i1#2 13.75 void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset) -byte~ memoryRemap::$0 202.0 byte~ memoryRemap::$1 67.33333333333333 byte~ memoryRemap::$2 202.0 byte~ memoryRemap::$3 202.0 -byte~ memoryRemap::$4 202.0 -byte~ memoryRemap::$5 202.0 byte~ memoryRemap::$6 67.33333333333333 byte~ memoryRemap::$7 202.0 byte~ memoryRemap::$8 202.0 -byte~ memoryRemap::$9 202.0 -volatile byte memoryRemap::aVal loadstore 7.769230769230769 +volatile byte memoryRemap::aVal loadstore 10.1 word memoryRemap::lowerPageOffset word memoryRemap::lowerPageOffset#0 11.0 -word memoryRemap::lowerPageOffset#2 53.25 +word memoryRemap::lowerPageOffset#2 71.0 byte memoryRemap::remapBlocks byte memoryRemap::remapBlocks#0 7.333333333333333 -byte memoryRemap::remapBlocks#2 21.299999999999997 +byte memoryRemap::remapBlocks#2 30.42857142857143 word memoryRemap::upperPageOffset word memoryRemap::upperPageOffset#0 22.0 -word memoryRemap::upperPageOffset#2 19.363636363636363 -volatile byte memoryRemap::xVal loadstore 12.625 -volatile byte memoryRemap::yVal loadstore 16.833333333333332 +word memoryRemap::upperPageOffset#2 26.625 +volatile byte memoryRemap::xVal loadstore 16.833333333333332 +volatile byte memoryRemap::yVal loadstore 20.2 volatile byte memoryRemap::zVal loadstore 101.0 void memoryRemap256M(byte memoryRemap256M::remapBlocks , dword memoryRemap256M::lowerPageOffset , dword memoryRemap256M::upperPageOffset) dword~ memoryRemap256M::$0 11.0 -byte~ memoryRemap256M::$1 22.0 byte~ memoryRemap256M::$10 22.0 -byte~ memoryRemap256M::$13 22.0 -byte~ memoryRemap256M::$4 22.0 byte~ memoryRemap256M::$5 7.333333333333333 byte~ memoryRemap256M::$6 22.0 byte~ memoryRemap256M::$7 22.0 -byte~ memoryRemap256M::$8 22.0 -volatile byte memoryRemap256M::aVal loadstore 1.1 -volatile byte memoryRemap256M::lMb loadstore 0.8461538461538461 +volatile byte memoryRemap256M::aVal loadstore 1.375 +volatile byte memoryRemap256M::lMb loadstore 1.1 dword memoryRemap256M::lowerPageOffset -dword memoryRemap256M::lowerPageOffset#2 4.125 +dword memoryRemap256M::lowerPageOffset#2 5.5 byte memoryRemap256M::remapBlocks -byte memoryRemap256M::remapBlocks#2 1.6923076923076923 -volatile byte memoryRemap256M::uMb loadstore 0.9166666666666666 +byte memoryRemap256M::remapBlocks#2 2.2 +volatile byte memoryRemap256M::uMb loadstore 1.2222222222222223 dword memoryRemap256M::upperPageOffset -volatile byte memoryRemap256M::xVal loadstore 2.2 -volatile byte memoryRemap256M::yVal loadstore 2.75 +volatile byte memoryRemap256M::xVal loadstore 2.75 +volatile byte memoryRemap256M::yVal loadstore 3.6666666666666665 volatile byte memoryRemap256M::zVal loadstore 11.0 void memoryRemapBlock(byte memoryRemapBlock::blockPage , word memoryRemapBlock::memoryPage) byte memoryRemapBlock::block @@ -839,34 +712,26 @@ Added variable main::$7 to live range equivalence class [ main::$7 ] Added variable memoryRemapBlock::pageOffset#0 to live range equivalence class [ memoryRemapBlock::pageOffset#0 ] Added variable memoryRemapBlock::block#0 to live range equivalence class [ memoryRemapBlock::block#0 ] Added variable memoryRemapBlock::blockBits#0 to live range equivalence class [ memoryRemapBlock::blockBits#0 ] -Added variable memoryRemap::$0 to live range equivalence class [ memoryRemap::$0 ] Added variable memoryRemap::aVal to live range equivalence class [ memoryRemap::aVal ] Added variable memoryRemap::$1 to live range equivalence class [ memoryRemap::$1 ] Added variable memoryRemap::$2 to live range equivalence class [ memoryRemap::$2 ] Added variable memoryRemap::$3 to live range equivalence class [ memoryRemap::$3 ] -Added variable memoryRemap::$4 to live range equivalence class [ memoryRemap::$4 ] Added variable memoryRemap::xVal to live range equivalence class [ memoryRemap::xVal ] -Added variable memoryRemap::$5 to live range equivalence class [ memoryRemap::$5 ] Added variable memoryRemap::yVal to live range equivalence class [ memoryRemap::yVal ] Added variable memoryRemap::$6 to live range equivalence class [ memoryRemap::$6 ] Added variable memoryRemap::$7 to live range equivalence class [ memoryRemap::$7 ] Added variable memoryRemap::$8 to live range equivalence class [ memoryRemap::$8 ] -Added variable memoryRemap::$9 to live range equivalence class [ memoryRemap::$9 ] Added variable memoryRemap::zVal to live range equivalence class [ memoryRemap::zVal ] Added variable memoryRemap256M::$0 to live range equivalence class [ memoryRemap256M::$0 ] -Added variable memoryRemap256M::$1 to live range equivalence class [ memoryRemap256M::$1 ] Added variable memoryRemap256M::lMb to live range equivalence class [ memoryRemap256M::lMb ] Added variable memoryRemap256M::uMb to live range equivalence class [ memoryRemap256M::uMb ] -Added variable memoryRemap256M::$4 to live range equivalence class [ memoryRemap256M::$4 ] Added variable memoryRemap256M::aVal to live range equivalence class [ memoryRemap256M::aVal ] Added variable memoryRemap256M::$5 to live range equivalence class [ memoryRemap256M::$5 ] Added variable memoryRemap256M::$6 to live range equivalence class [ memoryRemap256M::$6 ] Added variable memoryRemap256M::$7 to live range equivalence class [ memoryRemap256M::$7 ] -Added variable memoryRemap256M::$8 to live range equivalence class [ memoryRemap256M::$8 ] Added variable memoryRemap256M::xVal to live range equivalence class [ memoryRemap256M::xVal ] Added variable memoryRemap256M::yVal to live range equivalence class [ memoryRemap256M::yVal ] Added variable memoryRemap256M::$10 to live range equivalence class [ memoryRemap256M::$10 ] -Added variable memoryRemap256M::$13 to live range equivalence class [ memoryRemap256M::$13 ] Added variable memoryRemap256M::zVal to live range equivalence class [ memoryRemap256M::zVal ] Complete equivalence classes [ main::i#2 main::i#1 ] @@ -881,34 +746,26 @@ Complete equivalence classes [ memoryRemapBlock::pageOffset#0 ] [ memoryRemapBlock::block#0 ] [ memoryRemapBlock::blockBits#0 ] -[ memoryRemap::$0 ] [ memoryRemap::aVal ] [ memoryRemap::$1 ] [ memoryRemap::$2 ] [ memoryRemap::$3 ] -[ memoryRemap::$4 ] [ memoryRemap::xVal ] -[ memoryRemap::$5 ] [ memoryRemap::yVal ] [ memoryRemap::$6 ] [ memoryRemap::$7 ] [ memoryRemap::$8 ] -[ memoryRemap::$9 ] [ memoryRemap::zVal ] [ memoryRemap256M::$0 ] -[ memoryRemap256M::$1 ] [ memoryRemap256M::lMb ] [ memoryRemap256M::uMb ] -[ memoryRemap256M::$4 ] [ memoryRemap256M::aVal ] [ memoryRemap256M::$5 ] [ memoryRemap256M::$6 ] [ memoryRemap256M::$7 ] -[ memoryRemap256M::$8 ] [ memoryRemap256M::xVal ] [ memoryRemap256M::yVal ] [ memoryRemap256M::$10 ] -[ memoryRemap256M::$13 ] [ memoryRemap256M::zVal ] Allocated zp[1]:2 [ main::i#2 main::i#1 ] Allocated zp[1]:3 [ main::i1#2 main::i1#1 ] @@ -922,35 +779,27 @@ Allocated zp[1]:15 [ main::$7 ] Allocated zp[2]:16 [ memoryRemapBlock::pageOffset#0 ] Allocated zp[1]:18 [ memoryRemapBlock::block#0 ] Allocated zp[1]:19 [ memoryRemapBlock::blockBits#0 ] -Allocated zp[1]:20 [ memoryRemap::$0 ] -Allocated zp[1]:21 [ memoryRemap::aVal ] -Allocated zp[1]:22 [ memoryRemap::$1 ] -Allocated zp[1]:23 [ memoryRemap::$2 ] -Allocated zp[1]:24 [ memoryRemap::$3 ] -Allocated zp[1]:25 [ memoryRemap::$4 ] -Allocated zp[1]:26 [ memoryRemap::xVal ] -Allocated zp[1]:27 [ memoryRemap::$5 ] -Allocated zp[1]:28 [ memoryRemap::yVal ] -Allocated zp[1]:29 [ memoryRemap::$6 ] -Allocated zp[1]:30 [ memoryRemap::$7 ] -Allocated zp[1]:31 [ memoryRemap::$8 ] -Allocated zp[1]:32 [ memoryRemap::$9 ] -Allocated zp[1]:33 [ memoryRemap::zVal ] -Allocated zp[4]:34 [ memoryRemap256M::$0 ] -Allocated zp[1]:38 [ memoryRemap256M::$1 ] -Allocated zp[1]:39 [ memoryRemap256M::lMb ] -Allocated zp[1]:40 [ memoryRemap256M::uMb ] -Allocated zp[1]:41 [ memoryRemap256M::$4 ] -Allocated zp[1]:42 [ memoryRemap256M::aVal ] -Allocated zp[1]:43 [ memoryRemap256M::$5 ] -Allocated zp[1]:44 [ memoryRemap256M::$6 ] -Allocated zp[1]:45 [ memoryRemap256M::$7 ] -Allocated zp[1]:46 [ memoryRemap256M::$8 ] -Allocated zp[1]:47 [ memoryRemap256M::xVal ] -Allocated zp[1]:48 [ memoryRemap256M::yVal ] -Allocated zp[1]:49 [ memoryRemap256M::$10 ] -Allocated zp[1]:50 [ memoryRemap256M::$13 ] -Allocated zp[1]:51 [ memoryRemap256M::zVal ] +Allocated zp[1]:20 [ memoryRemap::aVal ] +Allocated zp[1]:21 [ memoryRemap::$1 ] +Allocated zp[1]:22 [ memoryRemap::$2 ] +Allocated zp[1]:23 [ memoryRemap::$3 ] +Allocated zp[1]:24 [ memoryRemap::xVal ] +Allocated zp[1]:25 [ memoryRemap::yVal ] +Allocated zp[1]:26 [ memoryRemap::$6 ] +Allocated zp[1]:27 [ memoryRemap::$7 ] +Allocated zp[1]:28 [ memoryRemap::$8 ] +Allocated zp[1]:29 [ memoryRemap::zVal ] +Allocated zp[4]:30 [ memoryRemap256M::$0 ] +Allocated zp[1]:34 [ memoryRemap256M::lMb ] +Allocated zp[1]:35 [ memoryRemap256M::uMb ] +Allocated zp[1]:36 [ memoryRemap256M::aVal ] +Allocated zp[1]:37 [ memoryRemap256M::$5 ] +Allocated zp[1]:38 [ memoryRemap256M::$6 ] +Allocated zp[1]:39 [ memoryRemap256M::$7 ] +Allocated zp[1]:40 [ memoryRemap256M::xVal ] +Allocated zp[1]:41 [ memoryRemap256M::yVal ] +Allocated zp[1]:42 [ memoryRemap256M::$10 ] +Allocated zp[1]:43 [ memoryRemap256M::zVal ] REGISTER UPLIFT POTENTIAL REGISTERS Statement [2] *main::BLOCK_4000 = '-' [ ] ( [ ] { } ) always clobbers reg byte a Statement [3] *(main::BLOCK_4000+1) = '*' [ ] ( [ ] { } ) always clobbers reg byte a @@ -969,22 +818,25 @@ Statement [27] memoryRemapBlock::blockBits#0 = 1 << memoryRemapBlock::block#0 [ Statement [29] memoryRemap::lowerPageOffset#0 = memoryRemapBlock::pageOffset#0 [ memoryRemapBlock::pageOffset#0 memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 ] ( memoryRemapBlock:1 [ memoryRemapBlock::pageOffset#0 memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemapBlock::pageOffset#0 memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp[1]:7 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] Statement [30] memoryRemap::upperPageOffset#0 = memoryRemapBlock::pageOffset#0 [ memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 memoryRemap::upperPageOffset#0 ] ( memoryRemapBlock:1 [ memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 memoryRemap::upperPageOffset#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 memoryRemap::upperPageOffset#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Statement [36] memoryRemap::$1 = memoryRemap::remapBlocks#2 << 4 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 ] ( memoryRemap:7 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Statement [38] memoryRemap::$3 = memoryRemap::$2 & $f [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 memoryRemap::$3 ] ( memoryRemap:7 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 memoryRemap::$3 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 memoryRemap::$3 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 memoryRemap::$3 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Removing always clobbered register reg byte a as potential for zp[1]:22 [ memoryRemap::$1 ] -Statement [43] memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 [ memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 ] ( memoryRemap:7 [ memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Statement [45] memoryRemap::$8 = memoryRemap::$7 & $f [ memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 memoryRemap::$8 ] ( memoryRemap:7 [ memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 memoryRemap::$8 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 memoryRemap::$8 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 memoryRemap::$8 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Removing always clobbered register reg byte a as potential for zp[1]:29 [ memoryRemap::$6 ] +Statement [34] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#2 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal ] ( memoryRemap:7 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [35] memoryRemap::$1 = memoryRemap::remapBlocks#2 << 4 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 ] ( memoryRemap:7 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [37] memoryRemap::$3 = memoryRemap::$2 & $f [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 memoryRemap::$3 ] ( memoryRemap:7 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 memoryRemap::$3 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 memoryRemap::$3 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 memoryRemap::$3 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:21 [ memoryRemap::$1 ] +Statement [39] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#2 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal ] ( memoryRemap:7 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [40] memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 [ memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 ] ( memoryRemap:7 [ memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [42] memoryRemap::$8 = memoryRemap::$7 & $f [ memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 memoryRemap::$8 ] ( memoryRemap:7 [ memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 memoryRemap::$8 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 memoryRemap::$8 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 memoryRemap::$8 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:26 [ memoryRemap::$6 ] Statement asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } always clobbers reg byte a reg byte x reg byte y reg byte z -Statement [51] memoryRemap256M::$0 = memoryRemap256M::lowerPageOffset#2 >> 4 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] { } ) always clobbers reg byte a +Statement [47] memoryRemap256M::$0 = memoryRemap256M::lowerPageOffset#2 >> 4 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] { } ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp[1]:14 [ memoryRemap256M::remapBlocks#2 ] -Statement [52] memoryRemap256M::$1 = byte1 (word)memoryRemap256M::$0 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$1 ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$1 ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$1 ] { } ) always clobbers reg byte a -Statement [54] memoryRemap256M::uMb = 0 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb ] { } ) always clobbers reg byte a -Statement [57] memoryRemap256M::$5 = memoryRemap256M::remapBlocks#2 << 4 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 ] { } ) always clobbers reg byte a -Statement [59] memoryRemap256M::$7 = memoryRemap256M::$6 & $f [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 memoryRemap256M::$7 ] ( memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 memoryRemap256M::$7 ] { } memoryRemap256M:17 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 memoryRemap256M::$7 ] { } ) always clobbers reg byte a -Removing always clobbered register reg byte a as potential for zp[1]:43 [ memoryRemap256M::$5 ] -Statement [62] memoryRemap256M::yVal = 0 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal ] ( memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal ] { } memoryRemap256M:17 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal ] { } ) always clobbers reg byte a -Statement [63] memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 [ memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal memoryRemap256M::$10 ] ( memoryRemap256M:13 [ memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal memoryRemap256M::$10 ] { } memoryRemap256M:17 [ memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal memoryRemap256M::$10 ] { } ) always clobbers reg byte a +Statement [48] memoryRemap256M::lMb = byte1 (word)memoryRemap256M::$0 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb ] { } ) always clobbers reg byte a +Statement [49] memoryRemap256M::uMb = 0 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb ] { } ) always clobbers reg byte a +Statement [50] memoryRemap256M::aVal = byte0 memoryRemap256M::lowerPageOffset#2 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal ] { } ) always clobbers reg byte a +Statement [51] memoryRemap256M::$5 = memoryRemap256M::remapBlocks#2 << 4 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 ] { } ) always clobbers reg byte a +Statement [53] memoryRemap256M::$7 = memoryRemap256M::$6 & $f [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 memoryRemap256M::$7 ] ( memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 memoryRemap256M::$7 ] { } memoryRemap256M:17 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 memoryRemap256M::$7 ] { } ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:37 [ memoryRemap256M::$5 ] +Statement [55] memoryRemap256M::yVal = 0 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal ] ( memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal ] { } memoryRemap256M:17 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal ] { } ) always clobbers reg byte a +Statement [56] memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 [ memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal memoryRemap256M::$10 ] ( memoryRemap256M:13 [ memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal memoryRemap256M::$10 ] { } memoryRemap256M:17 [ memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal memoryRemap256M::$10 ] { } ) always clobbers reg byte a Statement asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } always clobbers reg byte a reg byte x reg byte y reg byte z Statement [2] *main::BLOCK_4000 = '-' [ ] ( [ ] { } ) always clobbers reg byte a Statement [3] *(main::BLOCK_4000+1) = '*' [ ] ( [ ] { } ) always clobbers reg byte a @@ -999,18 +851,21 @@ Statement [26] memoryRemapBlock::block#0 = memoryRemapBlock::blockPage#2 >> 5 [ Statement [27] memoryRemapBlock::blockBits#0 = 1 << memoryRemapBlock::block#0 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::blockBits#0 ] ( memoryRemapBlock:1 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::blockBits#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemapBlock::pageOffset#0 memoryRemapBlock::blockBits#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a Statement [29] memoryRemap::lowerPageOffset#0 = memoryRemapBlock::pageOffset#0 [ memoryRemapBlock::pageOffset#0 memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 ] ( memoryRemapBlock:1 [ memoryRemapBlock::pageOffset#0 memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemapBlock::pageOffset#0 memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a Statement [30] memoryRemap::upperPageOffset#0 = memoryRemapBlock::pageOffset#0 [ memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 memoryRemap::upperPageOffset#0 ] ( memoryRemapBlock:1 [ memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 memoryRemap::upperPageOffset#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4 [ memoryRemap::remapBlocks#0 memoryRemap::lowerPageOffset#0 memoryRemap::upperPageOffset#0 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Statement [36] memoryRemap::$1 = memoryRemap::remapBlocks#2 << 4 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 ] ( memoryRemap:7 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Statement [38] memoryRemap::$3 = memoryRemap::$2 & $f [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 memoryRemap::$3 ] ( memoryRemap:7 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 memoryRemap::$3 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 memoryRemap::$3 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 memoryRemap::$3 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Statement [43] memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 [ memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 ] ( memoryRemap:7 [ memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a -Statement [45] memoryRemap::$8 = memoryRemap::$7 & $f [ memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 memoryRemap::$8 ] ( memoryRemap:7 [ memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 memoryRemap::$8 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 memoryRemap::$8 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 memoryRemap::$8 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [34] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#2 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal ] ( memoryRemap:7 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [35] memoryRemap::$1 = memoryRemap::remapBlocks#2 << 4 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 ] ( memoryRemap:7 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::lowerPageOffset#2 memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [37] memoryRemap::$3 = memoryRemap::$2 & $f [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 memoryRemap::$3 ] ( memoryRemap:7 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 memoryRemap::$3 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 memoryRemap::$3 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::$1 memoryRemap::$3 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [39] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#2 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal ] ( memoryRemap:7 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::remapBlocks#2 memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [40] memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 [ memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 ] ( memoryRemap:7 [ memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::upperPageOffset#2 memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a +Statement [42] memoryRemap::$8 = memoryRemap::$7 & $f [ memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 memoryRemap::$8 ] ( memoryRemap:7 [ memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 memoryRemap::$8 ] { } memoryRemapBlock:1::memoryRemap:31 [ memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 memoryRemap::$8 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } memoryRemapBlock:4::memoryRemap:31 [ memoryRemap::aVal memoryRemap::xVal memoryRemap::yVal memoryRemap::$6 memoryRemap::$8 ] { { memoryRemap::remapBlocks#0 = memoryRemap::remapBlocks#2 memoryRemapBlock::blockBits#0 } { memoryRemap::upperPageOffset#0 = memoryRemap::upperPageOffset#2 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 } } ) always clobbers reg byte a Statement asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } always clobbers reg byte a reg byte x reg byte y reg byte z -Statement [51] memoryRemap256M::$0 = memoryRemap256M::lowerPageOffset#2 >> 4 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] { } ) always clobbers reg byte a -Statement [52] memoryRemap256M::$1 = byte1 (word)memoryRemap256M::$0 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$1 ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$1 ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$1 ] { } ) always clobbers reg byte a -Statement [54] memoryRemap256M::uMb = 0 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb ] { } ) always clobbers reg byte a -Statement [57] memoryRemap256M::$5 = memoryRemap256M::remapBlocks#2 << 4 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 ] { } ) always clobbers reg byte a -Statement [59] memoryRemap256M::$7 = memoryRemap256M::$6 & $f [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 memoryRemap256M::$7 ] ( memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 memoryRemap256M::$7 ] { } memoryRemap256M:17 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 memoryRemap256M::$7 ] { } ) always clobbers reg byte a -Statement [62] memoryRemap256M::yVal = 0 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal ] ( memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal ] { } memoryRemap256M:17 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal ] { } ) always clobbers reg byte a -Statement [63] memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 [ memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal memoryRemap256M::$10 ] ( memoryRemap256M:13 [ memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal memoryRemap256M::$10 ] { } memoryRemap256M:17 [ memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal memoryRemap256M::$10 ] { } ) always clobbers reg byte a +Statement [47] memoryRemap256M::$0 = memoryRemap256M::lowerPageOffset#2 >> 4 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::$0 ] { } ) always clobbers reg byte a +Statement [48] memoryRemap256M::lMb = byte1 (word)memoryRemap256M::$0 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb ] { } ) always clobbers reg byte a +Statement [49] memoryRemap256M::uMb = 0 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb ] { } ) always clobbers reg byte a +Statement [50] memoryRemap256M::aVal = byte0 memoryRemap256M::lowerPageOffset#2 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal ] { } ) always clobbers reg byte a +Statement [51] memoryRemap256M::$5 = memoryRemap256M::remapBlocks#2 << 4 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 ] ( memoryRemap256M:13 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 ] { } memoryRemap256M:17 [ memoryRemap256M::lowerPageOffset#2 memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 ] { } ) always clobbers reg byte a +Statement [53] memoryRemap256M::$7 = memoryRemap256M::$6 & $f [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 memoryRemap256M::$7 ] ( memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 memoryRemap256M::$7 ] { } memoryRemap256M:17 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::$5 memoryRemap256M::$7 ] { } ) always clobbers reg byte a +Statement [55] memoryRemap256M::yVal = 0 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal ] ( memoryRemap256M:13 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal ] { } memoryRemap256M:17 [ memoryRemap256M::remapBlocks#2 memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal ] { } ) always clobbers reg byte a +Statement [56] memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 [ memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal memoryRemap256M::$10 ] ( memoryRemap256M:13 [ memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal memoryRemap256M::$10 ] { } memoryRemap256M:17 [ memoryRemap256M::lMb memoryRemap256M::uMb memoryRemap256M::aVal memoryRemap256M::xVal memoryRemap256M::yVal memoryRemap256M::$10 ] { } ) always clobbers reg byte a Statement asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } always clobbers reg byte a reg byte x reg byte y reg byte z Potential registers zp[1]:2 [ main::i#2 main::i#1 ] : zp[1]:2 , reg byte x , reg byte y , reg byte z , Potential registers zp[1]:3 [ main::i1#2 main::i1#1 ] : zp[1]:3 , reg byte x , reg byte y , reg byte z , @@ -1024,39 +879,31 @@ Potential registers zp[1]:15 [ main::$7 ] : zp[1]:15 , reg byte a , reg byte x , Potential registers zp[2]:16 [ memoryRemapBlock::pageOffset#0 ] : zp[2]:16 , Potential registers zp[1]:18 [ memoryRemapBlock::block#0 ] : zp[1]:18 , reg byte a , reg byte x , reg byte y , reg byte z , Potential registers zp[1]:19 [ memoryRemapBlock::blockBits#0 ] : zp[1]:19 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:20 [ memoryRemap::$0 ] : zp[1]:20 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:21 [ memoryRemap::aVal ] : zp[1]:21 , -Potential registers zp[1]:22 [ memoryRemap::$1 ] : zp[1]:22 , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:23 [ memoryRemap::$2 ] : zp[1]:23 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:24 [ memoryRemap::$3 ] : zp[1]:24 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:25 [ memoryRemap::$4 ] : zp[1]:25 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:26 [ memoryRemap::xVal ] : zp[1]:26 , -Potential registers zp[1]:27 [ memoryRemap::$5 ] : zp[1]:27 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:28 [ memoryRemap::yVal ] : zp[1]:28 , -Potential registers zp[1]:29 [ memoryRemap::$6 ] : zp[1]:29 , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:30 [ memoryRemap::$7 ] : zp[1]:30 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:31 [ memoryRemap::$8 ] : zp[1]:31 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:32 [ memoryRemap::$9 ] : zp[1]:32 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:33 [ memoryRemap::zVal ] : zp[1]:33 , -Potential registers zp[4]:34 [ memoryRemap256M::$0 ] : zp[4]:34 , -Potential registers zp[1]:38 [ memoryRemap256M::$1 ] : zp[1]:38 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:39 [ memoryRemap256M::lMb ] : zp[1]:39 , -Potential registers zp[1]:40 [ memoryRemap256M::uMb ] : zp[1]:40 , -Potential registers zp[1]:41 [ memoryRemap256M::$4 ] : zp[1]:41 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:42 [ memoryRemap256M::aVal ] : zp[1]:42 , -Potential registers zp[1]:43 [ memoryRemap256M::$5 ] : zp[1]:43 , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:44 [ memoryRemap256M::$6 ] : zp[1]:44 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:45 [ memoryRemap256M::$7 ] : zp[1]:45 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:46 [ memoryRemap256M::$8 ] : zp[1]:46 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:47 [ memoryRemap256M::xVal ] : zp[1]:47 , -Potential registers zp[1]:48 [ memoryRemap256M::yVal ] : zp[1]:48 , -Potential registers zp[1]:49 [ memoryRemap256M::$10 ] : zp[1]:49 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:50 [ memoryRemap256M::$13 ] : zp[1]:50 , reg byte a , reg byte x , reg byte y , reg byte z , -Potential registers zp[1]:51 [ memoryRemap256M::zVal ] : zp[1]:51 , +Potential registers zp[1]:20 [ memoryRemap::aVal ] : zp[1]:20 , +Potential registers zp[1]:21 [ memoryRemap::$1 ] : zp[1]:21 , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:22 [ memoryRemap::$2 ] : zp[1]:22 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:23 [ memoryRemap::$3 ] : zp[1]:23 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:24 [ memoryRemap::xVal ] : zp[1]:24 , +Potential registers zp[1]:25 [ memoryRemap::yVal ] : zp[1]:25 , +Potential registers zp[1]:26 [ memoryRemap::$6 ] : zp[1]:26 , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:27 [ memoryRemap::$7 ] : zp[1]:27 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:28 [ memoryRemap::$8 ] : zp[1]:28 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:29 [ memoryRemap::zVal ] : zp[1]:29 , +Potential registers zp[4]:30 [ memoryRemap256M::$0 ] : zp[4]:30 , +Potential registers zp[1]:34 [ memoryRemap256M::lMb ] : zp[1]:34 , +Potential registers zp[1]:35 [ memoryRemap256M::uMb ] : zp[1]:35 , +Potential registers zp[1]:36 [ memoryRemap256M::aVal ] : zp[1]:36 , +Potential registers zp[1]:37 [ memoryRemap256M::$5 ] : zp[1]:37 , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:38 [ memoryRemap256M::$6 ] : zp[1]:38 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:39 [ memoryRemap256M::$7 ] : zp[1]:39 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:40 [ memoryRemap256M::xVal ] : zp[1]:40 , +Potential registers zp[1]:41 [ memoryRemap256M::yVal ] : zp[1]:41 , +Potential registers zp[1]:42 [ memoryRemap256M::$10 ] : zp[1]:42 , reg byte a , reg byte x , reg byte y , reg byte z , +Potential registers zp[1]:43 [ memoryRemap256M::zVal ] : zp[1]:43 , REGISTER UPLIFT SCOPES -Uplift Scope [memoryRemap] 202: zp[1]:20 [ memoryRemap::$0 ] 202: zp[1]:23 [ memoryRemap::$2 ] 202: zp[1]:24 [ memoryRemap::$3 ] 202: zp[1]:25 [ memoryRemap::$4 ] 202: zp[1]:27 [ memoryRemap::$5 ] 202: zp[1]:30 [ memoryRemap::$7 ] 202: zp[1]:31 [ memoryRemap::$8 ] 202: zp[1]:32 [ memoryRemap::$9 ] 101: zp[1]:33 [ memoryRemap::zVal ] 67.33: zp[1]:22 [ memoryRemap::$1 ] 67.33: zp[1]:29 [ memoryRemap::$6 ] 64.25: zp[2]:5 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 ] 41.36: zp[2]:8 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#0 ] 28.63: zp[1]:7 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] 16.83: zp[1]:28 [ memoryRemap::yVal ] 12.62: zp[1]:26 [ memoryRemap::xVal ] 7.77: zp[1]:21 [ memoryRemap::aVal ] -Uplift Scope [memoryRemap256M] 22: zp[1]:38 [ memoryRemap256M::$1 ] 22: zp[1]:41 [ memoryRemap256M::$4 ] 22: zp[1]:44 [ memoryRemap256M::$6 ] 22: zp[1]:45 [ memoryRemap256M::$7 ] 22: zp[1]:46 [ memoryRemap256M::$8 ] 22: zp[1]:49 [ memoryRemap256M::$10 ] 22: zp[1]:50 [ memoryRemap256M::$13 ] 11: zp[4]:34 [ memoryRemap256M::$0 ] 11: zp[1]:51 [ memoryRemap256M::zVal ] 7.33: zp[1]:43 [ memoryRemap256M::$5 ] 4.12: zp[4]:10 [ memoryRemap256M::lowerPageOffset#2 ] 2.75: zp[1]:48 [ memoryRemap256M::yVal ] 2.2: zp[1]:47 [ memoryRemap256M::xVal ] 1.69: zp[1]:14 [ memoryRemap256M::remapBlocks#2 ] 1.1: zp[1]:42 [ memoryRemap256M::aVal ] 0.92: zp[1]:40 [ memoryRemap256M::uMb ] 0.85: zp[1]:39 [ memoryRemap256M::lMb ] +Uplift Scope [memoryRemap] 202: zp[1]:22 [ memoryRemap::$2 ] 202: zp[1]:23 [ memoryRemap::$3 ] 202: zp[1]:27 [ memoryRemap::$7 ] 202: zp[1]:28 [ memoryRemap::$8 ] 101: zp[1]:29 [ memoryRemap::zVal ] 82: zp[2]:5 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 ] 67.33: zp[1]:21 [ memoryRemap::$1 ] 67.33: zp[1]:26 [ memoryRemap::$6 ] 48.62: zp[2]:8 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#0 ] 37.76: zp[1]:7 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] 20.2: zp[1]:25 [ memoryRemap::yVal ] 16.83: zp[1]:24 [ memoryRemap::xVal ] 10.1: zp[1]:20 [ memoryRemap::aVal ] +Uplift Scope [memoryRemap256M] 22: zp[1]:38 [ memoryRemap256M::$6 ] 22: zp[1]:39 [ memoryRemap256M::$7 ] 22: zp[1]:42 [ memoryRemap256M::$10 ] 11: zp[4]:30 [ memoryRemap256M::$0 ] 11: zp[1]:43 [ memoryRemap256M::zVal ] 7.33: zp[1]:37 [ memoryRemap256M::$5 ] 5.5: zp[4]:10 [ memoryRemap256M::lowerPageOffset#2 ] 3.67: zp[1]:41 [ memoryRemap256M::yVal ] 2.75: zp[1]:40 [ memoryRemap256M::xVal ] 2.2: zp[1]:14 [ memoryRemap256M::remapBlocks#2 ] 1.38: zp[1]:36 [ memoryRemap256M::aVal ] 1.22: zp[1]:35 [ memoryRemap256M::uMb ] 1.1: zp[1]:34 [ memoryRemap256M::lMb ] Uplift Scope [main] 40.33: zp[1]:2 [ main::i#2 main::i#1 ] 35.75: zp[1]:3 [ main::i1#2 main::i1#1 ] 22: zp[1]:15 [ main::$7 ] Uplift Scope [memoryRemapBlock] 22: zp[1]:18 [ memoryRemapBlock::block#0 ] 22: zp[1]:19 [ memoryRemapBlock::blockBits#0 ] 11: zp[1]:4 [ memoryRemapBlock::blockPage#2 ] 6.6: zp[2]:16 [ memoryRemapBlock::pageOffset#0 ] Uplift Scope [MOS6526_CIA] @@ -1069,87 +916,71 @@ Uplift Scope [DMA_LIST_F018A] Uplift Scope [DMA_LIST_F018B] Uplift Scope [] -Uplifting [memoryRemap] best 1422 combination reg byte a [ memoryRemap::$0 ] reg byte a [ memoryRemap::$2 ] reg byte a [ memoryRemap::$3 ] zp[1]:25 [ memoryRemap::$4 ] zp[1]:27 [ memoryRemap::$5 ] zp[1]:30 [ memoryRemap::$7 ] zp[1]:31 [ memoryRemap::$8 ] zp[1]:32 [ memoryRemap::$9 ] zp[1]:33 [ memoryRemap::zVal ] zp[1]:22 [ memoryRemap::$1 ] zp[1]:29 [ memoryRemap::$6 ] zp[2]:5 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 ] zp[2]:8 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#0 ] zp[1]:7 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] zp[1]:28 [ memoryRemap::yVal ] zp[1]:26 [ memoryRemap::xVal ] zp[1]:21 [ memoryRemap::aVal ] -Limited combination testing to 100 combinations of 25000000 possible. -Uplifting [memoryRemap256M] best 1404 combination reg byte a [ memoryRemap256M::$1 ] reg byte a [ memoryRemap256M::$4 ] reg byte a [ memoryRemap256M::$6 ] zp[1]:45 [ memoryRemap256M::$7 ] zp[1]:46 [ memoryRemap256M::$8 ] zp[1]:49 [ memoryRemap256M::$10 ] zp[1]:50 [ memoryRemap256M::$13 ] zp[4]:34 [ memoryRemap256M::$0 ] zp[1]:51 [ memoryRemap256M::zVal ] zp[1]:43 [ memoryRemap256M::$5 ] zp[4]:10 [ memoryRemap256M::lowerPageOffset#2 ] zp[1]:48 [ memoryRemap256M::yVal ] zp[1]:47 [ memoryRemap256M::xVal ] zp[1]:14 [ memoryRemap256M::remapBlocks#2 ] zp[1]:42 [ memoryRemap256M::aVal ] zp[1]:40 [ memoryRemap256M::uMb ] zp[1]:39 [ memoryRemap256M::lMb ] -Limited combination testing to 100 combinations of 1250000 possible. -Uplifting [main] best 1094 combination reg byte x [ main::i#2 main::i#1 ] reg byte x [ main::i1#2 main::i1#1 ] reg byte a [ main::$7 ] -Uplifting [memoryRemapBlock] best 1080 combination reg byte a [ memoryRemapBlock::block#0 ] reg byte a [ memoryRemapBlock::blockBits#0 ] reg byte x [ memoryRemapBlock::blockPage#2 ] zp[2]:16 [ memoryRemapBlock::pageOffset#0 ] -Uplifting [MOS6526_CIA] best 1080 combination -Uplifting [MOS6569_VICII] best 1080 combination -Uplifting [MOS6581_SID] best 1080 combination -Uplifting [MOS4569_VICIII] best 1080 combination -Uplifting [MEGA65_VICIV] best 1080 combination -Uplifting [F018_DMAGIC] best 1080 combination -Uplifting [DMA_LIST_F018A] best 1080 combination -Uplifting [DMA_LIST_F018B] best 1080 combination -Uplifting [] best 1080 combination -Attempting to uplift remaining variables inzp[1]:25 [ memoryRemap::$4 ] -Uplifting [memoryRemap] best 1074 combination reg byte a [ memoryRemap::$4 ] -Attempting to uplift remaining variables inzp[1]:27 [ memoryRemap::$5 ] -Uplifting [memoryRemap] best 1068 combination reg byte a [ memoryRemap::$5 ] -Attempting to uplift remaining variables inzp[1]:30 [ memoryRemap::$7 ] -Uplifting [memoryRemap] best 1062 combination reg byte a [ memoryRemap::$7 ] -Attempting to uplift remaining variables inzp[1]:31 [ memoryRemap::$8 ] -Uplifting [memoryRemap] best 1056 combination reg byte a [ memoryRemap::$8 ] -Attempting to uplift remaining variables inzp[1]:32 [ memoryRemap::$9 ] -Uplifting [memoryRemap] best 1050 combination reg byte a [ memoryRemap::$9 ] -Attempting to uplift remaining variables inzp[1]:33 [ memoryRemap::zVal ] -Uplifting [memoryRemap] best 1050 combination zp[1]:33 [ memoryRemap::zVal ] -Attempting to uplift remaining variables inzp[1]:22 [ memoryRemap::$1 ] -Uplifting [memoryRemap] best 1050 combination zp[1]:22 [ memoryRemap::$1 ] -Attempting to uplift remaining variables inzp[1]:29 [ memoryRemap::$6 ] -Uplifting [memoryRemap] best 1050 combination zp[1]:29 [ memoryRemap::$6 ] +Uplifting [memoryRemap] best 1374 combination reg byte a [ memoryRemap::$2 ] reg byte a [ memoryRemap::$3 ] reg byte a [ memoryRemap::$7 ] zp[1]:28 [ memoryRemap::$8 ] zp[1]:29 [ memoryRemap::zVal ] zp[2]:5 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 ] zp[1]:21 [ memoryRemap::$1 ] zp[1]:26 [ memoryRemap::$6 ] zp[2]:8 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#0 ] zp[1]:7 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] zp[1]:25 [ memoryRemap::yVal ] zp[1]:24 [ memoryRemap::xVal ] zp[1]:20 [ memoryRemap::aVal ] +Limited combination testing to 100 combinations of 40000 possible. +Uplifting [memoryRemap256M] best 1356 combination reg byte a [ memoryRemap256M::$6 ] reg byte a [ memoryRemap256M::$7 ] reg byte a [ memoryRemap256M::$10 ] zp[4]:30 [ memoryRemap256M::$0 ] zp[1]:43 [ memoryRemap256M::zVal ] zp[1]:37 [ memoryRemap256M::$5 ] zp[4]:10 [ memoryRemap256M::lowerPageOffset#2 ] zp[1]:41 [ memoryRemap256M::yVal ] zp[1]:40 [ memoryRemap256M::xVal ] zp[1]:14 [ memoryRemap256M::remapBlocks#2 ] zp[1]:36 [ memoryRemap256M::aVal ] zp[1]:35 [ memoryRemap256M::uMb ] zp[1]:34 [ memoryRemap256M::lMb ] +Limited combination testing to 100 combinations of 2000 possible. +Uplifting [main] best 1046 combination reg byte x [ main::i#2 main::i#1 ] reg byte x [ main::i1#2 main::i1#1 ] reg byte a [ main::$7 ] +Uplifting [memoryRemapBlock] best 1032 combination reg byte a [ memoryRemapBlock::block#0 ] reg byte a [ memoryRemapBlock::blockBits#0 ] reg byte x [ memoryRemapBlock::blockPage#2 ] zp[2]:16 [ memoryRemapBlock::pageOffset#0 ] +Uplifting [MOS6526_CIA] best 1032 combination +Uplifting [MOS6569_VICII] best 1032 combination +Uplifting [MOS6581_SID] best 1032 combination +Uplifting [MOS4569_VICIII] best 1032 combination +Uplifting [MEGA65_VICIV] best 1032 combination +Uplifting [F018_DMAGIC] best 1032 combination +Uplifting [DMA_LIST_F018A] best 1032 combination +Uplifting [DMA_LIST_F018B] best 1032 combination +Uplifting [] best 1032 combination +Attempting to uplift remaining variables inzp[1]:28 [ memoryRemap::$8 ] +Uplifting [memoryRemap] best 1026 combination reg byte a [ memoryRemap::$8 ] +Attempting to uplift remaining variables inzp[1]:29 [ memoryRemap::zVal ] +Uplifting [memoryRemap] best 1026 combination zp[1]:29 [ memoryRemap::zVal ] +Attempting to uplift remaining variables inzp[1]:21 [ memoryRemap::$1 ] +Uplifting [memoryRemap] best 1026 combination zp[1]:21 [ memoryRemap::$1 ] +Attempting to uplift remaining variables inzp[1]:26 [ memoryRemap::$6 ] +Uplifting [memoryRemap] best 1026 combination zp[1]:26 [ memoryRemap::$6 ] Attempting to uplift remaining variables inzp[1]:7 [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] -Uplifting [memoryRemap] best 1041 combination reg byte z [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] -Attempting to uplift remaining variables inzp[1]:45 [ memoryRemap256M::$7 ] -Uplifting [memoryRemap256M] best 1035 combination reg byte a [ memoryRemap256M::$7 ] -Attempting to uplift remaining variables inzp[1]:46 [ memoryRemap256M::$8 ] -Uplifting [memoryRemap256M] best 1029 combination reg byte a [ memoryRemap256M::$8 ] -Attempting to uplift remaining variables inzp[1]:49 [ memoryRemap256M::$10 ] -Uplifting [memoryRemap256M] best 1023 combination reg byte a [ memoryRemap256M::$10 ] -Attempting to uplift remaining variables inzp[1]:50 [ memoryRemap256M::$13 ] -Uplifting [memoryRemap256M] best 1017 combination reg byte a [ memoryRemap256M::$13 ] -Attempting to uplift remaining variables inzp[1]:28 [ memoryRemap::yVal ] -Uplifting [memoryRemap] best 1017 combination zp[1]:28 [ memoryRemap::yVal ] -Attempting to uplift remaining variables inzp[1]:26 [ memoryRemap::xVal ] -Uplifting [memoryRemap] best 1017 combination zp[1]:26 [ memoryRemap::xVal ] -Attempting to uplift remaining variables inzp[1]:51 [ memoryRemap256M::zVal ] -Uplifting [memoryRemap256M] best 1017 combination zp[1]:51 [ memoryRemap256M::zVal ] -Attempting to uplift remaining variables inzp[1]:21 [ memoryRemap::aVal ] -Uplifting [memoryRemap] best 1017 combination zp[1]:21 [ memoryRemap::aVal ] -Attempting to uplift remaining variables inzp[1]:43 [ memoryRemap256M::$5 ] -Uplifting [memoryRemap256M] best 1017 combination zp[1]:43 [ memoryRemap256M::$5 ] -Attempting to uplift remaining variables inzp[1]:48 [ memoryRemap256M::yVal ] -Uplifting [memoryRemap256M] best 1017 combination zp[1]:48 [ memoryRemap256M::yVal ] -Attempting to uplift remaining variables inzp[1]:47 [ memoryRemap256M::xVal ] -Uplifting [memoryRemap256M] best 1017 combination zp[1]:47 [ memoryRemap256M::xVal ] +Uplifting [memoryRemap] best 1017 combination reg byte z [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ] +Attempting to uplift remaining variables inzp[1]:25 [ memoryRemap::yVal ] +Uplifting [memoryRemap] best 1017 combination zp[1]:25 [ memoryRemap::yVal ] +Attempting to uplift remaining variables inzp[1]:24 [ memoryRemap::xVal ] +Uplifting [memoryRemap] best 1017 combination zp[1]:24 [ memoryRemap::xVal ] +Attempting to uplift remaining variables inzp[1]:43 [ memoryRemap256M::zVal ] +Uplifting [memoryRemap256M] best 1017 combination zp[1]:43 [ memoryRemap256M::zVal ] +Attempting to uplift remaining variables inzp[1]:20 [ memoryRemap::aVal ] +Uplifting [memoryRemap] best 1017 combination zp[1]:20 [ memoryRemap::aVal ] +Attempting to uplift remaining variables inzp[1]:37 [ memoryRemap256M::$5 ] +Uplifting [memoryRemap256M] best 1017 combination zp[1]:37 [ memoryRemap256M::$5 ] +Attempting to uplift remaining variables inzp[1]:41 [ memoryRemap256M::yVal ] +Uplifting [memoryRemap256M] best 1017 combination zp[1]:41 [ memoryRemap256M::yVal ] +Attempting to uplift remaining variables inzp[1]:40 [ memoryRemap256M::xVal ] +Uplifting [memoryRemap256M] best 1017 combination zp[1]:40 [ memoryRemap256M::xVal ] Attempting to uplift remaining variables inzp[1]:14 [ memoryRemap256M::remapBlocks#2 ] Uplifting [memoryRemap256M] best 1007 combination reg byte z [ memoryRemap256M::remapBlocks#2 ] -Attempting to uplift remaining variables inzp[1]:42 [ memoryRemap256M::aVal ] -Uplifting [memoryRemap256M] best 1007 combination zp[1]:42 [ memoryRemap256M::aVal ] -Attempting to uplift remaining variables inzp[1]:40 [ memoryRemap256M::uMb ] -Uplifting [memoryRemap256M] best 1007 combination zp[1]:40 [ memoryRemap256M::uMb ] -Attempting to uplift remaining variables inzp[1]:39 [ memoryRemap256M::lMb ] -Uplifting [memoryRemap256M] best 1007 combination zp[1]:39 [ memoryRemap256M::lMb ] +Attempting to uplift remaining variables inzp[1]:36 [ memoryRemap256M::aVal ] +Uplifting [memoryRemap256M] best 1007 combination zp[1]:36 [ memoryRemap256M::aVal ] +Attempting to uplift remaining variables inzp[1]:35 [ memoryRemap256M::uMb ] +Uplifting [memoryRemap256M] best 1007 combination zp[1]:35 [ memoryRemap256M::uMb ] +Attempting to uplift remaining variables inzp[1]:34 [ memoryRemap256M::lMb ] +Uplifting [memoryRemap256M] best 1007 combination zp[1]:34 [ memoryRemap256M::lMb ] Coalescing zero page register [ zp[2]:5 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 ] ] with [ zp[2]:16 [ memoryRemapBlock::pageOffset#0 ] ] - score: 1 -Coalescing zero page register [ zp[1]:43 [ memoryRemap256M::$5 ] ] with [ zp[1]:22 [ memoryRemap::$1 ] ] +Coalescing zero page register [ zp[1]:37 [ memoryRemap256M::$5 ] ] with [ zp[1]:21 [ memoryRemap::$1 ] ] Allocated (was zp[2]:5) zp[2]:2 [ memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 ] Allocated (was zp[2]:8) zp[2]:4 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#0 ] Allocated (was zp[4]:10) zp[4]:6 [ memoryRemap256M::lowerPageOffset#2 ] -Allocated (was zp[1]:21) zp[1]:10 [ memoryRemap::aVal ] -Allocated (was zp[1]:26) zp[1]:11 [ memoryRemap::xVal ] -Allocated (was zp[1]:28) zp[1]:12 [ memoryRemap::yVal ] -Allocated (was zp[1]:29) zp[1]:13 [ memoryRemap::$6 ] -Allocated (was zp[1]:33) zp[1]:14 [ memoryRemap::zVal ] -Allocated (was zp[4]:34) zp[4]:15 [ memoryRemap256M::$0 ] -Allocated (was zp[1]:39) zp[1]:19 [ memoryRemap256M::lMb ] -Allocated (was zp[1]:40) zp[1]:20 [ memoryRemap256M::uMb ] -Allocated (was zp[1]:42) zp[1]:21 [ memoryRemap256M::aVal ] -Allocated (was zp[1]:43) zp[1]:22 [ memoryRemap256M::$5 memoryRemap::$1 ] -Allocated (was zp[1]:47) zp[1]:23 [ memoryRemap256M::xVal ] -Allocated (was zp[1]:48) zp[1]:24 [ memoryRemap256M::yVal ] -Allocated (was zp[1]:51) zp[1]:25 [ memoryRemap256M::zVal ] +Allocated (was zp[1]:20) zp[1]:10 [ memoryRemap::aVal ] +Allocated (was zp[1]:24) zp[1]:11 [ memoryRemap::xVal ] +Allocated (was zp[1]:25) zp[1]:12 [ memoryRemap::yVal ] +Allocated (was zp[1]:26) zp[1]:13 [ memoryRemap::$6 ] +Allocated (was zp[1]:29) zp[1]:14 [ memoryRemap::zVal ] +Allocated (was zp[4]:30) zp[4]:15 [ memoryRemap256M::$0 ] +Allocated (was zp[1]:34) zp[1]:19 [ memoryRemap256M::lMb ] +Allocated (was zp[1]:35) zp[1]:20 [ memoryRemap256M::uMb ] +Allocated (was zp[1]:36) zp[1]:21 [ memoryRemap256M::aVal ] +Allocated (was zp[1]:37) zp[1]:22 [ memoryRemap256M::$5 memoryRemap::$1 ] +Allocated (was zp[1]:40) zp[1]:23 [ memoryRemap256M::xVal ] +Allocated (was zp[1]:41) zp[1]:24 [ memoryRemap256M::yVal ] +Allocated (was zp[1]:43) zp[1]:25 [ memoryRemap256M::zVal ] ASSEMBLER BEFORE OPTIMIZATION // File Comments @@ -1266,11 +1097,11 @@ main: { __b3: // [13] call memoryRemap256M // Remap [$4000-$5fff] to point to [$ff80000-$ff81fff] COLORRAM! (notice usage of page offsets) - // [50] phi from main::@3 to memoryRemap256M [phi:main::@3->memoryRemap256M] + // [46] phi from main::@3 to memoryRemap256M [phi:main::@3->memoryRemap256M] memoryRemap256M_from___b3: - // [50] phi memoryRemap256M::remapBlocks#2 = MEMORYBLOCK_4000 [phi:main::@3->memoryRemap256M#0] -- vbuzz=vbuc1 + // [46] phi memoryRemap256M::remapBlocks#2 = MEMORYBLOCK_4000 [phi:main::@3->memoryRemap256M#0] -- vbuzz=vbuc1 ldz #MEMORYBLOCK_4000 - // [50] phi memoryRemap256M::lowerPageOffset#2 = $ff800-$40 [phi:main::@3->memoryRemap256M#1] -- vduz1=vduc1 + // [46] phi memoryRemap256M::lowerPageOffset#2 = $ff800-$40 [phi:main::@3->memoryRemap256M#1] -- vduz1=vduc1 lda #<$ff800-$40 sta.z memoryRemap256M.lowerPageOffset lda #>$ff800-$40 @@ -1298,11 +1129,11 @@ main: { __b6: // [17] call memoryRemap256M // Remap [$4000-$5fff] back to normal memory! - // [50] phi from main::@6 to memoryRemap256M [phi:main::@6->memoryRemap256M] + // [46] phi from main::@6 to memoryRemap256M [phi:main::@6->memoryRemap256M] memoryRemap256M_from___b6: - // [50] phi memoryRemap256M::remapBlocks#2 = 0 [phi:main::@6->memoryRemap256M#0] -- vbuzz=vbuc1 + // [46] phi memoryRemap256M::remapBlocks#2 = 0 [phi:main::@6->memoryRemap256M#0] -- vbuzz=vbuc1 ldz #0 - // [50] phi memoryRemap256M::lowerPageOffset#2 = 0 [phi:main::@6->memoryRemap256M#1] -- vduz1=vbuc1 + // [46] phi memoryRemap256M::lowerPageOffset#2 = 0 [phi:main::@6->memoryRemap256M#1] -- vduz1=vbuc1 lda #0 sta.z memoryRemap256M.lowerPageOffset lda #0 @@ -1351,6 +1182,7 @@ main: { memoryRemapBlock: { .label pageOffset = 2 // [25] memoryRemapBlock::pageOffset#0 = $100 - memoryRemapBlock::blockPage#2 -- vwuz1=vwuc1_minus_vbuxx + // Find the page offset (the number of pages to offset the block) stx.z $ff lda #<$100 sec @@ -1360,6 +1192,7 @@ memoryRemapBlock: { sbc #0 sta.z pageOffset+1 // [26] memoryRemapBlock::block#0 = memoryRemapBlock::blockPage#2 >> 5 -- vbuaa=vbuxx_ror_5 + // Which block is being remapped? (0-7) txa lsr lsr @@ -1432,44 +1265,40 @@ memoryRemap: { .label __6 = $d .label lowerPageOffset = 2 .label upperPageOffset = 4 - // [34] memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#2 -- vbuaa=_byte0_vwuz1 - lda.z lowerPageOffset - // [35] memoryRemap::aVal = memoryRemap::$0 -- vbuz1=vbuaa + // [34] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#2 -- vbuz1=_byte0_vwuz2 // lower blocks offset page low + lda.z lowerPageOffset sta.z aVal - // [36] memoryRemap::$1 = memoryRemap::remapBlocks#2 << 4 -- vbuz1=vbuzz_rol_4 + // [35] memoryRemap::$1 = memoryRemap::remapBlocks#2 << 4 -- vbuz1=vbuzz_rol_4 tza asl asl asl asl sta.z __1 - // [37] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#2 -- vbuaa=_byte1_vwuz1 + // [36] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#2 -- vbuaa=_byte1_vwuz1 lda.z lowerPageOffset+1 - // [38] memoryRemap::$3 = memoryRemap::$2 & $f -- vbuaa=vbuaa_band_vbuc1 + // [37] memoryRemap::$3 = memoryRemap::$2 & $f -- vbuaa=vbuaa_band_vbuc1 and #$f - // [39] memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 -- vbuaa=vbuz1_bor_vbuaa - ora.z __1 - // [40] memoryRemap::xVal = memoryRemap::$4 -- vbuz1=vbuaa + // [38] memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 -- vbuz1=vbuz2_bor_vbuaa // lower blocks to map + lower blocks offset high nibble + ora.z __1 sta.z xVal - // [41] memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#2 -- vbuaa=_byte0_vwuz1 - lda.z upperPageOffset - // [42] memoryRemap::yVal = memoryRemap::$5 -- vbuz1=vbuaa + // [39] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#2 -- vbuz1=_byte0_vwuz2 // upper blocks offset page + lda.z upperPageOffset sta.z yVal - // [43] memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 -- vbuz1=vbuzz_band_vbuc1 + // [40] memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 -- vbuz1=vbuzz_band_vbuc1 tza and #$f0 sta.z __6 - // [44] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#2 -- vbuaa=_byte1_vwuz1 + // [41] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#2 -- vbuaa=_byte1_vwuz1 lda.z upperPageOffset+1 - // [45] memoryRemap::$8 = memoryRemap::$7 & $f -- vbuaa=vbuaa_band_vbuc1 + // [42] memoryRemap::$8 = memoryRemap::$7 & $f -- vbuaa=vbuaa_band_vbuc1 and #$f - // [46] memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 -- vbuaa=vbuz1_bor_vbuaa - ora.z __6 - // [47] memoryRemap::zVal = memoryRemap::$9 -- vbuz1=vbuaa + // [43] memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 -- vbuz1=vbuz2_bor_vbuaa // upper blocks to map + upper blocks offset page high nibble + ora.z __6 sta.z zVal // asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } lda aVal @@ -1481,7 +1310,7 @@ memoryRemap: { jmp __breturn // memoryRemap::@return __breturn: - // [49] return + // [45] return rts } // memoryRemap256M @@ -1521,7 +1350,7 @@ memoryRemap256M: { .label yVal = $18 .label zVal = $19 .label lowerPageOffset = 6 - // [51] memoryRemap256M::$0 = memoryRemap256M::lowerPageOffset#2 >> 4 -- vduz1=vduz2_ror_4 + // [47] memoryRemap256M::$0 = memoryRemap256M::lowerPageOffset#2 >> 4 -- vduz1=vduz2_ror_4 lda.z lowerPageOffset+3 lsr sta.z __0+3 @@ -1546,45 +1375,41 @@ memoryRemap256M: { ror.z __0+2 ror.z __0+1 ror.z __0 - // [52] memoryRemap256M::$1 = byte1 (word)memoryRemap256M::$0 -- vbuaa=_byte1__word_vduz1 - lda.z __0+1 - // [53] memoryRemap256M::lMb = memoryRemap256M::$1 -- vbuz1=vbuaa + // [48] memoryRemap256M::lMb = byte1 (word)memoryRemap256M::$0 -- vbuz1=_byte1__word_vduz2 // lower blocks offset megabytes + lda.z __0+1 sta.z lMb - // [54] memoryRemap256M::uMb = 0 -- vbuz1=vbuc1 + // [49] memoryRemap256M::uMb = 0 -- vbuz1=vbuc1 // upper blocks offset megabytes lda #0 sta.z uMb - // [55] memoryRemap256M::$4 = byte0 memoryRemap256M::lowerPageOffset#2 -- vbuaa=_byte0_vduz1 - lda.z lowerPageOffset - // [56] memoryRemap256M::aVal = memoryRemap256M::$4 -- vbuz1=vbuaa + // [50] memoryRemap256M::aVal = byte0 memoryRemap256M::lowerPageOffset#2 -- vbuz1=_byte0_vduz2 // lower blocks offset page low + lda.z lowerPageOffset sta.z aVal - // [57] memoryRemap256M::$5 = memoryRemap256M::remapBlocks#2 << 4 -- vbuz1=vbuzz_rol_4 + // [51] memoryRemap256M::$5 = memoryRemap256M::remapBlocks#2 << 4 -- vbuz1=vbuzz_rol_4 tza asl asl asl asl sta.z __5 - // [58] memoryRemap256M::$6 = byte1 memoryRemap256M::lowerPageOffset#2 -- vbuaa=_byte1_vduz1 + // [52] memoryRemap256M::$6 = byte1 memoryRemap256M::lowerPageOffset#2 -- vbuaa=_byte1_vduz1 lda.z lowerPageOffset+1 - // [59] memoryRemap256M::$7 = memoryRemap256M::$6 & $f -- vbuaa=vbuaa_band_vbuc1 + // [53] memoryRemap256M::$7 = memoryRemap256M::$6 & $f -- vbuaa=vbuaa_band_vbuc1 and #$f - // [60] memoryRemap256M::$8 = memoryRemap256M::$5 | memoryRemap256M::$7 -- vbuaa=vbuz1_bor_vbuaa - ora.z __5 - // [61] memoryRemap256M::xVal = memoryRemap256M::$8 -- vbuz1=vbuaa + // [54] memoryRemap256M::xVal = memoryRemap256M::$5 | memoryRemap256M::$7 -- vbuz1=vbuz2_bor_vbuaa // lower blocks to map + lower blocks offset high nibble + ora.z __5 sta.z xVal - // [62] memoryRemap256M::yVal = 0 -- vbuz1=vbuc1 + // [55] memoryRemap256M::yVal = 0 -- vbuz1=vbuc1 // upper blocks offset page lda #0 sta.z yVal - // [63] memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 -- vbuaa=vbuzz_band_vbuc1 + // [56] memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 -- vbuaa=vbuzz_band_vbuc1 tza and #$f0 - // [64] memoryRemap256M::$13 = memoryRemap256M::$10 - // [65] memoryRemap256M::zVal = memoryRemap256M::$13 -- vbuz1=vbuaa + // [57] memoryRemap256M::zVal = memoryRemap256M::$10 -- vbuz1=vbuaa // upper blocks to map + upper blocks offset page high nibble sta.z zVal // asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } @@ -1602,7 +1427,7 @@ memoryRemap256M: { jmp __breturn // memoryRemap256M::@return __breturn: - // [67] return + // [59] return rts } // File Data @@ -1661,49 +1486,41 @@ byte main::i1 byte main::i1#1 reg byte x 22.0 byte main::i1#2 reg byte x 13.75 void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset) -byte~ memoryRemap::$0 reg byte a 202.0 byte~ memoryRemap::$1 zp[1]:22 67.33333333333333 byte~ memoryRemap::$2 reg byte a 202.0 byte~ memoryRemap::$3 reg byte a 202.0 -byte~ memoryRemap::$4 reg byte a 202.0 -byte~ memoryRemap::$5 reg byte a 202.0 byte~ memoryRemap::$6 zp[1]:13 67.33333333333333 byte~ memoryRemap::$7 reg byte a 202.0 byte~ memoryRemap::$8 reg byte a 202.0 -byte~ memoryRemap::$9 reg byte a 202.0 -volatile byte memoryRemap::aVal loadstore zp[1]:10 7.769230769230769 +volatile byte memoryRemap::aVal loadstore zp[1]:10 10.1 word memoryRemap::lowerPageOffset word memoryRemap::lowerPageOffset#0 lowerPageOffset zp[2]:2 11.0 -word memoryRemap::lowerPageOffset#2 lowerPageOffset zp[2]:2 53.25 +word memoryRemap::lowerPageOffset#2 lowerPageOffset zp[2]:2 71.0 byte memoryRemap::remapBlocks byte memoryRemap::remapBlocks#0 reg byte z 7.333333333333333 -byte memoryRemap::remapBlocks#2 reg byte z 21.299999999999997 +byte memoryRemap::remapBlocks#2 reg byte z 30.42857142857143 word memoryRemap::upperPageOffset word memoryRemap::upperPageOffset#0 upperPageOffset zp[2]:4 22.0 -word memoryRemap::upperPageOffset#2 upperPageOffset zp[2]:4 19.363636363636363 -volatile byte memoryRemap::xVal loadstore zp[1]:11 12.625 -volatile byte memoryRemap::yVal loadstore zp[1]:12 16.833333333333332 +word memoryRemap::upperPageOffset#2 upperPageOffset zp[2]:4 26.625 +volatile byte memoryRemap::xVal loadstore zp[1]:11 16.833333333333332 +volatile byte memoryRemap::yVal loadstore zp[1]:12 20.2 volatile byte memoryRemap::zVal loadstore zp[1]:14 101.0 void memoryRemap256M(byte memoryRemap256M::remapBlocks , dword memoryRemap256M::lowerPageOffset , dword memoryRemap256M::upperPageOffset) dword~ memoryRemap256M::$0 zp[4]:15 11.0 -byte~ memoryRemap256M::$1 reg byte a 22.0 byte~ memoryRemap256M::$10 reg byte a 22.0 -byte~ memoryRemap256M::$13 reg byte a 22.0 -byte~ memoryRemap256M::$4 reg byte a 22.0 byte~ memoryRemap256M::$5 zp[1]:22 7.333333333333333 byte~ memoryRemap256M::$6 reg byte a 22.0 byte~ memoryRemap256M::$7 reg byte a 22.0 -byte~ memoryRemap256M::$8 reg byte a 22.0 -volatile byte memoryRemap256M::aVal loadstore zp[1]:21 1.1 -volatile byte memoryRemap256M::lMb loadstore zp[1]:19 0.8461538461538461 +volatile byte memoryRemap256M::aVal loadstore zp[1]:21 1.375 +volatile byte memoryRemap256M::lMb loadstore zp[1]:19 1.1 dword memoryRemap256M::lowerPageOffset -dword memoryRemap256M::lowerPageOffset#2 lowerPageOffset zp[4]:6 4.125 +dword memoryRemap256M::lowerPageOffset#2 lowerPageOffset zp[4]:6 5.5 byte memoryRemap256M::remapBlocks -byte memoryRemap256M::remapBlocks#2 reg byte z 1.6923076923076923 -volatile byte memoryRemap256M::uMb loadstore zp[1]:20 0.9166666666666666 +byte memoryRemap256M::remapBlocks#2 reg byte z 2.2 +volatile byte memoryRemap256M::uMb loadstore zp[1]:20 1.2222222222222223 dword memoryRemap256M::upperPageOffset -volatile byte memoryRemap256M::xVal loadstore zp[1]:23 2.2 -volatile byte memoryRemap256M::yVal loadstore zp[1]:24 2.75 +volatile byte memoryRemap256M::xVal loadstore zp[1]:23 2.75 +volatile byte memoryRemap256M::yVal loadstore zp[1]:24 3.6666666666666665 volatile byte memoryRemap256M::zVal loadstore zp[1]:25 11.0 void memoryRemapBlock(byte memoryRemapBlock::blockPage , word memoryRemapBlock::memoryPage) byte memoryRemapBlock::block @@ -1727,33 +1544,25 @@ reg byte z [ memoryRemap256M::remapBlocks#2 ] reg byte a [ main::$7 ] reg byte a [ memoryRemapBlock::block#0 ] reg byte a [ memoryRemapBlock::blockBits#0 ] -reg byte a [ memoryRemap::$0 ] zp[1]:10 [ memoryRemap::aVal ] reg byte a [ memoryRemap::$2 ] reg byte a [ memoryRemap::$3 ] -reg byte a [ memoryRemap::$4 ] zp[1]:11 [ memoryRemap::xVal ] -reg byte a [ memoryRemap::$5 ] zp[1]:12 [ memoryRemap::yVal ] zp[1]:13 [ memoryRemap::$6 ] reg byte a [ memoryRemap::$7 ] reg byte a [ memoryRemap::$8 ] -reg byte a [ memoryRemap::$9 ] zp[1]:14 [ memoryRemap::zVal ] zp[4]:15 [ memoryRemap256M::$0 ] -reg byte a [ memoryRemap256M::$1 ] zp[1]:19 [ memoryRemap256M::lMb ] zp[1]:20 [ memoryRemap256M::uMb ] -reg byte a [ memoryRemap256M::$4 ] zp[1]:21 [ memoryRemap256M::aVal ] zp[1]:22 [ memoryRemap256M::$5 memoryRemap::$1 ] reg byte a [ memoryRemap256M::$6 ] reg byte a [ memoryRemap256M::$7 ] -reg byte a [ memoryRemap256M::$8 ] zp[1]:23 [ memoryRemap256M::xVal ] zp[1]:24 [ memoryRemap256M::yVal ] reg byte a [ memoryRemap256M::$10 ] -reg byte a [ memoryRemap256M::$13 ] zp[1]:25 [ memoryRemap256M::zVal ] @@ -1871,10 +1680,10 @@ main: { // memoryRemap256M(MEMORYBLOCK_4000, 0xff800-0x00040, 0) // [13] call memoryRemap256M // Remap [$4000-$5fff] to point to [$ff80000-$ff81fff] COLORRAM! (notice usage of page offsets) - // [50] phi from main::@3 to memoryRemap256M [phi:main::@3->memoryRemap256M] - // [50] phi memoryRemap256M::remapBlocks#2 = MEMORYBLOCK_4000 [phi:main::@3->memoryRemap256M#0] -- vbuzz=vbuc1 + // [46] phi from main::@3 to memoryRemap256M [phi:main::@3->memoryRemap256M] + // [46] phi memoryRemap256M::remapBlocks#2 = MEMORYBLOCK_4000 [phi:main::@3->memoryRemap256M#0] -- vbuzz=vbuc1 ldz #MEMORYBLOCK_4000 - // [50] phi memoryRemap256M::lowerPageOffset#2 = $ff800-$40 [phi:main::@3->memoryRemap256M#1] -- vduz1=vduc1 + // [46] phi memoryRemap256M::lowerPageOffset#2 = $ff800-$40 [phi:main::@3->memoryRemap256M#1] -- vduz1=vduc1 lda #<$ff800-$40 sta.z memoryRemap256M.lowerPageOffset lda #>$ff800-$40 @@ -1899,10 +1708,10 @@ main: { // memoryRemap256M(0, 0, 0) // [17] call memoryRemap256M // Remap [$4000-$5fff] back to normal memory! - // [50] phi from main::@6 to memoryRemap256M [phi:main::@6->memoryRemap256M] - // [50] phi memoryRemap256M::remapBlocks#2 = 0 [phi:main::@6->memoryRemap256M#0] -- vbuzz=vbuc1 + // [46] phi from main::@6 to memoryRemap256M [phi:main::@6->memoryRemap256M] + // [46] phi memoryRemap256M::remapBlocks#2 = 0 [phi:main::@6->memoryRemap256M#0] -- vbuzz=vbuc1 ldz #0 - // [50] phi memoryRemap256M::lowerPageOffset#2 = 0 [phi:main::@6->memoryRemap256M#1] -- vduz1=vbuc1 + // [46] phi memoryRemap256M::lowerPageOffset#2 = 0 [phi:main::@6->memoryRemap256M#1] -- vduz1=vbuc1 lda #0 sta.z memoryRemap256M.lowerPageOffset sta.z memoryRemap256M.lowerPageOffset+1 @@ -1953,6 +1762,7 @@ memoryRemapBlock: { .label pageOffset = 2 // unsigned int pageOffset = memoryPage-blockPage // [25] memoryRemapBlock::pageOffset#0 = $100 - memoryRemapBlock::blockPage#2 -- vwuz1=vwuc1_minus_vbuxx + // Find the page offset (the number of pages to offset the block) stx.z $ff lda #<$100 sec @@ -1963,6 +1773,7 @@ memoryRemapBlock: { sta.z pageOffset+1 // char block = blockPage / $20 // [26] memoryRemapBlock::block#0 = memoryRemapBlock::blockPage#2 >> 5 -- vbuaa=vbuxx_ror_5 + // Which block is being remapped? (0-7) txa lsr lsr @@ -2035,15 +1846,13 @@ memoryRemap: { .label __6 = $d .label lowerPageOffset = 2 .label upperPageOffset = 4 - // BYTE0(lowerPageOffset) - // [34] memoryRemap::$0 = byte0 memoryRemap::lowerPageOffset#2 -- vbuaa=_byte0_vwuz1 - lda.z lowerPageOffset // char aVal = BYTE0(lowerPageOffset) - // [35] memoryRemap::aVal = memoryRemap::$0 -- vbuz1=vbuaa + // [34] memoryRemap::aVal = byte0 memoryRemap::lowerPageOffset#2 -- vbuz1=_byte0_vwuz2 // lower blocks offset page low + lda.z lowerPageOffset sta.z aVal // remapBlocks << 4 - // [36] memoryRemap::$1 = memoryRemap::remapBlocks#2 << 4 -- vbuz1=vbuzz_rol_4 + // [35] memoryRemap::$1 = memoryRemap::remapBlocks#2 << 4 -- vbuz1=vbuzz_rol_4 tza asl asl @@ -2051,42 +1860,36 @@ memoryRemap: { asl sta.z __1 // BYTE1(lowerPageOffset) - // [37] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#2 -- vbuaa=_byte1_vwuz1 + // [36] memoryRemap::$2 = byte1 memoryRemap::lowerPageOffset#2 -- vbuaa=_byte1_vwuz1 lda.z lowerPageOffset+1 // BYTE1(lowerPageOffset) & 0xf - // [38] memoryRemap::$3 = memoryRemap::$2 & $f -- vbuaa=vbuaa_band_vbuc1 + // [37] memoryRemap::$3 = memoryRemap::$2 & $f -- vbuaa=vbuaa_band_vbuc1 and #$f - // (remapBlocks << 4) | (BYTE1(lowerPageOffset) & 0xf) - // [39] memoryRemap::$4 = memoryRemap::$1 | memoryRemap::$3 -- vbuaa=vbuz1_bor_vbuaa - ora.z __1 // char xVal = (remapBlocks << 4) | (BYTE1(lowerPageOffset) & 0xf) - // [40] memoryRemap::xVal = memoryRemap::$4 -- vbuz1=vbuaa + // [38] memoryRemap::xVal = memoryRemap::$1 | memoryRemap::$3 -- vbuz1=vbuz2_bor_vbuaa // lower blocks to map + lower blocks offset high nibble + ora.z __1 sta.z xVal - // BYTE0(upperPageOffset) - // [41] memoryRemap::$5 = byte0 memoryRemap::upperPageOffset#2 -- vbuaa=_byte0_vwuz1 - lda.z upperPageOffset // char yVal = BYTE0(upperPageOffset) - // [42] memoryRemap::yVal = memoryRemap::$5 -- vbuz1=vbuaa + // [39] memoryRemap::yVal = byte0 memoryRemap::upperPageOffset#2 -- vbuz1=_byte0_vwuz2 // upper blocks offset page + lda.z upperPageOffset sta.z yVal // remapBlocks & 0xf0 - // [43] memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 -- vbuz1=vbuzz_band_vbuc1 + // [40] memoryRemap::$6 = memoryRemap::remapBlocks#2 & $f0 -- vbuz1=vbuzz_band_vbuc1 tza and #$f0 sta.z __6 // BYTE1(upperPageOffset) - // [44] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#2 -- vbuaa=_byte1_vwuz1 + // [41] memoryRemap::$7 = byte1 memoryRemap::upperPageOffset#2 -- vbuaa=_byte1_vwuz1 lda.z upperPageOffset+1 // BYTE1(upperPageOffset) & 0xf - // [45] memoryRemap::$8 = memoryRemap::$7 & $f -- vbuaa=vbuaa_band_vbuc1 + // [42] memoryRemap::$8 = memoryRemap::$7 & $f -- vbuaa=vbuaa_band_vbuc1 and #$f - // (remapBlocks & 0xf0) | (BYTE1(upperPageOffset) & 0xf) - // [46] memoryRemap::$9 = memoryRemap::$6 | memoryRemap::$8 -- vbuaa=vbuz1_bor_vbuaa - ora.z __6 // char zVal = (remapBlocks & 0xf0) | (BYTE1(upperPageOffset) & 0xf) - // [47] memoryRemap::zVal = memoryRemap::$9 -- vbuz1=vbuaa + // [43] memoryRemap::zVal = memoryRemap::$6 | memoryRemap::$8 -- vbuz1=vbuz2_bor_vbuaa // upper blocks to map + upper blocks offset page high nibble + ora.z __6 sta.z zVal // asm // asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom } @@ -2098,7 +1901,7 @@ memoryRemap: { eom // memoryRemap::@return // } - // [49] return + // [45] return rts } // memoryRemap256M @@ -2139,7 +1942,7 @@ memoryRemap256M: { .label zVal = $19 .label lowerPageOffset = 6 // lowerPageOffset>>4 - // [51] memoryRemap256M::$0 = memoryRemap256M::lowerPageOffset#2 >> 4 -- vduz1=vduz2_ror_4 + // [47] memoryRemap256M::$0 = memoryRemap256M::lowerPageOffset#2 >> 4 -- vduz1=vduz2_ror_4 lda.z lowerPageOffset+3 lsr sta.z __0+3 @@ -2164,27 +1967,23 @@ memoryRemap256M: { ror.z __0+2 ror.z __0+1 ror.z __0 - // BYTE1((unsigned int)(lowerPageOffset>>4)) - // [52] memoryRemap256M::$1 = byte1 (word)memoryRemap256M::$0 -- vbuaa=_byte1__word_vduz1 - lda.z __0+1 // char lMb = BYTE1((unsigned int)(lowerPageOffset>>4)) - // [53] memoryRemap256M::lMb = memoryRemap256M::$1 -- vbuz1=vbuaa + // [48] memoryRemap256M::lMb = byte1 (word)memoryRemap256M::$0 -- vbuz1=_byte1__word_vduz2 // lower blocks offset megabytes + lda.z __0+1 sta.z lMb // char uMb = BYTE1((unsigned int)(upperPageOffset>>4)) - // [54] memoryRemap256M::uMb = 0 -- vbuz1=vbuc1 + // [49] memoryRemap256M::uMb = 0 -- vbuz1=vbuc1 // upper blocks offset megabytes lda #0 sta.z uMb - // BYTE0(lowerPageOffset) - // [55] memoryRemap256M::$4 = byte0 memoryRemap256M::lowerPageOffset#2 -- vbuaa=_byte0_vduz1 - lda.z lowerPageOffset // char aVal = BYTE0(lowerPageOffset) - // [56] memoryRemap256M::aVal = memoryRemap256M::$4 -- vbuz1=vbuaa + // [50] memoryRemap256M::aVal = byte0 memoryRemap256M::lowerPageOffset#2 -- vbuz1=_byte0_vduz2 // lower blocks offset page low + lda.z lowerPageOffset sta.z aVal // remapBlocks << 4 - // [57] memoryRemap256M::$5 = memoryRemap256M::remapBlocks#2 << 4 -- vbuz1=vbuzz_rol_4 + // [51] memoryRemap256M::$5 = memoryRemap256M::remapBlocks#2 << 4 -- vbuz1=vbuzz_rol_4 tza asl asl @@ -2192,31 +1991,27 @@ memoryRemap256M: { asl sta.z __5 // BYTE1(lowerPageOffset) - // [58] memoryRemap256M::$6 = byte1 memoryRemap256M::lowerPageOffset#2 -- vbuaa=_byte1_vduz1 + // [52] memoryRemap256M::$6 = byte1 memoryRemap256M::lowerPageOffset#2 -- vbuaa=_byte1_vduz1 lda.z lowerPageOffset+1 // BYTE1(lowerPageOffset) & 0xf - // [59] memoryRemap256M::$7 = memoryRemap256M::$6 & $f -- vbuaa=vbuaa_band_vbuc1 + // [53] memoryRemap256M::$7 = memoryRemap256M::$6 & $f -- vbuaa=vbuaa_band_vbuc1 and #$f - // (remapBlocks << 4) | (BYTE1(lowerPageOffset) & 0xf) - // [60] memoryRemap256M::$8 = memoryRemap256M::$5 | memoryRemap256M::$7 -- vbuaa=vbuz1_bor_vbuaa - ora.z __5 // char xVal = (remapBlocks << 4) | (BYTE1(lowerPageOffset) & 0xf) - // [61] memoryRemap256M::xVal = memoryRemap256M::$8 -- vbuz1=vbuaa + // [54] memoryRemap256M::xVal = memoryRemap256M::$5 | memoryRemap256M::$7 -- vbuz1=vbuz2_bor_vbuaa // lower blocks to map + lower blocks offset high nibble + ora.z __5 sta.z xVal // char yVal = BYTE0(upperPageOffset) - // [62] memoryRemap256M::yVal = 0 -- vbuz1=vbuc1 + // [55] memoryRemap256M::yVal = 0 -- vbuz1=vbuc1 // upper blocks offset page lda #0 sta.z yVal // remapBlocks & 0xf0 - // [63] memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 -- vbuaa=vbuzz_band_vbuc1 + // [56] memoryRemap256M::$10 = memoryRemap256M::remapBlocks#2 & $f0 -- vbuaa=vbuzz_band_vbuc1 tza and #$f0 - // (remapBlocks & 0xf0) | (BYTE1(upperPageOffset) & 0xf) - // [64] memoryRemap256M::$13 = memoryRemap256M::$10 // char zVal = (remapBlocks & 0xf0) | (BYTE1(upperPageOffset) & 0xf) - // [65] memoryRemap256M::zVal = memoryRemap256M::$13 -- vbuz1=vbuaa + // [57] memoryRemap256M::zVal = memoryRemap256M::$10 -- vbuz1=vbuaa // upper blocks to map + upper blocks offset page high nibble sta.z zVal // asm @@ -2234,7 +2029,7 @@ memoryRemap256M: { eom // memoryRemap256M::@return // } - // [67] return + // [59] return rts } // File Data diff --git a/src/test/ref/examples/mega65/memorymap-test.sym b/src/test/ref/examples/mega65/memorymap-test.sym index f269e3a59..6efe69f1e 100644 --- a/src/test/ref/examples/mega65/memorymap-test.sym +++ b/src/test/ref/examples/mega65/memorymap-test.sym @@ -12,49 +12,41 @@ byte main::i1 byte main::i1#1 reg byte x 22.0 byte main::i1#2 reg byte x 13.75 void memoryRemap(byte memoryRemap::remapBlocks , word memoryRemap::lowerPageOffset , word memoryRemap::upperPageOffset) -byte~ memoryRemap::$0 reg byte a 202.0 byte~ memoryRemap::$1 zp[1]:22 67.33333333333333 byte~ memoryRemap::$2 reg byte a 202.0 byte~ memoryRemap::$3 reg byte a 202.0 -byte~ memoryRemap::$4 reg byte a 202.0 -byte~ memoryRemap::$5 reg byte a 202.0 byte~ memoryRemap::$6 zp[1]:13 67.33333333333333 byte~ memoryRemap::$7 reg byte a 202.0 byte~ memoryRemap::$8 reg byte a 202.0 -byte~ memoryRemap::$9 reg byte a 202.0 -volatile byte memoryRemap::aVal loadstore zp[1]:10 7.769230769230769 +volatile byte memoryRemap::aVal loadstore zp[1]:10 10.1 word memoryRemap::lowerPageOffset word memoryRemap::lowerPageOffset#0 lowerPageOffset zp[2]:2 11.0 -word memoryRemap::lowerPageOffset#2 lowerPageOffset zp[2]:2 53.25 +word memoryRemap::lowerPageOffset#2 lowerPageOffset zp[2]:2 71.0 byte memoryRemap::remapBlocks byte memoryRemap::remapBlocks#0 reg byte z 7.333333333333333 -byte memoryRemap::remapBlocks#2 reg byte z 21.299999999999997 +byte memoryRemap::remapBlocks#2 reg byte z 30.42857142857143 word memoryRemap::upperPageOffset word memoryRemap::upperPageOffset#0 upperPageOffset zp[2]:4 22.0 -word memoryRemap::upperPageOffset#2 upperPageOffset zp[2]:4 19.363636363636363 -volatile byte memoryRemap::xVal loadstore zp[1]:11 12.625 -volatile byte memoryRemap::yVal loadstore zp[1]:12 16.833333333333332 +word memoryRemap::upperPageOffset#2 upperPageOffset zp[2]:4 26.625 +volatile byte memoryRemap::xVal loadstore zp[1]:11 16.833333333333332 +volatile byte memoryRemap::yVal loadstore zp[1]:12 20.2 volatile byte memoryRemap::zVal loadstore zp[1]:14 101.0 void memoryRemap256M(byte memoryRemap256M::remapBlocks , dword memoryRemap256M::lowerPageOffset , dword memoryRemap256M::upperPageOffset) dword~ memoryRemap256M::$0 zp[4]:15 11.0 -byte~ memoryRemap256M::$1 reg byte a 22.0 byte~ memoryRemap256M::$10 reg byte a 22.0 -byte~ memoryRemap256M::$13 reg byte a 22.0 -byte~ memoryRemap256M::$4 reg byte a 22.0 byte~ memoryRemap256M::$5 zp[1]:22 7.333333333333333 byte~ memoryRemap256M::$6 reg byte a 22.0 byte~ memoryRemap256M::$7 reg byte a 22.0 -byte~ memoryRemap256M::$8 reg byte a 22.0 -volatile byte memoryRemap256M::aVal loadstore zp[1]:21 1.1 -volatile byte memoryRemap256M::lMb loadstore zp[1]:19 0.8461538461538461 +volatile byte memoryRemap256M::aVal loadstore zp[1]:21 1.375 +volatile byte memoryRemap256M::lMb loadstore zp[1]:19 1.1 dword memoryRemap256M::lowerPageOffset -dword memoryRemap256M::lowerPageOffset#2 lowerPageOffset zp[4]:6 4.125 +dword memoryRemap256M::lowerPageOffset#2 lowerPageOffset zp[4]:6 5.5 byte memoryRemap256M::remapBlocks -byte memoryRemap256M::remapBlocks#2 reg byte z 1.6923076923076923 -volatile byte memoryRemap256M::uMb loadstore zp[1]:20 0.9166666666666666 +byte memoryRemap256M::remapBlocks#2 reg byte z 2.2 +volatile byte memoryRemap256M::uMb loadstore zp[1]:20 1.2222222222222223 dword memoryRemap256M::upperPageOffset -volatile byte memoryRemap256M::xVal loadstore zp[1]:23 2.2 -volatile byte memoryRemap256M::yVal loadstore zp[1]:24 2.75 +volatile byte memoryRemap256M::xVal loadstore zp[1]:23 2.75 +volatile byte memoryRemap256M::yVal loadstore zp[1]:24 3.6666666666666665 volatile byte memoryRemap256M::zVal loadstore zp[1]:25 11.0 void memoryRemapBlock(byte memoryRemapBlock::blockPage , word memoryRemapBlock::memoryPage) byte memoryRemapBlock::block @@ -78,31 +70,23 @@ reg byte z [ memoryRemap256M::remapBlocks#2 ] reg byte a [ main::$7 ] reg byte a [ memoryRemapBlock::block#0 ] reg byte a [ memoryRemapBlock::blockBits#0 ] -reg byte a [ memoryRemap::$0 ] zp[1]:10 [ memoryRemap::aVal ] reg byte a [ memoryRemap::$2 ] reg byte a [ memoryRemap::$3 ] -reg byte a [ memoryRemap::$4 ] zp[1]:11 [ memoryRemap::xVal ] -reg byte a [ memoryRemap::$5 ] zp[1]:12 [ memoryRemap::yVal ] zp[1]:13 [ memoryRemap::$6 ] reg byte a [ memoryRemap::$7 ] reg byte a [ memoryRemap::$8 ] -reg byte a [ memoryRemap::$9 ] zp[1]:14 [ memoryRemap::zVal ] zp[4]:15 [ memoryRemap256M::$0 ] -reg byte a [ memoryRemap256M::$1 ] zp[1]:19 [ memoryRemap256M::lMb ] zp[1]:20 [ memoryRemap256M::uMb ] -reg byte a [ memoryRemap256M::$4 ] zp[1]:21 [ memoryRemap256M::aVal ] zp[1]:22 [ memoryRemap256M::$5 memoryRemap::$1 ] reg byte a [ memoryRemap256M::$6 ] reg byte a [ memoryRemap256M::$7 ] -reg byte a [ memoryRemap256M::$8 ] zp[1]:23 [ memoryRemap256M::xVal ] zp[1]:24 [ memoryRemap256M::yVal ] reg byte a [ memoryRemap256M::$10 ] -reg byte a [ memoryRemap256M::$13 ] zp[1]:25 [ memoryRemap256M::zVal ] diff --git a/src/test/ref/examples/mega65/raster65.asm b/src/test/ref/examples/mega65/raster65.asm index fbcd75691..324aec5e6 100644 --- a/src/test/ref/examples/mega65/raster65.asm +++ b/src/test/ref/examples/mega65/raster65.asm @@ -193,6 +193,7 @@ irq: { cpx #$13 bcc __b29 // char greet_offset = greet_idx*16 + // Set up greetings lda.z greet_idx asl asl @@ -333,6 +334,7 @@ irq: { jmp __b18 __b17: // char col = SINE[sin_col]/4 + // Greeting colors lda SINE,y lsr lsr diff --git a/src/test/ref/examples/mega65/raster65.log b/src/test/ref/examples/mega65/raster65.log index 1f8c5a579..c9ceb0a49 100644 --- a/src/test/ref/examples/mega65/raster65.log +++ b/src/test/ref/examples/mega65/raster65.log @@ -24,6 +24,10 @@ Setting inferred volatile on symbol affected by address-of: memoryRemap256M::yVa Setting inferred volatile on symbol affected by address-of: memoryRemap256M::zVal in asm { ldalMb ldx#$0f ldyuMb ldz#$0f map ldaaVal ldxxVal ldyyVal ldzzVal map eom } Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call __init +Eliminating unused variable with no statement memset::$2 +Eliminating unused variable with no statement irq::$1 +Eliminating unused variable with no statement irq::$17 +Eliminating unused variable with no statement irq::$20 CONTROL FLOW GRAPH SSA @@ -45,8 +49,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -259,8 +262,7 @@ irq::@16: scope:[irq] from irq::@17 irq::@3 irq::@17: scope:[irq] from irq::@16 irq::i#3 = phi( irq::@16/irq::i#2 ) irq::sin_col#2 = phi( irq::@16/irq::sin_col#3 ) - irq::$17 = SINE[irq::sin_col#2] / 4 - irq::col1#0 = irq::$17 + irq::col1#0 = SINE[irq::sin_col#2] / 4 (COLORRAM+GREET_ROW*$28)[irq::i#3] = irq::col1#0 irq::col1#1 = irq::col1#0 / 2 (COLORRAM+LOGO_ROW*$28+0*$28-1)[irq::i#3] = irq::col1#1 @@ -300,8 +302,7 @@ irq::@23: scope:[irq] from irq::@22 irq::barcnt#3 = phi( irq::@22/irq::barcnt#2 ) irq::sin_bar#2 = phi( irq::@22/irq::sin_bar#4 ) irq::idx#0 = SINE[irq::sin_bar#2] - irq::$20 = irq::barcnt#3 * $10 - irq::barcol#0 = irq::$20 + irq::barcol#0 = irq::barcnt#3 * $10 irq::i1#0 = 0 to:irq::@25 irq::@24: scope:[irq] from irq::@22 @@ -375,8 +376,7 @@ irq::@32: scope:[irq] from irq::@31 irq::i3#1 = ++ irq::i3#3 to:irq::@31 irq::@33: scope:[irq] from irq::@31 - irq::$1 = greet_idx * $10 - irq::greet_offset#0 = irq::$1 + irq::greet_offset#0 = greet_idx * $10 irq::i4#0 = 0 to:irq::@34 irq::@34: scope:[irq] from irq::@33 irq::@35 @@ -507,7 +507,6 @@ void __start() volatile byte greet_idx loadstore volatile byte greet_zoomx loadstore __interrupt(hardware_clobber) void irq() -number~ irq::$1 number~ irq::$10 bool~ irq::$11 bool~ irq::$12 @@ -515,11 +514,9 @@ bool~ irq::$13 bool~ irq::$14 bool~ irq::$15 bool~ irq::$16 -number~ irq::$17 bool~ irq::$18 bool~ irq::$19 bool~ irq::$2 -number~ irq::$20 bool~ irq::$21 bool~ irq::$22 bool~ irq::$23 @@ -695,7 +692,6 @@ byte main::i2#3 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -763,8 +759,7 @@ Adding number conversion cast (unumber) irq::$10 in irq::$10 = irq::zoomval#0 + Adding number conversion cast (unumber) 0 in irq::$11 = greet_zoomx == 0 Adding number conversion cast (unumber) 0 in greet_idx = 0 Adding number conversion cast (unumber) $28 in irq::$16 = irq::i#2 < $28 -Adding number conversion cast (unumber) 4 in irq::$17 = SINE[irq::sin_col#2] / 4 -Adding number conversion cast (unumber) irq::$17 in irq::$17 = SINE[irq::sin_col#2] / (unumber)4 +Adding number conversion cast (unumber) 4 in irq::col1#0 = SINE[irq::sin_col#2] / 4 Adding number conversion cast (unumber) GREET_ROW*$28 in (COLORRAM+GREET_ROW*$28)[irq::i#3] = irq::col1#0 Adding number conversion cast (unumber) $28 in (COLORRAM+(unumber)GREET_ROW*$28)[irq::i#3] = irq::col1#0 Adding number conversion cast (unumber) 2 in irq::col1#1 = irq::col1#0 / 2 @@ -796,8 +791,7 @@ Adding number conversion cast (unumber) SCROLL_ROW*$28 in (COLORRAM+SCROLL_ROW*$ Adding number conversion cast (unumber) $28 in (COLORRAM+(unumber)SCROLL_ROW*$28)[irq::i#3] = PAL_GREEN[irq::sin_col#2] Adding number conversion cast (unumber) 0 in rasters[irq::l#3] = 0 Adding number conversion cast (unumber) $10 in irq::$19 = irq::barcnt#2 < $10 -Adding number conversion cast (unumber) $10 in irq::$20 = irq::barcnt#3 * $10 -Adding number conversion cast (unumber) irq::$20 in irq::$20 = irq::barcnt#3 * (unumber)$10 +Adding number conversion cast (unumber) $10 in irq::barcol#0 = irq::barcnt#3 * $10 Adding number conversion cast (unumber) $10 in irq::$21 = irq::i1#2 < $10 Adding number conversion cast (unumber) $f in irq::$22 = irq::i2#2 < $f Adding number conversion cast (unumber) $a in irq::sin_bar#1 = irq::sin_bar#3 + $a @@ -806,8 +800,7 @@ Adding number conversion cast (unumber) 2 in irq::$26 = rasters[irq::$25] / 2 Adding number conversion cast (unumber) irq::$26 in irq::$26 = rasters[irq::$25] / (unumber)2 Adding number conversion cast (unumber) 7 in irq::$27 = irq::$26 & 7 Adding number conversion cast (unumber) irq::$27 in irq::$27 = irq::$26 & (unumber)7 -Adding number conversion cast (unumber) $10 in irq::$1 = greet_idx * $10 -Adding number conversion cast (unumber) irq::$1 in irq::$1 = greet_idx * (unumber)$10 +Adding number conversion cast (unumber) $10 in irq::greet_offset#0 = greet_idx * $10 Adding number conversion cast (unumber) $10 in irq::$28 = irq::i4#2 < $10 Adding number conversion cast (unumber) $bf in irq::$29 = GREETING[irq::greet_offset#2] & $bf Adding number conversion cast (unumber) irq::$29 in irq::$29 = GREETING[irq::greet_offset#2] & (unumber)$bf @@ -996,25 +989,21 @@ Finalized unsigned number type (byte) $28 Finalized unsigned number type (byte) $27 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in irq::$10 = irq::zoomval#0 + 1 -Inferred type updated to byte in irq::$17 = SINE[irq::sin_col#2] / 4 -Inferred type updated to byte in irq::$20 = irq::barcnt#3 * $10 Inferred type updated to byte in irq::$26 = rasters[irq::$25] / 2 Inferred type updated to byte in irq::$27 = irq::$26 & 7 -Inferred type updated to byte in irq::$1 = greet_idx * $10 Inferred type updated to byte in irq::$29 = GREETING[irq::greet_offset#2] & $bf Inferred type updated to byte in irq::$33 = irq::nxt#2 & $bf Inversing boolean not [2] memset::$1 = memset::num#1 <= 0 from [1] memset::$0 = memset::num#1 > 0 -Inversing boolean not [100] irq::$9 = irq::line#6 != SCROLL_Y+SCROLL_BLACKBARS+1 from [99] irq::$8 = irq::line#6 == SCROLL_Y+SCROLL_BLACKBARS+1 -Inversing boolean not [109] irq::$12 = greet_zoomx != 0 from [108] irq::$11 = greet_zoomx == 0 -Inversing boolean not [114] irq::$14 = greet_idx != GREET_COUNT from [113] irq::$13 = greet_idx == GREET_COUNT -Inversing boolean not [204] irq::$3 = scroll_soft != $ff from [203] irq::$2 = scroll_soft == $ff -Inversing boolean not [217] irq::$32 = irq::nxt#0 != 0 from [216] irq::$31 = irq::nxt#0 == 0 +Inversing boolean not [99] irq::$9 = irq::line#6 != SCROLL_Y+SCROLL_BLACKBARS+1 from [98] irq::$8 = irq::line#6 == SCROLL_Y+SCROLL_BLACKBARS+1 +Inversing boolean not [108] irq::$12 = greet_zoomx != 0 from [107] irq::$11 = greet_zoomx == 0 +Inversing boolean not [113] irq::$14 = greet_idx != GREET_COUNT from [112] irq::$13 = greet_idx == GREET_COUNT +Inversing boolean not [200] irq::$3 = scroll_soft != $ff from [199] irq::$2 = scroll_soft == $ff +Inversing boolean not [213] irq::$32 = irq::nxt#0 != 0 from [212] irq::$31 = irq::nxt#0 == 0 Successful SSA optimization Pass2UnaryNotSimplification Alias memset::return#0 = memset::str#1 memset::return#3 memset::return#1 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -1027,11 +1016,9 @@ Alias irq::line#7 = irq::line#8 Alias irq::wobble_idx#5 = irq::wobble_idx#6 Alias irq::sin_col#2 = irq::sin_col#3 Alias irq::i#2 = irq::i#3 -Alias irq::col1#0 = irq::$17 Alias irq::l#2 = irq::l#3 Alias irq::sin_bar#2 = irq::sin_bar#4 Alias irq::barcnt#2 = irq::barcnt#3 -Alias irq::barcol#0 = irq::$20 Alias irq::barcol#3 = irq::barcol#5 irq::barcol#7 Alias irq::idx#3 = irq::idx#5 irq::idx#7 Alias irq::i1#2 = irq::i1#3 @@ -1043,7 +1030,6 @@ Alias irq::i2#2 = irq::i2#3 Alias irq::sin_bar#3 = irq::sin_bar#7 irq::sin_bar#5 Alias irq::barcnt#4 = irq::barcnt#7 irq::barcnt#5 Alias irq::i3#2 = irq::i3#3 -Alias irq::greet_offset#0 = irq::$1 Alias irq::greet_offset#2 = irq::greet_offset#3 Alias irq::i4#2 = irq::i4#3 Alias irq::i5#2 = irq::i5#3 @@ -2313,6 +2299,7 @@ irq: { // irq::@30 __b30: // [27] irq::greet_offset#0 = greet_idx << 4 -- vbuyy=vbuz1_rol_4 + // Set up greetings lda.z greet_idx asl asl @@ -2541,6 +2528,7 @@ irq: { // irq::@17 __b17: // [72] irq::col1#0 = SINE[irq::sin_col#2] >> 2 -- vbuaa=pbuc1_derefidx_vbuyy_ror_2 + // Greeting colors lda SINE,y lsr lsr @@ -3489,6 +3477,7 @@ irq: { // irq::@30 // char greet_offset = greet_idx*16 // [27] irq::greet_offset#0 = greet_idx << 4 -- vbuyy=vbuz1_rol_4 + // Set up greetings lda.z greet_idx asl asl @@ -3724,6 +3713,7 @@ irq: { __b17: // char col = SINE[sin_col]/4 // [72] irq::col1#0 = SINE[irq::sin_col#2] >> 2 -- vbuaa=pbuc1_derefidx_vbuyy_ror_2 + // Greeting colors lda SINE,y lsr lsr diff --git a/src/test/ref/examples/nes/nes-dxycp.asm b/src/test/ref/examples/nes/nes-dxycp.asm index aff37dcc4..7e8e15a0a 100644 --- a/src/test/ref/examples/nes/nes-dxycp.asm +++ b/src/test/ref/examples/nes/nes-dxycp.asm @@ -126,9 +126,9 @@ vblank: { // APU->OAMDMA = BYTE1(spriteBuffer) lda #>SPRITE_BUFFER sta APU+OFFSET_STRUCT_RICOH_2A03_OAMDMA - // readJoy1() - jsr readJoy1 // char joy = readJoy1() + // Read controller 1 + jsr readJoy1 // if(joy) cmp #0 beq __b1 diff --git a/src/test/ref/examples/nes/nes-dxycp.log b/src/test/ref/examples/nes/nes-dxycp.log index a629dcaa6..3f9ae7e02 100644 --- a/src/test/ref/examples/nes/nes-dxycp.log +++ b/src/test/ref/examples/nes/nes-dxycp.log @@ -34,6 +34,7 @@ Inlined call call initNES Inlined call call enableVideoOutput Inlined call call ppuSpriteBufferDmaTransfer SPRITE_BUFFER Inlined call call __init +Eliminating unused variable with no statement vblank::$1 CONTROL FLOW GRAPH SSA @@ -332,8 +333,7 @@ vblank::@16: scope:[vblank] from vblank::ppuSpriteBufferDmaTransfer1 to:vblank::@17 vblank::@17: scope:[vblank] from vblank::@16 readJoy1::return#4 = phi( vblank::@16/readJoy1::return#2 ) - vblank::$1 = readJoy1::return#4 - vblank::joy#0 = vblank::$1 + vblank::joy#0 = readJoy1::return#4 vblank::$33 = 0 != vblank::joy#0 vblank::$2 = ! vblank::$33 if(vblank::$2) goto vblank::@1 @@ -673,7 +673,6 @@ byte readJoy1::return#2 byte readJoy1::return#3 byte readJoy1::return#4 __interrupt(hardware_all) void vblank() -byte~ vblank::$1 number~ vblank::$10 number~ vblank::$11 number~ vblank::$12 @@ -1027,7 +1026,7 @@ Inferred type updated to byte in vblank::$23 = vblank::$22 Inferred type updated to byte for vblank::$26 Inversing boolean not [92] main::initNES1_waitForVBlank1_$1 = 0 == main::initNES1_waitForVBlank1_$0 from [91] main::initNES1_waitForVBlank1_$4 = 0 != main::initNES1_waitForVBlank1_$0 Inversing boolean not [111] main::initNES1_waitForVBlank2_$1 = 0 == main::initNES1_waitForVBlank2_$0 from [110] main::initNES1_waitForVBlank2_$4 = 0 != main::initNES1_waitForVBlank2_$0 -Inversing boolean not [168] vblank::$2 = 0 == vblank::joy#0 from [167] vblank::$33 = 0 != vblank::joy#0 +Inversing boolean not [167] vblank::$2 = 0 == vblank::joy#0 from [166] vblank::$33 = 0 != vblank::joy#0 Successful SSA optimization Pass2UnaryNotSimplification Alias candidate removed (volatile)x_sin_idx = vblank::$7 Alias candidate removed (volatile)x_sin_idx_2 = vblank::$12 @@ -1051,7 +1050,6 @@ Alias ppuDataTransfer::size#0 = main::$1 Alias main::s#2 = main::s#3 Alias vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#0 = vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer#1 Alias readJoy1::return#2 = readJoy1::return#4 -Alias vblank::joy#0 = vblank::$1 Alias vblank::y_idx#0 = vblank::y_idx#12 vblank::y_idx#13 Alias vblank::$5 = vblank::$4 Alias vblank::y_idx#10 = vblank::y_idx#6 vblank::y_idx#7 @@ -1090,7 +1088,7 @@ Identical Phi Values ppuDataTransfer::cpuData#1 ppuDataTransfer::cpuData#0 Identical Phi Values ppuDataTransfer::size#2 ppuDataTransfer::size#0 Identical Phi Values ppuDataTransfer::size#1 ppuDataTransfer::size#2 Successful SSA optimization Pass2IdenticalPhiElimination -Identified duplicate assignment right side [202] vblank::$28 = vblank::s#2 * SIZEOF_STRUCT_SPRITEDATA +Identified duplicate assignment right side [201] vblank::$28 = vblank::s#2 * SIZEOF_STRUCT_SPRITEDATA Successful SSA optimization Pass2DuplicateRValueIdentification Simple Condition readJoy1::$0 [10] if(readJoy1::i#2<8) goto readJoy1::@2 Simple Condition ppuDataFill::$1 [30] if(ppuDataFill::i#2vblank::@14] // vblank::@14 - // readJoy1() + // char joy = readJoy1() // [12] call readJoy1 + // Read controller 1 jsr readJoy1 // [13] readJoy1::return#2 = readJoy1::joy#2 // vblank::@15 - // char joy = readJoy1() // [14] vblank::joy#0 = readJoy1::return#2 // if(joy) // [15] if(0==vblank::joy#0) goto vblank::@1 -- 0_eq_vbuaa_then_la1 diff --git a/src/test/ref/examples/plus4/plus4-randomwalk.log b/src/test/ref/examples/plus4/plus4-randomwalk.log index 77ab2e94f..41039bea9 100644 --- a/src/test/ref/examples/plus4/plus4-randomwalk.log +++ b/src/test/ref/examples/plus4/plus4-randomwalk.log @@ -2,6 +2,9 @@ Fixing struct type size struct MOS7360_TED to 63 Fixing struct type SIZE_OF struct MOS7360_TED to 63 Fixing struct type SIZE_OF struct MOS7360_TED to 63 Inlined call call __init +Eliminating unused variable with no statement memset::$2 +Eliminating unused variable with no statement main::$4 +Eliminating unused variable with no statement main::$11 CONTROL FLOW GRAPH SSA @@ -23,8 +26,7 @@ memset::@2: scope:[memset] from memset memset::num#4 = phi( memset/memset::num#3 ) memset::str#4 = phi( memset/memset::str#5 ) memset::$4 = (byte*)memset::str#4 - memset::$2 = memset::$4 + memset::num#4 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#4 memset::dst#0 = ((byte*)) memset::str#4 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -113,8 +115,7 @@ main::@2: scope:[main] from main::@1 main::y#5 = phi( main::@1/main::y#8 ) main::$24 = (word)main::y#5 main::$3 = main::$24 * $28 - main::$4 = main::$3 + main::x#5 - main::offset#0 = main::$4 + main::offset#0 = main::$3 + main::x#5 main::$5 = VISITS + main::offset#0 *main::$5 = ++ *main::$5 main::$6 = VISITS + main::offset#0 @@ -132,8 +133,7 @@ main::@17: scope:[main] from main::@2 rand::return#4 = phi( main::@2/rand::return#2 ) main::$10 = rand::return#4 rand_state#4 = rand_state#11 - main::$11 = byte1 main::$10 - main::rnd#0 = main::$11 + main::rnd#0 = byte1 main::$10 main::$12 = main::rnd#0 & $80 main::$26 = 0 != main::$12 if(main::$26) goto main::@3 @@ -261,7 +261,6 @@ constant byte* VISITS[$3e8] = { fill( $3e8, 0) } void __start() void main() word~ main::$10 -byte~ main::$11 number~ main::$12 number~ main::$13 bool~ main::$14 @@ -280,7 +279,6 @@ bool~ main::$26 bool~ main::$27 bool~ main::$28 number~ main::$3 -number~ main::$4 byte*~ main::$5 byte*~ main::$6 byte*~ main::$8 @@ -332,7 +330,6 @@ byte main::y#9 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -433,7 +430,6 @@ Adding number conversion cast (unumber) 0 in *((byte*)TED+OFFSET_STRUCT_MOS7360_ Adding number conversion cast (unumber) 0 in *((byte*)TED+OFFSET_STRUCT_MOS7360_TED_BORDER_COLOR) = 0 Adding number conversion cast (unumber) $28 in main::$3 = main::$24 * $28 Adding number conversion cast (unumber) main::$3 in main::$3 = main::$24 * (unumber)$28 -Adding number conversion cast (unumber) main::$4 in main::$4 = main::$3 + main::x#5 Adding number conversion cast (unumber) $f in main::$9 = main::cnt#0 & $f Adding number conversion cast (unumber) main::$9 in main::$9 = main::cnt#0 & (unumber)$f Adding number conversion cast (unumber) $80 in main::$12 = main::rnd#0 & $80 @@ -533,22 +529,20 @@ Finalized unsigned number type (byte) $27 Finalized unsigned number type (byte) $ff Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to word in main::$3 = main::$24 * $28 -Inferred type updated to word in main::$4 = main::$3 + main::x#5 Inferred type updated to byte in main::$9 = main::cnt#0 & $f Inferred type updated to byte in main::$12 = main::rnd#0 & $80 Inferred type updated to byte in main::$18 = main::rnd#1 & $40 Inferred type updated to byte in main::$13 = main::rnd#2 & $40 Inversing boolean not [2] memset::$1 = memset::num#3 <= 0 from [1] memset::$0 = memset::num#3 > 0 -Inversing boolean not [91] main::$17 = main::y#1 != $19 from [90] main::$16 = main::y#1 == $19 -Inversing boolean not [96] main::$15 = main::y#2 != $ff from [95] main::$14 = main::y#2 == $ff -Inversing boolean not [105] main::$22 = main::x#1 != $28 from [104] main::$21 = main::x#1 == $28 -Inversing boolean not [110] main::$20 = main::x#2 != $ff from [109] main::$19 = main::x#2 == $ff +Inversing boolean not [88] main::$17 = main::y#1 != $19 from [87] main::$16 = main::y#1 == $19 +Inversing boolean not [93] main::$15 = main::y#2 != $ff from [92] main::$14 = main::y#2 == $ff +Inversing boolean not [102] main::$22 = main::x#1 != $28 from [101] main::$21 = main::x#1 == $28 +Inversing boolean not [107] main::$20 = main::x#2 != $ff from [106] main::$19 = main::x#2 == $ff Successful SSA optimization Pass2UnaryNotSimplification Alias memset::return#0 = memset::str#3 memset::return#5 memset::return#1 Alias memset::str#4 = memset::str#5 Alias memset::num#3 = memset::num#4 Alias memset::c#5 = memset::c#6 -Alias memset::end#0 = memset::$2 Alias memset::c#3 = memset::c#4 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -559,10 +553,9 @@ Alias rand_state#18 = rand_state#29 rand_state#32 rand_state#20 Alias main::y#11 = main::y#5 main::y#8 main::y#16 main::y#9 main::y#6 main::y#7 main::y#14 main::y#12 main::y#13 main::y#15 Alias main::x#11 = main::x#5 main::x#8 main::x#9 main::x#16 main::x#14 main::x#12 main::x#13 main::x#15 main::x#6 main::x#7 Alias rand_state#12 = rand_state#15 rand_state#16 rand_state#5 -Alias main::offset#0 = main::$4 Alias rand::return#2 = rand::return#4 Alias rand_state#11 = rand_state#4 rand_state#31 rand_state#30 rand_state#25 rand_state#21 rand_state#22 rand_state#26 rand_state#27 rand_state#23 rand_state#24 rand_state#28 -Alias main::rnd#0 = main::$11 main::rnd#1 main::rnd#2 +Alias main::rnd#0 = main::rnd#1 main::rnd#2 Alias rand_state#17 = rand_state#6 Alias rand_state#13 = rand_state#7 rand_state#14 rand_state#8 Successful SSA optimization Pass2AliasElimination @@ -577,7 +570,7 @@ Identical Phi Values rand_state#13 rand_state#12 Successful SSA optimization Pass2IdenticalPhiElimination Identical Phi Values memset::return#0 memset::str#4 Successful SSA optimization Pass2IdenticalPhiElimination -Identified duplicate assignment right side [65] main::$6 = VISITS + main::offset#0 +Identified duplicate assignment right side [63] main::$6 = VISITS + main::offset#0 Successful SSA optimization Pass2DuplicateRValueIdentification Simple Condition memset::$1 [2] if(memset::num#3<=0) goto memset::@1 Simple Condition memset::$3 [9] if(memset::dst#2!=memset::end#0) goto memset::@4 diff --git a/src/test/ref/examples/rom/rom.cfg b/src/test/ref/examples/rom/rom.cfg index 6f2a10e14..54298c8ce 100644 --- a/src/test/ref/examples/rom/rom.cfg +++ b/src/test/ref/examples/rom/rom.cfg @@ -61,16 +61,15 @@ call2: scope:[call2] from main main::@1 [36] call2::return = call2::$0 to:call2::@return call2::@return: scope:[call2] from call2 - [37] call2::return = call2::return - [38] return + [37] return to:@return byte call3(byte call3::param1 , byte call3::param2) call3: scope:[call3] from main::@2 main::@3 - [39] call3::param2#2 = phi( main::@2/2, main::@3/4 ) - [39] call3::param1#2 = phi( main::@2/1, main::@3/3 ) - [40] call3::return#0 = call3::param1#2 + call3::param2#2 + [38] call3::param2#2 = phi( main::@2/2, main::@3/4 ) + [38] call3::param1#2 = phi( main::@2/1, main::@3/3 ) + [39] call3::return#0 = call3::param1#2 + call3::param2#2 to:call3::@return call3::@return: scope:[call3] from call3 - [41] return + [40] return to:@return diff --git a/src/test/ref/examples/rom/rom.log b/src/test/ref/examples/rom/rom.log index b4b926a84..e22116167 100644 --- a/src/test/ref/examples/rom/rom.log +++ b/src/test/ref/examples/rom/rom.log @@ -36,7 +36,6 @@ call2: scope:[call2] from main main::@1 call2::return = call2::$0 to:call2::@return call2::@return: scope:[call2] from call2 - call2::return = call2::return return to:@return @@ -338,18 +337,17 @@ call2: scope:[call2] from main main::@1 [36] call2::return = call2::$0 to:call2::@return call2::@return: scope:[call2] from call2 - [37] call2::return = call2::return - [38] return + [37] return to:@return byte call3(byte call3::param1 , byte call3::param2) call3: scope:[call3] from main::@2 main::@3 - [39] call3::param2#2 = phi( main::@2/2, main::@3/4 ) - [39] call3::param1#2 = phi( main::@2/1, main::@3/3 ) - [40] call3::return#0 = call3::param1#2 + call3::param2#2 + [38] call3::param2#2 = phi( main::@2/2, main::@3/4 ) + [38] call3::param1#2 = phi( main::@2/1, main::@3/3 ) + [39] call3::return#0 = call3::param1#2 + call3::param2#2 to:call3::@return call3::@return: scope:[call3] from call3 - [41] return + [40] return to:@return @@ -367,7 +365,7 @@ byte call2::param1 byte call2::param1#2 11.0 byte call2::param2 byte call2::param2#2 11.0 -byte call2::return loadstore 6.428571428571428 +byte call2::return loadstore 3.833333333333333 byte call3(byte call3::param1 , byte call3::param2) byte call3::param1 byte call3::param1#2 11.0 @@ -457,7 +455,7 @@ Removing always clobbered register reg byte x as potential for zp[1]:15 [ call1: Statement [31] call1::return#0 = call1::param1#0 + call1::param2#0 [ call1::return#0 ] ( call1:2 [ call1::return#0 ] { } call1:8 [ call1::return#0 ] { } ) always clobbers reg byte a Statement [32] stackidx(byte,call1::OFFSET_STACK_RETURN) = call1::return#0 [ ] ( call1:2 [ ] { } call1:8 [ ] { } ) always clobbers reg byte x Statement [35] call2::$0 = call2::param1#2 + call2::param2#2 [ call2::$0 ] ( call2:12 [ call2::$0 ] { { call2::return = } } call2:16 [ call2::$0 ] { { call2::return = } } ) always clobbers reg byte a -Statement [40] call3::return#0 = call3::param1#2 + call3::param2#2 [ call3::return#0 ] ( call3:20 [ call3::return#0 ] { { call3::return#0 = call3::return#2 } } call3:24 [ call3::return#0 ] { { call3::return#0 = call3::return#3 } } ) always clobbers reg byte a +Statement [39] call3::return#0 = call3::param1#2 + call3::param2#2 [ call3::return#0 ] ( call3:20 [ call3::return#0 ] { { call3::return#0 = call3::return#2 } } call3:24 [ call3::return#0 ] { { call3::return#0 = call3::return#3 } } ) always clobbers reg byte a Statement [0] stackpush(byte) = 1 [ ] ( [ ] { { call2::return = } } ) always clobbers reg byte a Statement [1] stackpush(byte) = 2 [ ] ( [ ] { { call2::return = } } ) always clobbers reg byte a Statement sideeffect stackpullbytes(1) always clobbers reg byte a @@ -471,7 +469,7 @@ Statement [30] call1::param2#0 = stackidx(byte,call1::OFFSET_STACK_PARAM2) [ cal Statement [31] call1::return#0 = call1::param1#0 + call1::param2#0 [ call1::return#0 ] ( call1:2 [ call1::return#0 ] { } call1:8 [ call1::return#0 ] { } ) always clobbers reg byte a Statement [32] stackidx(byte,call1::OFFSET_STACK_RETURN) = call1::return#0 [ ] ( call1:2 [ ] { } call1:8 [ ] { } ) always clobbers reg byte x Statement [35] call2::$0 = call2::param1#2 + call2::param2#2 [ call2::$0 ] ( call2:12 [ call2::$0 ] { { call2::return = } } call2:16 [ call2::$0 ] { { call2::return = } } ) always clobbers reg byte a -Statement [40] call3::return#0 = call3::param1#2 + call3::param2#2 [ call3::return#0 ] ( call3:20 [ call3::return#0 ] { { call3::return#0 = call3::return#2 } } call3:24 [ call3::return#0 ] { { call3::return#0 = call3::return#3 } } ) always clobbers reg byte a +Statement [39] call3::return#0 = call3::param1#2 + call3::param2#2 [ call3::return#0 ] ( call3:20 [ call3::return#0 ] { { call3::return#0 = call3::return#2 } } call3:24 [ call3::return#0 ] { { call3::return#0 = call3::return#3 } } ) always clobbers reg byte a Potential registers zp[1]:2 [ call2::param1#2 ] : zp[1]:2 , reg byte a , reg byte x , reg byte y , Potential registers zp[1]:3 [ call2::param2#2 ] : zp[1]:3 , reg byte a , reg byte x , reg byte y , Potential registers zp[1]:4 [ call3::param1#2 ] : zp[1]:4 , reg byte a , reg byte x , reg byte y , @@ -493,7 +491,7 @@ Potential registers zp[1]:19 [ call3::return#0 ] : zp[1]:19 , reg byte a , reg b REGISTER UPLIFT SCOPES Uplift Scope [call1] 22: zp[1]:16 [ call1::param2#0 ] 22: zp[1]:17 [ call1::return#0 ] 11: zp[1]:15 [ call1::param1#0 ] -Uplift Scope [call2] 22: zp[1]:18 [ call2::$0 ] 11: zp[1]:2 [ call2::param1#2 ] 11: zp[1]:3 [ call2::param2#2 ] 6.43: zp[1]:8 [ call2::return ] +Uplift Scope [call2] 22: zp[1]:18 [ call2::$0 ] 11: zp[1]:2 [ call2::param1#2 ] 11: zp[1]:3 [ call2::param2#2 ] 3.83: zp[1]:8 [ call2::return ] Uplift Scope [call3] 11: zp[1]:4 [ call3::param1#2 ] 11: zp[1]:5 [ call3::param2#2 ] 4: zp[1]:11 [ call3::return#2 ] 4: zp[1]:13 [ call3::return#3 ] 3.75: zp[1]:19 [ call3::return#0 ] Uplift Scope [main] 4: zp[1]:6 [ main::$0 ] 4: zp[1]:7 [ main::$1 ] 4: zp[1]:9 [ main::$2 ] 4: zp[1]:10 [ main::$3 ] 4: zp[1]:12 [ main::$4 ] 4: zp[1]:14 [ main::$5 ] Uplift Scope [] @@ -507,12 +505,12 @@ Limited combination testing to 100 combinations of 4096 possible. Uplifting [] best 233 combination Attempting to uplift remaining variables inzp[1]:15 [ call1::param1#0 ] Uplifting [call1] best 233 combination zp[1]:15 [ call1::param1#0 ] -Attempting to uplift remaining variables inzp[1]:8 [ call2::return ] -Uplifting [call2] best 233 combination zp[1]:8 [ call2::return ] Attempting to uplift remaining variables inzp[1]:12 [ main::$4 ] Uplifting [main] best 227 combination reg byte a [ main::$4 ] Attempting to uplift remaining variables inzp[1]:14 [ main::$5 ] Uplifting [main] best 221 combination reg byte a [ main::$5 ] +Attempting to uplift remaining variables inzp[1]:8 [ call2::return ] +Uplifting [call2] best 221 combination zp[1]:8 [ call2::return ] Attempting to uplift remaining variables inzp[1]:19 [ call3::return#0 ] Uplifting [call3] best 212 combination reg byte a [ call3::return#0 ] Coalescing zero page register [ zp[1]:15 [ call1::param1#0 ] ] with [ zp[1]:8 [ call2::return ] ] @@ -597,11 +595,11 @@ main: { // [19] *main::ptr = main::$3 -- _deref_pbuc1=vbuaa sta ptr // [20] call call3 - // [39] phi from main::@2 to call3 [phi:main::@2->call3] + // [38] phi from main::@2 to call3 [phi:main::@2->call3] call3_from___b2: - // [39] phi call3::param2#2 = 2 [phi:main::@2->call3#0] -- vbuaa=vbuc1 + // [38] phi call3::param2#2 = 2 [phi:main::@2->call3#0] -- vbuaa=vbuc1 lda #2 - // [39] phi call3::param1#2 = 1 [phi:main::@2->call3#1] -- vbuxx=vbuc1 + // [38] phi call3::param1#2 = 1 [phi:main::@2->call3#1] -- vbuxx=vbuc1 ldx #1 jsr call3 // [21] call3::return#2 = call3::return#0 @@ -612,11 +610,11 @@ main: { // [23] *main::ptr = main::$4 -- _deref_pbuc1=vbuaa sta ptr // [24] call call3 - // [39] phi from main::@3 to call3 [phi:main::@3->call3] + // [38] phi from main::@3 to call3 [phi:main::@3->call3] call3_from___b3: - // [39] phi call3::param2#2 = 4 [phi:main::@3->call3#0] -- vbuaa=vbuc1 + // [38] phi call3::param2#2 = 4 [phi:main::@3->call3#0] -- vbuaa=vbuc1 lda #4 - // [39] phi call3::param1#2 = 3 [phi:main::@3->call3#1] -- vbuxx=vbuc1 + // [38] phi call3::param1#2 = 3 [phi:main::@3->call3#1] -- vbuxx=vbuc1 ldx #3 jsr call3 // [25] call3::return#3 = call3::return#0 @@ -674,22 +672,21 @@ call2: { jmp __breturn // call2::@return __breturn: - // [37] call2::return = call2::return - // [38] return + // [37] return rts } // call3 // A "normal" optimized ROM function that will transfer parameters and return value through registers or zeropage. // call3(byte register(X) param1, byte register(A) param2) call3: { - // [40] call3::return#0 = call3::param1#2 + call3::param2#2 -- vbuaa=vbuxx_plus_vbuaa + // [39] call3::return#0 = call3::param1#2 + call3::param2#2 -- vbuaa=vbuxx_plus_vbuaa stx.z $ff clc adc.z $ff jmp __breturn // call3::@return __breturn: - // [41] return + // [40] return rts } // File Data @@ -736,7 +733,7 @@ byte call2::param1 byte call2::param1#2 reg byte x 11.0 byte call2::param2 byte call2::param2#2 reg byte a 11.0 -byte call2::return loadstore zp[1]:2 6.428571428571428 +byte call2::return loadstore zp[1]:2 3.833333333333333 byte call3(byte call3::param1 , byte call3::param2) byte call3::param1 byte call3::param1#2 reg byte x 11.0 @@ -860,10 +857,10 @@ main: { sta ptr // call3(1,2) // [20] call call3 - // [39] phi from main::@2 to call3 [phi:main::@2->call3] - // [39] phi call3::param2#2 = 2 [phi:main::@2->call3#0] -- vbuaa=vbuc1 + // [38] phi from main::@2 to call3 [phi:main::@2->call3] + // [38] phi call3::param2#2 = 2 [phi:main::@2->call3#0] -- vbuaa=vbuc1 lda #2 - // [39] phi call3::param1#2 = 1 [phi:main::@2->call3#1] -- vbuxx=vbuc1 + // [38] phi call3::param1#2 = 1 [phi:main::@2->call3#1] -- vbuxx=vbuc1 ldx #1 jsr call3 // call3(1,2) @@ -875,10 +872,10 @@ main: { sta ptr // call3(3,4) // [24] call call3 - // [39] phi from main::@3 to call3 [phi:main::@3->call3] - // [39] phi call3::param2#2 = 4 [phi:main::@3->call3#0] -- vbuaa=vbuc1 + // [38] phi from main::@3 to call3 [phi:main::@3->call3] + // [38] phi call3::param2#2 = 4 [phi:main::@3->call3#0] -- vbuaa=vbuc1 lda #4 - // [39] phi call3::param1#2 = 3 [phi:main::@3->call3#1] -- vbuxx=vbuc1 + // [38] phi call3::param1#2 = 3 [phi:main::@3->call3#1] -- vbuxx=vbuc1 ldx #3 jsr call3 // call3(3,4) @@ -936,8 +933,7 @@ call2: { sta.z return // call2::@return // } - // [37] call2::return = call2::return - // [38] return + // [37] return rts } // call3 @@ -945,13 +941,13 @@ call2: { // call3(byte register(X) param1, byte register(A) param2) call3: { // param1+param2 - // [40] call3::return#0 = call3::param1#2 + call3::param2#2 -- vbuaa=vbuxx_plus_vbuaa + // [39] call3::return#0 = call3::param1#2 + call3::param2#2 -- vbuaa=vbuxx_plus_vbuaa stx.z $ff clc adc.z $ff // call3::@return // } - // [41] return + // [40] return rts } // File Data diff --git a/src/test/ref/examples/rom/rom.sym b/src/test/ref/examples/rom/rom.sym index 7a0c95fd9..a2738ff23 100644 --- a/src/test/ref/examples/rom/rom.sym +++ b/src/test/ref/examples/rom/rom.sym @@ -15,7 +15,7 @@ byte call2::param1 byte call2::param1#2 reg byte x 11.0 byte call2::param2 byte call2::param2#2 reg byte a 11.0 -byte call2::return loadstore zp[1]:2 6.428571428571428 +byte call2::return loadstore zp[1]:2 3.833333333333333 byte call3(byte call3::param1 , byte call3::param2) byte call3::param1 byte call3::param1#2 reg byte x 11.0 diff --git a/src/test/ref/fill-square.log b/src/test/ref/fill-square.log index ae462e92e..1311bf8a6 100644 --- a/src/test/ref/fill-square.log +++ b/src/test/ref/fill-square.log @@ -1,4 +1,5 @@ Inlined call call __init +Eliminating unused variable with no statement main::$1 CONTROL FLOW GRAPH SSA @@ -10,8 +11,7 @@ main::@1: scope:[main] from main main::@3 main::y#2 = phi( main/main::y#0, main::@3/main::y#1 ) main::$5 = (word)main::y#2 main::$0 = main::$5 * $28 - main::$1 = SCREEN + main::$0 - main::line#0 = main::$1 + main::line#0 = SCREEN + main::$0 main::x#0 = 5 to:main::@2 main::@2: scope:[main] from main::@1 main::@2 @@ -53,7 +53,6 @@ constant byte* SCREEN = (byte*)$400 void __start() void main() number~ main::$0 -byte*~ main::$1 byte~ main::$2 bool~ main::$3 bool~ main::$4 @@ -81,7 +80,6 @@ Successful SSA optimization PassNCastSimplification Finalized unsigned number type (byte) $28 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to word in main::$0 = main::$5 * $28 -Alias main::line#0 = main::$1 Alias main::y#3 = main::y#4 Successful SSA optimization Pass2AliasElimination Identical Phi Values main::y#3 main::y#2 diff --git a/src/test/ref/flipper-rex2.log b/src/test/ref/flipper-rex2.log index 2e96f71d6..0f00c6558 100644 --- a/src/test/ref/flipper-rex2.log +++ b/src/test/ref/flipper-rex2.log @@ -1,4 +1,5 @@ Inlined call call __init +Eliminating unused variable with no statement plot::$1 CONTROL FLOW GRAPH SSA @@ -106,8 +107,7 @@ flip::@return: scope:[flip] from flip::@5 void plot() plot: scope:[plot] from main::@7 plot::$0 = SCREEN + 5*$28 - plot::$1 = plot::$0 + $c - plot::line#0 = plot::$1 + plot::line#0 = plot::$0 + $c plot::i#0 = 0 plot::y#0 = $10 to:plot::@1 @@ -212,7 +212,6 @@ byte main::c#3 byte main::c#4 void plot() byte*~ plot::$0 -byte*~ plot::$1 bool~ plot::$2 byte*~ plot::$3 bool~ plot::$4 @@ -254,7 +253,7 @@ Adding number conversion cast (unumber) $ff in main::$2 = *RASTER != $ff Adding number conversion cast (unumber) $10 in flip::$0 = flip::dstIdx#3 + $10 Adding number conversion cast (unumber) flip::$0 in flip::$0 = flip::dstIdx#3 + (unumber)$10 Adding number conversion cast (unumber) 5*$28 in plot::$0 = SCREEN + 5*$28 -Adding number conversion cast (unumber) $c in plot::$1 = plot::$0 + $c +Adding number conversion cast (unumber) $c in plot::line#0 = plot::$0 + $c Adding number conversion cast (unumber) $10 in plot::$2 = plot::x#2 < $10 Adding number conversion cast (unumber) $28 in plot::$3 = plot::line#3 + $28 Successful SSA optimization PassNAddNumberTypeConversions @@ -279,7 +278,6 @@ Alias main::c#2 = main::c#3 Alias flip::dstIdx#1 = flip::$0 flip::dstIdx#4 Alias flip::r#2 = flip::r#3 Alias flip::srcIdx#1 = flip::srcIdx#4 -Alias plot::line#0 = plot::$1 Alias plot::i#2 = plot::i#3 plot::i#5 Alias plot::line#2 = plot::line#4 plot::line#3 Alias plot::x#2 = plot::x#3 diff --git a/src/test/ref/fragment-synth.asm b/src/test/ref/fragment-synth.asm index c04149623..847e90c28 100644 --- a/src/test/ref/fragment-synth.asm +++ b/src/test/ref/fragment-synth.asm @@ -17,25 +17,23 @@ main: { // z[3] = $0f lda #$f sta $450+3 - // fct(x, z) + // byte a1 = fct(x, z) lda #<$450 sta.z fct.z lda #>$450 sta.z fct.z+1 ldx #$aa jsr fct - // fct(x, z) // byte a1 = fct(x, z) // screen[0] = a1 sta screen - // fct(x, z) + // byte a2 = fct(x, z) lda #<$450+1 sta.z fct.z lda #>$450+1 sta.z fct.z+1 ldx #$55 jsr fct - // fct(x, z) // byte a2 = fct(x, z) // screen[1] = a2 sta screen+1 @@ -45,7 +43,7 @@ main: { // fct(byte register(X) x, byte* zp(2) z) fct: { .label z = 2 - // x & z[2] + // byte register(A) a = x & z[2] ldy #2 txa and (z),y diff --git a/src/test/ref/fragment-synth.log b/src/test/ref/fragment-synth.log index 07402bcb4..be73908f9 100644 --- a/src/test/ref/fragment-synth.log +++ b/src/test/ref/fragment-synth.log @@ -1,3 +1,6 @@ +Eliminating unused variable with no statement main::$0 +Eliminating unused variable with no statement main::$1 +Eliminating unused variable with no statement fct::$0 CONTROL FLOW GRAPH SSA @@ -15,8 +18,7 @@ main: scope:[main] from __start main::@1: scope:[main] from main main::z#2 = phi( main/main::z#0 ) fct::return#4 = phi( main/fct::return#0 ) - main::$0 = fct::return#4 - main::a1#0 = main::$0 + main::a1#0 = fct::return#4 main::screen[0] = main::a1#0 main::z#1 = ++ main::z#2 main::x#1 = $55 @@ -27,8 +29,7 @@ main::@1: scope:[main] from main to:main::@2 main::@2: scope:[main] from main::@1 fct::return#5 = phi( main::@1/fct::return#1 ) - main::$1 = fct::return#5 - main::a2#0 = main::$1 + main::a2#0 = fct::return#5 main::screen[1] = main::a2#0 to:main::@return main::@return: scope:[main] from main::@2 @@ -39,8 +40,7 @@ byte fct(byte fct::x , byte* fct::z) fct: scope:[fct] from main main::@1 fct::z#2 = phi( main/fct::z#0, main::@1/fct::z#1 ) fct::x#2 = phi( main/fct::x#0, main::@1/fct::x#1 ) - fct::$0 = fct::x#2 & fct::z#2[2] - fct::a#0 = fct::$0 + fct::a#0 = fct::x#2 & fct::z#2[2] fct::return#2 = fct::a#0 to:fct::@return fct::@return: scope:[fct] from fct @@ -62,7 +62,6 @@ __start::@return: scope:[__start] from __start::@1 SYMBOL TABLE SSA void __start() byte fct(byte fct::x , byte* fct::z) -byte~ fct::$0 byte fct::a !reg byte a byte fct::a#0 !reg byte a byte fct::return @@ -82,8 +81,6 @@ byte* fct::z#0 byte* fct::z#1 byte* fct::z#2 void main() -byte~ main::$0 -byte~ main::$1 byte main::a1 byte main::a1#0 byte main::a2 @@ -104,7 +101,7 @@ Adding number conversion cast (unumber) 3 in main::z#0[3] = ((unumber)) $f Adding number conversion cast (unumber) 0 in main::screen[0] = main::a1#0 Adding number conversion cast (unumber) $55 in main::x#1 = $55 Adding number conversion cast (unumber) 1 in main::screen[1] = main::a2#0 -Adding number conversion cast (unumber) 2 in fct::$0 = fct::x#2 & fct::z#2[2] +Adding number conversion cast (unumber) 2 in fct::a#0 = fct::x#2 & fct::z#2[2] Successful SSA optimization PassNAddNumberTypeConversions Inlining cast main::z#0[(unumber)2] = (unumber)$f0 Inlining cast main::z#0[(unumber)3] = (unumber)$f @@ -132,10 +129,8 @@ Finalized unsigned number type (byte) 2 Successful SSA optimization PassNFinalizeNumberTypeConversions Alias fct::return#0 = fct::return#4 Alias main::z#0 = main::z#2 -Alias main::a1#0 = main::$0 Alias fct::return#1 = fct::return#5 -Alias main::a2#0 = main::$1 -Alias fct::return#2 = fct::a#0 fct::$0 fct::return#6 fct::return#3 +Alias fct::return#2 = fct::a#0 fct::return#6 fct::return#3 Successful SSA optimization Pass2AliasElimination Constant main::z#0 = (byte*) 1104 Constant main::x#0 = $aa @@ -437,7 +432,7 @@ main: { // [1] *((byte*) 1104+3) = $f -- _deref_pbuc1=vbuc2 lda #$f sta $450+3 - // fct(x, z) + // byte a1 = fct(x, z) // [2] call fct // [11] phi from main to fct [phi:main->fct] // [11] phi fct::z#2 = (byte*) 1104 [phi:main->fct#0] -- pbuz1=pbuc1 @@ -448,15 +443,14 @@ main: { // [11] phi fct::x#2 = $aa [phi:main->fct#1] -- vbuxx=vbuc1 ldx #$aa jsr fct - // fct(x, z) + // byte a1 = fct(x, z) // [3] fct::return#0 = fct::return#2 // main::@1 - // byte a1 = fct(x, z) // [4] main::a1#0 = fct::return#0 // screen[0] = a1 // [5] *main::screen = main::a1#0 -- _deref_pbuc1=vbuaa sta screen - // fct(x, z) + // byte a2 = fct(x, z) // [6] call fct // [11] phi from main::@1 to fct [phi:main::@1->fct] // [11] phi fct::z#2 = ++(byte*) 1104 [phi:main::@1->fct#0] -- pbuz1=pbuc1 @@ -467,10 +461,9 @@ main: { // [11] phi fct::x#2 = $55 [phi:main::@1->fct#1] -- vbuxx=vbuc1 ldx #$55 jsr fct - // fct(x, z) + // byte a2 = fct(x, z) // [7] fct::return#1 = fct::return#2 // main::@2 - // byte a2 = fct(x, z) // [8] main::a2#0 = fct::return#1 // screen[1] = a2 // [9] *(main::screen+1) = main::a2#0 -- _deref_pbuc1=vbuaa @@ -484,7 +477,7 @@ main: { // fct(byte register(X) x, byte* zp(2) z) fct: { .label z = 2 - // x & z[2] + // byte register(A) a = x & z[2] // [12] fct::return#2 = fct::x#2 & fct::z#2[2] -- vbuaa=vbuxx_band_pbuz1_derefidx_vbuc1 ldy #2 txa diff --git a/src/test/ref/function-pointer-noarg-call-14.asm b/src/test/ref/function-pointer-noarg-call-14.asm index c5b044f76..65a91bc07 100644 --- a/src/test/ref/function-pointer-noarg-call-14.asm +++ b/src/test/ref/function-pointer-noarg-call-14.asm @@ -144,12 +144,11 @@ gotoxy: { sta.z conio_cursor_x // conio_cursor_y = y stx.z conio_cursor_y - // (unsigned int)y*CONIO_WIDTH + // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH txa sta.z __7 lda #0 sta.z __7+1 - // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH lda.z __7 asl sta.z __8 diff --git a/src/test/ref/function-pointer-noarg-call-14.log b/src/test/ref/function-pointer-noarg-call-14.log index bae5bb0d7..1161c0f5b 100644 --- a/src/test/ref/function-pointer-noarg-call-14.log +++ b/src/test/ref/function-pointer-noarg-call-14.log @@ -5,6 +5,9 @@ Fixing struct type SIZE_OF struct printf_buffer_number to 12 Fixing struct type SIZE_OF struct printf_buffer_number to 12 Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call __init +Eliminating unused variable with no statement memcpy::$0 +Eliminating unused variable with no statement memset::$2 +Eliminating unused variable with no statement gotoxy::$4 Eliminating unused variable with no statement printf_buffer Eliminating unused variable with no statement hello::$0 Eliminating unused variable with no statement world::$0 @@ -19,8 +22,7 @@ memcpy: scope:[memcpy] from cscroll::@3 cscroll::@4 memcpy::src#0 = ((byte*)) memcpy::source#2 memcpy::dst#0 = ((byte*)) memcpy::destination#2 memcpy::$2 = (byte*)memcpy::source#2 - memcpy::$0 = memcpy::$2 + memcpy::num#2 - memcpy::src_end#0 = memcpy::$0 + memcpy::src_end#0 = memcpy::$2 + memcpy::num#2 to:memcpy::@1 memcpy::@1: scope:[memcpy] from memcpy memcpy::@2 memcpy::destination#4 = phi( memcpy/memcpy::destination#2, memcpy::@2/memcpy::destination#5 ) @@ -67,8 +69,7 @@ memset::@2: scope:[memset] from memset memset::num#3 = phi( memset/memset::num#2 ) memset::str#3 = phi( memset/memset::str#4 ) memset::$4 = (byte*)memset::str#3 - memset::$2 = memset::$4 + memset::num#3 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#3 memset::dst#0 = ((byte*)) memset::str#3 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -118,8 +119,7 @@ gotoxy::@2: scope:[gotoxy] from gotoxy::@1 gotoxy::@4 conio_cursor_x = gotoxy::x#4 conio_cursor_y = gotoxy::y#4 gotoxy::$7 = (word)gotoxy::y#4 - gotoxy::$4 = gotoxy::$7 * $28 - gotoxy::line_offset#0 = gotoxy::$4 + gotoxy::line_offset#0 = gotoxy::$7 * $28 gotoxy::$5 = CONIO_SCREEN_TEXT + gotoxy::line_offset#0 conio_line_text = gotoxy::$5 gotoxy::$6 = CONIO_SCREEN_COLORS + gotoxy::line_offset#0 @@ -412,7 +412,6 @@ bool~ gotoxy::$0 bool~ gotoxy::$1 bool~ gotoxy::$2 bool~ gotoxy::$3 -number~ gotoxy::$4 byte*~ gotoxy::$5 byte*~ gotoxy::$6 word~ gotoxy::$7 @@ -438,7 +437,6 @@ void hello() constant byte* hello::s[7] = "hello " void main() void* memcpy(void* memcpy::destination , void* memcpy::source , word memcpy::num) -byte*~ memcpy::$0 bool~ memcpy::$1 byte*~ memcpy::$2 void* memcpy::destination @@ -479,7 +477,6 @@ byte* memcpy::src_end#2 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -524,8 +521,7 @@ Adding number conversion cast (unumber) 0 in memset::$0 = memset::num#2 > 0 Adding number conversion cast (unumber) $19 in gotoxy::$0 = gotoxy::y#3 > $19 Adding number conversion cast (unumber) $28 in gotoxy::$2 = gotoxy::x#3 >= $28 Adding number conversion cast (unumber) 0 in gotoxy::y#0 = 0 -Adding number conversion cast (unumber) $28 in gotoxy::$4 = gotoxy::$7 * $28 -Adding number conversion cast (unumber) gotoxy::$4 in gotoxy::$4 = gotoxy::$7 * (unumber)$28 +Adding number conversion cast (unumber) $28 in gotoxy::line_offset#0 = gotoxy::$7 * $28 Adding number conversion cast (unumber) 0 in gotoxy::x#0 = 0 Adding number conversion cast (unumber) $28 in cputc::$1 = conio_cursor_x == $28 Adding number conversion cast (unumber) $28 in conio_line_text = conio_line_text + $28 @@ -622,17 +618,15 @@ Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) $19 Finalized unsigned number type (byte) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to word in gotoxy::$4 = gotoxy::$7 * $28 -Inversing boolean not [20] memset::$1 = memset::num#2 <= 0 from [19] memset::$0 = memset::num#2 > 0 -Inversing boolean not [40] gotoxy::$1 = gotoxy::y#3 <= $19 from [39] gotoxy::$0 = gotoxy::y#3 > $19 -Inversing boolean not [44] gotoxy::$3 = gotoxy::x#3 < $28 from [43] gotoxy::$2 = gotoxy::x#3 >= $28 -Inversing boolean not [70] cputc::$2 = conio_cursor_x != $28 from [69] cputc::$1 = conio_cursor_x == $28 -Inversing boolean not [94] cscroll::$1 = conio_cursor_y != $19 from [93] cscroll::$0 = conio_cursor_y == $19 -Inversing boolean not [127] conio_c64_init::$1 = conio_c64_init::line#0 < $19 from [126] conio_c64_init::$0 = conio_c64_init::line#0 >= $19 +Inversing boolean not [19] memset::$1 = memset::num#2 <= 0 from [18] memset::$0 = memset::num#2 > 0 +Inversing boolean not [38] gotoxy::$1 = gotoxy::y#3 <= $19 from [37] gotoxy::$0 = gotoxy::y#3 > $19 +Inversing boolean not [42] gotoxy::$3 = gotoxy::x#3 < $28 from [41] gotoxy::$2 = gotoxy::x#3 >= $28 +Inversing boolean not [67] cputc::$2 = conio_cursor_x != $28 from [66] cputc::$1 = conio_cursor_x == $28 +Inversing boolean not [91] cscroll::$1 = conio_cursor_y != $19 from [90] cscroll::$0 = conio_cursor_y == $19 +Inversing boolean not [124] conio_c64_init::$1 = conio_c64_init::line#0 < $19 from [123] conio_c64_init::$0 = conio_c64_init::line#0 >= $19 Successful SSA optimization Pass2UnaryNotSimplification Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 -Alias memcpy::src_end#0 = memcpy::$0 Alias memcpy::src#2 = memcpy::src#3 Alias memcpy::dst#2 = memcpy::dst#3 Alias memcpy::src_end#1 = memcpy::src_end#2 @@ -641,13 +635,11 @@ Alias memset::return#0 = memset::str#2 memset::return#4 memset::return#1 Alias memset::str#3 = memset::str#4 Alias memset::num#2 = memset::num#3 Alias memset::c#4 = memset::c#5 -Alias memset::end#0 = memset::$2 Alias memset::c#2 = memset::c#3 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 Alias memset::str#5 = memset::str#6 Alias gotoxy::x#5 = gotoxy::x#6 -Alias gotoxy::line_offset#0 = gotoxy::$4 Alias gotoxy::y#5 = gotoxy::y#6 Alias cputc::c#1 = cputc::c#2 Alias cputs::c#1 = cputs::$0 cputs::c#2 @@ -2520,13 +2512,12 @@ gotoxy: { // conio_cursor_y = y // [39] conio_cursor_y = gotoxy::y#4 -- vbuz1=vbuxx stx.z conio_cursor_y - // (unsigned int)y*CONIO_WIDTH + // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH // [40] gotoxy::$7 = (word)gotoxy::y#4 -- vwuz1=_word_vbuxx txa sta.z __7 lda #0 sta.z __7+1 - // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH // [41] gotoxy::$8 = gotoxy::$7 << 2 -- vwuz1=vwuz2_rol_2 lda.z __7 asl diff --git a/src/test/ref/halfscii.log b/src/test/ref/halfscii.log index 0e63fc103..d2f3c1bd1 100644 --- a/src/test/ref/halfscii.log +++ b/src/test/ref/halfscii.log @@ -1,4 +1,5 @@ Inlined call call __init +Eliminating unused variable with no statement main::$0 CONTROL FLOW GRAPH SSA @@ -13,8 +14,7 @@ main::@1: scope:[main] from main main::@5 main::charset4#9 = phi( main/main::charset4#0, main::@5/main::charset4#1 ) main::chargen#2 = phi( main/main::chargen#0, main::@5/main::chargen#1 ) main::bits_gen#0 = 0 - main::$0 = main::chargen#2 + 1 - main::chargen1#0 = main::$0 + main::chargen1#0 = main::chargen#2 + 1 main::$1 = *main::chargen#2 & $60 main::$2 = *main::chargen1#0 & $60 main::$3 = main::$2 / 4 @@ -163,7 +163,6 @@ constant byte* SCREEN = (byte*)$400 void __start() constant byte* bits_count[] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 } void main() -byte*~ main::$0 number~ main::$1 number~ main::$10 number~ main::$11 @@ -265,7 +264,7 @@ byte main::i#1 byte main::i#2 Adding number conversion cast (unumber) $32 in *PROCPORT = $32 -Adding number conversion cast (unumber) 1 in main::$0 = main::chargen#2 + 1 +Adding number conversion cast (unumber) 1 in main::chargen1#0 = main::chargen#2 + 1 Adding number conversion cast (unumber) $60 in main::$1 = *main::chargen#2 & $60 Adding number conversion cast (unumber) main::$1 in main::$1 = *main::chargen#2 & (unumber)$60 Adding number conversion cast (unumber) $60 in main::$2 = *main::chargen1#0 & $60 @@ -434,15 +433,15 @@ Inferred type updated to byte in main::$32 = main::$30 | main::$31 Inferred type updated to byte in main::$27 = main::bits_gen#14 + 1 Inferred type updated to byte in main::$36 = main::bits_gen#15 * 2 Inferred type updated to byte in main::$35 = main::bits_gen#16 + 1 -Inversing boolean not [16] main::$8 = main::bits#0 < 2 from [15] main::$7 = main::bits#0 >= 2 -Inversing boolean not [28] main::$17 = main::bits#1 < 2 from [27] main::$16 = main::bits#1 >= 2 -Inversing boolean not [43] main::$26 = main::bits#2 < 2 from [42] main::$25 = main::bits#2 >= 2 -Inversing boolean not [57] main::$34 = main::bits#3 < 2 from [56] main::$33 = main::bits#3 >= 2 +Inversing boolean not [15] main::$8 = main::bits#0 < 2 from [14] main::$7 = main::bits#0 >= 2 +Inversing boolean not [27] main::$17 = main::bits#1 < 2 from [26] main::$16 = main::bits#1 >= 2 +Inversing boolean not [42] main::$26 = main::bits#2 < 2 from [41] main::$25 = main::bits#2 >= 2 +Inversing boolean not [56] main::$34 = main::bits#3 < 2 from [55] main::$33 = main::bits#3 >= 2 Successful SSA optimization Pass2UnaryNotSimplification -Alias main::chargen1#0 = main::$0 main::chargen1#4 Alias main::bits_gen#1 = main::$10 main::bits_gen#12 Alias main::bits_gen#0 = main::bits_gen#10 Alias main::chargen#2 = main::chargen#7 +Alias main::chargen1#0 = main::chargen1#4 Alias main::charset4#10 = main::charset4#9 Alias main::bits_gen#2 = main::$9 Alias main::bits_gen#14 = main::bits_gen#3 main::$19 diff --git a/src/test/ref/hex2dec.log b/src/test/ref/hex2dec.log index 11d4f60a2..8079c0814 100644 --- a/src/test/ref/hex2dec.log +++ b/src/test/ref/hex2dec.log @@ -1,4 +1,6 @@ Setting inferred volatile on symbol affected by address-of utoa16w::$2 = call utoa16n utoa16w::$1 &utoa16w::dst utoa16w::started +Eliminating unused variable with no statement main::$3 +Eliminating unused variable with no statement main::$14 CONTROL FLOW GRAPH SSA @@ -15,8 +17,7 @@ main::@1: scope:[main] from main::@4 main::@6 main::@2: scope:[main] from main::@1 main::@2 main::$1 = *control & $80 main::$2 = *raster >> 1 - main::$3 = main::$1 | main::$2 - main::rst#0 = main::$3 + main::rst#0 = main::$1 | main::$2 main::$4 = main::rst#0 != $30 if(main::$4) goto main::@2 to:main::@3 @@ -69,8 +70,7 @@ main::@11: scope:[main] from main::@10 main::time_start#1 = phi( main::@10/main::time_start#2 ) main::time_end#0 = *raster *BORDER_COLOR = 0 - main::$14 = main::time_end#0 - main::time_start#1 - main::time#0 = main::$14 + main::time#0 = main::time_end#0 - main::time_start#1 main::$15 = main::screen#9 + $50 utoa10w::value#0 = (word)main::time#0 utoa10w::dst#0 = main::$15 @@ -326,13 +326,11 @@ constant byte* cls::screen = (byte*)$400 constant byte* const control = (byte*)$d011 void main() number~ main::$1 -byte~ main::$14 byte*~ main::$15 bool~ main::$17 byte*~ main::$18 byte*~ main::$19 byte~ main::$2 -number~ main::$3 bool~ main::$4 byte main::i byte main::i#0 @@ -509,7 +507,6 @@ word utoa16w::value#8 Adding number conversion cast (unumber) $80 in main::$1 = *control & $80 Adding number conversion cast (unumber) main::$1 in main::$1 = *control & (unumber)$80 Adding number conversion cast (unumber) 1 in main::$2 = *raster >> 1 -Adding number conversion cast (unumber) main::$3 in main::$3 = main::$1 | main::$2 Adding number conversion cast (unumber) $30 in main::$4 = main::rst#0 != $30 Adding number conversion cast (unumber) 1 in *BORDER_COLOR = 1 Adding number conversion cast (unumber) 0 in utoa16w::value#0 = 0 @@ -636,23 +633,20 @@ Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) 1 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in main::$1 = *control & $80 -Inferred type updated to byte in main::$3 = main::$1 | main::$2 Inferred type updated to byte in utoa10w::$1 = utoa10w::i#4 & 1 Inferred type updated to byte in utoa16w::$4 = utoa16w::$3 & $f Inferred type updated to byte in utoa16w::$10 = utoa16w::$9 & $f -Inversing boolean not [83] utoa10w::$3 = utoa10w::$1 == 0 from [82] utoa10w::$2 = utoa10w::$1 != 0 -Inversing boolean not [91] utoa10w::$5 = utoa10w::bStarted#2 == 0 from [90] utoa10w::$4 = utoa10w::bStarted#2 != 0 -Inversing boolean not [147] utoa16n::$1 = utoa16n::nybble#4 == 0 from [146] utoa16n::$0 = utoa16n::nybble#4 != 0 -Inversing boolean not [151] utoa16n::$3 = utoa16n::started#5 == 0 from [150] utoa16n::$2 = utoa16n::started#5 != 0 +Inversing boolean not [81] utoa10w::$3 = utoa10w::$1 == 0 from [80] utoa10w::$2 = utoa10w::$1 != 0 +Inversing boolean not [89] utoa10w::$5 = utoa10w::bStarted#2 == 0 from [88] utoa10w::$4 = utoa10w::bStarted#2 != 0 +Inversing boolean not [145] utoa16n::$1 = utoa16n::nybble#4 == 0 from [144] utoa16n::$0 = utoa16n::nybble#4 != 0 +Inversing boolean not [149] utoa16n::$3 = utoa16n::started#5 == 0 from [148] utoa16n::$2 = utoa16n::started#5 != 0 Successful SSA optimization Pass2UnaryNotSimplification -Alias main::rst#0 = main::$3 Alias main::screen#0 = main::screen#5 Alias main::time_start#0 = main::time_start#5 main::time_start#4 main::time_start#3 main::time_start#2 main::time_start#1 Alias main::screen#1 = main::screen#6 Alias main::screen#2 = main::screen#7 Alias main::screen#3 = main::screen#8 Alias main::screen#12 = main::screen#9 main::screen#4 -Alias main::time#0 = main::$14 Alias utoa10w::dst#0 = main::$15 Alias main::screen#10 = main::screen#11 Alias main::i#2 = main::i#3 diff --git a/src/test/ref/incrementinarray.log b/src/test/ref/incrementinarray.log index 14e2a3b14..298e6c642 100644 --- a/src/test/ref/incrementinarray.log +++ b/src/test/ref/incrementinarray.log @@ -1,4 +1,5 @@ Inlined call call __init +Eliminating unused variable with no statement memset::$2 CONTROL FLOW GRAPH SSA @@ -109,8 +110,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -230,7 +230,6 @@ byte main::i#4 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -390,7 +389,6 @@ Alias memset::return#1 = memset::str#1 memset::return#3 memset::return#2 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 diff --git a/src/test/ref/inline-asm-uses-1.asm b/src/test/ref/inline-asm-uses-1.asm index 72e0f4644..93008e953 100644 --- a/src/test/ref/inline-asm-uses-1.asm +++ b/src/test/ref/inline-asm-uses-1.asm @@ -13,11 +13,10 @@ .segment Code main: { .label SCREEN = $1009 - // fgetc(7) + // char x = fgetc(7) lda #7 sta.z fgetc.channel jsr fgetc - // char x = fgetc(7) // *SCREEN = x sta SCREEN // } diff --git a/src/test/ref/inline-asm-uses-1.log b/src/test/ref/inline-asm-uses-1.log index 7f201833f..36b560549 100644 --- a/src/test/ref/inline-asm-uses-1.log +++ b/src/test/ref/inline-asm-uses-1.log @@ -1,5 +1,6 @@ Setting inferred volatile on symbol affected by address-of: fgetc::channel in asm { ldxchannel jsrCHKIN jsrGETIN staret jsrCLRCHN } Setting inferred volatile on symbol affected by address-of: fgetc::ret in asm { ldxchannel jsrCHKIN jsrGETIN staret jsrCLRCHN } +Eliminating unused variable with no statement main::$0 CONTROL FLOW GRAPH SSA @@ -11,8 +12,7 @@ main: scope:[main] from __start to:main::@1 main::@1: scope:[main] from main fgetc::return#3 = phi( main/fgetc::return#0 ) - main::$0 = fgetc::return#3 - main::x#0 = main::$0 + main::x#0 = fgetc::return#3 *main::SCREEN = main::x#0 to:main::@return main::@return: scope:[main] from main::@1 @@ -56,7 +56,6 @@ byte fgetc::return#2 byte fgetc::return#3 byte fgetc::return#4 void main() -byte~ main::$0 constant byte* const main::SCREEN = (byte*)$1009 byte main::x byte main::x#0 @@ -75,7 +74,6 @@ Finalized unsigned number type (byte) 7 Successful SSA optimization PassNFinalizeNumberTypeConversions Alias candidate removed (volatile)fgetc::return#1 = fgetc::ret fgetc::return#4 fgetc::return#2 Alias fgetc::return#0 = fgetc::return#3 -Alias main::x#0 = main::$0 Successful SSA optimization Pass2AliasElimination Alias candidate removed (volatile)fgetc::return#1 = fgetc::ret fgetc::return#4 fgetc::return#2 Identical Phi Values fgetc::return#4 fgetc::return#1 @@ -298,7 +296,7 @@ Score: 61 // main main: { .label SCREEN = $1009 - // fgetc(7) + // char x = fgetc(7) // [0] fgetc::channel = 7 -- vbuz1=vbuc1 lda #7 sta.z fgetc.channel @@ -306,7 +304,6 @@ main: { jsr fgetc // [2] fgetc::return#0 = fgetc::return#2 // main::@1 - // char x = fgetc(7) // [3] main::x#0 = fgetc::return#0 // *SCREEN = x // [4] *main::SCREEN = main::x#0 -- _deref_pbuc1=vbuaa diff --git a/src/test/ref/inline-function-level2.log b/src/test/ref/inline-function-level2.log index cd28215e0..c068d105d 100644 --- a/src/test/ref/inline-function-level2.log +++ b/src/test/ref/inline-function-level2.log @@ -4,6 +4,8 @@ Inlined call call line 4 $80 $f '.' Inlined call call plot main::line2_$2 main::line2_ch Inlined call call plot line::$2 line::ch Inlined call call __init +Eliminating unused variable with no statement main::line1_$0 +Eliminating unused variable with no statement main::line2_$0 CONTROL FLOW GRAPH SSA @@ -33,8 +35,7 @@ main::line1: scope:[main] from main::@3 main::line1_ysize#3 = phi( main::@3/main::line1_ysize#0 ) main::line1_xpos#1 = phi( main::@3/main::line1_xpos#0 ) cur_line#0 = (byte*)$400 - main::line1_$0 = main::line1_xpos#1 w= 0 - main::line1_pos#0 = main::line1_$0 + main::line1_pos#0 = main::line1_xpos#1 w= 0 main::line1_i#0 = 0 to:main::line1_@1 main::line1_@1: scope:[main] from main::@5 main::line1 @@ -93,8 +94,7 @@ main::line2: scope:[main] from main::@4 main::line2_ysize#3 = phi( main::@4/main::line2_ysize#0 ) main::line2_xpos#1 = phi( main::@4/main::line2_xpos#0 ) cur_line#2 = (byte*)$400 - main::line2_$0 = main::line2_xpos#1 w= 0 - main::line2_pos#0 = main::line2_$0 + main::line2_pos#0 = main::line2_xpos#1 w= 0 main::line2_i#0 = 0 to:main::line2_@1 main::line2_@1: scope:[main] from main::@6 main::line2 @@ -192,7 +192,6 @@ byte* cur_line#8 byte* cur_line#9 void main() bool~ main::$2 -word~ main::line1_$0 bool~ main::line1_$1 byte~ main::line1_$2 byte main::line1_ch @@ -233,7 +232,6 @@ byte main::line1_ysize#2 byte main::line1_ysize#3 byte main::line1_ysize#4 byte main::line1_ysize#5 -word~ main::line2_$0 bool~ main::line2_$1 byte~ main::line2_$2 byte main::line2_ch @@ -298,12 +296,12 @@ Adding number conversion cast (unumber) $400+$3e8 in main::$2 = main::sc#2 < $40 Adding number conversion cast (unumber) 2 in main::line1_xpos#0 = 2 Adding number conversion cast (unumber) $40 in main::line1_xadd#0 = $40 Adding number conversion cast (unumber) $a in main::line1_ysize#0 = $a -Adding number conversion cast (unumber) 0 in main::line1_$0 = main::line1_xpos#1 w= 0 +Adding number conversion cast (unumber) 0 in main::line1_pos#0 = main::line1_xpos#1 w= 0 Adding number conversion cast (unumber) $28 in cur_line#1 = cur_line#9 + $28 Adding number conversion cast (unumber) 4 in main::line2_xpos#0 = 4 Adding number conversion cast (unumber) $80 in main::line2_xadd#0 = $80 Adding number conversion cast (unumber) $f in main::line2_ysize#0 = $f -Adding number conversion cast (unumber) 0 in main::line2_$0 = main::line2_xpos#1 w= 0 +Adding number conversion cast (unumber) 0 in main::line2_pos#0 = main::line2_xpos#1 w= 0 Adding number conversion cast (unumber) $28 in cur_line#3 = cur_line#11 + $28 Successful SSA optimization PassNAddNumberTypeConversions Inlining cast main::line1_xpos#0 = (unumber)2 @@ -344,7 +342,6 @@ Alias main::line1_xpos#0 = main::line1_xpos#1 Alias main::line1_ysize#0 = main::line1_ysize#3 Alias main::line1_ch#0 = main::line1_ch#4 Alias main::line1_xadd#0 = main::line1_xadd#5 -Alias main::line1_pos#0 = main::line1_$0 Alias main::line1_pos#2 = main::line1_pos#4 main::line1_pos#5 main::line1_pos#3 Alias main::line1_ch#1 = main::line1_ch#2 main::plot1_ch#0 main::plot1_ch#1 main::line1_ch#5 main::line1_ch#3 Alias cur_line#15 = cur_line#19 cur_line#8 cur_line#9 @@ -356,7 +353,6 @@ Alias main::line2_xpos#0 = main::line2_xpos#1 Alias main::line2_ysize#0 = main::line2_ysize#3 Alias main::line2_ch#0 = main::line2_ch#4 Alias main::line2_xadd#0 = main::line2_xadd#5 -Alias main::line2_pos#0 = main::line2_$0 Alias main::line2_pos#2 = main::line2_pos#4 main::line2_pos#5 main::line2_pos#3 Alias main::line2_ch#1 = main::line2_ch#2 main::plot2_ch#0 main::plot2_ch#1 main::line2_ch#5 main::line2_ch#3 Alias cur_line#10 = cur_line#16 cur_line#17 cur_line#11 cur_line#12 cur_line#4 diff --git a/src/test/ref/inline-word.log b/src/test/ref/inline-word.log index d7d781027..213de6dd8 100644 --- a/src/test/ref/inline-word.log +++ b/src/test/ref/inline-word.log @@ -1,3 +1,4 @@ +Eliminating unused variable with no statement main::$0 CONTROL FLOW GRAPH SSA @@ -12,8 +13,7 @@ main::@1: scope:[main] from main main::@3 main::@2: scope:[main] from main::@1 main::@2 main::l#2 = phi( main::@1/main::l#0, main::@2/main::l#1 ) main::h#2 = phi( main::@1/main::h#4, main::@2/main::h#2 ) - main::$0 = main::his[main::h#2] w= main::l#2 - main::w#0 = main::$0 + main::w#0 = main::his[main::h#2] w= main::l#2 main::sc#0 = (byte*)main::w#0 *main::sc#0 = '*' main::l#1 = main::l#2 + rangenext(4,7) @@ -44,7 +44,6 @@ SYMBOL TABLE SSA constant byte* const SCREEN = (byte*)$400 void __start() void main() -word~ main::$0 bool~ main::$1 bool~ main::$2 byte main::h @@ -73,7 +72,6 @@ Successful SSA optimization PassNCastSimplification Finalized unsigned number type (word) $100 Finalized unsigned number type (word) $200 Successful SSA optimization PassNFinalizeNumberTypeConversions -Alias main::w#0 = main::$0 Alias main::h#2 = main::h#3 Successful SSA optimization Pass2AliasElimination Identical Phi Values main::h#2 main::h#4 diff --git a/src/test/ref/intermediates-simple.asm b/src/test/ref/intermediates-simple.asm index 7d48a0b6d..5a722925a 100644 --- a/src/test/ref/intermediates-simple.asm +++ b/src/test/ref/intermediates-simple.asm @@ -39,10 +39,9 @@ main: { sta SCREEN,y // SCREEN[idx++] = x; iny - // sum(i,j) + // char y = sum(i,j) lda.z i jsr sum - // char y = sum(i,j) // SCREEN[idx++] = y sta SCREEN,y // SCREEN[idx++] = y; diff --git a/src/test/ref/intermediates-simple.log b/src/test/ref/intermediates-simple.log index c6cc1a975..ebe3259ea 100644 --- a/src/test/ref/intermediates-simple.log +++ b/src/test/ref/intermediates-simple.log @@ -1,4 +1,6 @@ Inlined call call __init +Eliminating unused variable with no statement main::$2 +Eliminating unused variable with no statement main::$3 CONTROL FLOW GRAPH SSA @@ -29,8 +31,7 @@ main::@4: scope:[main] from main::@3 idx#6 = phi( main::@3/idx#11 ) main::j#3 = phi( main::@3/main::j#2 ) main::i#3 = phi( main::@3/main::i#5 ) - main::$2 = main::i#3 + main::j#3 - main::x#0 = main::$2 + main::x#0 = main::i#3 + main::j#3 SCREEN[idx#6] = main::x#0 idx#0 = ++ idx#6 sum::a#0 = main::i#3 @@ -43,8 +44,7 @@ main::@6: scope:[main] from main::@4 main::j#4 = phi( main::@4/main::j#3 ) idx#7 = phi( main::@4/idx#0 ) sum::return#3 = phi( main::@4/sum::return#0 ) - main::$3 = sum::return#3 - main::y#0 = main::$3 + main::y#0 = sum::return#3 SCREEN[idx#7] = main::y#0 idx#1 = ++ idx#7 main::j#1 = ++ main::j#4 @@ -117,8 +117,6 @@ byte idx#9 void main() bool~ main::$0 bool~ main::$1 -byte~ main::$2 -byte~ main::$3 byte main::i byte main::i#0 byte main::i#1 @@ -168,10 +166,8 @@ Alias idx#12 = idx#16 idx#8 idx#2 Alias main::i#3 = main::i#5 main::i#7 main::i#4 Alias main::j#2 = main::j#3 main::j#4 Alias idx#11 = idx#6 idx#15 -Alias main::x#0 = main::$2 Alias sum::return#0 = sum::return#3 Alias idx#0 = idx#7 -Alias main::y#0 = main::$3 Alias sum::return#1 = sum::$0 sum::return#4 sum::return#2 Alias idx#13 = idx#3 Alias idx#10 = idx#4 idx#9 idx#5 @@ -592,7 +588,7 @@ main: { // SCREEN[idx++] = x; // [9] idx#0 = ++ idx#11 -- vbuyy=_inc_vbuyy iny - // sum(i,j) + // char y = sum(i,j) // [10] sum::a#0 = main::i#2 -- vbuaa=vbuz1 lda.z i // [11] sum::b#0 = main::j#2 @@ -600,7 +596,6 @@ main: { jsr sum // [13] sum::return#0 = sum::return#1 // main::@5 - // char y = sum(i,j) // [14] main::y#0 = sum::return#0 // SCREEN[idx++] = y // [15] SCREEN[idx#0] = main::y#0 -- pbuc1_derefidx_vbuyy=vbuaa diff --git a/src/test/ref/intermediates-struct.asm b/src/test/ref/intermediates-struct.asm index 9987243dd..785356bb3 100644 --- a/src/test/ref/intermediates-struct.asm +++ b/src/test/ref/intermediates-struct.asm @@ -7,51 +7,35 @@ .segmentdef Data [startAfter="Code"] .segment Basic :BasicUpstart(main) - .const SIZEOF_STRUCT_DATA = 2 .const OFFSET_STRUCT_DATA_D = 1 + .const SIZEOF_STRUCT_DATA = 2 .label SCREEN = $400 .segment Code main: { .label x = 2 - .label __0 = 4 - .label y = 6 - .label __1 = 8 - // sum(1,2) + .label y = 4 + // struct Data x = sum(1,2) ldx #2 lda #1 jsr sum - // sum(1,2) - ldy #SIZEOF_STRUCT_DATA - !: - lda sum.return-1,y - sta __0-1,y - dey - bne !- // struct Data x = sum(1,2) ldy #SIZEOF_STRUCT_DATA !: - lda __0-1,y + lda sum.return-1,y sta x-1,y dey bne !- // SCREEN[idx++] = x.c lda.z x sta SCREEN - // sum(3, 4) + // struct Data y = sum(3, 4) ldx #4 lda #3 jsr sum - // sum(3, 4) - ldy #SIZEOF_STRUCT_DATA - !: - lda sum.return-1,y - sta __1-1,y - dey - bne !- // struct Data y = sum(3, 4) ldy #SIZEOF_STRUCT_DATA !: - lda __1-1,y + lda sum.return-1,y sta y-1,y dey bne !- @@ -63,8 +47,8 @@ main: { } // sum(byte register(A) a, byte register(X) b) sum: { - .label return = $a - .label d = $c + .label return = 6 + .label d = 8 // a+b stx.z $ff clc diff --git a/src/test/ref/intermediates-struct.cfg b/src/test/ref/intermediates-struct.cfg index dc9a86280..97b0dff8d 100644 --- a/src/test/ref/intermediates-struct.cfg +++ b/src/test/ref/intermediates-struct.cfg @@ -5,29 +5,27 @@ main: scope:[main] from [1] call sum to:main::@1 main::@1: scope:[main] from main - [2] *(&main::$0) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) - [3] *(&main::x) = memcpy(*(&main::$0), struct Data, SIZEOF_STRUCT_DATA) - [4] *SCREEN = *((byte*)&main::x) - [5] call sum + [2] *(&main::x) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) + [3] *SCREEN = *((byte*)&main::x) + [4] call sum to:main::@2 main::@2: scope:[main] from main::@1 - [6] *(&main::$1) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) - [7] *(&main::y) = memcpy(*(&main::$1), struct Data, SIZEOF_STRUCT_DATA) - [8] *(SCREEN+1) = *((byte*)&main::y+OFFSET_STRUCT_DATA_D) + [5] *(&main::y) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) + [6] *(SCREEN+1) = *((byte*)&main::y+OFFSET_STRUCT_DATA_D) to:main::@return main::@return: scope:[main] from main::@2 - [9] return + [7] return to:@return struct Data sum(byte sum::a , byte sum::b) sum: scope:[sum] from main main::@1 - [10] sum::b#2 = phi( main/2, main::@1/4 ) - [10] sum::a#2 = phi( main/1, main::@1/3 ) - [11] sum::$0 = sum::a#2 + sum::b#2 - [12] *((byte*)&sum::d) = sum::$0 - [13] *((byte*)&sum::d+OFFSET_STRUCT_DATA_D) = sum::b#2 - [14] *(&sum::return) = memcpy(*(&sum::d), struct Data, SIZEOF_STRUCT_DATA) + [8] sum::b#2 = phi( main/2, main::@1/4 ) + [8] sum::a#2 = phi( main/1, main::@1/3 ) + [9] sum::$0 = sum::a#2 + sum::b#2 + [10] *((byte*)&sum::d) = sum::$0 + [11] *((byte*)&sum::d+OFFSET_STRUCT_DATA_D) = sum::b#2 + [12] *(&sum::return) = memcpy(*(&sum::d), struct Data, SIZEOF_STRUCT_DATA) to:sum::@return sum::@return: scope:[sum] from sum - [15] return + [13] return to:@return diff --git a/src/test/ref/intermediates-struct.log b/src/test/ref/intermediates-struct.log index 534348701..23ebad9a9 100644 --- a/src/test/ref/intermediates-struct.log +++ b/src/test/ref/intermediates-struct.log @@ -1,9 +1,8 @@ Inlined call call __init -Removing C-classic struct-unwound assignment main::x = struct-unwound {*(&main::x)} -Removing C-classic struct-unwound assignment main::y = struct-unwound {*(&main::y)} +Eliminating unused variable with no statement main::$0 +Eliminating unused variable with no statement main::$1 Removing C-classic struct-unwound assignment sum::d = struct-unwound {*((byte*)&sum::d+OFFSET_STRUCT_DATA_C), *((byte*)&sum::d+OFFSET_STRUCT_DATA_D)} Removing C-classic struct-unwound assignment sum::return = struct-unwound {*(&sum::return)} -Removing C-classic struct-unwound assignment sum::return = struct-unwound {} CONTROL FLOW GRAPH SSA @@ -17,8 +16,7 @@ main: scope:[main] from __start::@1 to:main::@1 main::@1: scope:[main] from main idx#6 = phi( main/idx#11 ) - main::$0 = sum::return - *(&main::x) = memcpy(*(&main::$0), struct Data, SIZEOF_STRUCT_DATA) + main::x = sum::return SCREEN[idx#6] = *((byte*)&main::x+OFFSET_STRUCT_DATA_C) idx#0 = ++ idx#6 sum::a#1 = 3 @@ -28,8 +26,7 @@ main::@1: scope:[main] from main to:main::@2 main::@2: scope:[main] from main::@1 idx#7 = phi( main::@1/idx#0 ) - main::$1 = sum::return - *(&main::y) = memcpy(*(&main::$1), struct Data, SIZEOF_STRUCT_DATA) + main::y = sum::return SCREEN[idx#7] = *((byte*)&main::y+OFFSET_STRUCT_DATA_D) idx#1 = ++ idx#7 to:main::@return @@ -93,8 +90,6 @@ byte idx#7 byte idx#8 byte idx#9 void main() -struct Data~ main::$0 -struct Data~ main::$1 struct Data main::x loadstore struct Data main::y loadstore struct Data sum(byte sum::a , byte sum::b) @@ -146,11 +141,11 @@ Constant sum::a#1 = 3 Constant sum::b#1 = 4 Constant idx#12 = 0 Successful SSA optimization Pass2ConstantIdentification -Simplifying expression containing zero (byte*)&main::x in [7] SCREEN[idx#12] = *((byte*)&main::x+OFFSET_STRUCT_DATA_C) -Simplifying expression containing zero SCREEN in [7] SCREEN[idx#12] = *((byte*)&main::x) -Simplifying expression containing zero (byte*)&sum::d in [20] *((byte*)&sum::d+OFFSET_STRUCT_DATA_C) = sum::$0 +Simplifying expression containing zero (byte*)&main::x in [6] SCREEN[idx#12] = *((byte*)&main::x+OFFSET_STRUCT_DATA_C) +Simplifying expression containing zero SCREEN in [6] SCREEN[idx#12] = *((byte*)&main::x) +Simplifying expression containing zero (byte*)&sum::d in [18] *((byte*)&sum::d+OFFSET_STRUCT_DATA_C) = sum::$0 Successful SSA optimization PassNSimplifyExpressionWithZero -Eliminating unused variable idx#1 and assignment [11] idx#1 = ++ idx#0 +Eliminating unused variable idx#1 and assignment [9] idx#1 = ++ idx#0 Eliminating unused constant OFFSET_STRUCT_DATA_C Successful SSA optimization PassNEliminateUnusedVars Removing unused procedure __start @@ -160,7 +155,7 @@ Removing unused procedure block __start::@1 Removing unused procedure block __start::@2 Removing unused procedure block __start::@return Successful SSA optimization PassNEliminateEmptyStart -Constant right-side identified [5] idx#0 = ++ idx#12 +Constant right-side identified [4] idx#0 = ++ idx#12 Successful SSA optimization Pass2ConstantRValueConsolidation Constant idx#0 = ++idx#12 Successful SSA optimization Pass2ConstantIdentification @@ -182,12 +177,12 @@ Successful SSA optimization Pass2ConstantAdditionElimination Simplifying constant integer increment ++0 Successful SSA optimization Pass2ConstantSimplification Removing C-classic struct-unwound assignment sum::return = struct-unwound {} -Removing C-classic struct-unwound assignment main::$0 = struct-unwound {*(&main::$0)} +Removing C-classic struct-unwound assignment main::x = struct-unwound {*(&main::x)} Removing C-classic struct-unwound assignment sum::return = struct-unwound {} -Removing C-classic struct-unwound assignment main::$1 = struct-unwound {*(&main::$1)} +Removing C-classic struct-unwound assignment main::y = struct-unwound {*(&main::y)} Adding NOP phi() at start of main CALL GRAPH -Calls in [main] to sum:1 sum:5 +Calls in [main] to sum:1 sum:4 Created 2 initial phi equivalence classes Coalesced down to 2 phi equivalence classes @@ -201,39 +196,35 @@ main: scope:[main] from [1] call sum to:main::@1 main::@1: scope:[main] from main - [2] *(&main::$0) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) - [3] *(&main::x) = memcpy(*(&main::$0), struct Data, SIZEOF_STRUCT_DATA) - [4] *SCREEN = *((byte*)&main::x) - [5] call sum + [2] *(&main::x) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) + [3] *SCREEN = *((byte*)&main::x) + [4] call sum to:main::@2 main::@2: scope:[main] from main::@1 - [6] *(&main::$1) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) - [7] *(&main::y) = memcpy(*(&main::$1), struct Data, SIZEOF_STRUCT_DATA) - [8] *(SCREEN+1) = *((byte*)&main::y+OFFSET_STRUCT_DATA_D) + [5] *(&main::y) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) + [6] *(SCREEN+1) = *((byte*)&main::y+OFFSET_STRUCT_DATA_D) to:main::@return main::@return: scope:[main] from main::@2 - [9] return + [7] return to:@return struct Data sum(byte sum::a , byte sum::b) sum: scope:[sum] from main main::@1 - [10] sum::b#2 = phi( main/2, main::@1/4 ) - [10] sum::a#2 = phi( main/1, main::@1/3 ) - [11] sum::$0 = sum::a#2 + sum::b#2 - [12] *((byte*)&sum::d) = sum::$0 - [13] *((byte*)&sum::d+OFFSET_STRUCT_DATA_D) = sum::b#2 - [14] *(&sum::return) = memcpy(*(&sum::d), struct Data, SIZEOF_STRUCT_DATA) + [8] sum::b#2 = phi( main/2, main::@1/4 ) + [8] sum::a#2 = phi( main/1, main::@1/3 ) + [9] sum::$0 = sum::a#2 + sum::b#2 + [10] *((byte*)&sum::d) = sum::$0 + [11] *((byte*)&sum::d+OFFSET_STRUCT_DATA_D) = sum::b#2 + [12] *(&sum::return) = memcpy(*(&sum::d), struct Data, SIZEOF_STRUCT_DATA) to:sum::@return sum::@return: scope:[sum] from sum - [15] return + [13] return to:@return VARIABLE REGISTER WEIGHTS byte idx void main() -struct Data~ main::$0 -struct Data~ main::$1 struct Data main::x loadstore struct Data main::y loadstore struct Data sum(byte sum::a , byte sum::b) @@ -250,9 +241,7 @@ Initial phi equivalence classes [ sum::b#2 ] Added variable sum::$0 to live range equivalence class [ sum::$0 ] Added variable main::x to live range equivalence class [ main::x ] -Added variable main::$0 to live range equivalence class [ main::$0 ] Added variable main::y to live range equivalence class [ main::y ] -Added variable main::$1 to live range equivalence class [ main::$1 ] Added variable sum::return to live range equivalence class [ sum::return ] Added variable sum::d to live range equivalence class [ sum::d ] Complete equivalence classes @@ -260,64 +249,52 @@ Complete equivalence classes [ sum::b#2 ] [ sum::$0 ] [ main::x ] -[ main::$0 ] [ main::y ] -[ main::$1 ] [ sum::return ] [ sum::d ] Allocated zp[1]:2 [ sum::a#2 ] Allocated zp[1]:3 [ sum::b#2 ] Allocated zp[1]:4 [ sum::$0 ] Allocated zp[2]:5 [ main::x ] -Allocated zp[2]:7 [ main::$0 ] -Allocated zp[2]:9 [ main::y ] -Allocated zp[2]:11 [ main::$1 ] -Allocated zp[2]:13 [ sum::return ] -Allocated zp[2]:15 [ sum::d ] +Allocated zp[2]:7 [ main::y ] +Allocated zp[2]:9 [ sum::return ] +Allocated zp[2]:11 [ sum::d ] REGISTER UPLIFT POTENTIAL REGISTERS -Statement [2] *(&main::$0) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) [ main::$0 sum::return main::x main::$1 main::y sum::d ] ( [ main::$0 sum::return main::x main::$1 main::y sum::d ] { } ) always clobbers reg byte a reg byte y -Statement [3] *(&main::x) = memcpy(*(&main::$0), struct Data, SIZEOF_STRUCT_DATA) [ sum::return main::x main::$1 main::y sum::d ] ( [ sum::return main::x main::$1 main::y sum::d ] { } ) always clobbers reg byte a reg byte y -Statement [4] *SCREEN = *((byte*)&main::x) [ sum::return main::$1 main::y sum::d ] ( [ sum::return main::$1 main::y sum::d ] { } ) always clobbers reg byte a -Statement [6] *(&main::$1) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) [ main::$1 main::y ] ( [ main::$1 main::y ] { } ) always clobbers reg byte a reg byte y -Statement [7] *(&main::y) = memcpy(*(&main::$1), struct Data, SIZEOF_STRUCT_DATA) [ main::y ] ( [ main::y ] { } ) always clobbers reg byte a reg byte y -Statement [8] *(SCREEN+1) = *((byte*)&main::y+OFFSET_STRUCT_DATA_D) [ ] ( [ ] { } ) always clobbers reg byte a -Statement [11] sum::$0 = sum::a#2 + sum::b#2 [ sum::return sum::b#2 sum::$0 sum::d ] ( sum:1 [ main::$0 main::x main::$1 main::y sum::return sum::b#2 sum::$0 sum::d ] { } sum:5 [ main::$1 main::y sum::return sum::b#2 sum::$0 sum::d ] { } ) always clobbers reg byte a +Statement [2] *(&main::x) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) [ main::x sum::return main::y sum::d ] ( [ main::x sum::return main::y sum::d ] { } ) always clobbers reg byte a reg byte y +Statement [3] *SCREEN = *((byte*)&main::x) [ sum::return main::y sum::d ] ( [ sum::return main::y sum::d ] { } ) always clobbers reg byte a +Statement [5] *(&main::y) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) [ main::y ] ( [ main::y ] { } ) always clobbers reg byte a reg byte y +Statement [6] *(SCREEN+1) = *((byte*)&main::y+OFFSET_STRUCT_DATA_D) [ ] ( [ ] { } ) always clobbers reg byte a +Statement [9] sum::$0 = sum::a#2 + sum::b#2 [ sum::return sum::b#2 sum::$0 sum::d ] ( sum:1 [ main::x main::y sum::return sum::b#2 sum::$0 sum::d ] { } sum:4 [ main::y sum::return sum::b#2 sum::$0 sum::d ] { } ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp[1]:3 [ sum::b#2 ] -Statement [14] *(&sum::return) = memcpy(*(&sum::d), struct Data, SIZEOF_STRUCT_DATA) [ sum::return sum::d ] ( sum:1 [ main::$0 main::x main::$1 main::y sum::return sum::d ] { } sum:5 [ main::$1 main::y sum::return sum::d ] { } ) always clobbers reg byte a reg byte y -Statement [2] *(&main::$0) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) [ main::$0 sum::return main::x main::$1 main::y sum::d ] ( [ main::$0 sum::return main::x main::$1 main::y sum::d ] { } ) always clobbers reg byte a reg byte y -Statement [3] *(&main::x) = memcpy(*(&main::$0), struct Data, SIZEOF_STRUCT_DATA) [ sum::return main::x main::$1 main::y sum::d ] ( [ sum::return main::x main::$1 main::y sum::d ] { } ) always clobbers reg byte a reg byte y -Statement [4] *SCREEN = *((byte*)&main::x) [ sum::return main::$1 main::y sum::d ] ( [ sum::return main::$1 main::y sum::d ] { } ) always clobbers reg byte a -Statement [6] *(&main::$1) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) [ main::$1 main::y ] ( [ main::$1 main::y ] { } ) always clobbers reg byte a reg byte y -Statement [7] *(&main::y) = memcpy(*(&main::$1), struct Data, SIZEOF_STRUCT_DATA) [ main::y ] ( [ main::y ] { } ) always clobbers reg byte a reg byte y -Statement [8] *(SCREEN+1) = *((byte*)&main::y+OFFSET_STRUCT_DATA_D) [ ] ( [ ] { } ) always clobbers reg byte a -Statement [11] sum::$0 = sum::a#2 + sum::b#2 [ sum::return sum::b#2 sum::$0 sum::d ] ( sum:1 [ main::$0 main::x main::$1 main::y sum::return sum::b#2 sum::$0 sum::d ] { } sum:5 [ main::$1 main::y sum::return sum::b#2 sum::$0 sum::d ] { } ) always clobbers reg byte a -Statement [14] *(&sum::return) = memcpy(*(&sum::d), struct Data, SIZEOF_STRUCT_DATA) [ sum::return sum::d ] ( sum:1 [ main::$0 main::x main::$1 main::y sum::return sum::d ] { } sum:5 [ main::$1 main::y sum::return sum::d ] { } ) always clobbers reg byte a reg byte y +Statement [12] *(&sum::return) = memcpy(*(&sum::d), struct Data, SIZEOF_STRUCT_DATA) [ sum::return sum::d ] ( sum:1 [ main::x main::y sum::return sum::d ] { } sum:4 [ main::y sum::return sum::d ] { } ) always clobbers reg byte a reg byte y +Statement [2] *(&main::x) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) [ main::x sum::return main::y sum::d ] ( [ main::x sum::return main::y sum::d ] { } ) always clobbers reg byte a reg byte y +Statement [3] *SCREEN = *((byte*)&main::x) [ sum::return main::y sum::d ] ( [ sum::return main::y sum::d ] { } ) always clobbers reg byte a +Statement [5] *(&main::y) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) [ main::y ] ( [ main::y ] { } ) always clobbers reg byte a reg byte y +Statement [6] *(SCREEN+1) = *((byte*)&main::y+OFFSET_STRUCT_DATA_D) [ ] ( [ ] { } ) always clobbers reg byte a +Statement [9] sum::$0 = sum::a#2 + sum::b#2 [ sum::return sum::b#2 sum::$0 sum::d ] ( sum:1 [ main::x main::y sum::return sum::b#2 sum::$0 sum::d ] { } sum:4 [ main::y sum::return sum::b#2 sum::$0 sum::d ] { } ) always clobbers reg byte a +Statement [12] *(&sum::return) = memcpy(*(&sum::d), struct Data, SIZEOF_STRUCT_DATA) [ sum::return sum::d ] ( sum:1 [ main::x main::y sum::return sum::d ] { } sum:4 [ main::y sum::return sum::d ] { } ) always clobbers reg byte a reg byte y Potential registers zp[1]:2 [ sum::a#2 ] : zp[1]:2 , reg byte a , reg byte x , reg byte y , Potential registers zp[1]:3 [ sum::b#2 ] : zp[1]:3 , reg byte x , reg byte y , Potential registers zp[1]:4 [ sum::$0 ] : zp[1]:4 , reg byte a , reg byte x , reg byte y , Potential registers zp[2]:5 [ main::x ] : zp[2]:5 , -Potential registers zp[2]:7 [ main::$0 ] : zp[2]:7 , -Potential registers zp[2]:9 [ main::y ] : zp[2]:9 , -Potential registers zp[2]:11 [ main::$1 ] : zp[2]:11 , -Potential registers zp[2]:13 [ sum::return ] : zp[2]:13 , -Potential registers zp[2]:15 [ sum::d ] : zp[2]:15 , +Potential registers zp[2]:7 [ main::y ] : zp[2]:7 , +Potential registers zp[2]:9 [ sum::return ] : zp[2]:9 , +Potential registers zp[2]:11 [ sum::d ] : zp[2]:11 , REGISTER UPLIFT SCOPES -Uplift Scope [sum] 22: zp[1]:4 [ sum::$0 ] 11: zp[1]:2 [ sum::a#2 ] 7.33: zp[1]:3 [ sum::b#2 ] 0: zp[2]:13 [ sum::return ] 0: zp[2]:15 [ sum::d ] +Uplift Scope [sum] 22: zp[1]:4 [ sum::$0 ] 11: zp[1]:2 [ sum::a#2 ] 7.33: zp[1]:3 [ sum::b#2 ] 0: zp[2]:9 [ sum::return ] 0: zp[2]:11 [ sum::d ] Uplift Scope [Data] -Uplift Scope [main] 0: zp[2]:5 [ main::x ] 0: zp[2]:7 [ main::$0 ] 0: zp[2]:9 [ main::y ] 0: zp[2]:11 [ main::$1 ] +Uplift Scope [main] 0: zp[2]:5 [ main::x ] 0: zp[2]:7 [ main::y ] Uplift Scope [] -Uplifting [sum] best 154 combination reg byte a [ sum::$0 ] reg byte a [ sum::a#2 ] reg byte x [ sum::b#2 ] zp[2]:13 [ sum::return ] zp[2]:15 [ sum::d ] -Uplifting [Data] best 154 combination -Uplifting [main] best 154 combination zp[2]:5 [ main::x ] zp[2]:7 [ main::$0 ] zp[2]:9 [ main::y ] zp[2]:11 [ main::$1 ] -Uplifting [] best 154 combination +Uplifting [sum] best 122 combination reg byte a [ sum::$0 ] reg byte a [ sum::a#2 ] reg byte x [ sum::b#2 ] zp[2]:9 [ sum::return ] zp[2]:11 [ sum::d ] +Uplifting [Data] best 122 combination +Uplifting [main] best 122 combination zp[2]:5 [ main::x ] zp[2]:7 [ main::y ] +Uplifting [] best 122 combination Allocated (was zp[2]:5) zp[2]:2 [ main::x ] -Allocated (was zp[2]:7) zp[2]:4 [ main::$0 ] -Allocated (was zp[2]:9) zp[2]:6 [ main::y ] -Allocated (was zp[2]:11) zp[2]:8 [ main::$1 ] -Allocated (was zp[2]:13) zp[2]:10 [ sum::return ] -Allocated (was zp[2]:15) zp[2]:12 [ sum::d ] +Allocated (was zp[2]:7) zp[2]:4 [ main::y ] +Allocated (was zp[2]:9) zp[2]:6 [ sum::return ] +Allocated (was zp[2]:11) zp[2]:8 [ sum::d ] ASSEMBLER BEFORE OPTIMIZATION // File Comments @@ -332,92 +309,76 @@ ASSEMBLER BEFORE OPTIMIZATION .segment Basic :BasicUpstart(main) // Global Constants & labels - .const SIZEOF_STRUCT_DATA = 2 .const OFFSET_STRUCT_DATA_D = 1 + .const SIZEOF_STRUCT_DATA = 2 .label SCREEN = $400 .segment Code // main main: { .label x = 2 - .label __0 = 4 - .label y = 6 - .label __1 = 8 + .label y = 4 // [1] call sum - // [10] phi from main to sum [phi:main->sum] + // [8] phi from main to sum [phi:main->sum] sum_from_main: - // [10] phi sum::b#2 = 2 [phi:main->sum#0] -- vbuxx=vbuc1 + // [8] phi sum::b#2 = 2 [phi:main->sum#0] -- vbuxx=vbuc1 ldx #2 - // [10] phi sum::a#2 = 1 [phi:main->sum#1] -- vbuaa=vbuc1 + // [8] phi sum::a#2 = 1 [phi:main->sum#1] -- vbuaa=vbuc1 lda #1 jsr sum jmp __b1 // main::@1 __b1: - // [2] *(&main::$0) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 + // [2] *(&main::x) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 ldy #SIZEOF_STRUCT_DATA !: lda sum.return-1,y - sta __0-1,y - dey - bne !- - // [3] *(&main::x) = memcpy(*(&main::$0), struct Data, SIZEOF_STRUCT_DATA) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 - ldy #SIZEOF_STRUCT_DATA - !: - lda __0-1,y sta x-1,y dey bne !- - // [4] *SCREEN = *((byte*)&main::x) -- _deref_pbuc1=_deref_pbuc2 + // [3] *SCREEN = *((byte*)&main::x) -- _deref_pbuc1=_deref_pbuc2 lda.z x sta SCREEN - // [5] call sum - // [10] phi from main::@1 to sum [phi:main::@1->sum] + // [4] call sum + // [8] phi from main::@1 to sum [phi:main::@1->sum] sum_from___b1: - // [10] phi sum::b#2 = 4 [phi:main::@1->sum#0] -- vbuxx=vbuc1 + // [8] phi sum::b#2 = 4 [phi:main::@1->sum#0] -- vbuxx=vbuc1 ldx #4 - // [10] phi sum::a#2 = 3 [phi:main::@1->sum#1] -- vbuaa=vbuc1 + // [8] phi sum::a#2 = 3 [phi:main::@1->sum#1] -- vbuaa=vbuc1 lda #3 jsr sum jmp __b2 // main::@2 __b2: - // [6] *(&main::$1) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 + // [5] *(&main::y) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 ldy #SIZEOF_STRUCT_DATA !: lda sum.return-1,y - sta __1-1,y - dey - bne !- - // [7] *(&main::y) = memcpy(*(&main::$1), struct Data, SIZEOF_STRUCT_DATA) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 - ldy #SIZEOF_STRUCT_DATA - !: - lda __1-1,y sta y-1,y dey bne !- - // [8] *(SCREEN+1) = *((byte*)&main::y+OFFSET_STRUCT_DATA_D) -- _deref_pbuc1=_deref_pbuc2 + // [6] *(SCREEN+1) = *((byte*)&main::y+OFFSET_STRUCT_DATA_D) -- _deref_pbuc1=_deref_pbuc2 lda y+OFFSET_STRUCT_DATA_D sta SCREEN+1 jmp __breturn // main::@return __breturn: - // [9] return + // [7] return rts } // sum // sum(byte register(A) a, byte register(X) b) sum: { - .label return = $a - .label d = $c - // [11] sum::$0 = sum::a#2 + sum::b#2 -- vbuaa=vbuaa_plus_vbuxx + .label return = 6 + .label d = 8 + // [9] sum::$0 = sum::a#2 + sum::b#2 -- vbuaa=vbuaa_plus_vbuxx stx.z $ff clc adc.z $ff - // [12] *((byte*)&sum::d) = sum::$0 -- _deref_pbuc1=vbuaa + // [10] *((byte*)&sum::d) = sum::$0 -- _deref_pbuc1=vbuaa sta.z d - // [13] *((byte*)&sum::d+OFFSET_STRUCT_DATA_D) = sum::b#2 -- _deref_pbuc1=vbuxx + // [11] *((byte*)&sum::d+OFFSET_STRUCT_DATA_D) = sum::b#2 -- _deref_pbuc1=vbuxx stx d+OFFSET_STRUCT_DATA_D - // [14] *(&sum::return) = memcpy(*(&sum::d), struct Data, SIZEOF_STRUCT_DATA) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 + // [12] *(&sum::return) = memcpy(*(&sum::d), struct Data, SIZEOF_STRUCT_DATA) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 ldy #SIZEOF_STRUCT_DATA !: lda d-1,y @@ -427,7 +388,7 @@ sum: { jmp __breturn // sum::@return __breturn: - // [15] return + // [13] return rts } // File Data @@ -452,32 +413,28 @@ constant byte* const SCREEN = (byte*) 1024 constant byte SIZEOF_STRUCT_DATA = 2 byte idx void main() -struct Data~ main::$0 zp[2]:4 -struct Data~ main::$1 zp[2]:8 struct Data main::x loadstore zp[2]:2 -struct Data main::y loadstore zp[2]:6 +struct Data main::y loadstore zp[2]:4 struct Data sum(byte sum::a , byte sum::b) byte~ sum::$0 reg byte a 22.0 byte sum::a byte sum::a#2 reg byte a 11.0 byte sum::b byte sum::b#2 reg byte x 7.333333333333333 -struct Data sum::d loadstore zp[2]:12 -struct Data sum::return loadstore zp[2]:10 +struct Data sum::d loadstore zp[2]:8 +struct Data sum::return loadstore zp[2]:6 reg byte a [ sum::a#2 ] reg byte x [ sum::b#2 ] reg byte a [ sum::$0 ] zp[2]:2 [ main::x ] -zp[2]:4 [ main::$0 ] -zp[2]:6 [ main::y ] -zp[2]:8 [ main::$1 ] -zp[2]:10 [ sum::return ] -zp[2]:12 [ sum::d ] +zp[2]:4 [ main::y ] +zp[2]:6 [ sum::return ] +zp[2]:8 [ sum::d ] FINAL ASSEMBLER -Score: 142 +Score: 110 // File Comments // Test intermediate vars @@ -491,96 +448,78 @@ Score: 142 .segment Basic :BasicUpstart(main) // Global Constants & labels - .const SIZEOF_STRUCT_DATA = 2 .const OFFSET_STRUCT_DATA_D = 1 + .const SIZEOF_STRUCT_DATA = 2 .label SCREEN = $400 .segment Code // main main: { .label x = 2 - .label __0 = 4 - .label y = 6 - .label __1 = 8 - // sum(1,2) + .label y = 4 + // struct Data x = sum(1,2) // [1] call sum - // [10] phi from main to sum [phi:main->sum] - // [10] phi sum::b#2 = 2 [phi:main->sum#0] -- vbuxx=vbuc1 + // [8] phi from main to sum [phi:main->sum] + // [8] phi sum::b#2 = 2 [phi:main->sum#0] -- vbuxx=vbuc1 ldx #2 - // [10] phi sum::a#2 = 1 [phi:main->sum#1] -- vbuaa=vbuc1 + // [8] phi sum::a#2 = 1 [phi:main->sum#1] -- vbuaa=vbuc1 lda #1 jsr sum // main::@1 - // sum(1,2) - // [2] *(&main::$0) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 + // struct Data x = sum(1,2) + // [2] *(&main::x) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 ldy #SIZEOF_STRUCT_DATA !: lda sum.return-1,y - sta __0-1,y - dey - bne !- - // struct Data x = sum(1,2) - // [3] *(&main::x) = memcpy(*(&main::$0), struct Data, SIZEOF_STRUCT_DATA) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 - ldy #SIZEOF_STRUCT_DATA - !: - lda __0-1,y sta x-1,y dey bne !- // SCREEN[idx++] = x.c - // [4] *SCREEN = *((byte*)&main::x) -- _deref_pbuc1=_deref_pbuc2 + // [3] *SCREEN = *((byte*)&main::x) -- _deref_pbuc1=_deref_pbuc2 lda.z x sta SCREEN - // sum(3, 4) - // [5] call sum - // [10] phi from main::@1 to sum [phi:main::@1->sum] - // [10] phi sum::b#2 = 4 [phi:main::@1->sum#0] -- vbuxx=vbuc1 + // struct Data y = sum(3, 4) + // [4] call sum + // [8] phi from main::@1 to sum [phi:main::@1->sum] + // [8] phi sum::b#2 = 4 [phi:main::@1->sum#0] -- vbuxx=vbuc1 ldx #4 - // [10] phi sum::a#2 = 3 [phi:main::@1->sum#1] -- vbuaa=vbuc1 + // [8] phi sum::a#2 = 3 [phi:main::@1->sum#1] -- vbuaa=vbuc1 lda #3 jsr sum // main::@2 - // sum(3, 4) - // [6] *(&main::$1) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 + // struct Data y = sum(3, 4) + // [5] *(&main::y) = memcpy(*(&sum::return), struct Data, SIZEOF_STRUCT_DATA) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 ldy #SIZEOF_STRUCT_DATA !: lda sum.return-1,y - sta __1-1,y - dey - bne !- - // struct Data y = sum(3, 4) - // [7] *(&main::y) = memcpy(*(&main::$1), struct Data, SIZEOF_STRUCT_DATA) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 - ldy #SIZEOF_STRUCT_DATA - !: - lda __1-1,y sta y-1,y dey bne !- // SCREEN[idx++] = y.d - // [8] *(SCREEN+1) = *((byte*)&main::y+OFFSET_STRUCT_DATA_D) -- _deref_pbuc1=_deref_pbuc2 + // [6] *(SCREEN+1) = *((byte*)&main::y+OFFSET_STRUCT_DATA_D) -- _deref_pbuc1=_deref_pbuc2 lda y+OFFSET_STRUCT_DATA_D sta SCREEN+1 // main::@return // } - // [9] return + // [7] return rts } // sum // sum(byte register(A) a, byte register(X) b) sum: { - .label return = $a - .label d = $c + .label return = 6 + .label d = 8 // a+b - // [11] sum::$0 = sum::a#2 + sum::b#2 -- vbuaa=vbuaa_plus_vbuxx + // [9] sum::$0 = sum::a#2 + sum::b#2 -- vbuaa=vbuaa_plus_vbuxx stx.z $ff clc adc.z $ff // __ma struct Data d = { a+b, b } - // [12] *((byte*)&sum::d) = sum::$0 -- _deref_pbuc1=vbuaa + // [10] *((byte*)&sum::d) = sum::$0 -- _deref_pbuc1=vbuaa sta.z d - // [13] *((byte*)&sum::d+OFFSET_STRUCT_DATA_D) = sum::b#2 -- _deref_pbuc1=vbuxx + // [11] *((byte*)&sum::d+OFFSET_STRUCT_DATA_D) = sum::b#2 -- _deref_pbuc1=vbuxx stx d+OFFSET_STRUCT_DATA_D // return d; - // [14] *(&sum::return) = memcpy(*(&sum::d), struct Data, SIZEOF_STRUCT_DATA) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 + // [12] *(&sum::return) = memcpy(*(&sum::d), struct Data, SIZEOF_STRUCT_DATA) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 ldy #SIZEOF_STRUCT_DATA !: lda d-1,y @@ -589,7 +528,7 @@ sum: { bne !- // sum::@return // } - // [15] return + // [13] return rts } // File Data diff --git a/src/test/ref/intermediates-struct.sym b/src/test/ref/intermediates-struct.sym index 519a089a5..c5e94696d 100644 --- a/src/test/ref/intermediates-struct.sym +++ b/src/test/ref/intermediates-struct.sym @@ -3,25 +3,21 @@ constant byte* const SCREEN = (byte*) 1024 constant byte SIZEOF_STRUCT_DATA = 2 byte idx void main() -struct Data~ main::$0 zp[2]:4 -struct Data~ main::$1 zp[2]:8 struct Data main::x loadstore zp[2]:2 -struct Data main::y loadstore zp[2]:6 +struct Data main::y loadstore zp[2]:4 struct Data sum(byte sum::a , byte sum::b) byte~ sum::$0 reg byte a 22.0 byte sum::a byte sum::a#2 reg byte a 11.0 byte sum::b byte sum::b#2 reg byte x 7.333333333333333 -struct Data sum::d loadstore zp[2]:12 -struct Data sum::return loadstore zp[2]:10 +struct Data sum::d loadstore zp[2]:8 +struct Data sum::return loadstore zp[2]:6 reg byte a [ sum::a#2 ] reg byte x [ sum::b#2 ] reg byte a [ sum::$0 ] zp[2]:2 [ main::x ] -zp[2]:4 [ main::$0 ] -zp[2]:6 [ main::y ] -zp[2]:8 [ main::$1 ] -zp[2]:10 [ sum::return ] -zp[2]:12 [ sum::d ] +zp[2]:4 [ main::y ] +zp[2]:6 [ sum::return ] +zp[2]:8 [ sum::d ] diff --git a/src/test/ref/keyboard-glitch.asm b/src/test/ref/keyboard-glitch.asm index a25418ac9..05eb693a2 100644 --- a/src/test/ref/keyboard-glitch.asm +++ b/src/test/ref/keyboard-glitch.asm @@ -151,7 +151,7 @@ keyboard_matrix_read: { // CIA1->PORT_A = keyboard_matrix_row_bitmask[rowid] lda keyboard_matrix_row_bitmask,x sta CIA1 - // ~CIA1->PORT_B + // char row_pressed_bits = ~CIA1->PORT_B lda CIA1+OFFSET_STRUCT_MOS6526_CIA_PORT_B eor #$ff // } diff --git a/src/test/ref/keyboard-glitch.log b/src/test/ref/keyboard-glitch.log index 92118070e..f9af75bb2 100644 --- a/src/test/ref/keyboard-glitch.log +++ b/src/test/ref/keyboard-glitch.log @@ -1,5 +1,8 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call __init +Eliminating unused variable with no statement keyboard_matrix_read::$0 +Eliminating unused variable with no statement keyboard_key_pressed::$0 +Eliminating unused variable with no statement keyboard_key_pressed::$1 CONTROL FLOW GRAPH SSA @@ -7,8 +10,7 @@ byte keyboard_matrix_read(byte keyboard_matrix_read::rowid) keyboard_matrix_read: scope:[keyboard_matrix_read] from keyboard_key_pressed keyboard_matrix_read::rowid#1 = phi( keyboard_key_pressed/keyboard_matrix_read::rowid#0 ) *((byte*)CIA1+OFFSET_STRUCT_MOS6526_CIA_PORT_A) = keyboard_matrix_row_bitmask[keyboard_matrix_read::rowid#1] - keyboard_matrix_read::$0 = ~ *((byte*)CIA1+OFFSET_STRUCT_MOS6526_CIA_PORT_B) - keyboard_matrix_read::row_pressed_bits#0 = keyboard_matrix_read::$0 + keyboard_matrix_read::row_pressed_bits#0 = ~ *((byte*)CIA1+OFFSET_STRUCT_MOS6526_CIA_PORT_B) keyboard_matrix_read::return#0 = keyboard_matrix_read::row_pressed_bits#0 to:keyboard_matrix_read::@return keyboard_matrix_read::@return: scope:[keyboard_matrix_read] from keyboard_matrix_read @@ -20,10 +22,8 @@ keyboard_matrix_read::@return: scope:[keyboard_matrix_read] from keyboard_matri byte keyboard_key_pressed(byte keyboard_key_pressed::key) keyboard_key_pressed: scope:[keyboard_key_pressed] from menu::@2 menu::@3 menu::@4 pressed::@2 keyboard_key_pressed::key#4 = phi( menu::@2/keyboard_key_pressed::key#0, menu::@3/keyboard_key_pressed::key#1, menu::@4/keyboard_key_pressed::key#2, pressed::@2/keyboard_key_pressed::key#3 ) - keyboard_key_pressed::$0 = keyboard_key_pressed::key#4 & 7 - keyboard_key_pressed::colidx#0 = keyboard_key_pressed::$0 - keyboard_key_pressed::$1 = keyboard_key_pressed::key#4 >> 3 - keyboard_key_pressed::rowidx#0 = keyboard_key_pressed::$1 + keyboard_key_pressed::colidx#0 = keyboard_key_pressed::key#4 & 7 + keyboard_key_pressed::rowidx#0 = keyboard_key_pressed::key#4 >> 3 keyboard_matrix_read::rowid#0 = keyboard_key_pressed::rowidx#0 call keyboard_matrix_read keyboard_matrix_read::return#2 = keyboard_matrix_read::return#1 @@ -171,8 +171,6 @@ constant const byte RED = 2 constant byte* SCREEN = (byte*)$400 void __start() byte keyboard_key_pressed(byte keyboard_key_pressed::key) -number~ keyboard_key_pressed::$0 -byte~ keyboard_key_pressed::$1 byte~ keyboard_key_pressed::$2 byte~ keyboard_key_pressed::$3 byte keyboard_key_pressed::colidx @@ -200,7 +198,6 @@ byte keyboard_key_pressed::rowidx byte keyboard_key_pressed::rowidx#0 constant byte* keyboard_matrix_col_bitmask[8] = { 1, 2, 4, 8, $10, $20, $40, $80 } byte keyboard_matrix_read(byte keyboard_matrix_read::rowid) -byte~ keyboard_matrix_read::$0 byte keyboard_matrix_read::return byte keyboard_matrix_read::return#0 byte keyboard_matrix_read::return#1 @@ -229,9 +226,8 @@ byte~ pressed::$1 bool~ pressed::$2 bool~ pressed::$3 -Adding number conversion cast (unumber) 7 in keyboard_key_pressed::$0 = keyboard_key_pressed::key#4 & 7 -Adding number conversion cast (unumber) keyboard_key_pressed::$0 in keyboard_key_pressed::$0 = keyboard_key_pressed::key#4 & (unumber)7 -Adding number conversion cast (unumber) 3 in keyboard_key_pressed::$1 = keyboard_key_pressed::key#4 >> 3 +Adding number conversion cast (unumber) 7 in keyboard_key_pressed::colidx#0 = keyboard_key_pressed::key#4 & 7 +Adding number conversion cast (unumber) 3 in keyboard_key_pressed::rowidx#0 = keyboard_key_pressed::key#4 >> 3 Adding number conversion cast (unumber) 0 in menu::$1 = menu::$0 != 0 Adding number conversion cast (unumber) 0 in menu::$5 = menu::$4 != 0 Adding number conversion cast (unumber) 0 in menu::$8 = menu::$7 != 0 @@ -255,16 +251,14 @@ Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to byte in keyboard_key_pressed::$0 = keyboard_key_pressed::key#4 & 7 -Inversing boolean not [34] menu::$2 = menu::$0 == 0 from [33] menu::$1 = menu::$0 != 0 -Inversing boolean not [42] menu::$6 = menu::$4 == 0 from [41] menu::$5 = menu::$4 != 0 -Inversing boolean not [52] menu::$9 = menu::$7 == 0 from [51] menu::$8 = menu::$7 != 0 -Inversing boolean not [67] pressed::$3 = pressed::$1 == 0 from [66] pressed::$2 = pressed::$1 != 0 +Inversing boolean not [31] menu::$2 = menu::$0 == 0 from [30] menu::$1 = menu::$0 != 0 +Inversing boolean not [39] menu::$6 = menu::$4 == 0 from [38] menu::$5 = menu::$4 != 0 +Inversing boolean not [49] menu::$9 = menu::$7 == 0 from [48] menu::$8 = menu::$7 != 0 +Inversing boolean not [64] pressed::$3 = pressed::$1 == 0 from [63] pressed::$2 = pressed::$1 != 0 Successful SSA optimization Pass2UnaryNotSimplification -Alias keyboard_matrix_read::return#0 = keyboard_matrix_read::row_pressed_bits#0 keyboard_matrix_read::$0 keyboard_matrix_read::return#3 keyboard_matrix_read::return#1 -Alias keyboard_key_pressed::colidx#0 = keyboard_key_pressed::$0 keyboard_key_pressed::colidx#1 -Alias keyboard_key_pressed::rowidx#0 = keyboard_key_pressed::$1 +Alias keyboard_matrix_read::return#0 = keyboard_matrix_read::row_pressed_bits#0 keyboard_matrix_read::return#3 keyboard_matrix_read::return#1 Alias keyboard_matrix_read::return#2 = keyboard_matrix_read::return#4 +Alias keyboard_key_pressed::colidx#0 = keyboard_key_pressed::colidx#1 Alias keyboard_key_pressed::return#0 = keyboard_key_pressed::$3 keyboard_key_pressed::return#6 keyboard_key_pressed::return#1 Alias keyboard_key_pressed::return#2 = keyboard_key_pressed::return#7 Alias keyboard_key_pressed::return#3 = keyboard_key_pressed::return#8 @@ -1215,7 +1209,7 @@ keyboard_matrix_read: { // [43] *((byte*)CIA1) = keyboard_matrix_row_bitmask[keyboard_matrix_read::rowid#0] -- _deref_pbuc1=pbuc2_derefidx_vbuxx lda keyboard_matrix_row_bitmask,x sta CIA1 - // ~CIA1->PORT_B + // char row_pressed_bits = ~CIA1->PORT_B // [44] keyboard_matrix_read::return#0 = ~ *((byte*)CIA1+OFFSET_STRUCT_MOS6526_CIA_PORT_B) -- vbuaa=_bnot__deref_pbuc1 lda CIA1+OFFSET_STRUCT_MOS6526_CIA_PORT_B eor #$ff diff --git a/src/test/ref/linegen.asm b/src/test/ref/linegen.asm index 35d31a10c..2ca391b70 100644 --- a/src/test/ref/linegen.asm +++ b/src/test/ref/linegen.asm @@ -251,23 +251,21 @@ lin16u_gen: { lda.z ampl+1 sbc.z min+1 sta.z ampl+1 - // divr16u(ampl, length-1, 0) + // word stepi = divr16u(ampl, length-1, 0) lda #<0 sta.z divr16u.rem sta.z divr16u.rem+1 jsr divr16u - // divr16u(ampl, length-1, 0) // word stepi = divr16u(ampl, length-1, 0) lda.z divr16u.return sta.z stepi lda.z divr16u.return+1 sta.z stepi+1 - // divr16u(0, length-1, rem16u) + // word stepf = divr16u(0, length-1, rem16u) lda #<0 sta.z divr16u.dividend sta.z divr16u.dividend+1 jsr divr16u - // divr16u(0, length-1, rem16u) // word stepf = divr16u(0, length-1, rem16u) // dword step = MAKELONG( stepi, stepf ) lda.z stepi diff --git a/src/test/ref/linegen.log b/src/test/ref/linegen.log index 10c51a76c..63ec5919f 100644 --- a/src/test/ref/linegen.log +++ b/src/test/ref/linegen.log @@ -1,4 +1,10 @@ Inlined call call __init +Eliminating unused variable with no statement memset::$2 +Eliminating unused variable with no statement lin16u_gen::$0 +Eliminating unused variable with no statement lin16u_gen::$2 +Eliminating unused variable with no statement lin16u_gen::$4 +Eliminating unused variable with no statement lin16u_gen::$5 +Eliminating unused variable with no statement lin16u_gen::$6 CONTROL FLOW GRAPH SSA @@ -240,8 +246,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -542,8 +547,7 @@ lin16u_gen: scope:[lin16u_gen] from main main::@4 main::@5 lin16u_gen::length#3 = phi( main/lin16u_gen::length#0, main::@4/lin16u_gen::length#1, main::@5/lin16u_gen::length#2 ) lin16u_gen::min#3 = phi( main/lin16u_gen::min#0, main::@4/lin16u_gen::min#1, main::@5/lin16u_gen::min#2 ) lin16u_gen::max#3 = phi( main/lin16u_gen::max#0, main::@4/lin16u_gen::max#1, main::@5/lin16u_gen::max#2 ) - lin16u_gen::$0 = lin16u_gen::max#3 - lin16u_gen::min#3 - lin16u_gen::ampl#0 = lin16u_gen::$0 + lin16u_gen::ampl#0 = lin16u_gen::max#3 - lin16u_gen::min#3 lin16u_gen::$1 = lin16u_gen::length#3 - 1 divr16u::dividend#1 = lin16u_gen::ampl#0 divr16u::divisor#0 = lin16u_gen::$1 @@ -557,9 +561,8 @@ lin16u_gen::@3: scope:[lin16u_gen] from lin16u_gen lin16u_gen::length#4 = phi( lin16u_gen/lin16u_gen::length#3 ) rem16u#17 = phi( lin16u_gen/rem16u#1 ) divr16u::return#5 = phi( lin16u_gen/divr16u::return#2 ) - lin16u_gen::$2 = divr16u::return#5 + lin16u_gen::stepi#0 = divr16u::return#5 rem16u#6 = rem16u#17 - lin16u_gen::stepi#0 = lin16u_gen::$2 lin16u_gen::$3 = lin16u_gen::length#4 - 1 divr16u::dividend#2 = 0 divr16u::divisor#1 = lin16u_gen::$3 @@ -574,13 +577,10 @@ lin16u_gen::@4: scope:[lin16u_gen] from lin16u_gen::@3 lin16u_gen::stepi#1 = phi( lin16u_gen::@3/lin16u_gen::stepi#0 ) rem16u#18 = phi( lin16u_gen::@3/rem16u#1 ) divr16u::return#6 = phi( lin16u_gen::@3/divr16u::return#3 ) - lin16u_gen::$4 = divr16u::return#6 + lin16u_gen::stepf#0 = divr16u::return#6 rem16u#7 = rem16u#18 - lin16u_gen::stepf#0 = lin16u_gen::$4 - lin16u_gen::$5 = lin16u_gen::stepi#1 dw= lin16u_gen::stepf#0 - lin16u_gen::step#0 = lin16u_gen::$5 - lin16u_gen::$6 = lin16u_gen::min#4 dw= 0 - lin16u_gen::val#0 = lin16u_gen::$6 + lin16u_gen::step#0 = lin16u_gen::stepi#1 dw= lin16u_gen::stepf#0 + lin16u_gen::val#0 = lin16u_gen::min#4 dw= 0 lin16u_gen::i#0 = 0 to:lin16u_gen::@1 lin16u_gen::@1: scope:[lin16u_gen] from lin16u_gen::@2 lin16u_gen::@4 @@ -729,13 +729,8 @@ word divr16u::return#4 word divr16u::return#5 word divr16u::return#6 void lin16u_gen(word lin16u_gen::min , word lin16u_gen::max , word* lin16u_gen::lintab , word lin16u_gen::length) -word~ lin16u_gen::$0 number~ lin16u_gen::$1 -word~ lin16u_gen::$2 number~ lin16u_gen::$3 -word~ lin16u_gen::$4 -dword~ lin16u_gen::$5 -dword~ lin16u_gen::$6 bool~ lin16u_gen::$7 word~ lin16u_gen::$8 dword~ lin16u_gen::$9 @@ -824,7 +819,6 @@ constant byte* main::str8[2] = " " void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -1161,7 +1155,7 @@ Adding number conversion cast (unumber) 0 in divr16u::rem#3 = 0 Adding number conversion cast (unumber) 1 in lin16u_gen::$3 = lin16u_gen::length#4 - 1 Adding number conversion cast (unumber) lin16u_gen::$3 in lin16u_gen::$3 = lin16u_gen::length#4 - (unumber)1 Adding number conversion cast (unumber) 0 in divr16u::dividend#2 = 0 -Adding number conversion cast (unumber) 0 in lin16u_gen::$6 = lin16u_gen::min#4 dw= 0 +Adding number conversion cast (unumber) 0 in lin16u_gen::val#0 = lin16u_gen::min#4 dw= 0 Successful SSA optimization PassNAddNumberTypeConversions Inlining cast memset::num#0 = (unumber)$3e8 Inlining cast memset::dst#0 = (byte*)memset::str#2 @@ -1294,7 +1288,6 @@ Alias memset::return#1 = memset::str#1 memset::return#3 memset::return#2 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -1336,20 +1329,16 @@ Alias print_char_cursor#34 = print_char_cursor#74 Alias print_char_cursor#35 = print_char_cursor#75 Alias print_line_cursor#19 = print_line_cursor#7 print_line_cursor#20 print_line_cursor#8 Alias print_char_cursor#36 = print_char_cursor#76 print_char_cursor#77 print_char_cursor#37 -Alias lin16u_gen::ampl#0 = lin16u_gen::$0 Alias divr16u::divisor#0 = lin16u_gen::$1 Alias divr16u::return#2 = divr16u::return#5 Alias lin16u_gen::length#3 = lin16u_gen::length#4 lin16u_gen::length#7 Alias lin16u_gen::min#3 = lin16u_gen::min#5 lin16u_gen::min#4 Alias lin16u_gen::lintab#6 = lin16u_gen::lintab#7 lin16u_gen::lintab#8 Alias rem16u#17 = rem16u#6 -Alias lin16u_gen::stepi#0 = lin16u_gen::$2 lin16u_gen::stepi#1 Alias divr16u::divisor#1 = lin16u_gen::$3 Alias divr16u::return#3 = divr16u::return#6 +Alias lin16u_gen::stepi#0 = lin16u_gen::stepi#1 Alias rem16u#18 = rem16u#7 -Alias lin16u_gen::stepf#0 = lin16u_gen::$4 -Alias lin16u_gen::step#0 = lin16u_gen::$5 -Alias lin16u_gen::val#0 = lin16u_gen::$6 Alias lin16u_gen::val#2 = lin16u_gen::val#3 Alias lin16u_gen::lintab#4 = lin16u_gen::lintab#5 Alias lin16u_gen::step#1 = lin16u_gen::step#2 @@ -4136,7 +4125,7 @@ lin16u_gen: { lda.z ampl+1 sbc.z min+1 sta.z ampl+1 - // divr16u(ampl, length-1, 0) + // word stepi = divr16u(ampl, length-1, 0) // [60] divr16u::dividend#1 = lin16u_gen::ampl#0 // [61] call divr16u // [107] phi from lin16u_gen to divr16u [phi:lin16u_gen->divr16u] @@ -4146,16 +4135,15 @@ lin16u_gen: { sta.z divr16u.rem sta.z divr16u.rem+1 jsr divr16u - // divr16u(ampl, length-1, 0) + // word stepi = divr16u(ampl, length-1, 0) // [62] divr16u::return#2 = divr16u::return#0 // lin16u_gen::@3 - // word stepi = divr16u(ampl, length-1, 0) // [63] lin16u_gen::stepi#0 = divr16u::return#2 -- vwuz1=vwuz2 lda.z divr16u.return sta.z stepi lda.z divr16u.return+1 sta.z stepi+1 - // divr16u(0, length-1, rem16u) + // word stepf = divr16u(0, length-1, rem16u) // [64] divr16u::rem#4 = rem16u#0 // [65] call divr16u // [107] phi from lin16u_gen::@3 to divr16u [phi:lin16u_gen::@3->divr16u] @@ -4165,10 +4153,9 @@ lin16u_gen: { sta.z divr16u.dividend+1 // [107] phi divr16u::rem#10 = divr16u::rem#4 [phi:lin16u_gen::@3->divr16u#1] -- register_copy jsr divr16u - // divr16u(0, length-1, rem16u) + // word stepf = divr16u(0, length-1, rem16u) // [66] divr16u::return#3 = divr16u::return#0 // lin16u_gen::@4 - // word stepf = divr16u(0, length-1, rem16u) // [67] lin16u_gen::stepf#0 = divr16u::return#3 // dword step = MAKELONG( stepi, stepf ) // [68] lin16u_gen::step#0 = lin16u_gen::stepi#0 dw= lin16u_gen::stepf#0 -- vduz1=vwuz2_dword_vwuz3 diff --git a/src/test/ref/liverange-2.log b/src/test/ref/liverange-2.log index 57efaefa7..8fb7b42ff 100644 --- a/src/test/ref/liverange-2.log +++ b/src/test/ref/liverange-2.log @@ -1,3 +1,4 @@ +Eliminating unused variable with no statement main::$0 CONTROL FLOW GRAPH SSA @@ -18,8 +19,7 @@ main::@3: scope:[main] from main::@2 main::@6 main::b#2 = phi( main::@2/main::b#4, main::@6/main::b#5 ) main::a#2 = phi( main::@2/main::a#4, main::@6/main::a#5 ) main::c#2 = phi( main::@2/main::c#0, main::@6/main::c#1 ) - main::$0 = main::c#2 + main::a#2 - main::ca#0 = main::$0 + main::ca#0 = main::c#2 + main::a#2 print::b#0 = main::b#2 print::ca#0 = main::ca#0 call print @@ -73,7 +73,6 @@ SYMBOL TABLE SSA constant byte* const SCREEN = (byte*)$400 void __start() void main() -byte~ main::$0 bool~ main::$2 bool~ main::$3 bool~ main::$4 @@ -110,7 +109,6 @@ byte print::ca#1 Simplifying constant pointer cast (byte*) 1024 Successful SSA optimization PassNCastSimplification -Alias main::ca#0 = main::$0 Alias main::c#2 = main::c#3 Alias main::a#2 = main::a#5 main::a#6 main::a#3 Alias main::b#2 = main::b#5 main::b#3 diff --git a/src/test/ref/liverange-3.log b/src/test/ref/liverange-3.log index 5c3a0428a..47926f7da 100644 --- a/src/test/ref/liverange-3.log +++ b/src/test/ref/liverange-3.log @@ -1,3 +1,4 @@ +Eliminating unused variable with no statement main::$0 CONTROL FLOW GRAPH SSA @@ -18,8 +19,7 @@ main::@3: scope:[main] from main::@2 main::@6 main::b#2 = phi( main::@2/main::b#4, main::@6/main::b#5 ) main::a#2 = phi( main::@2/main::a#4, main::@6/main::a#5 ) main::c#2 = phi( main::@2/main::c#0, main::@6/main::c#1 ) - main::$0 = main::c#2 + main::a#2 - main::ca#0 = main::$0 + main::ca#0 = main::c#2 + main::a#2 print::b#0 = main::b#2 print::ca#0 = main::ca#0 call print @@ -74,7 +74,6 @@ SYMBOL TABLE SSA constant byte* const SCREEN = (byte*)$400 void __start() void main() -byte~ main::$0 bool~ main::$2 bool~ main::$3 bool~ main::$4 @@ -116,7 +115,6 @@ Simplifying constant integer cast $3e7 Successful SSA optimization PassNCastSimplification Finalized unsigned number type (word) $3e7 Successful SSA optimization PassNFinalizeNumberTypeConversions -Alias main::ca#0 = main::$0 Alias main::c#2 = main::c#3 Alias main::a#2 = main::a#5 main::a#6 main::a#3 Alias main::b#2 = main::b#5 main::b#3 diff --git a/src/test/ref/liverange-4.log b/src/test/ref/liverange-4.log index 77f1168d2..a7b44011a 100644 --- a/src/test/ref/liverange-4.log +++ b/src/test/ref/liverange-4.log @@ -1,3 +1,4 @@ +Eliminating unused variable with no statement main::$0 CONTROL FLOW GRAPH SSA @@ -18,8 +19,7 @@ main::@3: scope:[main] from main::@2 main::@6 main::b#2 = phi( main::@2/main::b#4, main::@6/main::b#5 ) main::a#2 = phi( main::@2/main::a#4, main::@6/main::a#5 ) main::c#2 = phi( main::@2/main::c#0, main::@6/main::c#1 ) - main::$0 = main::c#2 + main::a#2 - main::ca#0 = main::$0 + main::ca#0 = main::c#2 + main::a#2 print::b#0 = main::b#2 print::ca#0 = main::ca#0 call print @@ -87,7 +87,6 @@ SYMBOL TABLE SSA constant byte* const SCREEN = (byte*)$400 void __start() void main() -byte~ main::$0 bool~ main::$2 bool~ main::$3 bool~ main::$4 @@ -131,7 +130,6 @@ byte print::ca#1 Simplifying constant pointer cast (byte*) 1024 Successful SSA optimization PassNCastSimplification -Alias main::ca#0 = main::$0 Alias main::c#2 = main::c#3 Alias main::a#2 = main::a#5 main::a#6 main::a#3 Alias main::b#2 = main::b#5 main::b#3 diff --git a/src/test/ref/liverange-5.log b/src/test/ref/liverange-5.log index 1d06f2056..cff4f1e18 100644 --- a/src/test/ref/liverange-5.log +++ b/src/test/ref/liverange-5.log @@ -1,3 +1,4 @@ +Eliminating unused variable with no statement main::$0 CONTROL FLOW GRAPH SSA @@ -18,8 +19,7 @@ main::@3: scope:[main] from main::@2 main::@6 main::b#2 = phi( main::@2/main::b#4, main::@6/main::b#5 ) main::a#2 = phi( main::@2/main::a#4, main::@6/main::a#5 ) main::c#2 = phi( main::@2/main::c#0, main::@6/main::c#1 ) - main::$0 = main::c#2 + main::a#2 - main::ca#0 = main::$0 + main::ca#0 = main::c#2 + main::a#2 print::b#0 = main::b#2 print::ca#0 = main::ca#0 call print @@ -88,7 +88,6 @@ SYMBOL TABLE SSA constant byte* const SCREEN = (byte*)$400 void __start() void main() -byte~ main::$0 bool~ main::$2 bool~ main::$3 bool~ main::$4 @@ -137,7 +136,6 @@ Simplifying constant integer cast $3e7 Successful SSA optimization PassNCastSimplification Finalized unsigned number type (word) $3e7 Successful SSA optimization PassNFinalizeNumberTypeConversions -Alias main::ca#0 = main::$0 Alias main::c#2 = main::c#3 Alias main::a#2 = main::a#5 main::a#6 main::a#3 Alias main::b#2 = main::b#5 main::b#3 diff --git a/src/test/ref/liverange-problem-0.asm b/src/test/ref/liverange-problem-0.asm index 3a8c05a64..0ab92644d 100644 --- a/src/test/ref/liverange-problem-0.asm +++ b/src/test/ref/liverange-problem-0.asm @@ -15,19 +15,20 @@ .label SCREEN_2 = 6 .segment Code __start: { - // malloc() + // byte* SCREEN_1 = malloc() lda #<$400 sta.z MEM lda #>$400 sta.z MEM+1 jsr malloc - // malloc() + // byte* SCREEN_1 = malloc() lda.z malloc.return sta.z malloc.return_1 lda.z malloc.return+1 sta.z malloc.return_1+1 + // byte* SCREEN_2 = malloc() jsr malloc - // malloc() + // byte* SCREEN_2 = malloc() jsr main rts } diff --git a/src/test/ref/liverange-problem-0.log b/src/test/ref/liverange-problem-0.log index ff6e12d36..6243614a4 100644 --- a/src/test/ref/liverange-problem-0.log +++ b/src/test/ref/liverange-problem-0.log @@ -1,4 +1,6 @@ Inlined call call __init +Eliminating unused variable with no statement __start::__init1_$0 +Eliminating unused variable with no statement __start::__init1_$1 CONTROL FLOW GRAPH SSA @@ -38,9 +40,8 @@ __start::__init1: scope:[__start] from __start __start::@2: scope:[__start] from __start::__init1 MEM#8 = phi( __start::__init1/MEM#1 ) malloc::return#5 = phi( __start::__init1/malloc::return#2 ) - __start::__init1_$0 = malloc::return#5 + SCREEN_1#0 = malloc::return#5 MEM#3 = MEM#8 - SCREEN_1#0 = __start::__init1_$0 call malloc malloc::return#3 = malloc::return#1 to:__start::@3 @@ -48,9 +49,8 @@ __start::@3: scope:[__start] from __start::@2 SCREEN_1#6 = phi( __start::@2/SCREEN_1#0 ) MEM#9 = phi( __start::@2/MEM#1 ) malloc::return#6 = phi( __start::@2/malloc::return#3 ) - __start::__init1_$1 = malloc::return#6 + SCREEN_2#0 = malloc::return#6 MEM#4 = MEM#9 - SCREEN_2#0 = __start::__init1_$1 to:__start::@1 __start::@1: scope:[__start] from __start::@3 MEM#12 = phi( __start::@3/MEM#4 ) @@ -104,8 +104,6 @@ byte* SCREEN_2#3 byte* SCREEN_2#4 byte* SCREEN_2#5 void __start() -byte*~ __start::__init1_$0 -byte*~ __start::__init1_$1 void main() byte* malloc() byte* malloc::return @@ -134,10 +132,10 @@ Alias malloc::return#0 = malloc::return#4 malloc::return#1 Alias MEM#0 = MEM#7 MEM#1 Alias malloc::return#2 = malloc::return#5 Alias MEM#3 = MEM#8 -Alias SCREEN_1#0 = __start::__init1_$0 SCREEN_1#6 SCREEN_1#4 SCREEN_1#5 SCREEN_1#3 SCREEN_1#1 Alias malloc::return#3 = malloc::return#6 +Alias SCREEN_1#0 = SCREEN_1#6 SCREEN_1#4 SCREEN_1#5 SCREEN_1#3 SCREEN_1#1 Alias MEM#10 = MEM#4 MEM#9 MEM#12 MEM#11 MEM#5 -Alias SCREEN_2#0 = __start::__init1_$1 SCREEN_2#4 SCREEN_2#5 SCREEN_2#3 SCREEN_2#1 +Alias SCREEN_2#0 = SCREEN_2#4 SCREEN_2#5 SCREEN_2#3 SCREEN_2#1 Successful SSA optimization Pass2AliasElimination Identical Phi Values SCREEN_1#2 SCREEN_1#0 Identical Phi Values SCREEN_2#2 SCREEN_2#0 @@ -457,7 +455,7 @@ Score: 98 __start: { // [1] phi from __start to __start::__init1 [phi:__start->__start::__init1] // __start::__init1 - // malloc() + // byte* SCREEN_1 = malloc() // [2] call malloc // [11] phi from __start::__init1 to malloc [phi:__start::__init1->malloc] // [11] phi MEM#6 = (byte*) 1024 [phi:__start::__init1->malloc#0] -- pbuz1=pbuc1 @@ -466,7 +464,7 @@ __start: { lda #>$400 sta.z MEM+1 jsr malloc - // malloc() + // byte* SCREEN_1 = malloc() // [3] malloc::return#2 = malloc::return#0 -- pbuz1=pbuz2 lda.z malloc.return sta.z malloc.return_1 @@ -474,11 +472,12 @@ __start: { sta.z malloc.return_1+1 // __start::@2 // [4] SCREEN_1#0 = malloc::return#2 + // byte* SCREEN_2 = malloc() // [5] call malloc // [11] phi from __start::@2 to malloc [phi:__start::@2->malloc] // [11] phi MEM#6 = MEM#0 [phi:__start::@2->malloc#0] -- register_copy jsr malloc - // malloc() + // byte* SCREEN_2 = malloc() // [6] malloc::return#3 = malloc::return#0 // __start::@3 // [7] SCREEN_2#0 = malloc::return#3 diff --git a/src/test/ref/loop-memset-min.log b/src/test/ref/loop-memset-min.log index f682cabea..128cecad4 100644 --- a/src/test/ref/loop-memset-min.log +++ b/src/test/ref/loop-memset-min.log @@ -1,4 +1,5 @@ Inlined call call __init +Eliminating unused variable with no statement memset::$2 CONTROL FLOW GRAPH SSA @@ -34,8 +35,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -81,7 +81,6 @@ void main() void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -135,7 +134,6 @@ Alias memset::return#1 = memset::str#1 memset::return#3 memset::return#2 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 diff --git a/src/test/ref/loophead-problem-2.asm b/src/test/ref/loophead-problem-2.asm index e046b7594..bc2ca5765 100644 --- a/src/test/ref/loophead-problem-2.asm +++ b/src/test/ref/loophead-problem-2.asm @@ -12,11 +12,10 @@ .segment Code main: { .label screen = $400 - // scan_for_lowest() - jsr scan_for_lowest - // scan_for_lowest() - lda.z scan_for_lowest.lowest // char hit_check=scan_for_lowest() + jsr scan_for_lowest + // char hit_check=scan_for_lowest() + lda.z scan_for_lowest.lowest // screen[0] = hit_check sta screen // BYTE0(ball_y[hit_check]) diff --git a/src/test/ref/loophead-problem-2.log b/src/test/ref/loophead-problem-2.log index c7b00bdc1..0a52fcd37 100644 --- a/src/test/ref/loophead-problem-2.log +++ b/src/test/ref/loophead-problem-2.log @@ -1,3 +1,4 @@ +Eliminating unused variable with no statement main::$0 CONTROL FLOW GRAPH SSA @@ -8,8 +9,7 @@ main: scope:[main] from __start to:main::@1 main::@1: scope:[main] from main scan_for_lowest::return#3 = phi( main/scan_for_lowest::return#0 ) - main::$0 = scan_for_lowest::return#3 - main::hit_check#0 = main::$0 + main::hit_check#0 = scan_for_lowest::return#3 main::screen[0] = main::hit_check#0 main::$3 = main::hit_check#0 * SIZEOF_SIGNED_WORD main::$1 = byte0 ball_y[main::$3] @@ -81,7 +81,6 @@ constant byte SIZEOF_SIGNED_WORD = 2 void __start() constant signed word* ball_y[8] = { $32, $64, -$c8, $c, -$64, $4b, 0, -$79 } void main() -byte~ main::$0 byte~ main::$1 byte~ main::$2 byte~ main::$3 @@ -138,10 +137,9 @@ Finalized unsigned number type (byte) 2 Finalized unsigned number type (byte) 3 Finalized unsigned number type (byte) 8 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inversing boolean not [22] scan_for_lowest::$2 = ball_y[scan_for_lowest::$3] >= scan_for_lowest::height#2 from [21] scan_for_lowest::$1 = ball_y[scan_for_lowest::$3] < scan_for_lowest::height#2 +Inversing boolean not [21] scan_for_lowest::$2 = ball_y[scan_for_lowest::$3] >= scan_for_lowest::height#2 from [20] scan_for_lowest::$1 = ball_y[scan_for_lowest::$3] < scan_for_lowest::height#2 Successful SSA optimization Pass2UnaryNotSimplification Alias scan_for_lowest::return#0 = scan_for_lowest::return#3 -Alias main::hit_check#0 = main::$0 Alias scan_for_lowest::i#2 = scan_for_lowest::i#3 scan_for_lowest::i#5 scan_for_lowest::lowest#1 Alias scan_for_lowest::height#2 = scan_for_lowest::height#3 Alias scan_for_lowest::lowest#2 = scan_for_lowest::lowest#5 scan_for_lowest::lowest#3 scan_for_lowest::return#1 scan_for_lowest::return#4 scan_for_lowest::return#2 @@ -149,7 +147,7 @@ Successful SSA optimization Pass2AliasElimination Alias candidate removed (phi-usage) scan_for_lowest::i#2 = scan_for_lowest::i#4 Identical Phi Values scan_for_lowest::i#4 scan_for_lowest::i#2 Successful SSA optimization Pass2IdenticalPhiElimination -Identified duplicate assignment right side [9] main::$4 = main::hit_check#0 * SIZEOF_SIGNED_WORD +Identified duplicate assignment right side [8] main::$4 = main::hit_check#0 * SIZEOF_SIGNED_WORD Successful SSA optimization Pass2DuplicateRValueIdentification Simple Condition scan_for_lowest::$0 [16] if(scan_for_lowest::i#2<8) goto scan_for_lowest::@2 Simple Condition scan_for_lowest::$2 [19] if(ball_y[scan_for_lowest::$3]>=scan_for_lowest::height#2) goto scan_for_lowest::@4 @@ -554,15 +552,14 @@ Score: 770 // main main: { .label screen = $400 - // scan_for_lowest() + // char hit_check=scan_for_lowest() // [1] call scan_for_lowest // [11] phi from main to scan_for_lowest [phi:main->scan_for_lowest] jsr scan_for_lowest - // scan_for_lowest() + // char hit_check=scan_for_lowest() // [2] scan_for_lowest::return#0 = scan_for_lowest::lowest#2 -- vbuaa=vbuz1 lda.z scan_for_lowest.lowest // main::@1 - // char hit_check=scan_for_lowest() // [3] main::hit_check#0 = scan_for_lowest::return#0 // screen[0] = hit_check // [4] *main::screen = main::hit_check#0 -- _deref_pbuc1=vbuaa diff --git a/src/test/ref/loophead-problem-3.asm b/src/test/ref/loophead-problem-3.asm index 9113cc5ff..095658e99 100644 --- a/src/test/ref/loophead-problem-3.asm +++ b/src/test/ref/loophead-problem-3.asm @@ -16,9 +16,8 @@ main: { .label result = 2 .label kaputt = $a - // mul16u(4,123) + // dword result = mul16u(4,123) jsr mul16u - // mul16u(4,123) // dword result = mul16u(4,123) // word kaputt = WORD0(result) lda.z result diff --git a/src/test/ref/loophead-problem-3.log b/src/test/ref/loophead-problem-3.log index 3a1883d18..3f550a3b5 100644 --- a/src/test/ref/loophead-problem-3.log +++ b/src/test/ref/loophead-problem-3.log @@ -1,4 +1,6 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx +Eliminating unused variable with no statement main::$0 +Eliminating unused variable with no statement main::$1 CONTROL FLOW GRAPH SSA @@ -60,10 +62,8 @@ main: scope:[main] from __start to:main::@1 main::@1: scope:[main] from main mul16u::return#4 = phi( main/mul16u::return#2 ) - main::$0 = mul16u::return#4 - main::result#0 = main::$0 - main::$1 = word0 main::result#0 - main::kaputt#0 = main::$1 + main::result#0 = mul16u::return#4 + main::kaputt#0 = word0 main::result#0 main::$2 = byte0 main::kaputt#0 *BORDER_COLOR = main::$2 main::$3 = byte1 main::kaputt#0 @@ -88,8 +88,6 @@ constant byte* const BG_COLOR = (byte*)$d021 constant byte* const BORDER_COLOR = (byte*)$d020 void __start() void main() -dword~ main::$0 -word~ main::$1 byte~ main::$2 byte~ main::$3 word main::kaputt @@ -177,8 +175,6 @@ Alias mul16u::a#0 = mul16u::$5 Alias mul16u::mb#1 = mul16u::$6 Alias mul16u::res#1 = mul16u::$4 Alias mul16u::return#2 = mul16u::return#4 -Alias main::result#0 = main::$0 -Alias main::kaputt#0 = main::$1 Successful SSA optimization Pass2AliasElimination Alias mul16u::a#2 = mul16u::a#4 Alias mul16u::mb#2 = mul16u::mb#3 @@ -595,14 +591,13 @@ Score: 1414 main: { .label result = 2 .label kaputt = $a - // mul16u(4,123) + // dword result = mul16u(4,123) // [1] call mul16u // [10] phi from main to mul16u [phi:main->mul16u] jsr mul16u - // mul16u(4,123) + // dword result = mul16u(4,123) // [2] mul16u::return#2 = mul16u::res#2 // main::@1 - // dword result = mul16u(4,123) // [3] main::result#0 = mul16u::return#2 // word kaputt = WORD0(result) // [4] main::kaputt#0 = word0 main::result#0 -- vwuz1=_word0_vduz2 diff --git a/src/test/ref/makelong-0.log b/src/test/ref/makelong-0.log index caa710384..6a987146b 100644 --- a/src/test/ref/makelong-0.log +++ b/src/test/ref/makelong-0.log @@ -1,3 +1,4 @@ +Eliminating unused variable with no statement main::$2 CONTROL FLOW GRAPH SSA @@ -23,8 +24,7 @@ main::@3: scope:[main] from main::@2 main::@4 main::@4: scope:[main] from main::@3 main::lo#3 = phi( main::@3/main::lo#5 ) main::hi#3 = phi( main::@3/main::hi#2 ) - main::$2 = main::hi#3 dw= main::lo#3 - main::i#0 = main::$2 + main::i#0 = main::hi#3 dw= main::lo#3 *main::SCREEN = main::i#0 main::hi#1 = ++ main::hi#3 to:main::@3 @@ -51,7 +51,6 @@ void __start() void main() bool~ main::$0 bool~ main::$1 -dword~ main::$2 constant dword* const main::SCREEN = (word*)$400 word main::hi word main::hi#0 @@ -82,7 +81,6 @@ Successful SSA optimization PassNFinalizeNumberTypeConversions Alias main::lo#2 = main::lo#6 Alias main::hi#2 = main::hi#3 Alias main::lo#3 = main::lo#5 main::lo#4 -Alias main::i#0 = main::$2 Successful SSA optimization Pass2AliasElimination Identical Phi Values main::lo#3 main::lo#2 Successful SSA optimization Pass2IdenticalPhiElimination diff --git a/src/test/ref/makeword-0.log b/src/test/ref/makeword-0.log index ac91a7385..cf89d391c 100644 --- a/src/test/ref/makeword-0.log +++ b/src/test/ref/makeword-0.log @@ -1,3 +1,4 @@ +Eliminating unused variable with no statement main::$2 CONTROL FLOW GRAPH SSA @@ -23,8 +24,7 @@ main::@3: scope:[main] from main::@2 main::@4 main::@4: scope:[main] from main::@3 main::lo#3 = phi( main::@3/main::lo#5 ) main::hi#3 = phi( main::@3/main::hi#2 ) - main::$2 = main::hi#3 w= main::lo#3 - main::i#0 = main::$2 + main::i#0 = main::hi#3 w= main::lo#3 *main::SCREEN = main::i#0 main::hi#1 = ++ main::hi#3 to:main::@3 @@ -51,7 +51,6 @@ void __start() void main() bool~ main::$0 bool~ main::$1 -word~ main::$2 constant word* const main::SCREEN = (word*)$400 byte main::hi byte main::hi#0 @@ -82,7 +81,6 @@ Successful SSA optimization PassNFinalizeNumberTypeConversions Alias main::lo#2 = main::lo#6 Alias main::hi#2 = main::hi#3 Alias main::lo#3 = main::lo#5 main::lo#4 -Alias main::i#0 = main::$2 Successful SSA optimization Pass2AliasElimination Identical Phi Values main::lo#3 main::lo#2 Successful SSA optimization Pass2IdenticalPhiElimination diff --git a/src/test/ref/makeword-1.log b/src/test/ref/makeword-1.log index 8aeb5c7ee..bf470f6a4 100644 --- a/src/test/ref/makeword-1.log +++ b/src/test/ref/makeword-1.log @@ -1,3 +1,4 @@ +Eliminating unused variable with no statement main::$0 CONTROL FLOW GRAPH SSA diff --git a/src/test/ref/memcpy-0.log b/src/test/ref/memcpy-0.log index f6f179d33..527c9fa63 100644 --- a/src/test/ref/memcpy-0.log +++ b/src/test/ref/memcpy-0.log @@ -1,5 +1,6 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call main::$0 = call toD018 SCREEN_COPY CHARSET +Eliminating unused variable with no statement memcpy::$0 CONTROL FLOW GRAPH SSA @@ -11,8 +12,7 @@ memcpy: scope:[memcpy] from main::@1 main::@2 memcpy::src#0 = ((byte*)) memcpy::source#2 memcpy::dst#0 = ((byte*)) memcpy::destination#2 memcpy::$2 = (byte*)memcpy::source#2 - memcpy::$0 = memcpy::$2 + memcpy::num#2 - memcpy::src_end#0 = memcpy::$0 + memcpy::src_end#0 = memcpy::$2 + memcpy::num#2 to:memcpy::@1 memcpy::@1: scope:[memcpy] from memcpy memcpy::@2 memcpy::destination#4 = phi( memcpy/memcpy::destination#2, memcpy::@2/memcpy::destination#5 ) @@ -132,7 +132,6 @@ byte* main::toD0181_screen byte* main::toD0181_screen#0 byte* main::toD0181_screen#1 void* memcpy(void* memcpy::destination , void* memcpy::source , word memcpy::num) -byte*~ memcpy::$0 bool~ memcpy::$1 byte*~ memcpy::$2 void* memcpy::destination @@ -213,7 +212,6 @@ Inferred type updated to word in main::toD0181_$1 = main::toD0181_$0 * 4 Inferred type updated to byte in main::toD0181_$4 = main::toD0181_$3 / 4 Inferred type updated to byte in main::toD0181_$5 = main::toD0181_$4 & $f Inferred type updated to byte in main::toD0181_$6 = main::toD0181_$2 | main::toD0181_$5 -Alias memcpy::src_end#0 = memcpy::$0 Alias memcpy::src#2 = memcpy::src#3 Alias memcpy::dst#2 = memcpy::dst#3 Alias memcpy::src_end#1 = memcpy::src_end#2 diff --git a/src/test/ref/memcpy-1.log b/src/test/ref/memcpy-1.log index 5be4e08a2..bc3ecc335 100644 --- a/src/test/ref/memcpy-1.log +++ b/src/test/ref/memcpy-1.log @@ -1,3 +1,4 @@ +Eliminating unused variable with no statement memcpy::$0 CONTROL FLOW GRAPH SSA @@ -9,8 +10,7 @@ memcpy: scope:[memcpy] from main::@4 main::@5 memcpy::src#0 = ((byte*)) memcpy::source#2 memcpy::dst#0 = ((byte*)) memcpy::destination#2 memcpy::$2 = (byte*)memcpy::source#2 - memcpy::$0 = memcpy::$2 + memcpy::num#2 - memcpy::src_end#0 = memcpy::$0 + memcpy::src_end#0 = memcpy::$2 + memcpy::num#2 to:memcpy::@1 memcpy::@1: scope:[memcpy] from memcpy memcpy::@2 memcpy::destination#4 = phi( memcpy/memcpy::destination#2, memcpy::@2/memcpy::destination#5 ) @@ -136,7 +136,6 @@ byte* main::sc2#0 byte* main::sc2#1 byte* main::sc2#2 void* memcpy(void* memcpy::destination , void* memcpy::source , word memcpy::num) -byte*~ memcpy::$0 bool~ memcpy::$1 byte*~ memcpy::$2 void* memcpy::destination @@ -199,7 +198,6 @@ Finalized unsigned number type (byte) 7 Finalized unsigned number type (byte) $32 Finalized unsigned number type (byte) 5 Successful SSA optimization PassNFinalizeNumberTypeConversions -Alias memcpy::src_end#0 = memcpy::$0 Alias memcpy::src#2 = memcpy::src#3 Alias memcpy::dst#2 = memcpy::dst#3 Alias memcpy::src_end#1 = memcpy::src_end#2 diff --git a/src/test/ref/min-fmul-16.asm b/src/test/ref/min-fmul-16.asm index 9915283c6..96bccb95c 100644 --- a/src/test/ref/min-fmul-16.asm +++ b/src/test/ref/min-fmul-16.asm @@ -34,9 +34,8 @@ main: { bne __b2 // (*BORDER_COLOR)++; inc BORDER_COLOR - // mulf16u(a, b) - jsr mulf16u // dword r = mulf16u(a, b) + jsr mulf16u // (*BORDER_COLOR)--; dec BORDER_COLOR // print_ulong(r) diff --git a/src/test/ref/min-fmul-16.log b/src/test/ref/min-fmul-16.log index f0f888238..6b06d83a1 100644 --- a/src/test/ref/min-fmul-16.log +++ b/src/test/ref/min-fmul-16.log @@ -1,4 +1,5 @@ Inlined call call __init +Eliminating unused variable with no statement main::$3 CONTROL FLOW GRAPH SSA @@ -151,8 +152,7 @@ main::@5: scope:[main] from main::@3 print_screen#16 = phi( main::@3/print_screen#18 ) print_char_cursor#39 = phi( main::@3/print_char_cursor#43 ) mulf16u::return#3 = phi( main::@3/mulf16u::return#0 ) - main::$3 = mulf16u::return#3 - main::r#0 = main::$3 + main::r#0 = mulf16u::return#3 *BORDER_COLOR = -- *BORDER_COLOR print_ulong::dw#0 = main::r#0 call print_ulong @@ -343,7 +343,6 @@ constant byte* SCREEN = (byte*)$400 void __start() void main() bool~ main::$1 -dword~ main::$3 constant word main::a = $4d2 constant word main::b = $929 dword main::r @@ -628,8 +627,8 @@ Finalized unsigned number type (byte) 1 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in print_uchar::$2 = print_uchar::b#3 & $f Inferred type updated to byte in mulf_init::$1 = mulf_init::c#1 & 1 -Inversing boolean not [103] mulf_init::$3 = mulf_init::$1 != 0 from [102] mulf_init::$2 = mulf_init::$1 == 0 -Inversing boolean not [131] mulf_init::$10 = mulf_init::x_255#1 != 0 from [130] mulf_init::$9 = mulf_init::x_255#1 == 0 +Inversing boolean not [102] mulf_init::$3 = mulf_init::$1 != 0 from [101] mulf_init::$2 = mulf_init::$1 == 0 +Inversing boolean not [130] mulf_init::$10 = mulf_init::x_255#1 != 0 from [129] mulf_init::$9 = mulf_init::x_255#1 == 0 Successful SSA optimization Pass2UnaryNotSimplification Alias print_uchar::b#0 = print_uint::$0 Alias print_uint::w#2 = print_uint::w#3 @@ -653,7 +652,6 @@ Alias print_char_cursor#39 = print_char_cursor#43 print_char_cursor#45 Alias print_screen#12 = print_screen#18 print_screen#19 print_screen#16 Alias print_line_cursor#12 = print_line_cursor#18 print_line_cursor#19 print_line_cursor#16 Alias mulf16u::return#0 = mulf16u::return#3 -Alias main::r#0 = main::$3 Alias print_char_cursor#13 = print_char_cursor#31 Alias print_screen#2 = print_screen#8 Alias print_line_cursor#2 = print_line_cursor#8 @@ -2064,12 +2062,11 @@ main: { // (*BORDER_COLOR)++; // [5] *BORDER_COLOR = ++ *BORDER_COLOR -- _deref_pbuc1=_inc__deref_pbuc1 inc BORDER_COLOR - // mulf16u(a, b) + // dword r = mulf16u(a, b) // [6] call mulf16u jsr mulf16u // [7] mulf16u::return#0 = mulf16u::return#1 // main::@5 - // dword r = mulf16u(a, b) // [8] main::r#0 = mulf16u::return#0 // (*BORDER_COLOR)--; // [9] *BORDER_COLOR = -- *BORDER_COLOR -- _deref_pbuc1=_dec__deref_pbuc1 diff --git a/src/test/ref/multiplexer-irq/simple-multiplexer-irq.log b/src/test/ref/multiplexer-irq/simple-multiplexer-irq.log index 5de9eb85b..49502a375 100644 --- a/src/test/ref/multiplexer-irq/simple-multiplexer-irq.log +++ b/src/test/ref/multiplexer-irq/simple-multiplexer-irq.log @@ -5,6 +5,7 @@ Inlined call call plexFreePrepare Inlined call call plexFreeAdd plexShowSprite::ypos Inlined call plex_irq::$2 = call plexFreeNextYpos Inlined call call __init +Eliminating unused variable with no statement plexShowSprite::$0 CONTROL FLOW GRAPH SSA @@ -101,8 +102,7 @@ plexSort::@return: scope:[plexSort] from plexSort::plexFreePrepare1_@2 void plexShowSprite() plexShowSprite: scope:[plexShowSprite] from plex_irq::@3 - plexShowSprite::$0 = plex_sprite_idx * 2 - plexShowSprite::plex_sprite_idx2#0 = plexShowSprite::$0 + plexShowSprite::plex_sprite_idx2#0 = plex_sprite_idx * 2 plexShowSprite::ypos#0 = PLEX_YPOS[PLEX_SORTED_IDX[plex_show_idx]] SPRITES_YPOS[plexShowSprite::plex_sprite_idx2#0] = plexShowSprite::ypos#0 plexShowSprite::plexFreeAdd1_ypos#0 = plexShowSprite::ypos#0 @@ -416,7 +416,6 @@ byte* plexInit::screen byte* plexInit::screen#0 byte* plexInit::screen#1 void plexShowSprite() -number~ plexShowSprite::$0 byte~ plexShowSprite::$10 byte~ plexShowSprite::$2 bool~ plexShowSprite::$3 @@ -512,8 +511,7 @@ Adding number conversion cast (unumber) 0 in plex_sprite_idx = 0 Adding number conversion cast (unumber) 1 in plex_sprite_msb = 1 Adding number conversion cast (unumber) 0 in PLEX_FREE_YPOS[plexSort::plexFreePrepare1_s#2] = 0 Adding number conversion cast (unumber) 0 in plex_free_next = 0 -Adding number conversion cast (unumber) 2 in plexShowSprite::$0 = plex_sprite_idx * 2 -Adding number conversion cast (unumber) plexShowSprite::$0 in plexShowSprite::$0 = plex_sprite_idx * (unumber)2 +Adding number conversion cast (unumber) 2 in plexShowSprite::plex_sprite_idx2#0 = plex_sprite_idx * 2 Adding number conversion cast (unumber) $16 in plexShowSprite::plexFreeAdd1_$0 = plexShowSprite::plexFreeAdd1_ypos#1 + $16 Adding number conversion cast (unumber) plexShowSprite::plexFreeAdd1_$0 in plexShowSprite::plexFreeAdd1_$0 = plexShowSprite::plexFreeAdd1_ypos#1 + (unumber)$16 Adding number conversion cast (unumber) 1 in plexShowSprite::plexFreeAdd1_$1 = plex_free_next + 1 @@ -651,7 +649,6 @@ Finalized unsigned number type (word) $3f8 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in plexSort::$1 = plexSort::m#2 + 1 Inferred type updated to byte in plexSort::$4 = plexSort::s#3 + 1 -Inferred type updated to byte in plexShowSprite::$0 = plex_sprite_idx * 2 Inferred type updated to byte in plexShowSprite::plexFreeAdd1_$0 = plexShowSprite::plexFreeAdd1_ypos#1 + $16 Inferred type updated to byte in plexShowSprite::plexFreeAdd1_$1 = plex_free_next + 1 Inferred type updated to byte in plexShowSprite::plexFreeAdd1_$2 = plexShowSprite::plexFreeAdd1_$1 & 7 @@ -660,7 +657,7 @@ Inferred type updated to byte in plexShowSprite::$4 = plex_sprite_idx + 1 Inferred type updated to byte in plexShowSprite::$5 = plexShowSprite::$4 & 7 Inferred type updated to byte in plex_irq::$4 = *RASTER + 2 Inversing boolean not [18] plexSort::$3 = plexSort::nxt_y#0 >= PLEX_YPOS[PLEX_SORTED_IDX[plexSort::m#2]] from [17] plexSort::$2 = plexSort::nxt_y#0 < PLEX_YPOS[PLEX_SORTED_IDX[plexSort::m#2]] -Inversing boolean not [77] plexShowSprite::$7 = plex_sprite_msb != 0 from [76] plexShowSprite::$6 = plex_sprite_msb == 0 +Inversing boolean not [76] plexShowSprite::$7 = plex_sprite_msb != 0 from [75] plexShowSprite::$6 = plex_sprite_msb == 0 Successful SSA optimization Pass2UnaryNotSimplification Alias candidate removed (volatile)PLEX_SCREEN_PTR = plexInit::plexSetScreen1_$0 Alias candidate removed (volatile)plex_free_next = plexShowSprite::plexFreeAdd1_$2 @@ -672,8 +669,8 @@ Alias plexSort::nxt_idx#0 = plexSort::nxt_idx#3 Alias plexSort::s#1 = plexSort::s#4 Alias plexSort::nxt_idx#1 = plexSort::nxt_idx#2 Alias plexSort::m#5 = plexSort::m#6 -Alias plexShowSprite::plex_sprite_idx2#0 = plexShowSprite::$0 plexShowSprite::plex_sprite_idx2#2 plexShowSprite::plex_sprite_idx2#1 Alias plexShowSprite::plexFreeAdd1_ypos#0 = plexShowSprite::ypos#0 plexShowSprite::plexFreeAdd1_ypos#1 +Alias plexShowSprite::plex_sprite_idx2#0 = plexShowSprite::plex_sprite_idx2#2 plexShowSprite::plex_sprite_idx2#1 Alias plex_irq::plexFreeNextYpos1_return#0 = plex_irq::plexFreeNextYpos1_return#2 plex_irq::plexFreeNextYpos1_return#1 plex_irq::plexFreeNextYpos1_return#3 plex_irq::$2 plex_irq::rasterY#1 plex_irq::rasterY#3 plex_irq::rasterY#2 Alias loop::sin_idx#2 = loop::sin_idx#4 loop::y_idx#0 Alias loop::sin_idx#3 = loop::sin_idx#5 @@ -691,7 +688,7 @@ Identical Phi Values loop::sin_idx#3 loop::sin_idx#2 Successful SSA optimization Pass2IdenticalPhiElimination Identical Phi Values plexSort::m#3 plexSort::m#2 Successful SSA optimization Pass2IdenticalPhiElimination -Identified duplicate assignment right side [64] plexShowSprite::$10 = plexShowSprite::xpos_idx#0 * SIZEOF_WORD +Identified duplicate assignment right side [63] plexShowSprite::$10 = plexShowSprite::xpos_idx#0 * SIZEOF_WORD Successful SSA optimization Pass2DuplicateRValueIdentification Simple Condition plexInit::$1 [8] if(plexInit::i#1!=rangelast(0,PLEX_COUNT-1)) goto plexInit::@1 Simple Condition plexSort::$3 [16] if(plexSort::nxt_y#0>=PLEX_YPOS[PLEX_SORTED_IDX[plexSort::m#2]]) goto plexSort::@2 diff --git a/src/test/ref/multiply-1.log b/src/test/ref/multiply-1.log index 5314a87dd..c5e06cd6b 100644 --- a/src/test/ref/multiply-1.log +++ b/src/test/ref/multiply-1.log @@ -1,13 +1,13 @@ +Eliminating unused variable with no statement main::$0 +Eliminating unused variable with no statement main::$1 CONTROL FLOW GRAPH SSA void main() main: scope:[main] from __start - main::$0 = main::c1 * 2 - main::c2#0 = main::$0 + main::c2#0 = main::c1 * 2 main::c2#1 = ++ main::c2#0 - main::$1 = main::c1 * main::c2#1 - main::c3#0 = main::$1 + main::c3#0 = main::c1 * main::c2#1 SCREEN[0] = main::c3#0 to:main::@return main::@return: scope:[main] from main @@ -28,8 +28,6 @@ SYMBOL TABLE SSA constant byte* const SCREEN = (byte*)$400 void __start() void main() -number~ main::$0 -byte~ main::$1 constant byte main::c1 = 4 byte main::c2 byte main::c2#0 @@ -37,8 +35,7 @@ byte main::c2#1 byte main::c3 byte main::c3#0 -Adding number conversion cast (unumber) 2 in main::$0 = main::c1 * 2 -Adding number conversion cast (unumber) main::$0 in main::$0 = main::c1 * (unumber)2 +Adding number conversion cast (unumber) 2 in main::c2#0 = main::c1 * 2 Adding number conversion cast (unumber) 0 in SCREEN[0] = main::c3#0 Successful SSA optimization PassNAddNumberTypeConversions Simplifying constant pointer cast (byte*) 1024 @@ -48,10 +45,6 @@ Successful SSA optimization PassNCastSimplification Finalized unsigned number type (byte) 2 Finalized unsigned number type (byte) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to byte in main::$0 = main::c1 * 2 -Alias main::c2#0 = main::$0 -Alias main::c3#0 = main::$1 -Successful SSA optimization Pass2AliasElimination Constant right-side identified [0] main::c2#0 = main::c1 * 2 Successful SSA optimization Pass2ConstantRValueConsolidation Constant main::c2#0 = main::c1*2 diff --git a/src/test/ref/multiply-16bit-const.log b/src/test/ref/multiply-16bit-const.log index 16b7860f6..e422e49d0 100644 --- a/src/test/ref/multiply-16bit-const.log +++ b/src/test/ref/multiply-16bit-const.log @@ -1,4 +1,5 @@ Inlined call call __init +Eliminating unused variable with no statement memset::$2 CONTROL FLOW GRAPH SSA @@ -133,8 +134,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -451,7 +451,6 @@ dword main::i#5 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -794,7 +793,6 @@ Alias memset::return#1 = memset::str#1 memset::return#3 memset::return#2 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 diff --git a/src/test/ref/multiply-2.log b/src/test/ref/multiply-2.log index d58f974e4..1cbbe4e46 100644 --- a/src/test/ref/multiply-2.log +++ b/src/test/ref/multiply-2.log @@ -1,3 +1,4 @@ +Eliminating unused variable with no statement main::$1 CONTROL FLOW GRAPH SSA @@ -15,8 +16,7 @@ main::@1: scope:[main] from main main::@2 main::@2: scope:[main] from main::@1 main::i#2 = phi( main::@1/main::i#3 ) main::c1#3 = phi( main::@1/main::c1#2 ) - main::$1 = main::c1#3 * main::c2 - main::c3#0 = main::$1 + main::c3#0 = main::c1#3 * main::c2 SCREEN[main::i#2] = main::c3#0 main::i#1 = ++ main::i#2 main::c1#1 = ++ main::c1#3 @@ -40,7 +40,6 @@ constant byte* const SCREEN = (byte*)$400 void __start() void main() bool~ main::$0 -byte~ main::$1 byte main::c1 byte main::c1#0 byte main::c1#1 @@ -64,7 +63,6 @@ Finalized unsigned number type (byte) 5 Successful SSA optimization PassNFinalizeNumberTypeConversions Alias main::c1#2 = main::c1#3 Alias main::i#2 = main::i#3 -Alias main::c3#0 = main::$1 Successful SSA optimization Pass2AliasElimination Simple Condition main::$0 [4] if(main::c1#2<5) goto main::@2 Successful SSA optimization Pass2ConditionalJumpSimplification diff --git a/src/test/ref/multiply-2s.asm b/src/test/ref/multiply-2s.asm index 1e4312254..ac43f983a 100644 --- a/src/test/ref/multiply-2s.asm +++ b/src/test/ref/multiply-2s.asm @@ -34,6 +34,7 @@ main: { // (SCREEN+3*40)[i] = i*8 sta SCREEN+3*$28,x // signed byte sb = -(signed byte)i + // And a single signed byte txa eor #$ff clc diff --git a/src/test/ref/multiply-2s.log b/src/test/ref/multiply-2s.log index f4906d3d2..e23f0145a 100644 --- a/src/test/ref/multiply-2s.log +++ b/src/test/ref/multiply-2s.log @@ -1,3 +1,4 @@ +Eliminating unused variable with no statement main::$4 CONTROL FLOW GRAPH SSA @@ -15,8 +16,7 @@ main::@1: scope:[main] from main main::@1 (main::SCREEN+2*$28)[main::i#2] = main::$2 main::$3 = main::i#2 * 8 (main::SCREEN+3*$28)[main::i#2] = main::$3 - main::$4 = - (signed byte)main::i#2 - main::sb#0 = main::$4 + main::sb#0 = - (signed byte)main::i#2 main::$5 = main::sb#0 * 2 (main::SCREEN+5*$28)[main::i#2] = (byte)main::$5 main::i#1 = main::i#2 + rangenext(0,$a) @@ -44,7 +44,6 @@ number~ main::$0 number~ main::$1 number~ main::$2 number~ main::$3 -signed byte~ main::$4 number~ main::$5 bool~ main::$6 constant byte* const main::SCREEN = (byte*)$400 @@ -89,8 +88,6 @@ Inferred type updated to byte in main::$1 = main::i#2 * 2 Inferred type updated to byte in main::$2 = main::i#2 * 4 Inferred type updated to byte in main::$3 = main::i#2 * 8 Inferred type updated to signed byte in main::$5 = main::sb#0 * 2 -Alias main::sb#0 = main::$4 -Successful SSA optimization Pass2AliasElimination Simple Condition main::$6 [15] if(main::i#1!=rangelast(0,$a)) goto main::@1 Successful SSA optimization Pass2ConditionalJumpSimplification Constant main::i#0 = 0 @@ -287,6 +284,7 @@ main: { // [8] (main::SCREEN+3*$28)[main::i#2] = main::$3 -- pbuc1_derefidx_vbuxx=vbuaa sta SCREEN+3*$28,x // [9] main::sb#0 = - (signed byte)main::i#2 -- vbsaa=_neg_vbsxx + // And a single signed byte txa eor #$ff clc @@ -398,6 +396,7 @@ main: { sta SCREEN+3*$28,x // signed byte sb = -(signed byte)i // [9] main::sb#0 = - (signed byte)main::i#2 -- vbsaa=_neg_vbsxx + // And a single signed byte txa eor #$ff clc diff --git a/src/test/ref/norom-charset.log b/src/test/ref/norom-charset.log index d7f67fee9..4d8e4ca2f 100644 --- a/src/test/ref/norom-charset.log +++ b/src/test/ref/norom-charset.log @@ -1,11 +1,11 @@ Inlined call call __init +Eliminating unused variable with no statement main::$0 CONTROL FLOW GRAPH SSA void main() main: scope:[main] from __start::@1 - main::$0 = CHARSET + 8 - main::charset#0 = main::$0 + main::charset#0 = CHARSET + 8 main::c#0 = 0 to:main::@1 main::@1: scope:[main] from main main::@4 @@ -174,7 +174,6 @@ word gen_char3::spec#5 word gen_char3::spec#6 word gen_char3::spec#7 void main() -byte*~ main::$0 number~ main::$1 number~ main::$2 number~ main::$3 @@ -196,7 +195,7 @@ byte* main::charset#2 byte* main::charset#3 byte* main::charset#4 -Adding number conversion cast (unumber) 8 in main::$0 = CHARSET + 8 +Adding number conversion cast (unumber) 8 in main::charset#0 = CHARSET + 8 Adding number conversion cast (unumber) 4 in main::$4 = main::c#2 != 4 Adding number conversion cast (unumber) 8 in main::$6 = main::charset#3 + 8 Adding number conversion cast (unumber) $40 in main::$1 = main::$8 / $40 @@ -246,9 +245,8 @@ Inferred type updated to byte in gen_char3::$1 = gen_char3::$0 & $80 Inferred type updated to byte in gen_char3::$5 = gen_char3::b#3 * 2 Inferred type updated to word in gen_char3::$6 = gen_char3::spec#3 * 2 Inferred type updated to byte in gen_char3::$4 = gen_char3::b#4 | 1 -Inversing boolean not [31] gen_char3::$3 = gen_char3::$1 == 0 from [30] gen_char3::$2 = gen_char3::$1 != 0 +Inversing boolean not [30] gen_char3::$3 = gen_char3::$1 == 0 from [29] gen_char3::$2 = gen_char3::$1 != 0 Successful SSA optimization Pass2UnaryNotSimplification -Alias main::charset#0 = main::$0 Alias main::c#2 = main::c#3 main::c#4 Alias main::charset#2 = main::charset#4 main::charset#3 Alias main::charset#1 = main::$6 diff --git a/src/test/ref/number-inference-sum.log b/src/test/ref/number-inference-sum.log index 26f10479c..0fd629239 100644 --- a/src/test/ref/number-inference-sum.log +++ b/src/test/ref/number-inference-sum.log @@ -1,12 +1,12 @@ +Eliminating unused variable with no statement main::$0 +Eliminating unused variable with no statement main::$1 CONTROL FLOW GRAPH SSA void main() main: scope:[main] from __start - main::$0 = main::b1 + $fa - main::b2#0 = main::$0 - main::$1 = main::b2#0 + 1 - main::w#0 = main::$1 + main::b2#0 = main::b1 + $fa + main::w#0 = main::b2#0 + 1 main::$4 = 0 * SIZEOF_WORD main::screen[main::$4] = main::w#0 main::$2 = main::w#0 > $ff @@ -34,8 +34,6 @@ SYMBOL TABLE SSA constant byte SIZEOF_WORD = 2 void __start() void main() -number~ main::$0 -number~ main::$1 bool~ main::$2 bool~ main::$3 number~ main::$4 @@ -48,10 +46,8 @@ constant word* const main::screen = (word*)$400 word main::w word main::w#0 -Adding number conversion cast (unumber) $fa in main::$0 = main::b1 + $fa -Adding number conversion cast (unumber) main::$0 in main::$0 = main::b1 + (unumber)$fa -Adding number conversion cast (unumber) 1 in main::$1 = main::b2#0 + 1 -Adding number conversion cast (unumber) main::$1 in main::$1 = main::b2#0 + (unumber)1 +Adding number conversion cast (unumber) $fa in main::b2#0 = main::b1 + $fa +Adding number conversion cast (unumber) 1 in main::w#0 = main::b2#0 + 1 Adding number conversion cast (unumber) 0 in main::$4 = 0 * SIZEOF_WORD Adding number conversion cast (unumber) main::$4 in main::$4 = (unumber)0 * SIZEOF_WORD Adding number conversion cast (unumber) $ff in main::$2 = main::w#0 > $ff @@ -68,14 +64,9 @@ Finalized unsigned number type (byte) 1 Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) $ff Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to byte in main::$0 = main::b1 + $fa -Inferred type updated to byte in main::$1 = main::b2#0 + 1 Inferred type updated to byte in main::$4 = 0 * SIZEOF_WORD -Inversing boolean not [7] main::$3 = main::w#0 <= $ff from [6] main::$2 = main::w#0 > $ff +Inversing boolean not [5] main::$3 = main::w#0 <= $ff from [4] main::$2 = main::w#0 > $ff Successful SSA optimization Pass2UnaryNotSimplification -Alias main::b2#0 = main::$0 -Alias main::w#0 = main::$1 -Successful SSA optimization Pass2AliasElimination Simple Condition main::$3 [5] if(main::w#0<=$ff) goto main::@return Successful SSA optimization Pass2ConditionalJumpSimplification Constant right-side identified [0] main::b2#0 = main::b1 + $fa diff --git a/src/test/ref/number-ternary-fail-2.log b/src/test/ref/number-ternary-fail-2.log index e441e6a6a..c53bbce46 100644 --- a/src/test/ref/number-ternary-fail-2.log +++ b/src/test/ref/number-ternary-fail-2.log @@ -1,4 +1,5 @@ Inlined call call __init +Eliminating unused variable with no statement malloc::$0 CONTROL FLOW GRAPH SSA @@ -6,8 +7,7 @@ void* malloc(word malloc::size) malloc: scope:[malloc] from main malloc::size#1 = phi( main/malloc::size#0 ) heap_head#7 = phi( main/heap_head#13 ) - malloc::$0 = heap_head#7 - malloc::size#1 - malloc::mem#0 = malloc::$0 + malloc::mem#0 = heap_head#7 - malloc::size#1 heap_head#0 = malloc::mem#0 malloc::return#0 = ((void*)) malloc::mem#0 to:malloc::@return @@ -235,7 +235,6 @@ byte* main::maze#1 byte* main::maze#2 constant word main::width = (word)$12*2+3 void* malloc(word malloc::size) -byte*~ malloc::$0 byte* malloc::mem byte* malloc::mem#0 void* malloc::return @@ -278,7 +277,6 @@ Finalized unsigned number type (byte) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to word in SolveMaze::$0 = SolveMaze::width#1 - 2 Inferred type updated to word in SolveMaze::$2 = SolveMaze::height#1 - 2 -Alias malloc::mem#0 = malloc::$0 Alias malloc::return#0 = malloc::return#3 malloc::return#1 Alias heap_head#0 = heap_head#8 heap_head#1 Alias SolveMaze::width#1 = SolveMaze::width#2 SolveMaze::width#7 SolveMaze::width#8 diff --git a/src/test/ref/operator-lohi-problem.log b/src/test/ref/operator-lohi-problem.log index 2c39b2a5b..15188f8d2 100644 --- a/src/test/ref/operator-lohi-problem.log +++ b/src/test/ref/operator-lohi-problem.log @@ -1,13 +1,13 @@ +Eliminating unused variable with no statement main::$0 +Eliminating unused variable with no statement main::$2 CONTROL FLOW GRAPH SSA void main() main: scope:[main] from __start - main::$0 = word0 main::dw - main::w1#0 = main::$0 + main::w1#0 = word0 main::dw main::$1 = main::dw + 1 - main::$2 = word0 main::$1 - main::w2#0 = main::$2 + main::w2#0 = word0 main::$1 main::$3 = byte0 main::w1#0 SCREEN[0] = main::$3 main::$4 = byte1 main::w1#0 @@ -35,9 +35,7 @@ SYMBOL TABLE SSA constant byte* const SCREEN = (byte*)$400 void __start() void main() -word~ main::$0 number~ main::$1 -word~ main::$2 byte~ main::$3 byte~ main::$4 byte~ main::$5 @@ -69,9 +67,6 @@ Finalized unsigned number type (byte) 3 Finalized unsigned number type (byte) 4 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to dword in main::$1 = main::dw + 1 -Alias main::w1#0 = main::$0 -Alias main::w2#0 = main::$2 -Successful SSA optimization Pass2AliasElimination Constant right-side identified [0] main::w1#0 = word0 main::dw Constant right-side identified [1] main::$1 = main::dw + 1 Successful SSA optimization Pass2ConstantRValueConsolidation diff --git a/src/test/ref/plus4-keyboard-test.log b/src/test/ref/plus4-keyboard-test.log index 763903217..f307fb288 100644 --- a/src/test/ref/plus4-keyboard-test.log +++ b/src/test/ref/plus4-keyboard-test.log @@ -1,3 +1,5 @@ +Eliminating unused variable with no statement memset::$2 +Eliminating unused variable with no statement main::$4 CONTROL FLOW GRAPH SSA @@ -19,8 +21,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -77,8 +78,7 @@ main::@4: scope:[main] from main::@3 main::$3 = $ff ^ main::$2 *KEYBOARD_SCAN = main::$3 *KEYBOARD_INPUT = 0 - main::$4 = *KEYBOARD_INPUT ^ $ff - main::key_bit#0 = main::$4 + main::key_bit#0 = *KEYBOARD_INPUT ^ $ff main::x#0 = 0 to:main::@5 main::@5: scope:[main] from main::@4 main::@8 @@ -143,7 +143,6 @@ void main() bool~ main::$1 number~ main::$2 number~ main::$3 -number~ main::$4 bool~ main::$5 number~ main::$6 bool~ main::$7 @@ -186,7 +185,6 @@ byte main::y#8 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -229,8 +227,7 @@ Adding number conversion cast (unumber) main::$2 in main::$2 = (unumber)1 << mai Adding number conversion cast (unumber) $ff in main::$3 = $ff ^ main::$2 Adding number conversion cast (unumber) main::$3 in main::$3 = (unumber)$ff ^ main::$2 Adding number conversion cast (unumber) 0 in *KEYBOARD_INPUT = 0 -Adding number conversion cast (unumber) $ff in main::$4 = *KEYBOARD_INPUT ^ $ff -Adding number conversion cast (unumber) main::$4 in main::$4 = *KEYBOARD_INPUT ^ (unumber)$ff +Adding number conversion cast (unumber) $ff in main::key_bit#0 = *KEYBOARD_INPUT ^ $ff Adding number conversion cast (unumber) 8 in main::$5 = main::x#2 < 8 Adding number conversion cast (unumber) $80 in main::$6 = main::key_bit#2 & $80 Adding number conversion cast (unumber) main::$6 in main::$6 = main::key_bit#2 & (unumber)$80 @@ -273,23 +270,20 @@ Finalized unsigned number type (byte) 1 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in main::$2 = 1 << main::y#3 Inferred type updated to byte in main::$3 = $ff ^ main::$2 -Inferred type updated to byte in main::$4 = *KEYBOARD_INPUT ^ $ff Inferred type updated to byte in main::$6 = main::key_bit#2 & $80 Inversing boolean not [2] memset::$1 = memset::num#1 <= 0 from [1] memset::$0 = memset::num#1 > 0 -Inversing boolean not [47] main::$7 = 0 == main::$6 from [46] main::$9 = 0 != main::$6 +Inversing boolean not [45] main::$7 = 0 == main::$6 from [44] main::$9 = 0 != main::$6 Successful SSA optimization Pass2UnaryNotSimplification Alias memset::return#0 = memset::str#1 memset::return#3 memset::return#1 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 Alias memset::str#4 = memset::str#5 Alias main::y#2 = main::y#3 Alias main::row#6 = main::row#8 -Alias main::key_bit#0 = main::$4 Alias main::key_bit#2 = main::key_bit#4 main::key_bit#5 Alias main::x#2 = main::x#5 main::x#4 Alias main::row#2 = main::row#5 main::row#4 main::row#3 diff --git a/src/test/ref/pointer-plus-signed-word.log b/src/test/ref/pointer-plus-signed-word.log index d9fbc3094..a0e288a60 100644 --- a/src/test/ref/pointer-plus-signed-word.log +++ b/src/test/ref/pointer-plus-signed-word.log @@ -1,4 +1,5 @@ Inlined call call __init +Eliminating unused variable with no statement main::$0 CONTROL FLOW GRAPH SSA @@ -8,8 +9,7 @@ main: scope:[main] from __start::@1 to:main::@1 main::@1: scope:[main] from main main::@1 main::i#2 = phi( main/main::i#0, main::@1/main::i#1 ) - main::$0 = SCREEN + main::i#2 - main::sc#0 = main::$0 + main::sc#0 = SCREEN + main::i#2 *main::sc#0 = (byte)main::i#2 main::i#1 = main::i#2 + rangenext(-$a,$a) main::$1 = main::i#1 != rangelast(-$a,$a) @@ -37,7 +37,6 @@ SYMBOL TABLE SSA constant byte* SCREEN = (byte*)$400+$28*$a void __start() void main() -byte*~ main::$0 bool~ main::$1 signed word main::i signed word main::i#0 @@ -50,8 +49,6 @@ Adding number conversion cast (unumber) $28*$a in Successful SSA optimization PassNAddNumberTypeConversions Simplifying constant pointer cast (byte*) 1024 Successful SSA optimization PassNCastSimplification -Alias main::sc#0 = main::$0 -Successful SSA optimization Pass2AliasElimination Simple Condition main::$1 [6] if(main::i#1!=rangelast(-$a,$a)) goto main::@1 Successful SSA optimization Pass2ConditionalJumpSimplification Constant main::i#0 = -$a diff --git a/src/test/ref/primes-1000-2.asm b/src/test/ref/primes-1000-2.asm index 55405a368..14711dc96 100644 --- a/src/test/ref/primes-1000-2.asm +++ b/src/test/ref/primes-1000-2.asm @@ -203,12 +203,12 @@ mul8u: { div16u8u: { .label dividend = 5 .label divisor = 9 - // divr8u(BYTE1(dividend), divisor, 0) + // unsigned char quotient_hi = divr8u(BYTE1(dividend), divisor, 0) lda.z dividend+1 sta.z divr8u.dividend ldy #0 jsr divr8u - // divr8u(BYTE0(dividend), divisor, rem8u) + // unsigned char quotient_lo = divr8u(BYTE0(dividend), divisor, rem8u) lda.z dividend sta.z divr8u.dividend jsr divr8u diff --git a/src/test/ref/primes-1000-2.log b/src/test/ref/primes-1000-2.log index 1f2a1303e..6642cff0e 100644 --- a/src/test/ref/primes-1000-2.log +++ b/src/test/ref/primes-1000-2.log @@ -1,4 +1,7 @@ Inlined call call __init +Eliminating unused variable with no statement div16u8u::$1 +Eliminating unused variable with no statement div16u8u::$3 +Eliminating unused variable with no statement div16u8u::$4 CONTROL FLOW GRAPH SSA @@ -391,9 +394,8 @@ div16u8u::@1: scope:[div16u8u] from div16u8u div16u8u::dividend#2 = phi( div16u8u/div16u8u::dividend#1 ) rem8u#11 = phi( div16u8u/rem8u#1 ) divr8u::return#5 = phi( div16u8u/divr8u::return#2 ) - div16u8u::$1 = divr8u::return#5 + div16u8u::quotient_hi#0 = divr8u::return#5 rem8u#2 = rem8u#11 - div16u8u::quotient_hi#0 = div16u8u::$1 div16u8u::$2 = byte0 div16u8u::dividend#2 divr8u::dividend#2 = div16u8u::$2 divr8u::divisor#1 = div16u8u::divisor#2 @@ -405,11 +407,9 @@ div16u8u::@2: scope:[div16u8u] from div16u8u::@1 div16u8u::quotient_hi#1 = phi( div16u8u::@1/div16u8u::quotient_hi#0 ) rem8u#12 = phi( div16u8u::@1/rem8u#1 ) divr8u::return#6 = phi( div16u8u::@1/divr8u::return#3 ) - div16u8u::$3 = divr8u::return#6 + div16u8u::quotient_lo#0 = divr8u::return#6 rem8u#3 = rem8u#12 - div16u8u::quotient_lo#0 = div16u8u::$3 - div16u8u::$4 = div16u8u::quotient_hi#1 w= div16u8u::quotient_lo#0 - div16u8u::quotient#0 = div16u8u::$4 + div16u8u::quotient#0 = div16u8u::quotient_hi#1 w= div16u8u::quotient_lo#0 div16u8u::return#0 = div16u8u::quotient#0 to:div16u8u::@return div16u8u::@return: scope:[div16u8u] from div16u8u::@2 @@ -650,10 +650,7 @@ void __start() constant byte* decimal_digits[6] = { fill( 6, 0) } word div16u8u(word div16u8u::dividend , byte div16u8u::divisor) byte~ div16u8u::$0 -byte~ div16u8u::$1 byte~ div16u8u::$2 -byte~ div16u8u::$3 -word~ div16u8u::$4 word div16u8u::dividend word div16u8u::dividend#0 word div16u8u::dividend#1 @@ -1256,8 +1253,8 @@ Inferred type updated to byte in main::$11 = 2 * SIZEOF_WORD Inversing boolean not [122] mul8u::$3 = mul8u::$1 == 0 from [121] mul8u::$2 = mul8u::$1 != 0 Inversing boolean not [145] divr8u::$3 = divr8u::$1 == 0 from [144] divr8u::$2 = divr8u::$1 != 0 Inversing boolean not [153] divr8u::$8 = divr8u::rem#6 < divr8u::divisor#2 from [152] divr8u::$7 = divr8u::rem#6 >= divr8u::divisor#2 -Inversing boolean not [219] main::$2 = potential#7 <= main::$0 from [218] main::$1 = potential#7 > main::$0 -Inversing boolean not [236] main::$5 = rem8u#5 != 0 from [235] main::$4 = rem8u#5 == 0 +Inversing boolean not [216] main::$2 = potential#7 <= main::$0 from [215] main::$1 = potential#7 > main::$0 +Inversing boolean not [233] main::$5 = rem8u#5 != 0 from [232] main::$4 = rem8u#5 == 0 Successful SSA optimization Pass2UnaryNotSimplification Alias print_str::str#2 = print_str::str#3 print_str::str#4 Alias print_char_cursor#1 = print_char_cursor#23 print_char_cursor#24 print_char_cursor#13 @@ -1307,12 +1304,11 @@ Alias divr8u::return#2 = divr8u::return#5 Alias div16u8u::dividend#1 = div16u8u::dividend#2 Alias div16u8u::divisor#1 = div16u8u::divisor#2 Alias rem8u#11 = rem8u#2 -Alias div16u8u::quotient_hi#0 = div16u8u::$1 div16u8u::quotient_hi#1 Alias divr8u::dividend#2 = div16u8u::$2 Alias divr8u::return#3 = divr8u::return#6 +Alias div16u8u::quotient_hi#0 = div16u8u::quotient_hi#1 Alias rem8u#12 = rem8u#3 rem8u#13 rem8u#4 -Alias div16u8u::quotient_lo#0 = div16u8u::$3 -Alias div16u8u::return#0 = div16u8u::quotient#0 div16u8u::$4 div16u8u::return#3 div16u8u::return#1 +Alias div16u8u::return#0 = div16u8u::quotient#0 div16u8u::return#3 div16u8u::return#1 Alias mul8u::return#2 = mul8u::return#4 Alias potential#15 = potential#7 potential#16 Alias test_last#13 = test_last#6 test_last#7 @@ -3852,7 +3848,7 @@ mul8u: { div16u8u: { .label dividend = 5 .label divisor = 9 - // divr8u(BYTE1(dividend), divisor, 0) + // unsigned char quotient_hi = divr8u(BYTE1(dividend), divisor, 0) // [44] divr8u::dividend#1 = byte1 div16u8u::dividend#0 -- vbuz1=_byte1_vwuz2 lda.z dividend+1 sta.z divr8u.dividend @@ -3865,7 +3861,7 @@ div16u8u: { ldy #0 jsr divr8u // div16u8u::@1 - // divr8u(BYTE0(dividend), divisor, rem8u) + // unsigned char quotient_lo = divr8u(BYTE0(dividend), divisor, rem8u) // [47] divr8u::dividend#2 = byte0 div16u8u::dividend#0 -- vbuz1=_byte0_vwuz2 lda.z dividend sta.z divr8u.dividend diff --git a/src/test/ref/printf-1.asm b/src/test/ref/printf-1.asm index 3bbd1413c..2d3a1005e 100644 --- a/src/test/ref/printf-1.asm +++ b/src/test/ref/printf-1.asm @@ -130,12 +130,11 @@ gotoxy: { sta.z conio_cursor_x // conio_cursor_y = y stx.z conio_cursor_y - // (unsigned int)y*CONIO_WIDTH + // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH txa sta.z __7 lda #0 sta.z __7+1 - // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH lda.z __7 asl sta.z __8 diff --git a/src/test/ref/printf-1.log b/src/test/ref/printf-1.log index 00d160750..210aa4be5 100644 --- a/src/test/ref/printf-1.log +++ b/src/test/ref/printf-1.log @@ -9,6 +9,9 @@ Added struct type cast to parameter value list main::$5 = call printf_string "cm Added struct type cast to parameter value list main::$7 = call printf_string "rules" (struct printf_format_string){ $a, 1 } Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call __init +Eliminating unused variable with no statement memcpy::$0 +Eliminating unused variable with no statement memset::$2 +Eliminating unused variable with no statement gotoxy::$4 Eliminating unused variable with no statement printf_buffer CONTROL FLOW GRAPH SSA @@ -21,8 +24,7 @@ memcpy: scope:[memcpy] from cscroll::@3 cscroll::@4 memcpy::src#0 = ((byte*)) memcpy::source#2 memcpy::dst#0 = ((byte*)) memcpy::destination#2 memcpy::$2 = (byte*)memcpy::source#2 - memcpy::$0 = memcpy::$2 + memcpy::num#2 - memcpy::src_end#0 = memcpy::$0 + memcpy::src_end#0 = memcpy::$2 + memcpy::num#2 to:memcpy::@1 memcpy::@1: scope:[memcpy] from memcpy memcpy::@2 memcpy::destination#4 = phi( memcpy/memcpy::destination#2, memcpy::@2/memcpy::destination#5 ) @@ -69,8 +71,7 @@ memset::@2: scope:[memset] from memset memset::num#3 = phi( memset/memset::num#2 ) memset::str#3 = phi( memset/memset::str#4 ) memset::$4 = (byte*)memset::str#3 - memset::$2 = memset::$4 + memset::num#3 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#3 memset::dst#0 = ((byte*)) memset::str#3 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -201,8 +202,7 @@ gotoxy::@2: scope:[gotoxy] from gotoxy::@1 gotoxy::@4 conio_cursor_x = gotoxy::x#4 conio_cursor_y = gotoxy::y#4 gotoxy::$7 = (word)gotoxy::y#4 - gotoxy::$4 = gotoxy::$7 * $28 - gotoxy::line_offset#0 = gotoxy::$4 + gotoxy::line_offset#0 = gotoxy::$7 * $28 gotoxy::$5 = CONIO_SCREEN_TEXT + gotoxy::line_offset#0 conio_line_text = gotoxy::$5 gotoxy::$6 = CONIO_SCREEN_COLORS + gotoxy::line_offset#0 @@ -635,7 +635,6 @@ bool~ gotoxy::$0 bool~ gotoxy::$1 bool~ gotoxy::$2 bool~ gotoxy::$3 -number~ gotoxy::$4 byte*~ gotoxy::$5 byte*~ gotoxy::$6 word~ gotoxy::$7 @@ -663,7 +662,6 @@ constant byte* main::str1[6] = "rules" constant byte* main::str2[4] = "cml" constant byte* main::str3[6] = "rules" void* memcpy(void* memcpy::destination , void* memcpy::source , word memcpy::num) -byte*~ memcpy::$0 bool~ memcpy::$1 byte*~ memcpy::$2 void* memcpy::destination @@ -704,7 +702,6 @@ byte* memcpy::src_end#2 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -858,8 +855,7 @@ Adding number conversion cast (unumber) $28 in clrscr::line_cols#1 = clrscr::lin Adding number conversion cast (unumber) $19 in gotoxy::$0 = gotoxy::y#3 > $19 Adding number conversion cast (unumber) $28 in gotoxy::$2 = gotoxy::x#3 >= $28 Adding number conversion cast (unumber) 0 in gotoxy::y#0 = 0 -Adding number conversion cast (unumber) $28 in gotoxy::$4 = gotoxy::$7 * $28 -Adding number conversion cast (unumber) gotoxy::$4 in gotoxy::$4 = gotoxy::$7 * (unumber)$28 +Adding number conversion cast (unumber) $28 in gotoxy::line_offset#0 = gotoxy::$7 * $28 Adding number conversion cast (unumber) 0 in gotoxy::x#0 = 0 Adding number conversion cast (unumber) $28 in cputc::$1 = conio_cursor_x == $28 Adding number conversion cast (unumber) $28 in conio_line_text = conio_line_text + $28 @@ -1017,20 +1013,18 @@ Finalized unsigned number type (byte) 1 Finalized unsigned number type (byte) $a Finalized unsigned number type (byte) 1 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to word in gotoxy::$4 = gotoxy::$7 * $28 -Inversing boolean not [20] memset::$1 = memset::num#2 <= 0 from [19] memset::$0 = memset::num#2 > 0 -Inversing boolean not [77] gotoxy::$1 = gotoxy::y#3 <= $19 from [76] gotoxy::$0 = gotoxy::y#3 > $19 -Inversing boolean not [81] gotoxy::$3 = gotoxy::x#3 < $28 from [80] gotoxy::$2 = gotoxy::x#3 >= $28 -Inversing boolean not [107] cputc::$2 = conio_cursor_x != $28 from [106] cputc::$1 = conio_cursor_x == $28 -Inversing boolean not [131] cscroll::$1 = conio_cursor_y != $19 from [130] cscroll::$0 = conio_cursor_y == $19 -Inversing boolean not [164] conio_c64_init::$1 = conio_c64_init::line#0 < $19 from [163] conio_c64_init::$0 = conio_c64_init::line#0 >= $19 -Inversing boolean not [186] printf_string::$0 = 0 == printf_string::format_min_length#4 from [185] printf_string::$14 = 0 != printf_string::format_min_length#4 -Inversing boolean not [190] printf_string::$1 = 0 == printf_string::format_justify_left#4 from [189] printf_string::$15 = 0 != printf_string::format_justify_left#4 -Inversing boolean not [205] printf_string::$12 = printf_string::padding#1 >= 0 from [204] printf_string::$11 = printf_string::padding#1 < 0 +Inversing boolean not [19] memset::$1 = memset::num#2 <= 0 from [18] memset::$0 = memset::num#2 > 0 +Inversing boolean not [75] gotoxy::$1 = gotoxy::y#3 <= $19 from [74] gotoxy::$0 = gotoxy::y#3 > $19 +Inversing boolean not [79] gotoxy::$3 = gotoxy::x#3 < $28 from [78] gotoxy::$2 = gotoxy::x#3 >= $28 +Inversing boolean not [104] cputc::$2 = conio_cursor_x != $28 from [103] cputc::$1 = conio_cursor_x == $28 +Inversing boolean not [128] cscroll::$1 = conio_cursor_y != $19 from [127] cscroll::$0 = conio_cursor_y == $19 +Inversing boolean not [161] conio_c64_init::$1 = conio_c64_init::line#0 < $19 from [160] conio_c64_init::$0 = conio_c64_init::line#0 >= $19 +Inversing boolean not [183] printf_string::$0 = 0 == printf_string::format_min_length#4 from [182] printf_string::$14 = 0 != printf_string::format_min_length#4 +Inversing boolean not [187] printf_string::$1 = 0 == printf_string::format_justify_left#4 from [186] printf_string::$15 = 0 != printf_string::format_justify_left#4 +Inversing boolean not [202] printf_string::$12 = printf_string::padding#1 >= 0 from [201] printf_string::$11 = printf_string::padding#1 < 0 Successful SSA optimization Pass2UnaryNotSimplification Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 -Alias memcpy::src_end#0 = memcpy::$0 Alias memcpy::src#2 = memcpy::src#3 Alias memcpy::dst#2 = memcpy::dst#3 Alias memcpy::src_end#1 = memcpy::src_end#2 @@ -1039,7 +1033,6 @@ Alias memset::return#0 = memset::str#2 memset::return#4 memset::return#1 Alias memset::str#3 = memset::str#4 Alias memset::num#2 = memset::num#3 Alias memset::c#4 = memset::c#5 -Alias memset::end#0 = memset::$2 Alias memset::c#2 = memset::c#3 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -1054,7 +1047,6 @@ Alias clrscr::c#2 = clrscr::c#3 Alias clrscr::line_cols#2 = clrscr::line_cols#4 clrscr::line_cols#3 Alias clrscr::l#3 = clrscr::l#6 clrscr::l#4 Alias gotoxy::x#5 = gotoxy::x#6 -Alias gotoxy::line_offset#0 = gotoxy::$4 Alias gotoxy::y#5 = gotoxy::y#6 Alias cputc::c#2 = cputc::c#3 Alias cputs::c#1 = cputs::$0 cputs::c#2 @@ -3815,13 +3807,12 @@ gotoxy: { // conio_cursor_y = y // [37] conio_cursor_y = gotoxy::y#4 -- vbuz1=vbuxx stx.z conio_cursor_y - // (unsigned int)y*CONIO_WIDTH + // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH // [38] gotoxy::$7 = (word)gotoxy::y#4 -- vwuz1=_word_vbuxx txa sta.z __7 lda #0 sta.z __7+1 - // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH // [39] gotoxy::$8 = gotoxy::$7 << 2 -- vwuz1=vwuz2_rol_2 lda.z __7 asl diff --git a/src/test/ref/printf-14.asm b/src/test/ref/printf-14.asm index aad1b9737..cafe514a2 100644 --- a/src/test/ref/printf-14.asm +++ b/src/test/ref/printf-14.asm @@ -91,12 +91,11 @@ gotoxy: { sta.z conio_cursor_x // conio_cursor_y = y stx.z conio_cursor_y - // (unsigned int)y*CONIO_WIDTH + // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH txa sta.z __7 lda #0 sta.z __7+1 - // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH lda.z __7 asl sta.z __8 diff --git a/src/test/ref/printf-14.log b/src/test/ref/printf-14.log index f0d48cafd..0570fc2a2 100644 --- a/src/test/ref/printf-14.log +++ b/src/test/ref/printf-14.log @@ -6,6 +6,9 @@ Fixing struct type SIZE_OF struct printf_buffer_number to 12 Added struct type cast to parameter value list call printf_uchar main::c (struct printf_format_number){ 0, 0, 0, 0, 0, DECIMAL } Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call __init +Eliminating unused variable with no statement memcpy::$0 +Eliminating unused variable with no statement memset::$2 +Eliminating unused variable with no statement gotoxy::$4 Eliminating unused variable with no statement main::$1 CONTROL FLOW GRAPH SSA @@ -18,8 +21,7 @@ memcpy: scope:[memcpy] from cscroll::@3 cscroll::@4 memcpy::src#0 = ((byte*)) memcpy::source#2 memcpy::dst#0 = ((byte*)) memcpy::destination#2 memcpy::$2 = (byte*)memcpy::source#2 - memcpy::$0 = memcpy::$2 + memcpy::num#2 - memcpy::src_end#0 = memcpy::$0 + memcpy::src_end#0 = memcpy::$2 + memcpy::num#2 to:memcpy::@1 memcpy::@1: scope:[memcpy] from memcpy memcpy::@2 memcpy::destination#4 = phi( memcpy/memcpy::destination#2, memcpy::@2/memcpy::destination#5 ) @@ -66,8 +68,7 @@ memset::@2: scope:[memset] from memset memset::num#3 = phi( memset/memset::num#2 ) memset::str#3 = phi( memset/memset::str#4 ) memset::$4 = (byte*)memset::str#3 - memset::$2 = memset::$4 + memset::num#3 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#3 memset::dst#0 = ((byte*)) memset::str#3 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -435,8 +436,7 @@ gotoxy::@2: scope:[gotoxy] from gotoxy::@1 gotoxy::@4 conio_cursor_x = gotoxy::x#4 conio_cursor_y = gotoxy::y#4 gotoxy::$7 = (word)gotoxy::y#4 - gotoxy::$4 = gotoxy::$7 * $28 - gotoxy::line_offset#0 = gotoxy::$4 + gotoxy::line_offset#0 = gotoxy::$7 * $28 gotoxy::$5 = CONIO_SCREEN_TEXT + gotoxy::line_offset#0 conio_line_text = gotoxy::$5 gotoxy::$6 = CONIO_SCREEN_COLORS + gotoxy::line_offset#0 @@ -1059,7 +1059,6 @@ bool~ gotoxy::$0 bool~ gotoxy::$1 bool~ gotoxy::$2 bool~ gotoxy::$3 -number~ gotoxy::$4 byte*~ gotoxy::$5 byte*~ gotoxy::$6 word~ gotoxy::$7 @@ -1084,7 +1083,6 @@ byte gotoxy::y#6 void main() constant byte main::c = 7 void* memcpy(void* memcpy::destination , void* memcpy::source , word memcpy::num) -byte*~ memcpy::$0 bool~ memcpy::$1 byte*~ memcpy::$2 void* memcpy::destination @@ -1125,7 +1123,6 @@ byte* memcpy::src_end#2 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -1614,8 +1611,7 @@ Adding number conversion cast (unumber) $28 in clrscr::line_cols#1 = clrscr::lin Adding number conversion cast (unumber) $19 in gotoxy::$0 = gotoxy::y#3 > $19 Adding number conversion cast (unumber) $28 in gotoxy::$2 = gotoxy::x#3 >= $28 Adding number conversion cast (unumber) 0 in gotoxy::y#0 = 0 -Adding number conversion cast (unumber) $28 in gotoxy::$4 = gotoxy::$7 * $28 -Adding number conversion cast (unumber) gotoxy::$4 in gotoxy::$4 = gotoxy::$7 * (unumber)$28 +Adding number conversion cast (unumber) $28 in gotoxy::line_offset#0 = gotoxy::$7 * $28 Adding number conversion cast (unumber) 0 in gotoxy::x#0 = 0 Adding number conversion cast (unumber) $28 in cputc::$1 = conio_cursor_x == $28 Adding number conversion cast (unumber) $28 in conio_line_text = conio_line_text + $28 @@ -1807,27 +1803,25 @@ Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in uctoa::$4 = uctoa::max_digits#5 - 1 -Inferred type updated to word in gotoxy::$4 = gotoxy::$7 * $28 Inferred type updated to byte in printf_uchar::$0 = 0 Inferred type updated to byte for printf_uchar::$2 -Inversing boolean not [20] memset::$1 = memset::num#2 <= 0 from [19] memset::$0 = memset::num#2 > 0 -Inversing boolean not [188] gotoxy::$1 = gotoxy::y#3 <= $19 from [187] gotoxy::$0 = gotoxy::y#3 > $19 -Inversing boolean not [192] gotoxy::$3 = gotoxy::x#3 < $28 from [191] gotoxy::$2 = gotoxy::x#3 >= $28 -Inversing boolean not [218] cputc::$2 = conio_cursor_x != $28 from [217] cputc::$1 = conio_cursor_x == $28 -Inversing boolean not [242] cscroll::$1 = conio_cursor_y != $19 from [241] cscroll::$0 = conio_cursor_y == $19 -Inversing boolean not [275] conio_c64_init::$1 = conio_c64_init::line#0 < $19 from [274] conio_c64_init::$0 = conio_c64_init::line#0 >= $19 -Inversing boolean not [321] printf_number_buffer::$0 = 0 == printf_number_buffer::format_min_length#1 from [320] printf_number_buffer::$26 = 0 != printf_number_buffer::format_min_length#1 -Inversing boolean not [325] printf_number_buffer::$1 = 0 == printf_number_buffer::format_justify_left#1 from [324] printf_number_buffer::$27 = 0 != printf_number_buffer::format_justify_left#1 -Inversing boolean not [327] printf_number_buffer::$2 = 0 == printf_number_buffer::format_zero_padding#1 from [326] printf_number_buffer::$28 = 0 != printf_number_buffer::format_zero_padding#1 -Inversing boolean not [340] printf_number_buffer::$20 = 0 == printf_number_buffer::buffer_sign#1 from [339] printf_number_buffer::$29 = 0 != printf_number_buffer::buffer_sign#1 -Inversing boolean not [347] printf_number_buffer::$23 = printf_number_buffer::padding#1 >= 0 from [346] printf_number_buffer::$22 = printf_number_buffer::padding#1 < 0 -Inversing boolean not [355] printf_number_buffer::$7 = 0 == printf_number_buffer::buffer_sign#2 from [354] printf_number_buffer::$30 = 0 != printf_number_buffer::buffer_sign#2 -Inversing boolean not [372] printf_number_buffer::$12 = 0 == printf_number_buffer::format_upper_case#1 from [371] printf_number_buffer::$31 = 0 != printf_number_buffer::format_upper_case#1 -Inversing boolean not [384] printf_number_buffer::$14 = 0 == printf_number_buffer::format_zero_padding#3 from [383] printf_number_buffer::$32 = 0 != printf_number_buffer::format_zero_padding#3 +Inversing boolean not [19] memset::$1 = memset::num#2 <= 0 from [18] memset::$0 = memset::num#2 > 0 +Inversing boolean not [186] gotoxy::$1 = gotoxy::y#3 <= $19 from [185] gotoxy::$0 = gotoxy::y#3 > $19 +Inversing boolean not [190] gotoxy::$3 = gotoxy::x#3 < $28 from [189] gotoxy::$2 = gotoxy::x#3 >= $28 +Inversing boolean not [215] cputc::$2 = conio_cursor_x != $28 from [214] cputc::$1 = conio_cursor_x == $28 +Inversing boolean not [239] cscroll::$1 = conio_cursor_y != $19 from [238] cscroll::$0 = conio_cursor_y == $19 +Inversing boolean not [272] conio_c64_init::$1 = conio_c64_init::line#0 < $19 from [271] conio_c64_init::$0 = conio_c64_init::line#0 >= $19 +Inversing boolean not [318] printf_number_buffer::$0 = 0 == printf_number_buffer::format_min_length#1 from [317] printf_number_buffer::$26 = 0 != printf_number_buffer::format_min_length#1 +Inversing boolean not [322] printf_number_buffer::$1 = 0 == printf_number_buffer::format_justify_left#1 from [321] printf_number_buffer::$27 = 0 != printf_number_buffer::format_justify_left#1 +Inversing boolean not [324] printf_number_buffer::$2 = 0 == printf_number_buffer::format_zero_padding#1 from [323] printf_number_buffer::$28 = 0 != printf_number_buffer::format_zero_padding#1 +Inversing boolean not [337] printf_number_buffer::$20 = 0 == printf_number_buffer::buffer_sign#1 from [336] printf_number_buffer::$29 = 0 != printf_number_buffer::buffer_sign#1 +Inversing boolean not [344] printf_number_buffer::$23 = printf_number_buffer::padding#1 >= 0 from [343] printf_number_buffer::$22 = printf_number_buffer::padding#1 < 0 +Inversing boolean not [352] printf_number_buffer::$7 = 0 == printf_number_buffer::buffer_sign#2 from [351] printf_number_buffer::$30 = 0 != printf_number_buffer::buffer_sign#2 +Inversing boolean not [369] printf_number_buffer::$12 = 0 == printf_number_buffer::format_upper_case#1 from [368] printf_number_buffer::$31 = 0 != printf_number_buffer::format_upper_case#1 +Inversing boolean not [381] printf_number_buffer::$14 = 0 == printf_number_buffer::format_zero_padding#3 from [380] printf_number_buffer::$32 = 0 != printf_number_buffer::format_zero_padding#3 Successful SSA optimization Pass2UnaryNotSimplification Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 -Alias memcpy::src_end#0 = memcpy::$0 Alias memcpy::src#2 = memcpy::src#3 Alias memcpy::dst#2 = memcpy::dst#3 Alias memcpy::src_end#1 = memcpy::src_end#2 @@ -1836,7 +1830,6 @@ Alias memset::return#0 = memset::str#2 memset::return#4 memset::return#1 Alias memset::str#3 = memset::str#4 Alias memset::num#2 = memset::num#3 Alias memset::c#4 = memset::c#5 -Alias memset::end#0 = memset::$2 Alias memset::c#2 = memset::c#3 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -1874,7 +1867,6 @@ Alias clrscr::c#2 = clrscr::c#3 Alias clrscr::line_cols#2 = clrscr::line_cols#4 clrscr::line_cols#3 Alias clrscr::l#3 = clrscr::l#6 clrscr::l#4 Alias gotoxy::x#5 = gotoxy::x#6 -Alias gotoxy::line_offset#0 = gotoxy::$4 Alias gotoxy::y#5 = gotoxy::y#6 Alias cputc::c#3 = cputc::c#4 Alias cputs::c#1 = cputs::$0 cputs::c#2 @@ -4874,13 +4866,12 @@ gotoxy: { // conio_cursor_y = y // [25] conio_cursor_y = gotoxy::y#4 -- vbuz1=vbuxx stx.z conio_cursor_y - // (unsigned int)y*CONIO_WIDTH + // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH // [26] gotoxy::$7 = (word)gotoxy::y#4 -- vwuz1=_word_vbuxx txa sta.z __7 lda #0 sta.z __7+1 - // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH // [27] gotoxy::$8 = gotoxy::$7 << 2 -- vwuz1=vwuz2_rol_2 lda.z __7 asl diff --git a/src/test/ref/printf-15.asm b/src/test/ref/printf-15.asm index 2af87faf2..98e6f600a 100644 --- a/src/test/ref/printf-15.asm +++ b/src/test/ref/printf-15.asm @@ -104,12 +104,11 @@ gotoxy: { sta.z conio_cursor_x // conio_cursor_y = y stx.z conio_cursor_y - // (unsigned int)y*CONIO_WIDTH + // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH txa sta.z __7 lda #0 sta.z __7+1 - // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH lda.z __7 asl sta.z __8 diff --git a/src/test/ref/printf-15.log b/src/test/ref/printf-15.log index 9a680513f..3e74c73c5 100644 --- a/src/test/ref/printf-15.log +++ b/src/test/ref/printf-15.log @@ -5,6 +5,9 @@ Fixing struct type SIZE_OF struct printf_buffer_number to 12 Fixing struct type SIZE_OF struct printf_buffer_number to 12 Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call __init +Eliminating unused variable with no statement memcpy::$0 +Eliminating unused variable with no statement memset::$2 +Eliminating unused variable with no statement gotoxy::$4 Eliminating unused variable with no statement printf_buffer Eliminating unused variable with no statement main::$1 Eliminating unused variable with no statement main::$2 @@ -19,8 +22,7 @@ memcpy: scope:[memcpy] from cscroll::@3 cscroll::@4 memcpy::src#0 = ((byte*)) memcpy::source#2 memcpy::dst#0 = ((byte*)) memcpy::destination#2 memcpy::$2 = (byte*)memcpy::source#2 - memcpy::$0 = memcpy::$2 + memcpy::num#2 - memcpy::src_end#0 = memcpy::$0 + memcpy::src_end#0 = memcpy::$2 + memcpy::num#2 to:memcpy::@1 memcpy::@1: scope:[memcpy] from memcpy memcpy::@2 memcpy::destination#4 = phi( memcpy/memcpy::destination#2, memcpy::@2/memcpy::destination#5 ) @@ -67,8 +69,7 @@ memset::@2: scope:[memset] from memset memset::num#3 = phi( memset/memset::num#2 ) memset::str#3 = phi( memset/memset::str#4 ) memset::$4 = (byte*)memset::str#3 - memset::$2 = memset::$4 + memset::num#3 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#3 memset::dst#0 = ((byte*)) memset::str#3 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -172,8 +173,7 @@ gotoxy::@2: scope:[gotoxy] from gotoxy::@1 gotoxy::@4 conio_cursor_x = gotoxy::x#4 conio_cursor_y = gotoxy::y#4 gotoxy::$7 = (word)gotoxy::y#4 - gotoxy::$4 = gotoxy::$7 * $28 - gotoxy::line_offset#0 = gotoxy::$4 + gotoxy::line_offset#0 = gotoxy::$7 * $28 gotoxy::$5 = CONIO_SCREEN_TEXT + gotoxy::line_offset#0 conio_line_text = gotoxy::$5 gotoxy::$6 = CONIO_SCREEN_COLORS + gotoxy::line_offset#0 @@ -465,7 +465,6 @@ bool~ gotoxy::$0 bool~ gotoxy::$1 bool~ gotoxy::$2 bool~ gotoxy::$3 -number~ gotoxy::$4 byte*~ gotoxy::$5 byte*~ gotoxy::$6 word~ gotoxy::$7 @@ -493,7 +492,6 @@ constant byte* main::s[8] = "Lone 1 constant byte* main::s1[8] = "Lone 2 " void* memcpy(void* memcpy::destination , void* memcpy::source , word memcpy::num) -byte*~ memcpy::$0 bool~ memcpy::$1 byte*~ memcpy::$2 void* memcpy::destination @@ -534,7 +532,6 @@ byte* memcpy::src_end#2 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -583,8 +580,7 @@ Adding number conversion cast (unumber) $28 in clrscr::line_cols#1 = clrscr::lin Adding number conversion cast (unumber) $19 in gotoxy::$0 = gotoxy::y#3 > $19 Adding number conversion cast (unumber) $28 in gotoxy::$2 = gotoxy::x#3 >= $28 Adding number conversion cast (unumber) 0 in gotoxy::y#0 = 0 -Adding number conversion cast (unumber) $28 in gotoxy::$4 = gotoxy::$7 * $28 -Adding number conversion cast (unumber) gotoxy::$4 in gotoxy::$4 = gotoxy::$7 * (unumber)$28 +Adding number conversion cast (unumber) $28 in gotoxy::line_offset#0 = gotoxy::$7 * $28 Adding number conversion cast (unumber) 0 in gotoxy::x#0 = 0 Adding number conversion cast (unumber) $28 in cputc::$1 = conio_cursor_x == $28 Adding number conversion cast (unumber) $28 in conio_line_text = conio_line_text + $28 @@ -695,17 +691,15 @@ Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) $19 Finalized unsigned number type (byte) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to word in gotoxy::$4 = gotoxy::$7 * $28 -Inversing boolean not [20] memset::$1 = memset::num#2 <= 0 from [19] memset::$0 = memset::num#2 > 0 -Inversing boolean not [64] gotoxy::$1 = gotoxy::y#3 <= $19 from [63] gotoxy::$0 = gotoxy::y#3 > $19 -Inversing boolean not [68] gotoxy::$3 = gotoxy::x#3 < $28 from [67] gotoxy::$2 = gotoxy::x#3 >= $28 -Inversing boolean not [94] cputc::$2 = conio_cursor_x != $28 from [93] cputc::$1 = conio_cursor_x == $28 -Inversing boolean not [118] cscroll::$1 = conio_cursor_y != $19 from [117] cscroll::$0 = conio_cursor_y == $19 -Inversing boolean not [151] conio_c64_init::$1 = conio_c64_init::line#0 < $19 from [150] conio_c64_init::$0 = conio_c64_init::line#0 >= $19 +Inversing boolean not [19] memset::$1 = memset::num#2 <= 0 from [18] memset::$0 = memset::num#2 > 0 +Inversing boolean not [62] gotoxy::$1 = gotoxy::y#3 <= $19 from [61] gotoxy::$0 = gotoxy::y#3 > $19 +Inversing boolean not [66] gotoxy::$3 = gotoxy::x#3 < $28 from [65] gotoxy::$2 = gotoxy::x#3 >= $28 +Inversing boolean not [91] cputc::$2 = conio_cursor_x != $28 from [90] cputc::$1 = conio_cursor_x == $28 +Inversing boolean not [115] cscroll::$1 = conio_cursor_y != $19 from [114] cscroll::$0 = conio_cursor_y == $19 +Inversing boolean not [148] conio_c64_init::$1 = conio_c64_init::line#0 < $19 from [147] conio_c64_init::$0 = conio_c64_init::line#0 >= $19 Successful SSA optimization Pass2UnaryNotSimplification Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 -Alias memcpy::src_end#0 = memcpy::$0 Alias memcpy::src#2 = memcpy::src#3 Alias memcpy::dst#2 = memcpy::dst#3 Alias memcpy::src_end#1 = memcpy::src_end#2 @@ -714,7 +708,6 @@ Alias memset::return#0 = memset::str#2 memset::return#4 memset::return#1 Alias memset::str#3 = memset::str#4 Alias memset::num#2 = memset::num#3 Alias memset::c#4 = memset::c#5 -Alias memset::end#0 = memset::$2 Alias memset::c#2 = memset::c#3 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -727,7 +720,6 @@ Alias clrscr::c#2 = clrscr::c#3 Alias clrscr::line_cols#2 = clrscr::line_cols#4 clrscr::line_cols#3 Alias clrscr::l#3 = clrscr::l#6 clrscr::l#4 Alias gotoxy::x#5 = gotoxy::x#6 -Alias gotoxy::line_offset#0 = gotoxy::$4 Alias gotoxy::y#5 = gotoxy::y#6 Alias cputc::c#1 = cputc::c#2 Alias cputs::c#1 = cputs::$0 cputs::c#2 @@ -2681,13 +2673,12 @@ gotoxy: { // conio_cursor_y = y // [27] conio_cursor_y = gotoxy::y#4 -- vbuz1=vbuxx stx.z conio_cursor_y - // (unsigned int)y*CONIO_WIDTH + // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH // [28] gotoxy::$7 = (word)gotoxy::y#4 -- vwuz1=_word_vbuxx txa sta.z __7 lda #0 sta.z __7+1 - // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH // [29] gotoxy::$8 = gotoxy::$7 << 2 -- vwuz1=vwuz2_rol_2 lda.z __7 asl diff --git a/src/test/ref/procedure-callingconvention-stack-10.asm b/src/test/ref/procedure-callingconvention-stack-10.asm index 12062a067..dbaca4268 100644 --- a/src/test/ref/procedure-callingconvention-stack-10.asm +++ b/src/test/ref/procedure-callingconvention-stack-10.asm @@ -75,12 +75,11 @@ main: { // } rts __b2: - // get(i) + // struct Point p = get(i) lda.z i pha pha jsr get - // struct Point p = get(i) pla tay pla diff --git a/src/test/ref/procedure-callingconvention-stack-10.log b/src/test/ref/procedure-callingconvention-stack-10.log index 68fa48f74..094a74f82 100644 --- a/src/test/ref/procedure-callingconvention-stack-10.log +++ b/src/test/ref/procedure-callingconvention-stack-10.log @@ -3,7 +3,7 @@ Adding parameter assignment in __stackcall procedure get::i = param(get::i) Adding parameter assignment in __stackcall procedure print::p = param(print::p) Inlined call call __init Eliminating unused variable with no statement main::$1 -Calling convention __stackcall adding prepare/execute/finalize for { main::$1_x, main::$1_y } = call get main::i +Calling convention __stackcall adding prepare/execute/finalize for { main::p_x, main::p_y } = call get main::i Calling convention __stackcall adding prepare/execute/finalize for call print main::p_x main::p_y Calling convention __stackcall adding prepare/execute/finalize for call main Calling convention STACK_CALL replacing param(get::i) with stackidx(byte,get::OFFSET_STACK_I) @@ -11,8 +11,8 @@ Calling convention STACK_CALL replacing param(print::p_x) with stackidx(byte,pri Calling convention STACK_CALL replacing param(print::p_y) with stackidx(byte,print::OFFSET_STACK_P_Y) Calling convention STACK_CALL adding stack return stackidx(byte,get::OFFSET_STACK_RETURN+OFFSET_STRUCT_POINT_X) = get::return_x Calling convention STACK_CALL adding stack return stackidx(byte,get::OFFSET_STACK_RETURN+OFFSET_STRUCT_POINT_Y) = get::return_y -Calling convention STACK_CALL adding stack pull main::$1_x = stackpull(byte) -Calling convention STACK_CALL adding stack pull main::$1_y = stackpull(byte) +Calling convention STACK_CALL adding stack pull main::p_x = stackpull(byte) +Calling convention STACK_CALL adding stack pull main::p_y = stackpull(byte) Calling convention STACK_CALL adding stack push stackpush(byte) = main::i Calling convention STACK_CALL adding stack push stackpush(byte) = main::p_x Calling convention STACK_CALL adding stack push stackpush(byte) = main::p_y @@ -33,10 +33,8 @@ main::@2: scope:[main] from main::@1 stackpush(byte) = main::i#3 sideeffect stackpushbytes(1) callexecute get - main::$1_x = stackpull(byte) - main::$1_y = stackpull(byte) - main::p_x#0 = main::$1_x - main::p_y#0 = main::$1_y + main::p_x#0 = stackpull(byte) + main::p_y#0 = stackpull(byte) stackpush(byte) = main::p_x#0 stackpush(byte) = main::p_y#0 callexecute print @@ -118,13 +116,12 @@ byte get::return_y#1 byte idx loadstore __stackcall void main() bool~ main::$0 -byte~ main::$1_x -byte~ main::$1_y byte main::i byte main::i#0 byte main::i#1 byte main::i#2 byte main::i#3 +struct Point main::p byte main::p_x byte main::p_x#0 byte main::p_y @@ -150,8 +147,6 @@ Finalized unsigned number type (byte) 2 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in get::$0 = get::i#0 / 2 Alias main::i#2 = main::i#3 -Alias main::p_x#0 = main::$1_x -Alias main::p_y#0 = main::$1_y Alias get::return_x#0 = get::p_x#0 get::i#0 get::return_x#1 Alias get::return_y#0 = get::p_y#0 get::$0 get::return_y#1 Successful SSA optimization Pass2AliasElimination @@ -273,6 +268,7 @@ __stackcall void main() byte main::i byte main::i#1 202.0 byte main::i#2 36.72727272727273 +struct Point main::p byte main::p_x byte main::p_x#0 101.0 byte main::p_y @@ -574,6 +570,7 @@ __stackcall void main() byte main::i byte main::i#1 i zp[1]:2 202.0 byte main::i#2 i zp[1]:2 36.72727272727273 +struct Point main::p byte main::p_x byte main::p_x#0 reg byte y 101.0 byte main::p_y @@ -711,7 +708,7 @@ main: { rts // main::@2 __b2: - // get(i) + // struct Point p = get(i) // [21] stackpush(byte) = main::i#2 -- _stackpushbyte_=vbuz1 lda.z i pha @@ -719,7 +716,6 @@ main: { pha // [23] callexecute get -- jsr jsr get - // struct Point p = get(i) // [24] main::p_x#0 = stackpull(byte) -- vbuyy=_stackpullbyte_ pla tay diff --git a/src/test/ref/procedure-callingconvention-stack-10.sym b/src/test/ref/procedure-callingconvention-stack-10.sym index cda21b65c..10c15ea98 100644 --- a/src/test/ref/procedure-callingconvention-stack-10.sym +++ b/src/test/ref/procedure-callingconvention-stack-10.sym @@ -17,6 +17,7 @@ __stackcall void main() byte main::i byte main::i#1 i zp[1]:2 202.0 byte main::i#2 i zp[1]:2 36.72727272727273 +struct Point main::p byte main::p_x byte main::p_x#0 reg byte y 101.0 byte main::p_y diff --git a/src/test/ref/procedure-callingconvention-stack-11.asm b/src/test/ref/procedure-callingconvention-stack-11.asm index 9dc25e09a..ec7b27738 100644 --- a/src/test/ref/procedure-callingconvention-stack-11.asm +++ b/src/test/ref/procedure-callingconvention-stack-11.asm @@ -122,14 +122,13 @@ main: { // } rts __b2: - // get(i) + // struct Vector v = get(i) lda.z i pha pha pha pha jsr get - // struct Vector v = get(i) pla tay pla diff --git a/src/test/ref/procedure-callingconvention-stack-11.log b/src/test/ref/procedure-callingconvention-stack-11.log index 8ecf1d345..4cd349658 100644 --- a/src/test/ref/procedure-callingconvention-stack-11.log +++ b/src/test/ref/procedure-callingconvention-stack-11.log @@ -3,9 +3,7 @@ Adding parameter assignment in __stackcall procedure get::i = param(get::i) Adding parameter assignment in __stackcall procedure print::v = param(print::v) Inlined call call __init Eliminating unused variable with no statement main::$1 -Eliminating unused variable with no statement main::$1_p1 -Eliminating unused variable with no statement main::$1_p2 -Calling convention __stackcall adding prepare/execute/finalize for { { main::$1_p1_x, main::$1_p1_y }, { main::$1_p2_x, main::$1_p2_y } } = call get main::i +Calling convention __stackcall adding prepare/execute/finalize for { { main::v_p1_x, main::v_p1_y }, { main::v_p2_x, main::v_p2_y } } = call get main::i Calling convention __stackcall adding prepare/execute/finalize for call print main::v_p1_x main::v_p1_y main::v_p2_x main::v_p2_y Calling convention __stackcall adding prepare/execute/finalize for call main Calling convention STACK_CALL replacing param(get::i) with stackidx(byte,get::OFFSET_STACK_I) @@ -17,10 +15,10 @@ Calling convention STACK_CALL adding stack return stackidx(byte,get::OFFSET_STAC Calling convention STACK_CALL adding stack return stackidx(byte,get::OFFSET_STACK_RETURN+OFFSET_STRUCT_VECTOR_P1+OFFSET_STRUCT_POINT_Y) = get::return_p1_y Calling convention STACK_CALL adding stack return stackidx(byte,get::OFFSET_STACK_RETURN+OFFSET_STRUCT_VECTOR_P2+OFFSET_STRUCT_POINT_X) = get::return_p2_x Calling convention STACK_CALL adding stack return stackidx(byte,get::OFFSET_STACK_RETURN+OFFSET_STRUCT_VECTOR_P2+OFFSET_STRUCT_POINT_Y) = get::return_p2_y -Calling convention STACK_CALL adding stack pull main::$1_p1_x = stackpull(byte) -Calling convention STACK_CALL adding stack pull main::$1_p1_y = stackpull(byte) -Calling convention STACK_CALL adding stack pull main::$1_p2_x = stackpull(byte) -Calling convention STACK_CALL adding stack pull main::$1_p2_y = stackpull(byte) +Calling convention STACK_CALL adding stack pull main::v_p1_x = stackpull(byte) +Calling convention STACK_CALL adding stack pull main::v_p1_y = stackpull(byte) +Calling convention STACK_CALL adding stack pull main::v_p2_x = stackpull(byte) +Calling convention STACK_CALL adding stack pull main::v_p2_y = stackpull(byte) Calling convention STACK_CALL adding stack push stackpush(byte) = main::i Calling convention STACK_CALL adding stack push stackpush(byte) = main::v_p1_x Calling convention STACK_CALL adding stack push stackpush(byte) = main::v_p1_y @@ -43,14 +41,10 @@ main::@2: scope:[main] from main::@1 stackpush(byte) = main::i#3 sideeffect stackpushbytes(3) callexecute get - main::$1_p1_x = stackpull(byte) - main::$1_p1_y = stackpull(byte) - main::$1_p2_x = stackpull(byte) - main::$1_p2_y = stackpull(byte) - main::v_p1_x#0 = main::$1_p1_x - main::v_p1_y#0 = main::$1_p1_y - main::v_p2_x#0 = main::$1_p2_x - main::v_p2_y#0 = main::$1_p2_y + main::v_p1_x#0 = stackpull(byte) + main::v_p1_y#0 = stackpull(byte) + main::v_p2_x#0 = stackpull(byte) + main::v_p2_y#0 = stackpull(byte) stackpush(byte) = main::v_p1_x#0 stackpush(byte) = main::v_p1_y#0 stackpush(byte) = main::v_p2_x#0 @@ -170,15 +164,12 @@ byte get::v_p2_y#0 byte idx loadstore __stackcall void main() bool~ main::$0 -byte~ main::$1_p1_x -byte~ main::$1_p1_y -byte~ main::$1_p2_x -byte~ main::$1_p2_y byte main::i byte main::i#0 byte main::i#1 byte main::i#2 byte main::i#3 +struct Vector main::v struct Point main::v_p1 byte main::v_p1_x byte main::v_p1_x#0 @@ -228,10 +219,6 @@ Inferred type updated to byte in get::$0 = get::i#0 / 2 Inferred type updated to byte in get::$1 = get::i#0 + 1 Inferred type updated to byte in get::$2 = get::i#0 * 2 Alias main::i#2 = main::i#3 -Alias main::v_p1_x#0 = main::$1_p1_x -Alias main::v_p1_y#0 = main::$1_p1_y -Alias main::v_p2_x#0 = main::$1_p2_x -Alias main::v_p2_y#0 = main::$1_p2_y Alias get::return_p1_x#0 = get::v_p1_x#0 get::i#0 get::return_p1_x#1 Alias get::return_p1_y#0 = get::v_p1_y#0 get::$0 get::return_p1_y#1 Alias get::return_p2_x#0 = get::v_p2_x#0 get::$1 get::return_p2_x#1 @@ -388,6 +375,7 @@ __stackcall void main() byte main::i byte main::i#1 202.0 byte main::i#2 26.933333333333334 +struct Vector main::v struct Point main::v_p1 byte main::v_p1_x byte main::v_p1_x#0 50.5 @@ -859,6 +847,7 @@ __stackcall void main() byte main::i byte main::i#1 i zp[1]:2 202.0 byte main::i#2 i zp[1]:2 26.933333333333334 +struct Vector main::v struct Point main::v_p1 byte main::v_p1_x byte main::v_p1_x#0 reg byte y 50.5 @@ -1071,7 +1060,7 @@ main: { rts // main::@2 __b2: - // get(i) + // struct Vector v = get(i) // [33] stackpush(byte) = main::i#2 -- _stackpushbyte_=vbuz1 lda.z i pha @@ -1081,7 +1070,6 @@ main: { pha // [35] callexecute get -- jsr jsr get - // struct Vector v = get(i) // [36] main::v_p1_x#0 = stackpull(byte) -- vbuyy=_stackpullbyte_ pla tay diff --git a/src/test/ref/procedure-callingconvention-stack-11.sym b/src/test/ref/procedure-callingconvention-stack-11.sym index c4cf2cda3..11a8eec43 100644 --- a/src/test/ref/procedure-callingconvention-stack-11.sym +++ b/src/test/ref/procedure-callingconvention-stack-11.sym @@ -28,6 +28,7 @@ __stackcall void main() byte main::i byte main::i#1 i zp[1]:2 202.0 byte main::i#2 i zp[1]:2 26.933333333333334 +struct Vector main::v struct Point main::v_p1 byte main::v_p1_x byte main::v_p1_x#0 reg byte y 50.5 diff --git a/src/test/ref/procedure-callingconvention-stack-13.asm b/src/test/ref/procedure-callingconvention-stack-13.asm index a6f1e53ea..ad0c27a9a 100644 --- a/src/test/ref/procedure-callingconvention-stack-13.asm +++ b/src/test/ref/procedure-callingconvention-stack-13.asm @@ -23,10 +23,9 @@ pow2: { // n-1 sec sbc #1 - // pow2(n-1) + // char c = pow2(n-1) pha jsr pow2 - // char c = pow2(n-1) pla // return c+c; asl diff --git a/src/test/ref/procedure-callingconvention-stack-13.log b/src/test/ref/procedure-callingconvention-stack-13.log index 16cff40a1..1e5fabe8d 100644 --- a/src/test/ref/procedure-callingconvention-stack-13.log +++ b/src/test/ref/procedure-callingconvention-stack-13.log @@ -1,10 +1,11 @@ Adding parameter assignment in __stackcall procedure pow2::n = param(pow2::n) +Eliminating unused variable with no statement pow2::$2 Calling convention __stackcall adding prepare/execute/finalize for main::$0 = call pow2 6 -Calling convention __stackcall adding prepare/execute/finalize for pow2::$2 = call pow2 pow2::$1 +Calling convention __stackcall adding prepare/execute/finalize for pow2::c = call pow2 pow2::$1 Calling convention STACK_CALL replacing param(pow2::n) with stackidx(byte,pow2::OFFSET_STACK_N) Calling convention STACK_CALL adding stack return stackidx(byte,pow2::OFFSET_STACK_RETURN) = pow2::return Calling convention STACK_CALL adding stack pull main::$0 = stackpull(byte) -Calling convention STACK_CALL adding stack pull pow2::$2 = stackpull(byte) +Calling convention STACK_CALL adding stack pull pow2::c = stackpull(byte) Calling convention STACK_CALL adding stack push stackpush(byte) = 6 Calling convention STACK_CALL adding stack push stackpush(byte) = pow2::$1 @@ -35,8 +36,7 @@ pow2::@2: scope:[pow2] from pow2 pow2::$1 = pow2::n#1 - 1 stackpush(byte) = pow2::$1 callexecute pow2 - pow2::$2 = stackpull(byte) - pow2::c#0 = pow2::$2 + pow2::c#0 = stackpull(byte) pow2::$3 = pow2::c#0 + pow2::c#0 pow2::return#1 = pow2::$3 to:pow2::@return @@ -65,7 +65,6 @@ byte~ main::$0 __stackcall byte pow2(byte pow2::n) bool~ pow2::$0 number~ pow2::$1 -byte~ pow2::$2 byte~ pow2::$3 constant byte pow2::OFFSET_STACK_N = 0 constant byte pow2::OFFSET_STACK_RETURN = 0 @@ -101,7 +100,6 @@ Finalized unsigned number type (byte) 1 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in pow2::$1 = pow2::n#1 - 1 Alias pow2::n#0 = pow2::n#1 -Alias pow2::c#0 = pow2::$2 Alias pow2::return#1 = pow2::$3 Successful SSA optimization Pass2AliasElimination Simple Condition pow2::$0 [7] if(pow2::n#0==0) goto pow2::@1 @@ -362,12 +360,11 @@ pow2: { // [2] pow2::$1 = pow2::n#0 - 1 -- vbuaa=vbuaa_minus_1 sec sbc #1 - // pow2(n-1) + // char c = pow2(n-1) // [3] stackpush(byte) = pow2::$1 -- _stackpushbyte_=vbuaa pha // [4] callexecute pow2 -- jsr jsr pow2 - // char c = pow2(n-1) // [5] pow2::c#0 = stackpull(byte) -- vbuaa=_stackpullbyte_ pla // return c+c; diff --git a/src/test/ref/procedure-callingconvention-stack-4.asm b/src/test/ref/procedure-callingconvention-stack-4.asm index ff637c385..914ea103b 100644 --- a/src/test/ref/procedure-callingconvention-stack-4.asm +++ b/src/test/ref/procedure-callingconvention-stack-4.asm @@ -48,14 +48,13 @@ main: { // char v = a+1 ldx.z a inx - // plus('0', v) + // char w = plus('0', v) lda #'0' pha txa pha jsr plus pla - // char w = plus('0', v) pla // w+a clc diff --git a/src/test/ref/procedure-callingconvention-stack-4.log b/src/test/ref/procedure-callingconvention-stack-4.log index a60895990..6e40c78a3 100644 --- a/src/test/ref/procedure-callingconvention-stack-4.log +++ b/src/test/ref/procedure-callingconvention-stack-4.log @@ -2,11 +2,13 @@ Converting variable modified inside __stackcall procedure plus() to load/store i Adding parameter assignment in __stackcall procedure plus::b = param(plus::b) Adding parameter assignment in __stackcall procedure plus::a = param(plus::a) Inlined call call __init -Calling convention __stackcall adding prepare/execute/finalize for main::$1 = call plus '0' main::v +Eliminating unused variable with no statement main::$0 +Eliminating unused variable with no statement main::$1 +Calling convention __stackcall adding prepare/execute/finalize for main::w = call plus '0' main::v Calling convention STACK_CALL replacing param(plus::a) with stackidx(byte,plus::OFFSET_STACK_A) Calling convention STACK_CALL replacing param(plus::b) with stackidx(byte,plus::OFFSET_STACK_B) Calling convention STACK_CALL adding stack return stackidx(byte,plus::OFFSET_STACK_RETURN) = plus::return -Calling convention STACK_CALL adding stack pull main::$1 = stackpull(byte) +Calling convention STACK_CALL adding stack pull main::w = stackpull(byte) Calling convention STACK_CALL adding stack push stackpush(byte) = '0' Calling convention STACK_CALL adding stack push stackpush(byte) = main::v @@ -18,14 +20,12 @@ main: scope:[main] from __start::@1 to:main::@1 main::@1: scope:[main] from main main::@1 main::a#2 = phi( main/main::a#0, main::@1/main::a#1 ) - main::$0 = main::a#2 + 1 - main::v#0 = main::$0 + main::v#0 = main::a#2 + 1 stackpush(byte) = '0' stackpush(byte) = main::v#0 callexecute plus sideeffect stackpullbytes(1) - main::$1 = stackpull(byte) - main::w#0 = main::$1 + main::w#0 = stackpull(byte) main::$2 = main::w#0 + main::a#2 SCREEN[i] = main::$2 main::a#1 = main::a#2 + rangenext(0,1) @@ -71,8 +71,6 @@ constant word STACK_BASE = $103 void __start() byte i loadstore void main() -number~ main::$0 -byte~ main::$1 byte~ main::$2 bool~ main::$3 byte main::a @@ -96,17 +94,13 @@ byte plus::return byte plus::return#0 byte plus::return#1 -Adding number conversion cast (unumber) 1 in main::$0 = main::a#2 + 1 -Adding number conversion cast (unumber) main::$0 in main::$0 = main::a#2 + (unumber)1 +Adding number conversion cast (unumber) 1 in main::v#0 = main::a#2 + 1 Successful SSA optimization PassNAddNumberTypeConversions Simplifying constant pointer cast (byte*) 1024 Simplifying constant integer cast 1 Successful SSA optimization PassNCastSimplification Finalized unsigned number type (byte) 1 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to byte in main::$0 = main::a#2 + 1 -Alias main::v#0 = main::$0 -Alias main::w#0 = main::$1 Alias plus::return#0 = plus::$0 plus::return#1 Successful SSA optimization Pass2AliasElimination Simple Condition main::$3 [12] if(main::a#1!=rangelast(0,1)) goto main::@1 @@ -556,7 +550,7 @@ main: { // [13] main::v#0 = main::a#2 + 1 -- vbuxx=vbuz1_plus_1 ldx.z a inx - // plus('0', v) + // char w = plus('0', v) // [14] stackpush(byte) = '0' -- _stackpushbyte_=vbuc1 lda #'0' pha @@ -567,7 +561,6 @@ main: { jsr plus // sideeffect stackpullbytes(1) -- _stackpullbyte_1 pla - // char w = plus('0', v) // [18] main::w#0 = stackpull(byte) -- vbuaa=_stackpullbyte_ pla // w+a diff --git a/src/test/ref/procedure-declare-10.log b/src/test/ref/procedure-declare-10.log index 8800c0e13..762bd99ed 100644 --- a/src/test/ref/procedure-declare-10.log +++ b/src/test/ref/procedure-declare-10.log @@ -1,3 +1,4 @@ +Eliminating unused variable with no statement memcpy::$0 CONTROL FLOW GRAPH SSA @@ -9,8 +10,7 @@ memcpy: scope:[memcpy] from main memcpy::src#0 = ((byte*)) memcpy::source#1 memcpy::dst#0 = ((byte*)) memcpy::destination#1 memcpy::$2 = (byte*)memcpy::source#1 - memcpy::$0 = memcpy::$2 + memcpy::num#1 - memcpy::src_end#0 = memcpy::$0 + memcpy::src_end#0 = memcpy::$2 + memcpy::num#1 to:memcpy::@1 memcpy::@1: scope:[memcpy] from memcpy memcpy::@2 memcpy::destination#3 = phi( memcpy/memcpy::destination#1, memcpy::@2/memcpy::destination#4 ) @@ -71,7 +71,6 @@ void __start() void main() word~ main::$0 void* memcpy(void* memcpy::destination , void* memcpy::source , word memcpy::num) -byte*~ memcpy::$0 bool~ memcpy::$1 byte*~ memcpy::$2 void* memcpy::destination @@ -111,7 +110,6 @@ Inlining cast memcpy::dst#0 = (byte*)memcpy::destination#1 Successful SSA optimization Pass2InlineCast Simplifying constant pointer cast (byte*) 1024 Successful SSA optimization PassNCastSimplification -Alias memcpy::src_end#0 = memcpy::$0 Alias memcpy::src#2 = memcpy::src#3 Alias memcpy::dst#2 = memcpy::dst#3 Alias memcpy::src_end#1 = memcpy::src_end#2 diff --git a/src/test/ref/processor-port-test.log b/src/test/ref/processor-port-test.log index 3b8434621..96535ab8b 100644 --- a/src/test/ref/processor-port-test.log +++ b/src/test/ref/processor-port-test.log @@ -1,5 +1,6 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call __init +Eliminating unused variable with no statement memset::$2 CONTROL FLOW GRAPH SSA @@ -136,8 +137,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -652,7 +652,6 @@ constant byte* main::str[$28] = "ddr port ddr2 $00 $01 $a000 $d000 $e000" void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -1342,7 +1341,6 @@ Alias memset::return#1 = memset::str#1 memset::return#3 memset::return#2 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 diff --git a/src/test/ref/ptr-complex.asm b/src/test/ref/ptr-complex.asm index 762cf2805..490695b9e 100644 --- a/src/test/ref/ptr-complex.asm +++ b/src/test/ref/ptr-complex.asm @@ -13,6 +13,7 @@ main: { .label screen = $400 // Increment on a const named pointer .label BG_COLOR = $d020 + // LValue pointer expression (constant - through tmp variable) .label sc2 = screen+$51 ldx #0 // RValue pointer expression (variable) diff --git a/src/test/ref/ptr-complex.log b/src/test/ref/ptr-complex.log index d869a4d18..0b66152e5 100644 --- a/src/test/ref/ptr-complex.log +++ b/src/test/ref/ptr-complex.log @@ -1,3 +1,4 @@ +Eliminating unused variable with no statement main::$1 CONTROL FLOW GRAPH SSA @@ -15,8 +16,7 @@ main::@1: scope:[main] from main main::@1 if(main::$10) goto main::@1 to:main::@2 main::@2: scope:[main] from main::@1 - main::$1 = main::screen + $51 - main::sc2#0 = main::$1 + main::sc2#0 = main::screen + $51 main::$2 = main::screen + $79 *main::sc2#0 = *main::$2 main::$3 = main::screen + $52 @@ -57,7 +57,6 @@ __start::@return: scope:[__start] from __start::@1 SYMBOL TABLE SSA void __start() void main() -byte*~ main::$1 bool~ main::$10 byte*~ main::$11 byte*~ main::$12 @@ -83,7 +82,7 @@ byte* main::sc2#0 constant byte* main::screen = (byte*)$400 Adding number conversion cast (unumber) $28 in main::$8 = main::screen + $28 -Adding number conversion cast (unumber) $51 in main::$1 = main::screen + $51 +Adding number conversion cast (unumber) $51 in main::sc2#0 = main::screen + $51 Adding number conversion cast (unumber) $79 in main::$2 = main::screen + $79 Adding number conversion cast (unumber) $52 in main::$3 = main::screen + $52 Adding number conversion cast (unumber) $7a in main::$4 = main::screen + $7a @@ -110,8 +109,6 @@ Finalized unsigned number type (byte) $7a Finalized unsigned number type (byte) $a0 Finalized unsigned number type (byte) $c8 Successful SSA optimization PassNFinalizeNumberTypeConversions -Alias main::sc2#0 = main::$1 -Successful SSA optimization Pass2AliasElimination Simple Condition main::$10 [7] if(main::i#1!=rangelast(0,$a)) goto main::@1 Simple Condition main::$15 [23] if(main::j#1!=rangelast(0,$a)) goto main::@3 Successful SSA optimization Pass2ConditionalJumpSimplification @@ -277,6 +274,7 @@ main: { .label screen = $400 // Increment on a const named pointer .label BG_COLOR = $d020 + // LValue pointer expression (constant - through tmp variable) .label sc2 = screen+$51 // [1] phi from main to main::@1 [phi:main->main::@1] __b1_from_main: @@ -406,6 +404,7 @@ main: { .label screen = $400 // Increment on a const named pointer .label BG_COLOR = $d020 + // LValue pointer expression (constant - through tmp variable) .label sc2 = screen+$51 // [1] phi from main to main::@1 [phi:main->main::@1] // [1] phi main::i#2 = 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 diff --git a/src/test/ref/robozzle64-label-problem.asm b/src/test/ref/robozzle64-label-problem.asm index a47f49ca8..560960468 100644 --- a/src/test/ref/robozzle64-label-problem.asm +++ b/src/test/ref/robozzle64-label-problem.asm @@ -22,10 +22,9 @@ main: { lda #0 sta.z y __b1: - // mul8u(y,40) + // word z1 = mul8u(y,40) ldx.z y jsr mul8u - // mul8u(y,40) // word z1 = mul8u(y,40) // *screen++ = z1 ldy #0 @@ -34,10 +33,9 @@ main: { iny lda.z z1+1 sta (screen),y - // mul8u(y,40) + // word z2 = mul8u(y,40) ldx.z y jsr mul8u - // mul8u(y,40) // word z2 = mul8u(y,40) // *screen++ = z2 ldy #SIZEOF_WORD diff --git a/src/test/ref/robozzle64-label-problem.log b/src/test/ref/robozzle64-label-problem.log index a034ab2fc..e12ccf959 100644 --- a/src/test/ref/robozzle64-label-problem.log +++ b/src/test/ref/robozzle64-label-problem.log @@ -1,3 +1,5 @@ +Eliminating unused variable with no statement main::$0 +Eliminating unused variable with no statement main::$1 CONTROL FLOW GRAPH SSA @@ -67,8 +69,7 @@ main::@2: scope:[main] from main::@1 main::y#3 = phi( main::@1/main::y#2 ) main::screen#3 = phi( main::@1/main::screen#5 ) mul8u::return#5 = phi( main::@1/mul8u::return#2 ) - main::$0 = mul8u::return#5 - main::z1#0 = main::$0 + main::z1#0 = mul8u::return#5 *main::screen#3 = main::z1#0 main::screen#1 = main::screen#3 + SIZEOF_WORD mul8u::a#2 = main::y#3 @@ -80,8 +81,7 @@ main::@3: scope:[main] from main::@2 main::y#4 = phi( main::@2/main::y#3 ) main::screen#4 = phi( main::@2/main::screen#1 ) mul8u::return#6 = phi( main::@2/mul8u::return#3 ) - main::$1 = mul8u::return#6 - main::z2#0 = main::$1 + main::z2#0 = mul8u::return#6 *main::screen#4 = main::z2#0 main::screen#2 = main::screen#4 + SIZEOF_WORD main::y#1 = main::y#4 + rangenext(0,5) @@ -106,8 +106,6 @@ SYMBOL TABLE SSA constant byte SIZEOF_WORD = 2 void __start() void main() -word~ main::$0 -word~ main::$1 bool~ main::$2 word* main::screen word* main::screen#0 @@ -212,10 +210,8 @@ Alias mul8u::res#1 = mul8u::$4 Alias mul8u::return#2 = mul8u::return#5 Alias main::screen#3 = main::screen#5 Alias main::y#2 = main::y#3 main::y#4 -Alias main::z1#0 = main::$0 Alias mul8u::return#3 = mul8u::return#6 Alias main::screen#1 = main::screen#4 -Alias main::z2#0 = main::$1 Successful SSA optimization Pass2AliasElimination Alias mul8u::a#3 = mul8u::a#5 Alias mul8u::mb#2 = mul8u::mb#3 @@ -750,17 +746,16 @@ main: { // [1] phi main::y#2 = main::y#1 [phi:main::@3->main::@1#1] -- register_copy // main::@1 __b1: - // mul8u(y,40) + // word z1 = mul8u(y,40) // [2] mul8u::a#1 = main::y#2 -- vbuxx=vbuz1 ldx.z y // [3] call mul8u // [16] phi from main::@1 to mul8u [phi:main::@1->mul8u] // [16] phi mul8u::a#6 = mul8u::a#1 [phi:main::@1->mul8u#0] -- register_copy jsr mul8u - // mul8u(y,40) + // word z1 = mul8u(y,40) // [4] mul8u::return#2 = mul8u::res#2 // main::@2 - // word z1 = mul8u(y,40) // [5] main::z1#0 = mul8u::return#2 // *screen++ = z1 // [6] *main::screen#1 = main::z1#0 -- _deref_pwuz1=vwuz2 @@ -770,17 +765,16 @@ main: { iny lda.z z1+1 sta (screen),y - // mul8u(y,40) + // word z2 = mul8u(y,40) // [7] mul8u::a#2 = main::y#2 -- vbuxx=vbuz1 ldx.z y // [8] call mul8u // [16] phi from main::@2 to mul8u [phi:main::@2->mul8u] // [16] phi mul8u::a#6 = mul8u::a#2 [phi:main::@2->mul8u#0] -- register_copy jsr mul8u - // mul8u(y,40) + // word z2 = mul8u(y,40) // [9] mul8u::return#3 = mul8u::res#2 // main::@3 - // word z2 = mul8u(y,40) // [10] main::z2#0 = mul8u::return#3 // *screen++ = z2 // [11] main::screen#1[SIZEOF_WORD] = main::z2#0 -- pwuz1_derefidx_vbuc1=vwuz2 diff --git a/src/test/ref/scan-desire-problem.asm b/src/test/ref/scan-desire-problem.asm index b3d57fcc5..754dd819b 100644 --- a/src/test/ref/scan-desire-problem.asm +++ b/src/test/ref/scan-desire-problem.asm @@ -164,10 +164,9 @@ draw_block: { // y = y << 1 lda.z y asl - // mul8u(y,40) + // word z = mul8u(y,40) tax jsr mul8u - // mul8u(y,40) // word z = mul8u(y,40) // z = z + x1 clc diff --git a/src/test/ref/scan-desire-problem.log b/src/test/ref/scan-desire-problem.log index a248d63d0..5878ad022 100644 --- a/src/test/ref/scan-desire-problem.log +++ b/src/test/ref/scan-desire-problem.log @@ -1,6 +1,10 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call init::$3 = call toD018 screen charset Inlined call call __init +Eliminating unused variable with no statement memset::$2 +Eliminating unused variable with no statement main::$3 +Eliminating unused variable with no statement draw_block::$1 +Eliminating unused variable with no statement draw_block::$3 CONTROL FLOW GRAPH SSA @@ -22,8 +26,7 @@ memset::@2: scope:[memset] from memset memset::num#3 = phi( memset/memset::num#2 ) memset::str#3 = phi( memset/memset::str#4 ) memset::$4 = (byte*)memset::str#3 - memset::$2 = memset::$4 + memset::num#3 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#3 memset::dst#0 = ((byte*)) memset::str#3 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -122,8 +125,7 @@ main::@3: scope:[main] from main::@2 main::@8 main::@4: scope:[main] from main::@3 main::y#3 = phi( main::@3/main::y#2 ) main::x#3 = phi( main::@3/main::x#5 ) - main::$3 = main::x#3 + main::y#3 - main::z#0 = main::$3 + main::z#0 = main::x#3 + main::y#3 main::tile#0 = level_address[main::z#0] draw_block::tileno#0 = main::tile#0 draw_block::x#0 = main::x#3 @@ -221,8 +223,7 @@ draw_block: scope:[draw_block] from main::@4 draw_block::tileno#2 = phi( main::@4/draw_block::tileno#0 ) draw_block::$0 = draw_block::tileno#2 << 2 draw_block::tileno#1 = draw_block::$0 - draw_block::$1 = draw_block::x#1 << 1 - draw_block::x1#0 = draw_block::$1 + draw_block::x1#0 = draw_block::x#1 << 1 draw_block::$2 = draw_block::y#2 << 1 draw_block::y#1 = draw_block::$2 mul8u::a#1 = draw_block::y#1 @@ -234,8 +235,7 @@ draw_block::@1: scope:[draw_block] from draw_block draw_block::tileno#3 = phi( draw_block/draw_block::tileno#1 ) draw_block::x1#1 = phi( draw_block/draw_block::x1#0 ) mul8u::return#4 = phi( draw_block/mul8u::return#2 ) - draw_block::$3 = mul8u::return#4 - draw_block::z#0 = draw_block::$3 + draw_block::z#0 = mul8u::return#4 draw_block::$4 = draw_block::z#0 + draw_block::x1#1 draw_block::z#1 = draw_block::$4 draw_block::drawtile#0 = tileset[draw_block::tileno#3] @@ -296,10 +296,8 @@ constant byte* const charset = (byte*)$2000 constant byte* const colors = (byte*)$d800 void draw_block(byte draw_block::tileno , byte draw_block::x , byte draw_block::y , byte draw_block::color) byte~ draw_block::$0 -byte~ draw_block::$1 number~ draw_block::$10 byte~ draw_block::$2 -word~ draw_block::$3 word~ draw_block::$4 number~ draw_block::$5 number~ draw_block::$6 @@ -354,7 +352,6 @@ constant byte* const level_address = (byte*)$3000 void main() bool~ main::$1 bool~ main::$2 -byte~ main::$3 byte main::tile byte main::tile#0 byte main::x @@ -377,7 +374,6 @@ byte main::z#0 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -485,7 +481,7 @@ Adding number conversion cast (unumber) 0 in *SPRITES_EXPAND_Y = 0 Adding number conversion cast (unumber) 0 in *SPRITES_XMSB = 0 Adding number conversion cast (unumber) 0 in *SPRITES_MC = 0 Adding number conversion cast (unumber) 2 in draw_block::$0 = draw_block::tileno#2 << 2 -Adding number conversion cast (unumber) 1 in draw_block::$1 = draw_block::x#1 << 1 +Adding number conversion cast (unumber) 1 in draw_block::x1#0 = draw_block::x#1 << 1 Adding number conversion cast (unumber) 1 in draw_block::$2 = draw_block::y#2 << 1 Adding number conversion cast (unumber) $28 in mul8u::b#0 = $28 Adding number conversion cast (unumber) 1 in draw_block::$5 = draw_block::z#1 + 1 @@ -616,13 +612,12 @@ Inferred type updated to word in draw_block::$8 = draw_block::z#1 + $28 Inferred type updated to word in draw_block::$9 = draw_block::z#1 + $29 Inferred type updated to word in draw_block::$10 = draw_block::z#1 + $29 Inversing boolean not [2] memset::$1 = memset::num#2 <= 0 from [1] memset::$0 = memset::num#2 > 0 -Inversing boolean not [29] mul8u::$3 = mul8u::$1 == 0 from [28] mul8u::$2 = mul8u::$1 != 0 +Inversing boolean not [28] mul8u::$3 = mul8u::$1 == 0 from [27] mul8u::$2 = mul8u::$1 != 0 Successful SSA optimization Pass2UnaryNotSimplification Alias memset::return#0 = memset::str#2 memset::return#4 memset::return#1 Alias memset::str#3 = memset::str#4 Alias memset::num#2 = memset::num#3 Alias memset::c#4 = memset::c#5 -Alias memset::end#0 = memset::$2 Alias memset::c#2 = memset::c#3 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -636,15 +631,13 @@ Alias mul8u::res#1 = mul8u::$4 Alias main::x#2 = main::x#6 Alias main::x#3 = main::x#5 main::x#7 main::x#4 Alias main::y#2 = main::y#3 main::y#4 -Alias main::z#0 = main::$3 Alias init::toD0181_screen#0 = init::toD0181_screen#1 Alias init::toD0181_gfx#0 = init::toD0181_gfx#1 Alias init::toD0181_return#0 = init::toD0181_$6 init::toD0181_return#2 init::toD0181_return#1 init::toD0181_return#3 init::$3 Alias draw_block::tileno#1 = draw_block::$0 draw_block::tileno#3 -Alias draw_block::x1#0 = draw_block::$1 draw_block::x1#1 Alias draw_block::y#1 = draw_block::$2 Alias mul8u::return#2 = mul8u::return#4 -Alias draw_block::z#0 = draw_block::$3 +Alias draw_block::x1#0 = draw_block::x1#1 Alias draw_block::z#1 = draw_block::$4 Successful SSA optimization Pass2AliasElimination Alias mul8u::a#2 = mul8u::a#4 @@ -662,9 +655,9 @@ Identical Phi Values draw_block::y#2 draw_block::y#0 Successful SSA optimization Pass2IdenticalPhiElimination Identical Phi Values memset::return#0 memset::str#3 Successful SSA optimization Pass2IdenticalPhiElimination -Identified duplicate assignment right side [132] draw_block::$6 = draw_block::z#1 + 1 -Identified duplicate assignment right side [136] draw_block::$8 = draw_block::z#1 + $28 -Identified duplicate assignment right side [140] draw_block::$10 = draw_block::z#1 + $29 +Identified duplicate assignment right side [128] draw_block::$6 = draw_block::z#1 + 1 +Identified duplicate assignment right side [132] draw_block::$8 = draw_block::z#1 + $28 +Identified duplicate assignment right side [136] draw_block::$10 = draw_block::z#1 + $29 Successful SSA optimization Pass2DuplicateRValueIdentification Simple Condition memset::$1 [2] if(memset::num#2<=0) goto memset::@1 Simple Condition memset::$3 [9] if(memset::dst#2!=memset::end#0) goto memset::@4 @@ -2318,16 +2311,15 @@ draw_block: { // [32] draw_block::y#1 = draw_block::y#0 << 1 -- vbuaa=vbuz1_rol_1 lda.z y asl - // mul8u(y,40) + // word z = mul8u(y,40) // [33] mul8u::a#1 = draw_block::y#1 -- vbuxx=vbuaa tax // [34] call mul8u // [74] phi from draw_block to mul8u [phi:draw_block->mul8u] jsr mul8u - // mul8u(y,40) + // word z = mul8u(y,40) // [35] mul8u::return#2 = mul8u::res#2 // draw_block::@1 - // word z = mul8u(y,40) // [36] draw_block::z#0 = mul8u::return#2 // z = z + x1 // [37] draw_block::z#1 = draw_block::z#0 + draw_block::x1#0 -- vwuz1=vwuz2_plus_vwuz1 diff --git a/src/test/ref/semi-struct-1.log b/src/test/ref/semi-struct-1.log index 79810e65a..d195866a8 100644 --- a/src/test/ref/semi-struct-1.log +++ b/src/test/ref/semi-struct-1.log @@ -1,10 +1,13 @@ -Inlined call init_points::$0 = call getPoint init_points::i +Inlined call init_points::point = call getPoint init_points::i Inlined call init_points::$1 = call pointXpos init_points::point Inlined call init_points::$2 = call pointYpos init_points::point -Inlined call print_points::$1 = call getPoint print_points::i +Inlined call print_points::point = call getPoint print_points::i Inlined call print_points::$2 = call pointXpos print_points::point Inlined call print_points::$5 = call pointYpos print_points::point Inlined call call __init +Eliminating unused variable with no statement memset::$2 +Eliminating unused variable with no statement init_points::$0 +Eliminating unused variable with no statement print_points::$1 CONTROL FLOW GRAPH SSA @@ -141,8 +144,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -222,8 +224,7 @@ init_points::@2: scope:[init_points] from init_points::getPoint1_@return init_points::i#9 = phi( init_points::getPoint1_@return/init_points::i#10 ) init_points::pos#9 = phi( init_points::getPoint1_@return/init_points::pos#10 ) init_points::getPoint1_return#3 = phi( init_points::getPoint1_@return/init_points::getPoint1_return#1 ) - init_points::$0 = init_points::getPoint1_return#3 - init_points::point#0 = init_points::$0 + init_points::point#0 = init_points::getPoint1_return#3 init_points::pointXpos1_point#0 = init_points::point#0 to:init_points::pointXpos1 init_points::pointXpos1: scope:[init_points] from init_points::@2 @@ -320,8 +321,7 @@ print_points::@2: scope:[print_points] from print_points::getPoint1_@return print_line_cursor#37 = phi( print_points::getPoint1_@return/print_line_cursor#38 ) print_char_cursor#57 = phi( print_points::getPoint1_@return/print_char_cursor#58 ) print_points::getPoint1_return#3 = phi( print_points::getPoint1_@return/print_points::getPoint1_return#1 ) - print_points::$1 = print_points::getPoint1_return#3 - print_points::point#0 = print_points::$1 + print_points::point#0 = print_points::getPoint1_return#3 print_points::pointXpos1_point#0 = print_points::point#0 to:print_points::pointXpos1 print_points::pointXpos1: scope:[print_points] from print_points::@2 @@ -457,7 +457,6 @@ constant byte RADIX::OCTAL = 8 constant const byte SIZEOF_POINT = 2 void __start() void init_points() -byte*~ init_points::$0 byte*~ init_points::$1 byte*~ init_points::$2 bool~ init_points::$3 @@ -525,7 +524,6 @@ void main() void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -676,7 +674,6 @@ void print_ln() byte*~ print_ln::$0 bool~ print_ln::$1 void print_points() -byte*~ print_points::$1 byte*~ print_points::$2 byte*~ print_points::$5 bool~ print_points::$8 @@ -832,7 +829,6 @@ Alias memset::return#1 = memset::str#1 memset::return#3 memset::return#2 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -844,7 +840,7 @@ Alias print_line_cursor#16 = print_line_cursor#4 print_line_cursor#17 print_line Alias print_char_cursor#11 = print_char_cursor#32 print_char_cursor#33 print_char_cursor#12 Alias init_points::i#10 = init_points::getPoint1_idx#0 init_points::i#2 init_points::getPoint1_idx#1 init_points::i#11 init_points::i#9 init_points::i#8 init_points::i#7 init_points::i#6 init_points::i#5 init_points::i#4 init_points::i#3 Alias init_points::pos#10 = init_points::pos#11 init_points::pos#12 init_points::pos#9 init_points::pos#7 init_points::pos#5 init_points::pos#3 -Alias init_points::getPoint1_return#0 = init_points::getPoint1_$1 init_points::getPoint1_return#2 init_points::getPoint1_return#1 init_points::getPoint1_return#3 init_points::$0 init_points::point#0 init_points::pointXpos1_point#0 init_points::pointXpos1_point#1 init_points::point#3 init_points::point#2 init_points::point#1 init_points::pointYpos1_point#0 init_points::pointYpos1_point#1 +Alias init_points::getPoint1_return#0 = init_points::getPoint1_$1 init_points::getPoint1_return#2 init_points::getPoint1_return#1 init_points::getPoint1_return#3 init_points::point#0 init_points::pointXpos1_point#0 init_points::pointXpos1_point#1 init_points::point#3 init_points::point#2 init_points::point#1 init_points::pointYpos1_point#0 init_points::pointYpos1_point#1 Alias init_points::pointXpos1_return#0 = init_points::pointXpos1_$0 init_points::pointXpos1_return#2 init_points::pointXpos1_return#1 init_points::pointXpos1_return#3 init_points::$1 Alias init_points::pos#1 = init_points::pos#8 init_points::pos#6 init_points::pos#4 Alias init_points::pointYpos1_return#0 = init_points::pointYpos1_$0 init_points::pointYpos1_return#2 init_points::pointYpos1_return#1 init_points::pointYpos1_return#3 init_points::$2 @@ -853,7 +849,7 @@ Alias print_char_cursor#13 = print_char_cursor#34 Alias print_points::i#10 = print_points::getPoint1_idx#0 print_points::i#2 print_points::getPoint1_idx#1 print_points::i#15 print_points::i#14 print_points::i#13 print_points::i#12 print_points::i#11 print_points::i#9 print_points::i#8 print_points::i#7 print_points::i#6 print_points::i#5 print_points::i#4 print_points::i#3 Alias print_char_cursor#48 = print_char_cursor#59 print_char_cursor#60 print_char_cursor#58 print_char_cursor#57 print_char_cursor#55 print_char_cursor#53 Alias print_line_cursor#26 = print_line_cursor#39 print_line_cursor#40 print_line_cursor#38 print_line_cursor#37 print_line_cursor#36 print_line_cursor#35 print_line_cursor#34 print_line_cursor#33 print_line_cursor#32 print_line_cursor#31 print_line_cursor#30 print_line_cursor#29 -Alias print_points::point#0 = print_points::getPoint1_return#0 print_points::getPoint1_$1 print_points::getPoint1_return#2 print_points::getPoint1_return#1 print_points::getPoint1_return#3 print_points::$1 print_points::pointXpos1_point#0 print_points::pointXpos1_point#1 print_points::point#5 print_points::point#4 print_points::point#3 print_points::point#2 print_points::point#1 print_points::pointYpos1_point#0 print_points::pointYpos1_point#1 +Alias print_points::point#0 = print_points::getPoint1_return#0 print_points::getPoint1_$1 print_points::getPoint1_return#2 print_points::getPoint1_return#1 print_points::getPoint1_return#3 print_points::pointXpos1_point#0 print_points::pointXpos1_point#1 print_points::point#5 print_points::point#4 print_points::point#3 print_points::point#2 print_points::point#1 print_points::pointYpos1_point#0 print_points::pointYpos1_point#1 Alias print_points::pointXpos1_return#0 = print_points::pointXpos1_$0 print_points::pointXpos1_return#2 print_points::pointXpos1_return#1 print_points::pointXpos1_return#3 print_points::$2 Alias print_char_cursor#14 = print_char_cursor#35 Alias print_char_cursor#15 = print_char_cursor#36 print_char_cursor#56 print_char_cursor#54 print_char_cursor#49 diff --git a/src/test/ref/sieve-min.asm b/src/test/ref/sieve-min.asm index aa9a9f282..82781515b 100644 --- a/src/test/ref/sieve-min.asm +++ b/src/test/ref/sieve-min.asm @@ -99,6 +99,7 @@ main: { cmp #0 bne __b3 // unsigned int j = i*2 + /* Prime number - mark all multiples */ lda.z i asl sta.z j diff --git a/src/test/ref/sieve-min.log b/src/test/ref/sieve-min.log index 1b982e1af..f1469db2e 100644 --- a/src/test/ref/sieve-min.log +++ b/src/test/ref/sieve-min.log @@ -1,5 +1,9 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call __init +Eliminating unused variable with no statement memset::$2 +Eliminating unused variable with no statement main::$1 +Eliminating unused variable with no statement main::$5 +Eliminating unused variable with no statement main::$6 CONTROL FLOW GRAPH SSA @@ -21,8 +25,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -124,8 +127,7 @@ main: scope:[main] from __start::@1 main::@14: scope:[main] from main print_char_cursor#38 = phi( main/print_char_cursor#40 ) main::i#0 = 2 - main::$1 = & sieve[main::i#0] - main::sieve_i#0 = main::$1 + main::sieve_i#0 = & sieve[main::i#0] to:main::@1 main::@1: scope:[main] from main::@14 main::@4 print_char_cursor#37 = phi( main::@14/print_char_cursor#38, main::@4/print_char_cursor#39 ) @@ -158,10 +160,8 @@ main::@7: scope:[main] from main::@2 print_char_cursor#44 = phi( main::@2/print_char_cursor#41 ) main::sieve_i#7 = phi( main::@2/main::sieve_i#2 ) main::i#6 = phi( main::@2/main::i#12 ) - main::$5 = main::i#6 * 2 - main::j#0 = main::$5 - main::$6 = & sieve[main::j#0] - main::s#0 = main::$6 + main::j#0 = main::i#6 * 2 + main::s#0 = & sieve[main::j#0] to:main::@5 main::@5: scope:[main] from main::@6 main::@7 print_char_cursor#42 = phi( main::@6/print_char_cursor#43, main::@7/print_char_cursor#44 ) @@ -273,15 +273,12 @@ constant byte* const SCREEN = (byte*)$400 constant const byte SQRT_COUNT = $80 void __start() void main() -byte*~ main::$1 bool~ main::$10 bool~ main::$14 bool~ main::$15 bool~ main::$2 bool~ main::$3 bool~ main::$4 -number~ main::$5 -byte*~ main::$6 bool~ main::$7 bool~ main::$8 bool~ main::$9 @@ -324,7 +321,6 @@ byte* main::sieve_i#7 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -447,8 +443,7 @@ Adding number conversion cast (unumber) print_uchar::$2 in print_uchar::$2 = pri Adding number conversion cast (unumber) 0 in memset::c#0 = 0 Adding number conversion cast (unumber) 0 in main::$14 = 0 != *main::sieve_i#2 Adding number conversion cast (unumber) 2 in main::i#1 = 2 -Adding number conversion cast (unumber) 2 in main::$5 = main::i#6 * 2 -Adding number conversion cast (unumber) main::$5 in main::$5 = main::i#6 * (unumber)2 +Adding number conversion cast (unumber) 2 in main::j#0 = main::i#6 * 2 Adding number conversion cast (unumber) 1 in *main::s#2 = 1 Adding number conversion cast (unumber) $4c7 in main::$8 = main::i#8 < $4c7 Adding number conversion cast (unumber) 0 in main::$15 = 0 != sieve[main::i#9] @@ -487,18 +482,16 @@ Finalized unsigned number type (byte) 0 Finalized unsigned number type (word) $3e7 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in print_uchar::$2 = print_uchar::b#3 & $f -Inferred type updated to word in main::$5 = main::i#6 * 2 Inversing boolean not [2] memset::$1 = memset::num#1 <= 0 from [1] memset::$0 = memset::num#1 > 0 -Inversing boolean not [69] main::$3 = 0 == *main::sieve_i#2 from [68] main::$14 = 0 != *main::sieve_i#2 -Inversing boolean not [70] main::$4 = 0 != *main::sieve_i#2 from [69] main::$3 = 0 == *main::sieve_i#2 -Inversing boolean not [94] main::$9 = 0 == sieve[main::i#9] from [93] main::$15 = 0 != sieve[main::i#9] -Inversing boolean not [95] main::$10 = 0 != sieve[main::i#9] from [94] main::$9 = 0 == sieve[main::i#9] +Inversing boolean not [67] main::$3 = 0 == *main::sieve_i#2 from [66] main::$14 = 0 != *main::sieve_i#2 +Inversing boolean not [68] main::$4 = 0 != *main::sieve_i#2 from [67] main::$3 = 0 == *main::sieve_i#2 +Inversing boolean not [90] main::$9 = 0 == sieve[main::i#9] from [89] main::$15 = 0 != sieve[main::i#9] +Inversing boolean not [91] main::$10 = 0 != sieve[main::i#9] from [90] main::$9 = 0 == sieve[main::i#9] Successful SSA optimization Pass2UnaryNotSimplification Alias memset::return#0 = memset::str#1 memset::return#3 memset::return#1 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -513,12 +506,9 @@ Alias print_char_cursor#17 = print_char_cursor#3 Alias print_char_cursor#18 = print_char_cursor#4 print_char_cursor#19 print_char_cursor#5 Alias print_char_cursor#21 = print_char_cursor#6 print_char_cursor#7 Alias print_char_cursor#38 = print_char_cursor#40 -Alias main::sieve_i#0 = main::$1 Alias main::sieve_i#2 = main::sieve_i#4 main::sieve_i#7 Alias main::i#12 = main::i#4 main::i#6 Alias print_char_cursor#36 = print_char_cursor#41 print_char_cursor#37 print_char_cursor#44 -Alias main::j#0 = main::$5 -Alias main::s#0 = main::$6 Alias main::s#2 = main::s#3 Alias main::i#13 = main::i#7 Alias main::j#2 = main::j#3 @@ -1134,6 +1124,7 @@ main: { // main::@6 __b6: // [16] main::j#0 = main::i#12 << 1 -- vwuz1=vwuz2_rol_1 + /* Prime number - mark all multiples */ lda.z i asl sta.z j @@ -1615,6 +1606,7 @@ main: { // main::@6 // unsigned int j = i*2 // [16] main::j#0 = main::i#12 << 1 -- vwuz1=vwuz2_rol_1 + /* Prime number - mark all multiples */ lda.z i asl sta.z j diff --git a/src/test/ref/signed-indexed-subtract.log b/src/test/ref/signed-indexed-subtract.log index b23733b43..f70e0014f 100644 --- a/src/test/ref/signed-indexed-subtract.log +++ b/src/test/ref/signed-indexed-subtract.log @@ -1,4 +1,5 @@ Inlined call call __init +Eliminating unused variable with no statement memset::$2 CONTROL FLOW GRAPH SSA @@ -179,8 +180,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -363,7 +363,6 @@ byte main::j#4 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -616,7 +615,6 @@ Alias memset::return#1 = memset::str#1 memset::return#3 memset::return#2 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 diff --git a/src/test/ref/signed-words.log b/src/test/ref/signed-words.log index a2cd5dcec..475aaba60 100644 --- a/src/test/ref/signed-words.log +++ b/src/test/ref/signed-words.log @@ -1,5 +1,7 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call __init +Eliminating unused variable with no statement anim::$6 +Eliminating unused variable with no statement anim::$8 CONTROL FLOW GRAPH SSA @@ -122,11 +124,9 @@ anim::@1: scope:[anim] from anim anim::@4 anim::$4 = ypos#11 + yvel#2 ypos#2 = anim::$4 anim::$5 = xpos#2 >> 7 - anim::$6 = anim::$5 + $a0 - anim::sprite_x#0 = anim::$6 + anim::sprite_x#0 = anim::$5 + $a0 anim::$7 = ypos#2 >> 5 - anim::$8 = $e6 - anim::$7 - anim::sprite_y#0 = anim::$8 + anim::sprite_y#0 = $e6 - anim::$7 SPRITES_XPOS[0] = (byte)anim::sprite_x#0 SPRITES_YPOS[0] = (byte)anim::sprite_y#0 anim::$9 = byte1 anim::sprite_x#0 @@ -241,9 +241,7 @@ signed word~ anim::$2 signed word~ anim::$3 signed word~ anim::$4 signed word~ anim::$5 -number~ anim::$6 signed word~ anim::$7 -number~ anim::$8 byte~ anim::$9 signed word anim::sprite_x signed word anim::sprite_x#0 @@ -394,11 +392,9 @@ Adding number conversion cast (unumber) $3e8 in init::$0 = init::sc#2 != SCREEN+ Adding number conversion cast (unumber) $ff in SPRITE[init::i#2] = $ff Adding number conversion cast (snumber) 0 in anim::$0 = ypos#10 < 0 Adding number conversion cast (snumber) 7 in anim::$5 = xpos#2 >> 7 -Adding number conversion cast (snumber) $a0 in anim::$6 = anim::$5 + $a0 -Adding number conversion cast (snumber) anim::$6 in anim::$6 = anim::$5 + (snumber)$a0 +Adding number conversion cast (snumber) $a0 in anim::sprite_x#0 = anim::$5 + $a0 Adding number conversion cast (snumber) 5 in anim::$7 = ypos#2 >> 5 -Adding number conversion cast (snumber) $e6 in anim::$8 = $e6 - anim::$7 -Adding number conversion cast (snumber) anim::$8 in anim::$8 = (snumber)$e6 - anim::$7 +Adding number conversion cast (snumber) $e6 in anim::sprite_y#0 = $e6 - anim::$7 Adding number conversion cast (unumber) 0 in SPRITES_XPOS[0] = (byte)anim::sprite_x#0 Adding number conversion cast (unumber) 0 in SPRITES_YPOS[0] = (byte)anim::sprite_y#0 Adding number conversion cast (snumber) 0 in xpos#3 = 0 @@ -482,11 +478,9 @@ Finalized signed number type (signed byte) $a Finalized signed number type (signed word) -$c8 Finalized signed number type (signed word) $c8 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to signed word in anim::$6 = anim::$5 + $a0 -Inferred type updated to signed word in anim::$8 = $e6 - anim::$7 Inferred type updated to signed word in anim::$11 = yvel_init#10 - $a Inversing boolean not [45] anim::$1 = ypos#10 >= 0 from [44] anim::$0 = ypos#10 < 0 -Inversing boolean not [72] anim::$13 = yvel_init#2 >= -$c8 from [71] anim::$12 = yvel_init#2 < -$c8 +Inversing boolean not [70] anim::$13 = yvel_init#2 >= -$c8 from [69] anim::$12 = yvel_init#2 < -$c8 Successful SSA optimization Pass2UnaryNotSimplification Alias yvel#18 = yvel#19 Alias xpos#20 = xpos#21 @@ -507,8 +501,6 @@ Alias init::sc#2 = init::sc#3 Alias yvel#11 = yvel#2 anim::$2 yvel#4 Alias xpos#11 = xpos#2 anim::$3 xpos#4 Alias ypos#12 = ypos#2 anim::$4 ypos#4 -Alias anim::sprite_x#0 = anim::$6 -Alias anim::sprite_y#0 = anim::$8 Alias xvel#10 = xvel#15 Alias yvel_init#10 = yvel_init#16 Alias xvel#19 = xvel#2 anim::$10 diff --git a/src/test/ref/sinus-basic.asm b/src/test/ref/sinus-basic.asm index 00f4550c3..b78f3df83 100644 --- a/src/test/ref/sinus-basic.asm +++ b/src/test/ref/sinus-basic.asm @@ -231,7 +231,7 @@ getFAC: { jsr $b1aa sty memLo sta memHi - // MAKEWORD( *memHi, *memLo ) + // unsigned int w = MAKEWORD( *memHi, *memLo ) sta.z return+1 tya sta.z return diff --git a/src/test/ref/sinus-basic.log b/src/test/ref/sinus-basic.log index 0a5e66c45..a617d8e89 100644 --- a/src/test/ref/sinus-basic.log +++ b/src/test/ref/sinus-basic.log @@ -8,6 +8,7 @@ Inlined call call prepareMEM (word)divMEMbyFAC::mem Inlined call call prepareMEM (word)mulFACbyMEM::mem Inlined call call prepareMEM (word)pwrMEMbyFAC::mem Inlined call call __init +Eliminating unused variable with no statement getFAC::$0 CONTROL FLOW GRAPH SSA @@ -123,8 +124,7 @@ setFAC::@return: scope:[setFAC] from setFAC::@1 word getFAC() getFAC: scope:[getFAC] from main::@12 asm { jsr$b1aa stymemLo stamemHi } - getFAC::$0 = *memHi w= *memLo - getFAC::w#0 = getFAC::$0 + getFAC::w#0 = *memHi w= *memLo getFAC::return#0 = getFAC::w#0 to:getFAC::@return getFAC::@return: scope:[getFAC] from getFAC @@ -401,7 +401,6 @@ word divMEMbyFAC::prepareMEM1_mem word divMEMbyFAC::prepareMEM1_mem#0 word divMEMbyFAC::prepareMEM1_mem#1 word getFAC() -word~ getFAC::$0 word getFAC::return word getFAC::return#0 word getFAC::return#1 @@ -616,7 +615,7 @@ Alias print_char_cursor#21 = print_char_cursor#5 Alias print_char_cursor#22 = print_char_cursor#6 print_char_cursor#23 print_char_cursor#7 Alias print_char_cursor#25 = print_char_cursor#8 print_char_cursor#9 Alias setFAC::prepareMEM1_mem#0 = setFAC::w#3 setFAC::prepareMEM1_mem#1 -Alias getFAC::return#0 = getFAC::w#0 getFAC::$0 getFAC::return#3 getFAC::return#1 +Alias getFAC::return#0 = getFAC::w#0 getFAC::return#3 getFAC::return#1 Alias setMEMtoFAC::prepareMEM1_mem#0 = setMEMtoFAC::prepareMEM1_mem#1 Alias addMEMtoFAC::prepareMEM1_mem#0 = addMEMtoFAC::prepareMEM1_mem#1 Alias divMEMbyFAC::prepareMEM1_mem#0 = divMEMbyFAC::prepareMEM1_mem#1 @@ -2398,7 +2397,7 @@ getFAC: { jsr $b1aa sty memLo sta memHi - // MAKEWORD( *memHi, *memLo ) + // unsigned int w = MAKEWORD( *memHi, *memLo ) // [70] getFAC::return#0 = *memHi w= *memLo -- vwuz1=_deref_pbuc1_word__deref_pbuc2 sta.z return+1 tya diff --git a/src/test/ref/sinusgen16.asm b/src/test/ref/sinusgen16.asm index 7e16367cf..96b814b60 100644 --- a/src/test/ref/sinusgen16.asm +++ b/src/test/ref/sinusgen16.asm @@ -108,9 +108,9 @@ sin16s_gen: { // Iterate over the table .label x = 4 .label i = 8 - // div32u16u(PI2_u4f28, wavelength) + // unsigned long step = div32u16u(PI2_u4f28, wavelength) + // u[4.28] step = PI*2/wavelength jsr div32u16u - // div32u16u(PI2_u4f28, wavelength) // unsigned long step = div32u16u(PI2_u4f28, wavelength) lda #>$10 sta.z divr16u.dividend lda #>PI2_u4f28>>$10 @@ -261,21 +261,19 @@ div32u16u: { sta.z divr16u.rem sta.z divr16u.rem+1 jsr divr16u - // divr16u(WORD1(dividend), divisor, 0) // unsigned int quotient_hi = divr16u(WORD1(dividend), divisor, 0) lda.z divr16u.return sta.z quotient_hi lda.z divr16u.return+1 sta.z quotient_hi+1 - // divr16u(WORD0(dividend), divisor, rem16u) + // unsigned int quotient_lo = divr16u(WORD0(dividend), divisor, rem16u) lda #PI2_u4f28&$ffff sta.z divr16u.dividend+1 jsr divr16u - // divr16u(WORD0(dividend), divisor, rem16u) // unsigned int quotient_lo = divr16u(WORD0(dividend), divisor, rem16u) - // MAKELONG( quotient_hi, quotient_lo ) + // unsigned long quotient = MAKELONG( quotient_hi, quotient_lo ) lda.z quotient_hi sta.z return+2 lda.z quotient_hi+1 @@ -394,11 +392,12 @@ sin16s: { rol.z __4+2 rol.z __4+3 // unsigned int x1 = WORD1(x<<3) + // sinx = x - x^3/6 + x5/128; lda.z __4+2 sta.z x1 lda.z __4+3 sta.z x1+1 - // mulu16_sel(x1, x1, 0) + // unsigned int x2 = mulu16_sel(x1, x1, 0) lda.z x1 sta.z mulu16_sel.v1 lda.z x1+1 @@ -407,37 +406,38 @@ sin16s: { sta.z mulu16_sel.v2 lda.z x1+1 sta.z mulu16_sel.v2+1 + // u[1.15] ldx #0 jsr mulu16_sel - // mulu16_sel(x1, x1, 0) // unsigned int x2 = mulu16_sel(x1, x1, 0) lda.z mulu16_sel.return sta.z x2 lda.z mulu16_sel.return+1 sta.z x2+1 - // mulu16_sel(x2, x1, 1) + // unsigned int x3 = mulu16_sel(x2, x1, 1) lda.z x1 sta.z mulu16_sel.v2 lda.z x1+1 sta.z mulu16_sel.v2+1 + // u[2.14] x^2 ldx #1 jsr mulu16_sel - // mulu16_sel(x2, x1, 1) + // unsigned int x3 = mulu16_sel(x2, x1, 1) lda.z mulu16_sel.return sta.z mulu16_sel.return_1 lda.z mulu16_sel.return+1 sta.z mulu16_sel.return_1+1 - // unsigned int x3 = mulu16_sel(x2, x1, 1) - // mulu16_sel(x3, $10000/6, 1) + // unsigned int x3_6 = mulu16_sel(x3, $10000/6, 1) + // u[2.14] x^3 ldx #1 lda #<$10000/6 sta.z mulu16_sel.v2 lda #>$10000/6 sta.z mulu16_sel.v2+1 jsr mulu16_sel - // mulu16_sel(x3, $10000/6, 1) // unsigned int x3_6 = mulu16_sel(x3, $10000/6, 1) // unsigned int usinx = x1 - x3_6 + // u[1.15] x^3/6; lda.z x1 sec sbc.z x3_6 @@ -445,29 +445,30 @@ sin16s: { lda.z x1+1 sbc.z x3_6+1 sta.z usinx+1 - // mulu16_sel(x3, x1, 0) + // unsigned int x4 = mulu16_sel(x3, x1, 0) lda.z x1 sta.z mulu16_sel.v2 lda.z x1+1 sta.z mulu16_sel.v2+1 + // u[1.15] x - x^3/6 ldx #0 jsr mulu16_sel - // mulu16_sel(x3, x1, 0) + // unsigned int x4 = mulu16_sel(x3, x1, 0) lda.z mulu16_sel.return sta.z mulu16_sel.return_1 lda.z mulu16_sel.return+1 sta.z mulu16_sel.return_1+1 - // unsigned int x4 = mulu16_sel(x3, x1, 0) - // mulu16_sel(x4, x1, 0) + // unsigned int x5 = mulu16_sel(x4, x1, 0) lda.z x1 sta.z mulu16_sel.v2 lda.z x1+1 sta.z mulu16_sel.v2+1 + // u[3.13] x^4 ldx #0 jsr mulu16_sel - // mulu16_sel(x4, x1, 0) // unsigned int x5 = mulu16_sel(x4, x1, 0) // unsigned int x5_128 = x5>>4 + // u[4.12] x^5 lsr.z x5_128+1 ror.z x5_128 lsr.z x5_128+1 diff --git a/src/test/ref/sinusgen16.log b/src/test/ref/sinusgen16.log index 55444b926..657cf5a02 100644 --- a/src/test/ref/sinusgen16.log +++ b/src/test/ref/sinusgen16.log @@ -1,4 +1,17 @@ Inlined call call __init +Eliminating unused variable with no statement sin16s_gen::$0 +Eliminating unused variable with no statement sin16s::$5 +Eliminating unused variable with no statement sin16s::$6 +Eliminating unused variable with no statement sin16s::$7 +Eliminating unused variable with no statement sin16s::$8 +Eliminating unused variable with no statement sin16s::$9 +Eliminating unused variable with no statement sin16s::$10 +Eliminating unused variable with no statement sin16s::$11 +Eliminating unused variable with no statement sin16s::$12 +Eliminating unused variable with no statement div32u16u::$1 +Eliminating unused variable with no statement div32u16u::$3 +Eliminating unused variable with no statement div32u16u::$4 +Eliminating unused variable with no statement memset::$2 CONTROL FLOW GRAPH SSA @@ -17,9 +30,8 @@ sin16s_gen::@3: scope:[sin16s_gen] from sin16s_gen sin16s_gen::wavelength#3 = phi( sin16s_gen/sin16s_gen::wavelength#1 ) rem16u#12 = phi( sin16s_gen/rem16u#6 ) div32u16u::return#3 = phi( sin16s_gen/div32u16u::return#0 ) - sin16s_gen::$0 = div32u16u::return#3 + sin16s_gen::step#0 = div32u16u::return#3 rem16u#0 = rem16u#12 - sin16s_gen::step#0 = sin16s_gen::$0 sin16s_gen::x#0 = 0 sin16s_gen::i#0 = 0 to:sin16s_gen::@1 @@ -90,8 +102,7 @@ sin16s::@2: scope:[sin16s] from sin16s::@1 sin16s::@5 sin16s::isUpper#7 = phi( sin16s::@1/sin16s::isUpper#8, sin16s::@5/sin16s::isUpper#9 ) sin16s::x#6 = phi( sin16s::@1/sin16s::x#4, sin16s::@5/sin16s::x#2 ) sin16s::$4 = sin16s::x#6 << 3 - sin16s::$5 = word1 sin16s::$4 - sin16s::x1#0 = sin16s::$5 + sin16s::x1#0 = word1 sin16s::$4 mulu16_sel::v1#0 = sin16s::x1#0 mulu16_sel::v2#0 = sin16s::x1#0 mulu16_sel::select#0 = 0 @@ -102,8 +113,7 @@ sin16s::@7: scope:[sin16s] from sin16s::@2 sin16s::isUpper#6 = phi( sin16s::@2/sin16s::isUpper#7 ) sin16s::x1#1 = phi( sin16s::@2/sin16s::x1#0 ) mulu16_sel::return#7 = phi( sin16s::@2/mulu16_sel::return#0 ) - sin16s::$6 = mulu16_sel::return#7 - sin16s::x2#0 = sin16s::$6 + sin16s::x2#0 = mulu16_sel::return#7 mulu16_sel::v1#1 = sin16s::x2#0 mulu16_sel::v2#1 = sin16s::x1#1 mulu16_sel::select#1 = 1 @@ -114,8 +124,7 @@ sin16s::@8: scope:[sin16s] from sin16s::@7 sin16s::isUpper#5 = phi( sin16s::@7/sin16s::isUpper#6 ) sin16s::x1#4 = phi( sin16s::@7/sin16s::x1#1 ) mulu16_sel::return#8 = phi( sin16s::@7/mulu16_sel::return#1 ) - sin16s::$7 = mulu16_sel::return#8 - sin16s::x3#0 = sin16s::$7 + sin16s::x3#0 = mulu16_sel::return#8 mulu16_sel::v1#2 = sin16s::x3#0 mulu16_sel::v2#2 = $10000/6 mulu16_sel::select#2 = 1 @@ -127,10 +136,8 @@ sin16s::@9: scope:[sin16s] from sin16s::@8 sin16s::x3#1 = phi( sin16s::@8/sin16s::x3#0 ) sin16s::x1#2 = phi( sin16s::@8/sin16s::x1#4 ) mulu16_sel::return#9 = phi( sin16s::@8/mulu16_sel::return#2 ) - sin16s::$8 = mulu16_sel::return#9 - sin16s::x3_6#0 = sin16s::$8 - sin16s::$9 = sin16s::x1#2 - sin16s::x3_6#0 - sin16s::usinx#0 = sin16s::$9 + sin16s::x3_6#0 = mulu16_sel::return#9 + sin16s::usinx#0 = sin16s::x1#2 - sin16s::x3_6#0 mulu16_sel::v1#3 = sin16s::x3#1 mulu16_sel::v2#3 = sin16s::x1#2 mulu16_sel::select#3 = 0 @@ -142,8 +149,7 @@ sin16s::@10: scope:[sin16s] from sin16s::@9 sin16s::usinx#4 = phi( sin16s::@9/sin16s::usinx#0 ) sin16s::x1#3 = phi( sin16s::@9/sin16s::x1#2 ) mulu16_sel::return#10 = phi( sin16s::@9/mulu16_sel::return#3 ) - sin16s::$10 = mulu16_sel::return#10 - sin16s::x4#0 = sin16s::$10 + sin16s::x4#0 = mulu16_sel::return#10 mulu16_sel::v1#4 = sin16s::x4#0 mulu16_sel::v2#4 = sin16s::x1#3 mulu16_sel::select#4 = 0 @@ -154,10 +160,8 @@ sin16s::@11: scope:[sin16s] from sin16s::@10 sin16s::isUpper#2 = phi( sin16s::@10/sin16s::isUpper#3 ) sin16s::usinx#2 = phi( sin16s::@10/sin16s::usinx#4 ) mulu16_sel::return#11 = phi( sin16s::@10/mulu16_sel::return#4 ) - sin16s::$11 = mulu16_sel::return#11 - sin16s::x5#0 = sin16s::$11 - sin16s::$12 = sin16s::x5#0 >> 4 - sin16s::x5_128#0 = sin16s::$12 + sin16s::x5#0 = mulu16_sel::return#11 + sin16s::x5_128#0 = sin16s::x5#0 >> 4 sin16s::$13 = sin16s::usinx#2 + sin16s::x5_128#0 sin16s::usinx#1 = sin16s::$13 sin16s::sinx#0 = (signed word)sin16s::usinx#1 @@ -306,9 +310,8 @@ div32u16u::@1: scope:[div32u16u] from div32u16u div32u16u::dividend#2 = phi( div32u16u/div32u16u::dividend#1 ) rem16u#15 = phi( div32u16u/rem16u#3 ) divr16u::return#5 = phi( div32u16u/divr16u::return#2 ) - div32u16u::$1 = divr16u::return#5 + div32u16u::quotient_hi#0 = divr16u::return#5 rem16u#4 = rem16u#15 - div32u16u::quotient_hi#0 = div32u16u::$1 div32u16u::$2 = word0 div32u16u::dividend#2 divr16u::dividend#2 = div32u16u::$2 divr16u::divisor#1 = div32u16u::divisor#2 @@ -320,11 +323,9 @@ div32u16u::@2: scope:[div32u16u] from div32u16u::@1 div32u16u::quotient_hi#1 = phi( div32u16u::@1/div32u16u::quotient_hi#0 ) rem16u#16 = phi( div32u16u::@1/rem16u#3 ) divr16u::return#6 = phi( div32u16u::@1/divr16u::return#3 ) - div32u16u::$3 = divr16u::return#6 + div32u16u::quotient_lo#0 = divr16u::return#6 rem16u#5 = rem16u#16 - div32u16u::quotient_lo#0 = div32u16u::$3 - div32u16u::$4 = div32u16u::quotient_hi#1 dw= div32u16u::quotient_lo#0 - div32u16u::quotient#0 = div32u16u::$4 + div32u16u::quotient#0 = div32u16u::quotient_hi#1 dw= div32u16u::quotient_lo#0 div32u16u::return#1 = div32u16u::quotient#0 to:div32u16u::@return div32u16u::@return: scope:[div32u16u] from div32u16u::@2 @@ -565,8 +566,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -739,10 +739,7 @@ constant byte SIZEOF_SIGNED_WORD = 2 void __start() dword div32u16u(dword div32u16u::dividend , word div32u16u::divisor) word~ div32u16u::$0 -word~ div32u16u::$1 word~ div32u16u::$2 -word~ div32u16u::$3 -dword~ div32u16u::$4 dword div32u16u::dividend dword div32u16u::dividend#0 dword div32u16u::dividend#1 @@ -863,7 +860,6 @@ constant word main::wavelength = $78 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -1161,9 +1157,6 @@ word rem16u#9 signed word sin16s(dword sin16s::x) bool~ sin16s::$0 bool~ sin16s::$1 -word~ sin16s::$10 -word~ sin16s::$11 -word~ sin16s::$12 word~ sin16s::$13 bool~ sin16s::$14 bool~ sin16s::$15 @@ -1173,11 +1166,6 @@ signed word~ sin16s::$18 bool~ sin16s::$2 bool~ sin16s::$3 dword~ sin16s::$4 -word~ sin16s::$5 -word~ sin16s::$6 -word~ sin16s::$7 -word~ sin16s::$8 -word~ sin16s::$9 byte sin16s::isUpper byte sin16s::isUpper#0 byte sin16s::isUpper#1 @@ -1234,7 +1222,6 @@ word sin16s::x5#0 word sin16s::x5_128 word sin16s::x5_128#0 void sin16s_gen(signed word* sin16s_gen::sintab , word sin16s_gen::wavelength) -dword~ sin16s_gen::$0 bool~ sin16s_gen::$1 signed word~ sin16s_gen::$2 dword~ sin16s_gen::$3 @@ -1279,7 +1266,7 @@ Adding number conversion cast (unumber) $10000/6 in mulu16_sel::v2#2 = $10000/6 Adding number conversion cast (unumber) 1 in mulu16_sel::select#2 = 1 Adding number conversion cast (unumber) 0 in mulu16_sel::select#3 = 0 Adding number conversion cast (unumber) 0 in mulu16_sel::select#4 = 0 -Adding number conversion cast (unumber) 4 in sin16s::$12 = sin16s::x5#0 >> 4 +Adding number conversion cast (unumber) 4 in sin16s::x5_128#0 = sin16s::x5#0 >> 4 Adding number conversion cast (unumber) 0 in sin16s::$14 = sin16s::isUpper#2 != 0 Adding number conversion cast (unumber) 1 in divr16u::$0 = divr16u::rem#5 << 1 Adding number conversion cast (unumber) $80 in divr16u::$2 = divr16u::$1 & $80 @@ -1379,20 +1366,19 @@ Inferred type updated to byte in divr16u::$2 = divr16u::$1 & $80 Inferred type updated to word in divr16u::$5 = divr16u::rem#7 | 1 Inferred type updated to byte in mul16u::$1 = mul16u::a#3 & 1 Inferred type updated to byte in print_uchar::$2 = print_uchar::b#3 & $f -Inversing boolean not [31] sin16s::$1 = sin16s::x#3 < PI_u4f28 from [30] sin16s::$0 = sin16s::x#3 >= PI_u4f28 -Inversing boolean not [35] sin16s::$3 = sin16s::x#4 < PI_HALF_u4f28 from [34] sin16s::$2 = sin16s::x#4 >= PI_HALF_u4f28 -Inversing boolean not [93] sin16s::$15 = sin16s::isUpper#2 == 0 from [92] sin16s::$14 = sin16s::isUpper#2 != 0 -Inversing boolean not [128] divr16u::$4 = divr16u::$2 == 0 from [127] divr16u::$3 = divr16u::$2 != 0 -Inversing boolean not [136] divr16u::$9 = divr16u::rem#6 < divr16u::divisor#2 from [135] divr16u::$8 = divr16u::rem#6 >= divr16u::divisor#2 -Inversing boolean not [193] mul16u::$3 = mul16u::$1 == 0 from [192] mul16u::$2 = mul16u::$1 != 0 -Inversing boolean not [293] memset::$1 = memset::num#1 <= 0 from [292] memset::$0 = memset::num#1 > 0 -Inversing boolean not [330] main::$5 = main::sw#0 < 0 from [329] main::$4 = main::sw#0 >= 0 +Inversing boolean not [30] sin16s::$1 = sin16s::x#3 < PI_u4f28 from [29] sin16s::$0 = sin16s::x#3 >= PI_u4f28 +Inversing boolean not [34] sin16s::$3 = sin16s::x#4 < PI_HALF_u4f28 from [33] sin16s::$2 = sin16s::x#4 >= PI_HALF_u4f28 +Inversing boolean not [84] sin16s::$15 = sin16s::isUpper#2 == 0 from [83] sin16s::$14 = sin16s::isUpper#2 != 0 +Inversing boolean not [119] divr16u::$4 = divr16u::$2 == 0 from [118] divr16u::$3 = divr16u::$2 != 0 +Inversing boolean not [127] divr16u::$9 = divr16u::rem#6 < divr16u::divisor#2 from [126] divr16u::$8 = divr16u::rem#6 >= divr16u::divisor#2 +Inversing boolean not [181] mul16u::$3 = mul16u::$1 == 0 from [180] mul16u::$2 = mul16u::$1 != 0 +Inversing boolean not [281] memset::$1 = memset::num#1 <= 0 from [280] memset::$0 = memset::num#1 > 0 +Inversing boolean not [317] main::$5 = main::sw#0 < 0 from [316] main::$4 = main::sw#0 >= 0 Successful SSA optimization Pass2UnaryNotSimplification Alias div32u16u::return#0 = div32u16u::return#3 Alias sin16s_gen::wavelength#1 = sin16s_gen::wavelength#3 Alias sin16s_gen::sintab#5 = sin16s_gen::sintab#6 Alias rem16u#0 = rem16u#12 -Alias sin16s_gen::step#0 = sin16s_gen::$0 Alias sin16s_gen::x#2 = sin16s_gen::x#4 sin16s_gen::x#3 Alias sin16s_gen::sintab#2 = sin16s_gen::sintab#3 sin16s_gen::sintab#4 Alias sin16s_gen::step#1 = sin16s_gen::step#2 sin16s_gen::step#3 @@ -1403,20 +1389,15 @@ Alias sin16s::return#0 = sin16s::return#3 Alias sin16s_gen::x#1 = sin16s_gen::$3 Alias sin16s::x#3 = sin16s::x#5 Alias sin16s::x#1 = sin16s::$16 -Alias sin16s::x1#0 = sin16s::$5 sin16s::x1#1 sin16s::x1#4 sin16s::x1#2 sin16s::x1#3 Alias mulu16_sel::return#0 = mulu16_sel::return#7 +Alias sin16s::x1#0 = sin16s::x1#1 sin16s::x1#4 sin16s::x1#2 sin16s::x1#3 Alias sin16s::isUpper#2 = sin16s::isUpper#6 sin16s::isUpper#7 sin16s::isUpper#5 sin16s::isUpper#4 sin16s::isUpper#3 -Alias sin16s::x2#0 = sin16s::$6 Alias mulu16_sel::return#1 = mulu16_sel::return#8 -Alias sin16s::x3#0 = sin16s::$7 sin16s::x3#1 Alias mulu16_sel::return#2 = mulu16_sel::return#9 -Alias sin16s::x3_6#0 = sin16s::$8 -Alias sin16s::usinx#0 = sin16s::$9 sin16s::usinx#4 sin16s::usinx#2 +Alias sin16s::x3#0 = sin16s::x3#1 Alias mulu16_sel::return#10 = mulu16_sel::return#3 -Alias sin16s::x4#0 = sin16s::$10 +Alias sin16s::usinx#0 = sin16s::usinx#4 sin16s::usinx#2 Alias mulu16_sel::return#11 = mulu16_sel::return#4 -Alias sin16s::x5#0 = sin16s::$11 -Alias sin16s::x5_128#0 = sin16s::$12 Alias sin16s::usinx#1 = sin16s::$13 sin16s::usinx#3 Alias sin16s::x#4 = sin16s::x#7 Alias sin16s::isUpper#8 = sin16s::isUpper#9 @@ -1446,12 +1427,11 @@ Alias divr16u::return#2 = divr16u::return#5 Alias div32u16u::dividend#1 = div32u16u::dividend#2 Alias div32u16u::divisor#1 = div32u16u::divisor#2 Alias rem16u#15 = rem16u#4 -Alias div32u16u::quotient_hi#0 = div32u16u::$1 div32u16u::quotient_hi#1 Alias divr16u::dividend#2 = div32u16u::$2 Alias divr16u::return#3 = divr16u::return#6 +Alias div32u16u::quotient_hi#0 = div32u16u::quotient_hi#1 Alias rem16u#16 = rem16u#5 rem16u#17 rem16u#6 -Alias div32u16u::quotient_lo#0 = div32u16u::$3 -Alias div32u16u::return#1 = div32u16u::quotient#0 div32u16u::$4 div32u16u::return#4 div32u16u::return#2 +Alias div32u16u::return#1 = div32u16u::quotient#0 div32u16u::return#4 div32u16u::return#2 Alias mul16u::a#2 = mul16u::a#3 mul16u::a#6 Alias mul16u::mb#3 = mul16u::mb#4 mul16u::mb#5 Alias mul16u::res#2 = mul16u::res#5 mul16u::res#4 mul16u::return#1 mul16u::res#3 mul16u::return#4 mul16u::return#2 @@ -1481,7 +1461,6 @@ Alias memset::return#1 = memset::str#1 memset::return#3 memset::return#2 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -3059,6 +3038,7 @@ sin16s_gen: { .label x = 4 .label i = 8 // [18] call div32u16u + // u[4.28] step = PI*2/wavelength // [52] phi from sin16s_gen to div32u16u [phi:sin16s_gen->div32u16u] div32u16u_from_sin16s_gen: jsr div32u16u @@ -3472,6 +3452,7 @@ sin16s: { rol.z __4+2 rol.z __4+3 // [69] sin16s::x1#0 = word1 sin16s::$4 -- vwuz1=_word1_vduz2 + // sinx = x - x^3/6 + x5/128; lda.z __4+2 sta.z x1 lda.z __4+3 @@ -3487,6 +3468,7 @@ sin16s: { lda.z x1+1 sta.z mulu16_sel.v2+1 // [72] call mulu16_sel + // u[1.15] // [135] phi from sin16s::@2 to mulu16_sel [phi:sin16s::@2->mulu16_sel] mulu16_sel_from___b2: // [135] phi mulu16_sel::select#5 = 0 [phi:sin16s::@2->mulu16_sel#0] -- vbuxx=vbuc1 @@ -3510,6 +3492,7 @@ sin16s: { lda.z x1+1 sta.z mulu16_sel.v2+1 // [77] call mulu16_sel + // u[2.14] x^2 // [135] phi from sin16s::@7 to mulu16_sel [phi:sin16s::@7->mulu16_sel] mulu16_sel_from___b7: // [135] phi mulu16_sel::select#5 = 1 [phi:sin16s::@7->mulu16_sel#0] -- vbuxx=vbuc1 @@ -3528,6 +3511,7 @@ sin16s: { // [79] sin16s::x3#0 = mulu16_sel::return#1 // [80] mulu16_sel::v1#2 = sin16s::x3#0 // [81] call mulu16_sel + // u[2.14] x^3 // [135] phi from sin16s::@8 to mulu16_sel [phi:sin16s::@8->mulu16_sel] mulu16_sel_from___b8: // [135] phi mulu16_sel::select#5 = 1 [phi:sin16s::@8->mulu16_sel#0] -- vbuxx=vbuc1 @@ -3545,6 +3529,7 @@ sin16s: { __b9: // [83] sin16s::x3_6#0 = mulu16_sel::return#2 // [84] sin16s::usinx#0 = sin16s::x1#0 - sin16s::x3_6#0 -- vwuz1=vwuz2_minus_vwuz3 + // u[1.15] x^3/6; lda.z x1 sec sbc.z x3_6 @@ -3559,6 +3544,7 @@ sin16s: { lda.z x1+1 sta.z mulu16_sel.v2+1 // [87] call mulu16_sel + // u[1.15] x - x^3/6 // [135] phi from sin16s::@9 to mulu16_sel [phi:sin16s::@9->mulu16_sel] mulu16_sel_from___b9: // [135] phi mulu16_sel::select#5 = 0 [phi:sin16s::@9->mulu16_sel#0] -- vbuxx=vbuc1 @@ -3582,6 +3568,7 @@ sin16s: { lda.z x1+1 sta.z mulu16_sel.v2+1 // [92] call mulu16_sel + // u[3.13] x^4 // [135] phi from sin16s::@10 to mulu16_sel [phi:sin16s::@10->mulu16_sel] mulu16_sel_from___b10: // [135] phi mulu16_sel::select#5 = 0 [phi:sin16s::@10->mulu16_sel#0] -- vbuxx=vbuc1 @@ -3595,6 +3582,7 @@ sin16s: { __b11: // [94] sin16s::x5#0 = mulu16_sel::return#11 // [95] sin16s::x5_128#0 = sin16s::x5#0 >> 4 -- vwuz1=vwuz1_ror_4 + // u[4.12] x^5 lsr.z x5_128+1 ror.z x5_128 lsr.z x5_128+1 @@ -4121,7 +4109,6 @@ Removing instruction __b1_from_print_sint: Removing instruction print_char_from___b1: Removing instruction __b2_from___b1: Removing instruction __b2_from___b5: -Removing instruction mulu16_sel_from___b8: Removing instruction __b3_from___b12: Removing instruction __b3_from___b6: Removing instruction __breturn: @@ -4167,6 +4154,7 @@ Removing instruction mulu16_sel_from___b2: Removing instruction __b7: Removing instruction mulu16_sel_from___b7: Removing instruction __b8: +Removing instruction mulu16_sel_from___b8: Removing instruction __b9: Removing instruction mulu16_sel_from___b9: Removing instruction __b10: @@ -4593,14 +4581,14 @@ sin16s_gen: { // Iterate over the table .label x = 4 .label i = 8 - // div32u16u(PI2_u4f28, wavelength) + // unsigned long step = div32u16u(PI2_u4f28, wavelength) // [18] call div32u16u + // u[4.28] step = PI*2/wavelength // [52] phi from sin16s_gen to div32u16u [phi:sin16s_gen->div32u16u] jsr div32u16u - // div32u16u(PI2_u4f28, wavelength) + // unsigned long step = div32u16u(PI2_u4f28, wavelength) // [19] div32u16u::return#0 = div32u16u::return#1 // sin16s_gen::@3 - // unsigned long step = div32u16u(PI2_u4f28, wavelength) // [20] sin16s_gen::step#0 = div32u16u::return#0 // [21] phi from sin16s_gen::@3 to sin16s_gen::@1 [phi:sin16s_gen::@3->sin16s_gen::@1] // [21] phi sin16s_gen::sintab#2 = main::sintab1 [phi:sin16s_gen::@3->sin16s_gen::@1#0] -- pwsz1=pwsc1 @@ -4809,7 +4797,7 @@ div32u16u: { .label return = $1a .label quotient_hi = $24 .label quotient_lo = $14 - // divr16u(WORD1(dividend), divisor, 0) + // unsigned int quotient_hi = divr16u(WORD1(dividend), divisor, 0) // [53] call divr16u // [117] phi from div32u16u to divr16u [phi:div32u16u->divr16u] // [117] phi divr16u::dividend#5 = word1 PI2_u4f28 [phi:div32u16u->divr16u#0] -- vwuz1=vwuc1 @@ -4822,16 +4810,15 @@ div32u16u: { sta.z divr16u.rem sta.z divr16u.rem+1 jsr divr16u - // divr16u(WORD1(dividend), divisor, 0) + // unsigned int quotient_hi = divr16u(WORD1(dividend), divisor, 0) // [54] divr16u::return#2 = divr16u::return#0 // div32u16u::@1 - // unsigned int quotient_hi = divr16u(WORD1(dividend), divisor, 0) // [55] div32u16u::quotient_hi#0 = divr16u::return#2 -- vwuz1=vwuz2 lda.z divr16u.return sta.z quotient_hi lda.z divr16u.return+1 sta.z quotient_hi+1 - // divr16u(WORD0(dividend), divisor, rem16u) + // unsigned int quotient_lo = divr16u(WORD0(dividend), divisor, rem16u) // [56] divr16u::rem#4 = rem16u#14 // [57] call divr16u // [117] phi from div32u16u::@1 to divr16u [phi:div32u16u::@1->divr16u] @@ -4842,12 +4829,11 @@ div32u16u: { sta.z divr16u.dividend+1 // [117] phi divr16u::rem#10 = divr16u::rem#4 [phi:div32u16u::@1->divr16u#1] -- register_copy jsr divr16u - // divr16u(WORD0(dividend), divisor, rem16u) + // unsigned int quotient_lo = divr16u(WORD0(dividend), divisor, rem16u) // [58] divr16u::return#3 = divr16u::return#0 // div32u16u::@2 - // unsigned int quotient_lo = divr16u(WORD0(dividend), divisor, rem16u) // [59] div32u16u::quotient_lo#0 = divr16u::return#3 - // MAKELONG( quotient_hi, quotient_lo ) + // unsigned long quotient = MAKELONG( quotient_hi, quotient_lo ) // [60] div32u16u::return#1 = div32u16u::quotient_hi#0 dw= div32u16u::quotient_lo#0 -- vduz1=vwuz2_dword_vwuz3 lda.z quotient_hi sta.z return+2 @@ -4988,11 +4974,12 @@ sin16s: { rol.z __4+3 // unsigned int x1 = WORD1(x<<3) // [69] sin16s::x1#0 = word1 sin16s::$4 -- vwuz1=_word1_vduz2 + // sinx = x - x^3/6 + x5/128; lda.z __4+2 sta.z x1 lda.z __4+3 sta.z x1+1 - // mulu16_sel(x1, x1, 0) + // unsigned int x2 = mulu16_sel(x1, x1, 0) // [70] mulu16_sel::v1#0 = sin16s::x1#0 -- vwuz1=vwuz2 lda.z x1 sta.z mulu16_sel.v1 @@ -5004,22 +4991,22 @@ sin16s: { lda.z x1+1 sta.z mulu16_sel.v2+1 // [72] call mulu16_sel + // u[1.15] // [135] phi from sin16s::@2 to mulu16_sel [phi:sin16s::@2->mulu16_sel] // [135] phi mulu16_sel::select#5 = 0 [phi:sin16s::@2->mulu16_sel#0] -- vbuxx=vbuc1 ldx #0 // [135] phi mulu16_sel::v2#5 = mulu16_sel::v2#0 [phi:sin16s::@2->mulu16_sel#1] -- register_copy // [135] phi mulu16_sel::v1#5 = mulu16_sel::v1#0 [phi:sin16s::@2->mulu16_sel#2] -- register_copy jsr mulu16_sel - // mulu16_sel(x1, x1, 0) + // unsigned int x2 = mulu16_sel(x1, x1, 0) // [73] mulu16_sel::return#0 = mulu16_sel::return#12 // sin16s::@7 - // unsigned int x2 = mulu16_sel(x1, x1, 0) // [74] sin16s::x2#0 = mulu16_sel::return#0 -- vwuz1=vwuz2 lda.z mulu16_sel.return sta.z x2 lda.z mulu16_sel.return+1 sta.z x2+1 - // mulu16_sel(x2, x1, 1) + // unsigned int x3 = mulu16_sel(x2, x1, 1) // [75] mulu16_sel::v1#1 = sin16s::x2#0 // [76] mulu16_sel::v2#1 = sin16s::x1#0 -- vwuz1=vwuz2 lda.z x1 @@ -5027,24 +5014,25 @@ sin16s: { lda.z x1+1 sta.z mulu16_sel.v2+1 // [77] call mulu16_sel + // u[2.14] x^2 // [135] phi from sin16s::@7 to mulu16_sel [phi:sin16s::@7->mulu16_sel] // [135] phi mulu16_sel::select#5 = 1 [phi:sin16s::@7->mulu16_sel#0] -- vbuxx=vbuc1 ldx #1 // [135] phi mulu16_sel::v2#5 = mulu16_sel::v2#1 [phi:sin16s::@7->mulu16_sel#1] -- register_copy // [135] phi mulu16_sel::v1#5 = mulu16_sel::v1#1 [phi:sin16s::@7->mulu16_sel#2] -- register_copy jsr mulu16_sel - // mulu16_sel(x2, x1, 1) + // unsigned int x3 = mulu16_sel(x2, x1, 1) // [78] mulu16_sel::return#1 = mulu16_sel::return#12 -- vwuz1=vwuz2 lda.z mulu16_sel.return sta.z mulu16_sel.return_1 lda.z mulu16_sel.return+1 sta.z mulu16_sel.return_1+1 // sin16s::@8 - // unsigned int x3 = mulu16_sel(x2, x1, 1) // [79] sin16s::x3#0 = mulu16_sel::return#1 - // mulu16_sel(x3, $10000/6, 1) + // unsigned int x3_6 = mulu16_sel(x3, $10000/6, 1) // [80] mulu16_sel::v1#2 = sin16s::x3#0 // [81] call mulu16_sel + // u[2.14] x^3 // [135] phi from sin16s::@8 to mulu16_sel [phi:sin16s::@8->mulu16_sel] // [135] phi mulu16_sel::select#5 = 1 [phi:sin16s::@8->mulu16_sel#0] -- vbuxx=vbuc1 ldx #1 @@ -5055,13 +5043,13 @@ sin16s: { sta.z mulu16_sel.v2+1 // [135] phi mulu16_sel::v1#5 = mulu16_sel::v1#2 [phi:sin16s::@8->mulu16_sel#2] -- register_copy jsr mulu16_sel - // mulu16_sel(x3, $10000/6, 1) + // unsigned int x3_6 = mulu16_sel(x3, $10000/6, 1) // [82] mulu16_sel::return#2 = mulu16_sel::return#12 // sin16s::@9 - // unsigned int x3_6 = mulu16_sel(x3, $10000/6, 1) // [83] sin16s::x3_6#0 = mulu16_sel::return#2 // unsigned int usinx = x1 - x3_6 // [84] sin16s::usinx#0 = sin16s::x1#0 - sin16s::x3_6#0 -- vwuz1=vwuz2_minus_vwuz3 + // u[1.15] x^3/6; lda.z x1 sec sbc.z x3_6 @@ -5069,7 +5057,7 @@ sin16s: { lda.z x1+1 sbc.z x3_6+1 sta.z usinx+1 - // mulu16_sel(x3, x1, 0) + // unsigned int x4 = mulu16_sel(x3, x1, 0) // [85] mulu16_sel::v1#3 = sin16s::x3#0 // [86] mulu16_sel::v2#3 = sin16s::x1#0 -- vwuz1=vwuz2 lda.z x1 @@ -5077,22 +5065,22 @@ sin16s: { lda.z x1+1 sta.z mulu16_sel.v2+1 // [87] call mulu16_sel + // u[1.15] x - x^3/6 // [135] phi from sin16s::@9 to mulu16_sel [phi:sin16s::@9->mulu16_sel] // [135] phi mulu16_sel::select#5 = 0 [phi:sin16s::@9->mulu16_sel#0] -- vbuxx=vbuc1 ldx #0 // [135] phi mulu16_sel::v2#5 = mulu16_sel::v2#3 [phi:sin16s::@9->mulu16_sel#1] -- register_copy // [135] phi mulu16_sel::v1#5 = mulu16_sel::v1#3 [phi:sin16s::@9->mulu16_sel#2] -- register_copy jsr mulu16_sel - // mulu16_sel(x3, x1, 0) + // unsigned int x4 = mulu16_sel(x3, x1, 0) // [88] mulu16_sel::return#10 = mulu16_sel::return#12 -- vwuz1=vwuz2 lda.z mulu16_sel.return sta.z mulu16_sel.return_1 lda.z mulu16_sel.return+1 sta.z mulu16_sel.return_1+1 // sin16s::@10 - // unsigned int x4 = mulu16_sel(x3, x1, 0) // [89] sin16s::x4#0 = mulu16_sel::return#10 - // mulu16_sel(x4, x1, 0) + // unsigned int x5 = mulu16_sel(x4, x1, 0) // [90] mulu16_sel::v1#4 = sin16s::x4#0 // [91] mulu16_sel::v2#4 = sin16s::x1#0 -- vwuz1=vwuz2 lda.z x1 @@ -5100,19 +5088,20 @@ sin16s: { lda.z x1+1 sta.z mulu16_sel.v2+1 // [92] call mulu16_sel + // u[3.13] x^4 // [135] phi from sin16s::@10 to mulu16_sel [phi:sin16s::@10->mulu16_sel] // [135] phi mulu16_sel::select#5 = 0 [phi:sin16s::@10->mulu16_sel#0] -- vbuxx=vbuc1 ldx #0 // [135] phi mulu16_sel::v2#5 = mulu16_sel::v2#4 [phi:sin16s::@10->mulu16_sel#1] -- register_copy // [135] phi mulu16_sel::v1#5 = mulu16_sel::v1#4 [phi:sin16s::@10->mulu16_sel#2] -- register_copy jsr mulu16_sel - // mulu16_sel(x4, x1, 0) + // unsigned int x5 = mulu16_sel(x4, x1, 0) // [93] mulu16_sel::return#11 = mulu16_sel::return#12 // sin16s::@11 - // unsigned int x5 = mulu16_sel(x4, x1, 0) // [94] sin16s::x5#0 = mulu16_sel::return#11 // unsigned int x5_128 = x5>>4 // [95] sin16s::x5_128#0 = sin16s::x5#0 >> 4 -- vwuz1=vwuz1_ror_4 + // u[4.12] x^5 lsr.z x5_128+1 ror.z x5_128 lsr.z x5_128+1 diff --git a/src/test/ref/sizeof-problem.log b/src/test/ref/sizeof-problem.log index 3f6dc0f57..fd69bd39e 100644 --- a/src/test/ref/sizeof-problem.log +++ b/src/test/ref/sizeof-problem.log @@ -1,10 +1,10 @@ +Eliminating unused variable with no statement main::$0 CONTROL FLOW GRAPH SSA void main() main: scope:[main] from __start - main::$0 = sizeof ARR1 - main::i#0 = main::$0 + main::i#0 = sizeof ARR1 main::$1 = main::i#0 - 1 ARR1[main::$1] = 0 main::$2 = sizeof ARR2 @@ -31,7 +31,6 @@ constant byte* ARR1[$130] = { fill( $130, 0) } constant byte* ARR2[] = { 1, 2, 3 } void __start() void main() -word~ main::$0 number~ main::$1 word~ main::$2 number~ main::$3 @@ -62,8 +61,6 @@ Finalized unsigned number type (byte) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to word in main::$1 = main::i#0 - 1 Inferred type updated to byte in main::$3 = main::j#0 - 1 -Alias main::i#0 = main::$0 -Successful SSA optimization Pass2AliasElimination Constant right-side identified [0] main::i#0 = sizeof ARR1 Constant right-side identified [3] main::$2 = sizeof ARR2 Successful SSA optimization Pass2ConstantRValueConsolidation diff --git a/src/test/ref/stars-2.asm b/src/test/ref/stars-2.asm index dc1148f74..2edeac644 100644 --- a/src/test/ref/stars-2.asm +++ b/src/test/ref/stars-2.asm @@ -127,12 +127,11 @@ gotoxy: { sta.z conio_cursor_x // conio_cursor_y = y stx.z conio_cursor_y - // (unsigned int)y*CONIO_WIDTH + // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH txa sta.z __7 lda #0 sta.z __7+1 - // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH lda.z __7 asl sta.z __8 diff --git a/src/test/ref/stars-2.log b/src/test/ref/stars-2.log index 2e2e75856..c39cdedd4 100644 --- a/src/test/ref/stars-2.log +++ b/src/test/ref/stars-2.log @@ -7,6 +7,9 @@ Added struct type cast to parameter value list call printf_uchar (stars.star_x)[ Added struct type cast to parameter value list call printf_uchar (stars.star_y)[main::i] (struct printf_format_number){ 0, 0, 0, 0, 0, DECIMAL } Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call __init +Eliminating unused variable with no statement memcpy::$0 +Eliminating unused variable with no statement memset::$2 +Eliminating unused variable with no statement gotoxy::$4 Eliminating unused variable with no statement main::$2 CONTROL FLOW GRAPH SSA @@ -19,8 +22,7 @@ memcpy: scope:[memcpy] from cscroll::@3 cscroll::@4 memcpy::src#0 = ((byte*)) memcpy::source#2 memcpy::dst#0 = ((byte*)) memcpy::destination#2 memcpy::$2 = (byte*)memcpy::source#2 - memcpy::$0 = memcpy::$2 + memcpy::num#2 - memcpy::src_end#0 = memcpy::$0 + memcpy::src_end#0 = memcpy::$2 + memcpy::num#2 to:memcpy::@1 memcpy::@1: scope:[memcpy] from memcpy memcpy::@2 memcpy::destination#4 = phi( memcpy/memcpy::destination#2, memcpy::@2/memcpy::destination#5 ) @@ -67,8 +69,7 @@ memset::@2: scope:[memset] from memset memset::num#3 = phi( memset/memset::num#2 ) memset::str#3 = phi( memset/memset::str#4 ) memset::$4 = (byte*)memset::str#3 - memset::$2 = memset::$4 + memset::num#3 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#3 memset::dst#0 = ((byte*)) memset::str#3 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -436,8 +437,7 @@ gotoxy::@2: scope:[gotoxy] from gotoxy::@1 gotoxy::@4 conio_cursor_x = gotoxy::x#4 conio_cursor_y = gotoxy::y#4 gotoxy::$7 = (word)gotoxy::y#4 - gotoxy::$4 = gotoxy::$7 * $28 - gotoxy::line_offset#0 = gotoxy::$4 + gotoxy::line_offset#0 = gotoxy::$7 * $28 gotoxy::$5 = CONIO_SCREEN_TEXT + gotoxy::line_offset#0 conio_line_text = gotoxy::$5 gotoxy::$6 = CONIO_SCREEN_COLORS + gotoxy::line_offset#0 @@ -1096,7 +1096,6 @@ bool~ gotoxy::$0 bool~ gotoxy::$1 bool~ gotoxy::$2 bool~ gotoxy::$3 -number~ gotoxy::$4 byte*~ gotoxy::$5 byte*~ gotoxy::$6 word~ gotoxy::$7 @@ -1133,7 +1132,6 @@ constant byte* main::s[2] = " " constant byte* main::s1[2] = " " void* memcpy(void* memcpy::destination , void* memcpy::source , word memcpy::num) -byte*~ memcpy::$0 bool~ memcpy::$1 byte*~ memcpy::$2 void* memcpy::destination @@ -1174,7 +1172,6 @@ byte* memcpy::src_end#2 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -1671,8 +1668,7 @@ Adding number conversion cast (unumber) $28 in clrscr::line_cols#1 = clrscr::lin Adding number conversion cast (unumber) $19 in gotoxy::$0 = gotoxy::y#3 > $19 Adding number conversion cast (unumber) $28 in gotoxy::$2 = gotoxy::x#3 >= $28 Adding number conversion cast (unumber) 0 in gotoxy::y#0 = 0 -Adding number conversion cast (unumber) $28 in gotoxy::$4 = gotoxy::$7 * $28 -Adding number conversion cast (unumber) gotoxy::$4 in gotoxy::$4 = gotoxy::$7 * (unumber)$28 +Adding number conversion cast (unumber) $28 in gotoxy::line_offset#0 = gotoxy::$7 * $28 Adding number conversion cast (unumber) 0 in gotoxy::x#0 = 0 Adding number conversion cast (unumber) $28 in cputc::$1 = conio_cursor_x == $28 Adding number conversion cast (unumber) $28 in conio_line_text = conio_line_text + $28 @@ -1867,27 +1863,25 @@ Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) 5 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in uctoa::$4 = uctoa::max_digits#5 - 1 -Inferred type updated to word in gotoxy::$4 = gotoxy::$7 * $28 Inferred type updated to byte in printf_uchar::$0 = 0 Inferred type updated to byte for printf_uchar::$2 -Inversing boolean not [20] memset::$1 = memset::num#2 <= 0 from [19] memset::$0 = memset::num#2 > 0 -Inversing boolean not [188] gotoxy::$1 = gotoxy::y#3 <= $19 from [187] gotoxy::$0 = gotoxy::y#3 > $19 -Inversing boolean not [192] gotoxy::$3 = gotoxy::x#3 < $28 from [191] gotoxy::$2 = gotoxy::x#3 >= $28 -Inversing boolean not [218] cputc::$2 = conio_cursor_x != $28 from [217] cputc::$1 = conio_cursor_x == $28 -Inversing boolean not [242] cscroll::$1 = conio_cursor_y != $19 from [241] cscroll::$0 = conio_cursor_y == $19 -Inversing boolean not [275] conio_c64_init::$1 = conio_c64_init::line#0 < $19 from [274] conio_c64_init::$0 = conio_c64_init::line#0 >= $19 -Inversing boolean not [321] printf_number_buffer::$0 = 0 == printf_number_buffer::format_min_length#1 from [320] printf_number_buffer::$26 = 0 != printf_number_buffer::format_min_length#1 -Inversing boolean not [325] printf_number_buffer::$1 = 0 == printf_number_buffer::format_justify_left#1 from [324] printf_number_buffer::$27 = 0 != printf_number_buffer::format_justify_left#1 -Inversing boolean not [327] printf_number_buffer::$2 = 0 == printf_number_buffer::format_zero_padding#1 from [326] printf_number_buffer::$28 = 0 != printf_number_buffer::format_zero_padding#1 -Inversing boolean not [340] printf_number_buffer::$20 = 0 == printf_number_buffer::buffer_sign#1 from [339] printf_number_buffer::$29 = 0 != printf_number_buffer::buffer_sign#1 -Inversing boolean not [347] printf_number_buffer::$23 = printf_number_buffer::padding#1 >= 0 from [346] printf_number_buffer::$22 = printf_number_buffer::padding#1 < 0 -Inversing boolean not [355] printf_number_buffer::$7 = 0 == printf_number_buffer::buffer_sign#2 from [354] printf_number_buffer::$30 = 0 != printf_number_buffer::buffer_sign#2 -Inversing boolean not [372] printf_number_buffer::$12 = 0 == printf_number_buffer::format_upper_case#1 from [371] printf_number_buffer::$31 = 0 != printf_number_buffer::format_upper_case#1 -Inversing boolean not [384] printf_number_buffer::$14 = 0 == printf_number_buffer::format_zero_padding#3 from [383] printf_number_buffer::$32 = 0 != printf_number_buffer::format_zero_padding#3 +Inversing boolean not [19] memset::$1 = memset::num#2 <= 0 from [18] memset::$0 = memset::num#2 > 0 +Inversing boolean not [186] gotoxy::$1 = gotoxy::y#3 <= $19 from [185] gotoxy::$0 = gotoxy::y#3 > $19 +Inversing boolean not [190] gotoxy::$3 = gotoxy::x#3 < $28 from [189] gotoxy::$2 = gotoxy::x#3 >= $28 +Inversing boolean not [215] cputc::$2 = conio_cursor_x != $28 from [214] cputc::$1 = conio_cursor_x == $28 +Inversing boolean not [239] cscroll::$1 = conio_cursor_y != $19 from [238] cscroll::$0 = conio_cursor_y == $19 +Inversing boolean not [272] conio_c64_init::$1 = conio_c64_init::line#0 < $19 from [271] conio_c64_init::$0 = conio_c64_init::line#0 >= $19 +Inversing boolean not [318] printf_number_buffer::$0 = 0 == printf_number_buffer::format_min_length#1 from [317] printf_number_buffer::$26 = 0 != printf_number_buffer::format_min_length#1 +Inversing boolean not [322] printf_number_buffer::$1 = 0 == printf_number_buffer::format_justify_left#1 from [321] printf_number_buffer::$27 = 0 != printf_number_buffer::format_justify_left#1 +Inversing boolean not [324] printf_number_buffer::$2 = 0 == printf_number_buffer::format_zero_padding#1 from [323] printf_number_buffer::$28 = 0 != printf_number_buffer::format_zero_padding#1 +Inversing boolean not [337] printf_number_buffer::$20 = 0 == printf_number_buffer::buffer_sign#1 from [336] printf_number_buffer::$29 = 0 != printf_number_buffer::buffer_sign#1 +Inversing boolean not [344] printf_number_buffer::$23 = printf_number_buffer::padding#1 >= 0 from [343] printf_number_buffer::$22 = printf_number_buffer::padding#1 < 0 +Inversing boolean not [352] printf_number_buffer::$7 = 0 == printf_number_buffer::buffer_sign#2 from [351] printf_number_buffer::$30 = 0 != printf_number_buffer::buffer_sign#2 +Inversing boolean not [369] printf_number_buffer::$12 = 0 == printf_number_buffer::format_upper_case#1 from [368] printf_number_buffer::$31 = 0 != printf_number_buffer::format_upper_case#1 +Inversing boolean not [381] printf_number_buffer::$14 = 0 == printf_number_buffer::format_zero_padding#3 from [380] printf_number_buffer::$32 = 0 != printf_number_buffer::format_zero_padding#3 Successful SSA optimization Pass2UnaryNotSimplification Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 -Alias memcpy::src_end#0 = memcpy::$0 Alias memcpy::src#2 = memcpy::src#3 Alias memcpy::dst#2 = memcpy::dst#3 Alias memcpy::src_end#1 = memcpy::src_end#2 @@ -1896,7 +1890,6 @@ Alias memset::return#0 = memset::str#2 memset::return#4 memset::return#1 Alias memset::str#3 = memset::str#4 Alias memset::num#2 = memset::num#3 Alias memset::c#4 = memset::c#5 -Alias memset::end#0 = memset::$2 Alias memset::c#2 = memset::c#3 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -1934,7 +1927,6 @@ Alias clrscr::c#2 = clrscr::c#3 Alias clrscr::line_cols#2 = clrscr::line_cols#4 clrscr::line_cols#3 Alias clrscr::l#3 = clrscr::l#6 clrscr::l#4 Alias gotoxy::x#5 = gotoxy::x#6 -Alias gotoxy::line_offset#0 = gotoxy::$4 Alias gotoxy::y#5 = gotoxy::y#6 Alias cputc::c#3 = cputc::c#4 Alias cputs::c#1 = cputs::$0 cputs::c#2 @@ -5254,13 +5246,12 @@ gotoxy: { // conio_cursor_y = y // [34] conio_cursor_y = gotoxy::y#4 -- vbuz1=vbuxx stx.z conio_cursor_y - // (unsigned int)y*CONIO_WIDTH + // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH // [35] gotoxy::$7 = (word)gotoxy::y#4 -- vwuz1=_word_vbuxx txa sta.z __7 lda #0 sta.z __7+1 - // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH // [36] gotoxy::$8 = gotoxy::$7 << 2 -- vwuz1=vwuz2_rol_2 lda.z __7 asl diff --git a/src/test/ref/statement-sequence-1.log b/src/test/ref/statement-sequence-1.log index fc0354ad8..1c082fc03 100644 --- a/src/test/ref/statement-sequence-1.log +++ b/src/test/ref/statement-sequence-1.log @@ -1,3 +1,4 @@ +Eliminating unused variable with no statement main::$0 CONTROL FLOW GRAPH SSA @@ -7,8 +8,7 @@ main: scope:[main] from __start to:main::@1 main::@1: scope:[main] from main main::@2 main::i#2 = phi( main/main::i#0, main::@2/main::i#1 ) - main::$0 = main::i#2 + 5 - main::c#0 = main::$0 + main::c#0 = main::i#2 + 5 main::$1 = main::i#2 & 1 main::$2 = main::$1 == 0 main::$3 = main::i#2 > 5 @@ -46,7 +46,6 @@ __start::@return: scope:[__start] from __start::@1 SYMBOL TABLE SSA void __start() void main() -number~ main::$0 number~ main::$1 bool~ main::$2 bool~ main::$3 @@ -66,8 +65,7 @@ byte main::i#2 byte main::i#3 byte main::i#4 -Adding number conversion cast (unumber) 5 in main::$0 = main::i#2 + 5 -Adding number conversion cast (unumber) main::$0 in main::$0 = main::i#2 + (unumber)5 +Adding number conversion cast (unumber) 5 in main::c#0 = main::i#2 + 5 Adding number conversion cast (unumber) 1 in main::$1 = main::i#2 & 1 Adding number conversion cast (unumber) main::$1 in main::$1 = main::i#2 & (unumber)1 Adding number conversion cast (unumber) 0 in main::$2 = main::$1 == 0 @@ -84,9 +82,8 @@ Finalized unsigned number type (byte) 1 Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) 5 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to byte in main::$0 = main::i#2 + 5 Inferred type updated to byte in main::$1 = main::i#2 & 1 -Alias main::c#0 = main::$0 main::c#3 +Alias main::c#0 = main::c#3 Alias main::i#2 = main::i#4 Successful SSA optimization Pass2AliasElimination Alias main::i#2 = main::i#3 diff --git a/src/test/ref/struct-23.asm b/src/test/ref/struct-23.asm index a198a54d7..b591d25ad 100644 --- a/src/test/ref/struct-23.asm +++ b/src/test/ref/struct-23.asm @@ -13,11 +13,10 @@ main: { .label point1 = 2 .label point2 = 4 - // getPoint(2, 3) + // __ma struct Point point1 = getPoint(2, 3) lda #3 ldx #2 jsr getPoint - // getPoint(2, 3) // __ma struct Point point1 = getPoint(2, 3) stx.z point1 sta point1+OFFSET_STRUCT_POINT_Y @@ -27,11 +26,10 @@ main: { // SCREEN[1] = point1.y lda point1+OFFSET_STRUCT_POINT_Y sta SCREEN+1 - // getPoint(4, 5) + // __ma struct Point point2 = getPoint(4, 5) lda #5 ldx #4 jsr getPoint - // getPoint(4, 5) // __ma struct Point point2 = getPoint(4, 5) stx.z point2 sta point2+OFFSET_STRUCT_POINT_Y diff --git a/src/test/ref/struct-23.cfg b/src/test/ref/struct-23.cfg index d9f02d49a..d810277f9 100644 --- a/src/test/ref/struct-23.cfg +++ b/src/test/ref/struct-23.cfg @@ -7,33 +7,29 @@ main: scope:[main] from [3] getPoint::return_y#0 = getPoint::return_y#2 to:main::@1 main::@1: scope:[main] from main - [4] main::$0_x = getPoint::return_x#0 - [5] main::$0_y = getPoint::return_y#0 - [6] *((byte*)&main::point1) = main::$0_x - [7] *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y) = main::$0_y - [8] *SCREEN = *((byte*)&main::point1) - [9] *(SCREEN+1) = *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y) - [10] call getPoint - [11] getPoint::return_x#1 = getPoint::return_x#2 - [12] getPoint::return_y#1 = getPoint::return_y#2 + [4] *((byte*)&main::point1) = getPoint::return_x#0 + [5] *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y) = getPoint::return_y#0 + [6] *SCREEN = *((byte*)&main::point1) + [7] *(SCREEN+1) = *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y) + [8] call getPoint + [9] getPoint::return_x#1 = getPoint::return_x#2 + [10] getPoint::return_y#1 = getPoint::return_y#2 to:main::@2 main::@2: scope:[main] from main::@1 - [13] main::$1_x = getPoint::return_x#1 - [14] main::$1_y = getPoint::return_y#1 - [15] *((byte*)&main::point2) = main::$1_x - [16] *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y) = main::$1_y - [17] *(SCREEN+2) = *((byte*)&main::point2) - [18] *(SCREEN+3) = *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y) + [11] *((byte*)&main::point2) = getPoint::return_x#1 + [12] *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y) = getPoint::return_y#1 + [13] *(SCREEN+2) = *((byte*)&main::point2) + [14] *(SCREEN+3) = *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y) to:main::@return main::@return: scope:[main] from main::@2 - [19] return + [15] return to:@return struct Point getPoint(byte getPoint::x , byte getPoint::y) getPoint: scope:[getPoint] from main main::@1 - [20] getPoint::return_y#2 = phi( main/3, main::@1/5 ) - [20] getPoint::return_x#2 = phi( main/2, main::@1/4 ) + [16] getPoint::return_y#2 = phi( main/3, main::@1/5 ) + [16] getPoint::return_x#2 = phi( main/2, main::@1/4 ) to:getPoint::@return getPoint::@return: scope:[getPoint] from getPoint - [21] return + [17] return to:@return diff --git a/src/test/ref/struct-23.log b/src/test/ref/struct-23.log index 586ce35c8..e2e2fe63b 100644 --- a/src/test/ref/struct-23.log +++ b/src/test/ref/struct-23.log @@ -1,11 +1,9 @@ Eliminating unused variable with no statement main::$0 Eliminating unused variable with no statement main::$1 -Unwinding list assignment { main::$0_x, main::$0_y } = { getPoint::return_x, getPoint::return_y } -Unwinding list assignment { main::$1_x, main::$1_y } = { getPoint::return_x, getPoint::return_y } +Unwinding list assignment { *((byte*)&main::point1+OFFSET_STRUCT_POINT_X), *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y) } = { getPoint::return_x, getPoint::return_y } +Unwinding list assignment { *((byte*)&main::point2+OFFSET_STRUCT_POINT_X), *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y) } = { getPoint::return_x, getPoint::return_y } Unwinding list assignment { getPoint::return_x#0, getPoint::return_y#0 } = { getPoint::return_x#5, getPoint::return_y#5 } Unwinding list assignment { getPoint::return_x#1, getPoint::return_y#1 } = { getPoint::return_x#5, getPoint::return_y#5 } -Removing C-classic struct-unwound assignment main::point1 = struct-unwound {*((byte*)&main::point1+OFFSET_STRUCT_POINT_X), *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y)} -Removing C-classic struct-unwound assignment main::point2 = struct-unwound {*((byte*)&main::point2+OFFSET_STRUCT_POINT_X), *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y)} CONTROL FLOW GRAPH SSA @@ -20,10 +18,8 @@ main: scope:[main] from __start main::@1: scope:[main] from main getPoint::return_y#3 = phi( main/getPoint::return_y#0 ) getPoint::return_x#3 = phi( main/getPoint::return_x#0 ) - main::$0_x = getPoint::return_x#3 - main::$0_y = getPoint::return_y#3 - *((byte*)&main::point1+OFFSET_STRUCT_POINT_X) = main::$0_x - *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y) = main::$0_y + *((byte*)&main::point1+OFFSET_STRUCT_POINT_X) = getPoint::return_x#3 + *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y) = getPoint::return_y#3 SCREEN[0] = *((byte*)&main::point1+OFFSET_STRUCT_POINT_X) SCREEN[1] = *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y) getPoint::x#1 = 4 @@ -35,10 +31,8 @@ main::@1: scope:[main] from main main::@2: scope:[main] from main::@1 getPoint::return_y#4 = phi( main::@1/getPoint::return_y#1 ) getPoint::return_x#4 = phi( main::@1/getPoint::return_x#1 ) - main::$1_x = getPoint::return_x#4 - main::$1_y = getPoint::return_y#4 - *((byte*)&main::point2+OFFSET_STRUCT_POINT_X) = main::$1_x - *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y) = main::$1_y + *((byte*)&main::point2+OFFSET_STRUCT_POINT_X) = getPoint::return_x#4 + *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y) = getPoint::return_y#4 SCREEN[2] = *((byte*)&main::point2+OFFSET_STRUCT_POINT_X) SCREEN[3] = *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y) to:main::@return @@ -109,10 +103,6 @@ byte getPoint::y#0 byte getPoint::y#1 byte getPoint::y#2 void main() -byte~ main::$0_x -byte~ main::$0_y -byte~ main::$1_x -byte~ main::$1_y struct Point main::point1 loadstore struct Point main::point2 loadstore @@ -161,14 +151,14 @@ Constant getPoint::y#0 = 3 Constant getPoint::x#1 = 4 Constant getPoint::y#1 = 5 Successful SSA optimization Pass2ConstantIdentification -Simplifying expression containing zero (byte*)&main::point1 in [7] *((byte*)&main::point1+OFFSET_STRUCT_POINT_X) = main::$0_x -Simplifying expression containing zero (byte*)&main::point1 in [9] SCREEN[0] = *((byte*)&main::point1+OFFSET_STRUCT_POINT_X) -Simplifying expression containing zero SCREEN in [9] SCREEN[0] = *((byte*)&main::point1) -Simplifying expression containing zero (byte*)&main::point2 in [18] *((byte*)&main::point2+OFFSET_STRUCT_POINT_X) = main::$1_x -Simplifying expression containing zero (byte*)&main::point2 in [20] SCREEN[2] = *((byte*)&main::point2+OFFSET_STRUCT_POINT_X) +Simplifying expression containing zero (byte*)&main::point1 in [5] *((byte*)&main::point1+OFFSET_STRUCT_POINT_X) = getPoint::return_x#0 +Simplifying expression containing zero (byte*)&main::point1 in [7] SCREEN[0] = *((byte*)&main::point1+OFFSET_STRUCT_POINT_X) +Simplifying expression containing zero SCREEN in [7] SCREEN[0] = *((byte*)&main::point1) +Simplifying expression containing zero (byte*)&main::point2 in [14] *((byte*)&main::point2+OFFSET_STRUCT_POINT_X) = getPoint::return_x#1 +Simplifying expression containing zero (byte*)&main::point2 in [16] SCREEN[2] = *((byte*)&main::point2+OFFSET_STRUCT_POINT_X) Successful SSA optimization PassNSimplifyExpressionWithZero -Eliminating unused variable getPoint::return#0 and assignment [20] getPoint::return#0 = struct-unwound {getPoint::return_x#2, getPoint::return_y#2} -Eliminating unused variable getPoint::return#1 and assignment [21] getPoint::return#1 = struct-unwound {} +Eliminating unused variable getPoint::return#0 and assignment [16] getPoint::return#0 = struct-unwound {getPoint::return_x#2, getPoint::return_y#2} +Eliminating unused variable getPoint::return#1 and assignment [17] getPoint::return#1 = struct-unwound {} Eliminating unused constant OFFSET_STRUCT_POINT_X Successful SSA optimization PassNEliminateUnusedVars Removing unused procedure __start @@ -191,7 +181,7 @@ Consolidated array index constant in *(SCREEN+3) Successful SSA optimization Pass2ConstantAdditionElimination Adding NOP phi() at start of main CALL GRAPH -Calls in [main] to getPoint:1 getPoint:10 +Calls in [main] to getPoint:1 getPoint:8 Created 2 initial phi equivalence classes Coalesced down to 2 phi equivalence classes @@ -207,35 +197,31 @@ main: scope:[main] from [3] getPoint::return_y#0 = getPoint::return_y#2 to:main::@1 main::@1: scope:[main] from main - [4] main::$0_x = getPoint::return_x#0 - [5] main::$0_y = getPoint::return_y#0 - [6] *((byte*)&main::point1) = main::$0_x - [7] *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y) = main::$0_y - [8] *SCREEN = *((byte*)&main::point1) - [9] *(SCREEN+1) = *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y) - [10] call getPoint - [11] getPoint::return_x#1 = getPoint::return_x#2 - [12] getPoint::return_y#1 = getPoint::return_y#2 + [4] *((byte*)&main::point1) = getPoint::return_x#0 + [5] *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y) = getPoint::return_y#0 + [6] *SCREEN = *((byte*)&main::point1) + [7] *(SCREEN+1) = *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y) + [8] call getPoint + [9] getPoint::return_x#1 = getPoint::return_x#2 + [10] getPoint::return_y#1 = getPoint::return_y#2 to:main::@2 main::@2: scope:[main] from main::@1 - [13] main::$1_x = getPoint::return_x#1 - [14] main::$1_y = getPoint::return_y#1 - [15] *((byte*)&main::point2) = main::$1_x - [16] *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y) = main::$1_y - [17] *(SCREEN+2) = *((byte*)&main::point2) - [18] *(SCREEN+3) = *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y) + [11] *((byte*)&main::point2) = getPoint::return_x#1 + [12] *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y) = getPoint::return_y#1 + [13] *(SCREEN+2) = *((byte*)&main::point2) + [14] *(SCREEN+3) = *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y) to:main::@return main::@return: scope:[main] from main::@2 - [19] return + [15] return to:@return struct Point getPoint(byte getPoint::x , byte getPoint::y) getPoint: scope:[getPoint] from main main::@1 - [20] getPoint::return_y#2 = phi( main/3, main::@1/5 ) - [20] getPoint::return_x#2 = phi( main/2, main::@1/4 ) + [16] getPoint::return_y#2 = phi( main/3, main::@1/5 ) + [16] getPoint::return_x#2 = phi( main/2, main::@1/4 ) to:getPoint::@return getPoint::@return: scope:[getPoint] from getPoint - [21] return + [17] return to:@return @@ -255,10 +241,6 @@ byte getPoint::return_y#2 0.6666666666666666 byte getPoint::x byte getPoint::y void main() -byte~ main::$0_x 2.0 -byte~ main::$0_y 2.0 -byte~ main::$1_x 2.0 -byte~ main::$1_y 2.0 struct Point main::point1 loadstore struct Point main::point2 loadstore @@ -267,12 +249,8 @@ Initial phi equivalence classes [ getPoint::return_y#2 ] Added variable getPoint::return_x#0 to live range equivalence class [ getPoint::return_x#0 ] Added variable getPoint::return_y#0 to live range equivalence class [ getPoint::return_y#0 ] -Added variable main::$0_x to live range equivalence class [ main::$0_x ] -Added variable main::$0_y to live range equivalence class [ main::$0_y ] Added variable getPoint::return_x#1 to live range equivalence class [ getPoint::return_x#1 ] Added variable getPoint::return_y#1 to live range equivalence class [ getPoint::return_y#1 ] -Added variable main::$1_x to live range equivalence class [ main::$1_x ] -Added variable main::$1_y to live range equivalence class [ main::$1_y ] Added variable main::point1 to live range equivalence class [ main::point1 ] Added variable main::point2 to live range equivalence class [ main::point2 ] Complete equivalence classes @@ -280,66 +258,51 @@ Complete equivalence classes [ getPoint::return_y#2 ] [ getPoint::return_x#0 ] [ getPoint::return_y#0 ] -[ main::$0_x ] -[ main::$0_y ] [ getPoint::return_x#1 ] [ getPoint::return_y#1 ] -[ main::$1_x ] -[ main::$1_y ] [ main::point1 ] [ main::point2 ] Allocated zp[1]:2 [ getPoint::return_x#2 ] Allocated zp[1]:3 [ getPoint::return_y#2 ] Allocated zp[1]:4 [ getPoint::return_x#0 ] Allocated zp[1]:5 [ getPoint::return_y#0 ] -Allocated zp[1]:6 [ main::$0_x ] -Allocated zp[1]:7 [ main::$0_y ] -Allocated zp[1]:8 [ getPoint::return_x#1 ] -Allocated zp[1]:9 [ getPoint::return_y#1 ] -Allocated zp[1]:10 [ main::$1_x ] -Allocated zp[1]:11 [ main::$1_y ] -Allocated zp[2]:12 [ main::point1 ] -Allocated zp[2]:14 [ main::point2 ] +Allocated zp[1]:6 [ getPoint::return_x#1 ] +Allocated zp[1]:7 [ getPoint::return_y#1 ] +Allocated zp[2]:8 [ main::point1 ] +Allocated zp[2]:10 [ main::point2 ] REGISTER UPLIFT POTENTIAL REGISTERS -Statement [8] *SCREEN = *((byte*)&main::point1) [ main::point1 main::point2 ] ( [ main::point1 main::point2 ] { { getPoint::return_x#1 = getPoint::return_x#2 } { getPoint::return_y#1 = getPoint::return_y#2 } } ) always clobbers reg byte a -Statement [9] *(SCREEN+1) = *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y) [ main::point2 ] ( [ main::point2 ] { { getPoint::return_x#1 = getPoint::return_x#2 } { getPoint::return_y#1 = getPoint::return_y#2 } } ) always clobbers reg byte a -Statement [17] *(SCREEN+2) = *((byte*)&main::point2) [ main::point2 ] ( [ main::point2 ] { } ) always clobbers reg byte a -Statement [18] *(SCREEN+3) = *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y) [ ] ( [ ] { } ) always clobbers reg byte a +Statement [6] *SCREEN = *((byte*)&main::point1) [ main::point1 main::point2 ] ( [ main::point1 main::point2 ] { { getPoint::return_x#1 = getPoint::return_x#2 } { getPoint::return_y#1 = getPoint::return_y#2 } } ) always clobbers reg byte a +Statement [7] *(SCREEN+1) = *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y) [ main::point2 ] ( [ main::point2 ] { { getPoint::return_x#1 = getPoint::return_x#2 } { getPoint::return_y#1 = getPoint::return_y#2 } } ) always clobbers reg byte a +Statement [13] *(SCREEN+2) = *((byte*)&main::point2) [ main::point2 ] ( [ main::point2 ] { } ) always clobbers reg byte a +Statement [14] *(SCREEN+3) = *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y) [ ] ( [ ] { } ) always clobbers reg byte a Potential registers zp[1]:2 [ getPoint::return_x#2 ] : zp[1]:2 , reg byte a , reg byte x , reg byte y , Potential registers zp[1]:3 [ getPoint::return_y#2 ] : zp[1]:3 , reg byte a , reg byte x , reg byte y , Potential registers zp[1]:4 [ getPoint::return_x#0 ] : zp[1]:4 , reg byte a , reg byte x , reg byte y , Potential registers zp[1]:5 [ getPoint::return_y#0 ] : zp[1]:5 , reg byte a , reg byte x , reg byte y , -Potential registers zp[1]:6 [ main::$0_x ] : zp[1]:6 , reg byte a , reg byte x , reg byte y , -Potential registers zp[1]:7 [ main::$0_y ] : zp[1]:7 , reg byte a , reg byte x , reg byte y , -Potential registers zp[1]:8 [ getPoint::return_x#1 ] : zp[1]:8 , reg byte a , reg byte x , reg byte y , -Potential registers zp[1]:9 [ getPoint::return_y#1 ] : zp[1]:9 , reg byte a , reg byte x , reg byte y , -Potential registers zp[1]:10 [ main::$1_x ] : zp[1]:10 , reg byte a , reg byte x , reg byte y , -Potential registers zp[1]:11 [ main::$1_y ] : zp[1]:11 , reg byte a , reg byte x , reg byte y , -Potential registers zp[2]:12 [ main::point1 ] : zp[2]:12 , -Potential registers zp[2]:14 [ main::point2 ] : zp[2]:14 , +Potential registers zp[1]:6 [ getPoint::return_x#1 ] : zp[1]:6 , reg byte a , reg byte x , reg byte y , +Potential registers zp[1]:7 [ getPoint::return_y#1 ] : zp[1]:7 , reg byte a , reg byte x , reg byte y , +Potential registers zp[2]:8 [ main::point1 ] : zp[2]:8 , +Potential registers zp[2]:10 [ main::point2 ] : zp[2]:10 , REGISTER UPLIFT SCOPES -Uplift Scope [getPoint] 2: zp[1]:4 [ getPoint::return_x#0 ] 2: zp[1]:5 [ getPoint::return_y#0 ] 2: zp[1]:8 [ getPoint::return_x#1 ] 2: zp[1]:9 [ getPoint::return_y#1 ] 1: zp[1]:2 [ getPoint::return_x#2 ] 0.67: zp[1]:3 [ getPoint::return_y#2 ] -Uplift Scope [main] 2: zp[1]:6 [ main::$0_x ] 2: zp[1]:7 [ main::$0_y ] 2: zp[1]:10 [ main::$1_x ] 2: zp[1]:11 [ main::$1_y ] 0: zp[2]:12 [ main::point1 ] 0: zp[2]:14 [ main::point2 ] +Uplift Scope [getPoint] 2: zp[1]:4 [ getPoint::return_x#0 ] 2: zp[1]:5 [ getPoint::return_y#0 ] 2: zp[1]:6 [ getPoint::return_x#1 ] 2: zp[1]:7 [ getPoint::return_y#1 ] 1: zp[1]:2 [ getPoint::return_x#2 ] 0.67: zp[1]:3 [ getPoint::return_y#2 ] Uplift Scope [Point] +Uplift Scope [main] 0: zp[2]:8 [ main::point1 ] 0: zp[2]:10 [ main::point2 ] Uplift Scope [] -Uplifting [getPoint] best 169 combination reg byte x [ getPoint::return_x#0 ] reg byte a [ getPoint::return_y#0 ] reg byte x [ getPoint::return_x#1 ] zp[1]:9 [ getPoint::return_y#1 ] zp[1]:2 [ getPoint::return_x#2 ] zp[1]:3 [ getPoint::return_y#2 ] +Uplifting [getPoint] best 145 combination reg byte x [ getPoint::return_x#0 ] reg byte a [ getPoint::return_y#0 ] reg byte x [ getPoint::return_x#1 ] zp[1]:7 [ getPoint::return_y#1 ] zp[1]:2 [ getPoint::return_x#2 ] zp[1]:3 [ getPoint::return_y#2 ] Limited combination testing to 100 combinations of 4096 possible. -Uplifting [main] best 151 combination reg byte x [ main::$0_x ] reg byte a [ main::$0_y ] reg byte x [ main::$1_x ] zp[1]:11 [ main::$1_y ] zp[2]:12 [ main::point1 ] zp[2]:14 [ main::point2 ] -Limited combination testing to 100 combinations of 256 possible. -Uplifting [Point] best 151 combination -Uplifting [] best 151 combination -Attempting to uplift remaining variables inzp[1]:9 [ getPoint::return_y#1 ] -Uplifting [getPoint] best 145 combination reg byte a [ getPoint::return_y#1 ] -Attempting to uplift remaining variables inzp[1]:11 [ main::$1_y ] -Uplifting [main] best 139 combination reg byte a [ main::$1_y ] +Uplifting [Point] best 145 combination +Uplifting [main] best 145 combination zp[2]:8 [ main::point1 ] zp[2]:10 [ main::point2 ] +Uplifting [] best 145 combination +Attempting to uplift remaining variables inzp[1]:7 [ getPoint::return_y#1 ] +Uplifting [getPoint] best 139 combination reg byte a [ getPoint::return_y#1 ] Attempting to uplift remaining variables inzp[1]:2 [ getPoint::return_x#2 ] Uplifting [getPoint] best 127 combination reg byte x [ getPoint::return_x#2 ] Attempting to uplift remaining variables inzp[1]:3 [ getPoint::return_y#2 ] Uplifting [getPoint] best 115 combination reg byte a [ getPoint::return_y#2 ] -Allocated (was zp[2]:12) zp[2]:2 [ main::point1 ] -Allocated (was zp[2]:14) zp[2]:4 [ main::point2 ] +Allocated (was zp[2]:8) zp[2]:2 [ main::point1 ] +Allocated (was zp[2]:10) zp[2]:4 [ main::point2 ] ASSEMBLER BEFORE OPTIMIZATION // File Comments @@ -362,11 +325,11 @@ main: { .label point1 = 2 .label point2 = 4 // [1] call getPoint - // [20] phi from main to getPoint [phi:main->getPoint] + // [16] phi from main to getPoint [phi:main->getPoint] getPoint_from_main: - // [20] phi getPoint::return_y#2 = 3 [phi:main->getPoint#0] -- vbuaa=vbuc1 + // [16] phi getPoint::return_y#2 = 3 [phi:main->getPoint#0] -- vbuaa=vbuc1 lda #3 - // [20] phi getPoint::return_x#2 = 2 [phi:main->getPoint#1] -- vbuxx=vbuc1 + // [16] phi getPoint::return_x#2 = 2 [phi:main->getPoint#1] -- vbuxx=vbuc1 ldx #2 jsr getPoint // [2] getPoint::return_x#0 = getPoint::return_x#2 @@ -374,47 +337,43 @@ main: { jmp __b1 // main::@1 __b1: - // [4] main::$0_x = getPoint::return_x#0 - // [5] main::$0_y = getPoint::return_y#0 - // [6] *((byte*)&main::point1) = main::$0_x -- _deref_pbuc1=vbuxx + // [4] *((byte*)&main::point1) = getPoint::return_x#0 -- _deref_pbuc1=vbuxx stx.z point1 - // [7] *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y) = main::$0_y -- _deref_pbuc1=vbuaa + // [5] *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y) = getPoint::return_y#0 -- _deref_pbuc1=vbuaa sta point1+OFFSET_STRUCT_POINT_Y - // [8] *SCREEN = *((byte*)&main::point1) -- _deref_pbuc1=_deref_pbuc2 + // [6] *SCREEN = *((byte*)&main::point1) -- _deref_pbuc1=_deref_pbuc2 lda.z point1 sta SCREEN - // [9] *(SCREEN+1) = *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2 + // [7] *(SCREEN+1) = *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2 lda point1+OFFSET_STRUCT_POINT_Y sta SCREEN+1 - // [10] call getPoint - // [20] phi from main::@1 to getPoint [phi:main::@1->getPoint] + // [8] call getPoint + // [16] phi from main::@1 to getPoint [phi:main::@1->getPoint] getPoint_from___b1: - // [20] phi getPoint::return_y#2 = 5 [phi:main::@1->getPoint#0] -- vbuaa=vbuc1 + // [16] phi getPoint::return_y#2 = 5 [phi:main::@1->getPoint#0] -- vbuaa=vbuc1 lda #5 - // [20] phi getPoint::return_x#2 = 4 [phi:main::@1->getPoint#1] -- vbuxx=vbuc1 + // [16] phi getPoint::return_x#2 = 4 [phi:main::@1->getPoint#1] -- vbuxx=vbuc1 ldx #4 jsr getPoint - // [11] getPoint::return_x#1 = getPoint::return_x#2 - // [12] getPoint::return_y#1 = getPoint::return_y#2 + // [9] getPoint::return_x#1 = getPoint::return_x#2 + // [10] getPoint::return_y#1 = getPoint::return_y#2 jmp __b2 // main::@2 __b2: - // [13] main::$1_x = getPoint::return_x#1 - // [14] main::$1_y = getPoint::return_y#1 - // [15] *((byte*)&main::point2) = main::$1_x -- _deref_pbuc1=vbuxx + // [11] *((byte*)&main::point2) = getPoint::return_x#1 -- _deref_pbuc1=vbuxx stx.z point2 - // [16] *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y) = main::$1_y -- _deref_pbuc1=vbuaa + // [12] *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y) = getPoint::return_y#1 -- _deref_pbuc1=vbuaa sta point2+OFFSET_STRUCT_POINT_Y - // [17] *(SCREEN+2) = *((byte*)&main::point2) -- _deref_pbuc1=_deref_pbuc2 + // [13] *(SCREEN+2) = *((byte*)&main::point2) -- _deref_pbuc1=_deref_pbuc2 lda.z point2 sta SCREEN+2 - // [18] *(SCREEN+3) = *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2 + // [14] *(SCREEN+3) = *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2 lda point2+OFFSET_STRUCT_POINT_Y sta SCREEN+3 jmp __breturn // main::@return __breturn: - // [19] return + // [15] return rts } // getPoint @@ -422,7 +381,7 @@ getPoint: { jmp __breturn // getPoint::@return __breturn: - // [21] return + // [17] return rts } // File Data @@ -461,10 +420,6 @@ byte getPoint::return_y#2 reg byte a 0.6666666666666666 byte getPoint::x byte getPoint::y void main() -byte~ main::$0_x reg byte x 2.0 -byte~ main::$0_y reg byte a 2.0 -byte~ main::$1_x reg byte x 2.0 -byte~ main::$1_y reg byte a 2.0 struct Point main::point1 loadstore zp[2]:2 struct Point main::point2 loadstore zp[2]:4 @@ -472,12 +427,8 @@ reg byte x [ getPoint::return_x#2 ] reg byte a [ getPoint::return_y#2 ] reg byte x [ getPoint::return_x#0 ] reg byte a [ getPoint::return_y#0 ] -reg byte x [ main::$0_x ] -reg byte a [ main::$0_y ] reg byte x [ getPoint::return_x#1 ] reg byte a [ getPoint::return_y#1 ] -reg byte x [ main::$1_x ] -reg byte a [ main::$1_y ] zp[2]:2 [ main::point1 ] zp[2]:4 [ main::point2 ] @@ -504,69 +455,63 @@ Score: 74 main: { .label point1 = 2 .label point2 = 4 - // getPoint(2, 3) + // __ma struct Point point1 = getPoint(2, 3) // [1] call getPoint - // [20] phi from main to getPoint [phi:main->getPoint] - // [20] phi getPoint::return_y#2 = 3 [phi:main->getPoint#0] -- vbuaa=vbuc1 + // [16] phi from main to getPoint [phi:main->getPoint] + // [16] phi getPoint::return_y#2 = 3 [phi:main->getPoint#0] -- vbuaa=vbuc1 lda #3 - // [20] phi getPoint::return_x#2 = 2 [phi:main->getPoint#1] -- vbuxx=vbuc1 + // [16] phi getPoint::return_x#2 = 2 [phi:main->getPoint#1] -- vbuxx=vbuc1 ldx #2 jsr getPoint - // getPoint(2, 3) + // __ma struct Point point1 = getPoint(2, 3) // [2] getPoint::return_x#0 = getPoint::return_x#2 // [3] getPoint::return_y#0 = getPoint::return_y#2 // main::@1 - // [4] main::$0_x = getPoint::return_x#0 - // [5] main::$0_y = getPoint::return_y#0 - // __ma struct Point point1 = getPoint(2, 3) - // [6] *((byte*)&main::point1) = main::$0_x -- _deref_pbuc1=vbuxx + // [4] *((byte*)&main::point1) = getPoint::return_x#0 -- _deref_pbuc1=vbuxx stx.z point1 - // [7] *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y) = main::$0_y -- _deref_pbuc1=vbuaa + // [5] *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y) = getPoint::return_y#0 -- _deref_pbuc1=vbuaa sta point1+OFFSET_STRUCT_POINT_Y // SCREEN[0] = point1.x - // [8] *SCREEN = *((byte*)&main::point1) -- _deref_pbuc1=_deref_pbuc2 + // [6] *SCREEN = *((byte*)&main::point1) -- _deref_pbuc1=_deref_pbuc2 txa sta SCREEN // SCREEN[1] = point1.y - // [9] *(SCREEN+1) = *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2 + // [7] *(SCREEN+1) = *((byte*)&main::point1+OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2 lda point1+OFFSET_STRUCT_POINT_Y sta SCREEN+1 - // getPoint(4, 5) - // [10] call getPoint - // [20] phi from main::@1 to getPoint [phi:main::@1->getPoint] - // [20] phi getPoint::return_y#2 = 5 [phi:main::@1->getPoint#0] -- vbuaa=vbuc1 + // __ma struct Point point2 = getPoint(4, 5) + // [8] call getPoint + // [16] phi from main::@1 to getPoint [phi:main::@1->getPoint] + // [16] phi getPoint::return_y#2 = 5 [phi:main::@1->getPoint#0] -- vbuaa=vbuc1 lda #5 - // [20] phi getPoint::return_x#2 = 4 [phi:main::@1->getPoint#1] -- vbuxx=vbuc1 + // [16] phi getPoint::return_x#2 = 4 [phi:main::@1->getPoint#1] -- vbuxx=vbuc1 ldx #4 jsr getPoint - // getPoint(4, 5) - // [11] getPoint::return_x#1 = getPoint::return_x#2 - // [12] getPoint::return_y#1 = getPoint::return_y#2 - // main::@2 - // [13] main::$1_x = getPoint::return_x#1 - // [14] main::$1_y = getPoint::return_y#1 // __ma struct Point point2 = getPoint(4, 5) - // [15] *((byte*)&main::point2) = main::$1_x -- _deref_pbuc1=vbuxx + // [9] getPoint::return_x#1 = getPoint::return_x#2 + // [10] getPoint::return_y#1 = getPoint::return_y#2 + // main::@2 + // [11] *((byte*)&main::point2) = getPoint::return_x#1 -- _deref_pbuc1=vbuxx stx.z point2 - // [16] *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y) = main::$1_y -- _deref_pbuc1=vbuaa + // [12] *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y) = getPoint::return_y#1 -- _deref_pbuc1=vbuaa sta point2+OFFSET_STRUCT_POINT_Y // SCREEN[2] = point2.x - // [17] *(SCREEN+2) = *((byte*)&main::point2) -- _deref_pbuc1=_deref_pbuc2 + // [13] *(SCREEN+2) = *((byte*)&main::point2) -- _deref_pbuc1=_deref_pbuc2 txa sta SCREEN+2 // SCREEN[3] = point2.y - // [18] *(SCREEN+3) = *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2 + // [14] *(SCREEN+3) = *((byte*)&main::point2+OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2 lda point2+OFFSET_STRUCT_POINT_Y sta SCREEN+3 // main::@return // } - // [19] return + // [15] return rts } // getPoint getPoint: { // getPoint::@return - // [21] return + // [17] return rts } // File Data diff --git a/src/test/ref/struct-23.sym b/src/test/ref/struct-23.sym index 403cceba1..2c74c68f4 100644 --- a/src/test/ref/struct-23.sym +++ b/src/test/ref/struct-23.sym @@ -15,10 +15,6 @@ byte getPoint::return_y#2 reg byte a 0.6666666666666666 byte getPoint::x byte getPoint::y void main() -byte~ main::$0_x reg byte x 2.0 -byte~ main::$0_y reg byte a 2.0 -byte~ main::$1_x reg byte x 2.0 -byte~ main::$1_y reg byte a 2.0 struct Point main::point1 loadstore zp[2]:2 struct Point main::point2 loadstore zp[2]:4 @@ -26,11 +22,7 @@ reg byte x [ getPoint::return_x#2 ] reg byte a [ getPoint::return_y#2 ] reg byte x [ getPoint::return_x#0 ] reg byte a [ getPoint::return_y#0 ] -reg byte x [ main::$0_x ] -reg byte a [ main::$0_y ] reg byte x [ getPoint::return_x#1 ] reg byte a [ getPoint::return_y#1 ] -reg byte x [ main::$1_x ] -reg byte a [ main::$1_y ] zp[2]:2 [ main::point1 ] zp[2]:4 [ main::point2 ] diff --git a/src/test/ref/struct-ptr-2.asm b/src/test/ref/struct-ptr-2.asm index 6588d834c..9f1f06740 100644 --- a/src/test/ref/struct-ptr-2.asm +++ b/src/test/ref/struct-ptr-2.asm @@ -15,11 +15,10 @@ main: { .label point_i1 = 4 ldx #0 __b1: - // points+i + // struct Point* point_i = points+i txa asl tay - // struct Point* point_i = points+i tya clc adc #main::@1#0] -- register_copy // main::@1 __b1: - // points+i + // struct Point* point_i = points+i // [2] main::$9 = main::i#2 << 1 -- vbuyy=vbuxx_rol_1 txa asl tay - // struct Point* point_i = points+i // [3] main::point_i#0 = points + main::$9 -- pssz1=pssc1_plus_vbuyy tya clc @@ -522,12 +516,11 @@ main: { // [9] phi main::i1#2 = main::i1#1 [phi:main::@2->main::@2#0] -- register_copy // main::@2 __b2: - // points+i + // struct Point* point_i = points+i // [10] main::$10 = main::i1#2 << 1 -- vbuyy=vbuxx_rol_1 txa asl tay - // struct Point* point_i = points+i // [11] main::point_i1#0 = points + main::$10 -- pssz1=pssc1_plus_vbuyy tya clc diff --git a/src/test/ref/struct-ptr-22.log b/src/test/ref/struct-ptr-22.log index 8bd74fede..10f38c68b 100644 --- a/src/test/ref/struct-ptr-22.log +++ b/src/test/ref/struct-ptr-22.log @@ -1,4 +1,5 @@ Inlined call call __init +Eliminating unused variable with no statement memset::$2 CONTROL FLOW GRAPH SSA @@ -135,8 +136,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -328,7 +328,6 @@ constant byte* main::str1[7] = "$4004=" void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -544,7 +543,6 @@ Alias memset::return#1 = memset::str#1 memset::return#3 memset::return#2 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 diff --git a/src/test/ref/struct-ptr-5.log b/src/test/ref/struct-ptr-5.log index 49b9b2a54..b73eae256 100644 --- a/src/test/ref/struct-ptr-5.log +++ b/src/test/ref/struct-ptr-5.log @@ -1,5 +1,7 @@ Fixing struct type size struct Entry to 3 Inlined call call __init +Eliminating unused variable with no statement main::$0 +Eliminating unused variable with no statement main::$1 CONTROL FLOW GRAPH SSA @@ -7,11 +9,9 @@ void main() main: scope:[main] from __start::@1 main::entry0#0 = ENTRIES main::$5 = 1 * SIZEOF_STRUCT_ENTRY - main::$0 = ENTRIES + main::$5 - main::entry1#0 = main::$0 + main::entry1#0 = ENTRIES + main::$5 main::$6 = 2 * SIZEOF_STRUCT_ENTRY - main::$1 = ENTRIES + main::$6 - main::entry2#0 = main::$1 + main::entry2#0 = ENTRIES + main::$6 main::$17 = (struct Entry**)main::entry0#0 main::$7 = main::$17 + OFFSET_STRUCT_ENTRY_NEXT *main::$7 = main::entry2#0 @@ -88,8 +88,6 @@ constant byte OFFSET_STRUCT_ENTRY_VALUE = 0 constant byte SIZEOF_STRUCT_ENTRY = 3 void __start() void main() -struct Entry*~ main::$0 -struct Entry*~ main::$1 byte*~ main::$10 struct Entry**~ main::$11 byte*~ main::$12 @@ -166,8 +164,6 @@ Finalized unsigned number type (byte) 3 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in main::$5 = 1 * SIZEOF_STRUCT_ENTRY Inferred type updated to byte in main::$6 = 2 * SIZEOF_STRUCT_ENTRY -Alias main::entry1#0 = main::$0 -Alias main::entry2#0 = main::$1 Alias main::entry#2 = main::entry#3 Alias main::idx#5 = main::idx#6 Successful SSA optimization Pass2AliasElimination diff --git a/src/test/ref/summin.asm b/src/test/ref/summin.asm index fd7bb5a79..06dfe8093 100644 --- a/src/test/ref/summin.asm +++ b/src/test/ref/summin.asm @@ -11,25 +11,22 @@ main: { .label s1 = 2 .label s3 = 3 - // sum(1,2) + // byte s1=sum(1,2) lda #2 ldx #1 jsr sum - // sum(1,2) // byte s1=sum(1,2) sta.z s1 - // sum(3,4) + // byte s2=sum(3,4) lda #4 ldx #3 jsr sum - // sum(3,4) // byte s2=sum(3,4) tay - // sum(9,13) + // byte s3=sum(9,13) lda #$d ldx #9 jsr sum - // sum(9,13) // byte s3=sum(9,13) sta.z s3 // s1+s2 diff --git a/src/test/ref/summin.log b/src/test/ref/summin.log index cfcd80240..4c851a74d 100644 --- a/src/test/ref/summin.log +++ b/src/test/ref/summin.log @@ -1,4 +1,8 @@ Inlined call call __init +Eliminating unused variable with no statement main::$0 +Eliminating unused variable with no statement main::$1 +Eliminating unused variable with no statement main::$2 +Eliminating unused variable with no statement main::$4 CONTROL FLOW GRAPH SSA @@ -11,8 +15,7 @@ main: scope:[main] from __start::@1 to:main::@1 main::@1: scope:[main] from main sum::return#5 = phi( main/sum::return#0 ) - main::$0 = sum::return#5 - main::s1#0 = main::$0 + main::s1#0 = sum::return#5 sum::a#1 = 3 sum::b#1 = 4 call sum @@ -21,8 +24,7 @@ main::@1: scope:[main] from main main::@2: scope:[main] from main::@1 main::s1#2 = phi( main::@1/main::s1#0 ) sum::return#6 = phi( main::@1/sum::return#1 ) - main::$1 = sum::return#6 - main::s2#0 = main::$1 + main::s2#0 = sum::return#6 sum::a#2 = 9 sum::b#2 = $d call sum @@ -32,11 +34,9 @@ main::@3: scope:[main] from main::@2 main::s2#1 = phi( main::@2/main::s2#0 ) main::s1#1 = phi( main::@2/main::s1#2 ) sum::return#7 = phi( main::@2/sum::return#2 ) - main::$2 = sum::return#7 - main::s3#0 = main::$2 + main::s3#0 = sum::return#7 main::$3 = main::s1#1 + main::s2#1 - main::$4 = main::$3 + main::s3#0 - main::s4#0 = main::$4 + main::s4#0 = main::$3 + main::s3#0 *screen = main::s4#0 to:main::@return main::@return: scope:[main] from main::@3 @@ -73,11 +73,7 @@ __start::@return: scope:[__start] from __start::@2 SYMBOL TABLE SSA void __start() void main() -byte~ main::$0 -byte~ main::$1 -byte~ main::$2 byte~ main::$3 -byte~ main::$4 byte main::s1 byte main::s1#0 byte main::s1#1 @@ -143,12 +139,10 @@ Finalized unsigned number type (byte) 9 Finalized unsigned number type (byte) $d Successful SSA optimization PassNFinalizeNumberTypeConversions Alias sum::return#0 = sum::return#5 -Alias main::s1#0 = main::$0 main::s1#2 main::s1#1 Alias sum::return#1 = sum::return#6 -Alias main::s2#0 = main::$1 main::s2#1 +Alias main::s1#0 = main::s1#2 main::s1#1 Alias sum::return#2 = sum::return#7 -Alias main::s3#0 = main::$2 -Alias main::s4#0 = main::$4 +Alias main::s2#0 = main::s2#1 Alias sum::return#3 = sum::$0 sum::return#8 sum::return#4 Successful SSA optimization Pass2AliasElimination Constant sum::a#0 = 1 @@ -490,7 +484,7 @@ Score: 74 main: { .label s1 = 2 .label s3 = 3 - // sum(1,2) + // byte s1=sum(1,2) // [1] call sum // [14] phi from main to sum [phi:main->sum] // [14] phi sum::b#3 = 2 [phi:main->sum#0] -- vbuaa=vbuc1 @@ -498,13 +492,12 @@ main: { // [14] phi sum::a#3 = 1 [phi:main->sum#1] -- vbuxx=vbuc1 ldx #1 jsr sum - // sum(1,2) + // byte s1=sum(1,2) // [2] sum::return#0 = sum::return#3 // main::@1 - // byte s1=sum(1,2) // [3] main::s1#0 = sum::return#0 -- vbuz1=vbuaa sta.z s1 - // sum(3,4) + // byte s2=sum(3,4) // [4] call sum // [14] phi from main::@1 to sum [phi:main::@1->sum] // [14] phi sum::b#3 = 4 [phi:main::@1->sum#0] -- vbuaa=vbuc1 @@ -512,13 +505,12 @@ main: { // [14] phi sum::a#3 = 3 [phi:main::@1->sum#1] -- vbuxx=vbuc1 ldx #3 jsr sum - // sum(3,4) + // byte s2=sum(3,4) // [5] sum::return#1 = sum::return#3 // main::@2 - // byte s2=sum(3,4) // [6] main::s2#0 = sum::return#1 -- vbuyy=vbuaa tay - // sum(9,13) + // byte s3=sum(9,13) // [7] call sum // [14] phi from main::@2 to sum [phi:main::@2->sum] // [14] phi sum::b#3 = $d [phi:main::@2->sum#0] -- vbuaa=vbuc1 @@ -526,10 +518,9 @@ main: { // [14] phi sum::a#3 = 9 [phi:main::@2->sum#1] -- vbuxx=vbuc1 ldx #9 jsr sum - // sum(9,13) + // byte s3=sum(9,13) // [8] sum::return#2 = sum::return#3 // main::@3 - // byte s3=sum(9,13) // [9] main::s3#0 = sum::return#2 -- vbuz1=vbuaa sta.z s3 // s1+s2 diff --git a/src/test/ref/test-comments-block.asm b/src/test/ref/test-comments-block.asm index ac07b65f6..3015937f4 100644 --- a/src/test/ref/test-comments-block.asm +++ b/src/test/ref/test-comments-block.asm @@ -42,7 +42,8 @@ main: { */ // sum(byte register(A) b) sum: { - // a+b + // byte r = a+b + // calculate the sum clc adc #@a // } diff --git a/src/test/ref/test-comments-block.log b/src/test/ref/test-comments-block.log index d350878c7..af66ecbf2 100644 --- a/src/test/ref/test-comments-block.log +++ b/src/test/ref/test-comments-block.log @@ -1,4 +1,5 @@ Inlined call call __init +Eliminating unused variable with no statement sum::$0 CONTROL FLOW GRAPH SSA @@ -34,8 +35,7 @@ byte sum(byte sum::a , byte sum::b) sum: scope:[sum] from main::@1 sum::b#1 = phi( main::@1/sum::b#0 ) sum::a#1 = phi( main::@1/sum::a#0 ) - sum::$0 = sum::a#1 + sum::b#1 - sum::r#0 = sum::$0 + sum::r#0 = sum::a#1 + sum::b#1 sum::return#1 = sum::r#0 to:sum::@return sum::@return: scope:[sum] from sum @@ -76,7 +76,6 @@ byte main::i#1 byte main::i#2 byte main::i#3 byte sum(byte sum::a , byte sum::b) -byte~ sum::$0 byte sum::a byte sum::a#0 byte sum::a#1 @@ -97,7 +96,7 @@ Successful SSA optimization PassNCastSimplification Alias sum::return#0 = sum::return#3 Alias main::i#2 = main::i#3 Alias main::b#2 = main::b#3 -Alias sum::return#1 = sum::r#0 sum::$0 sum::return#4 sum::return#2 +Alias sum::return#1 = sum::r#0 sum::return#4 sum::return#2 Successful SSA optimization Pass2AliasElimination Identical Phi Values sum::a#1 sum::a#0 Identical Phi Values sum::b#1 sum::b#0 @@ -301,6 +300,7 @@ main: { // sum(byte register(A) b) sum: { // [11] sum::return#1 = a + sum::b#0 -- vbuaa=vbuc1_plus_vbuaa + // calculate the sum clc adc #@a jmp __breturn @@ -426,8 +426,9 @@ main: { */ // sum(byte register(A) b) sum: { - // a+b + // byte r = a+b // [11] sum::return#1 = a + sum::b#0 -- vbuaa=vbuc1_plus_vbuaa + // calculate the sum clc adc #@a // sum::@return diff --git a/src/test/ref/test-comments-single.asm b/src/test/ref/test-comments-single.asm index 23bfc1471..58a66b5d1 100644 --- a/src/test/ref/test-comments-single.asm +++ b/src/test/ref/test-comments-single.asm @@ -40,7 +40,8 @@ main: { // Returns the sum pf the two bytes // sum(byte register(A) b) sum: { - // a+b + // byte r = a+b + // calculate the sum clc adc #@a // } diff --git a/src/test/ref/test-comments-single.log b/src/test/ref/test-comments-single.log index 986eace69..dfcc39047 100644 --- a/src/test/ref/test-comments-single.log +++ b/src/test/ref/test-comments-single.log @@ -1,4 +1,5 @@ Inlined call call __init +Eliminating unused variable with no statement sum::$0 CONTROL FLOW GRAPH SSA @@ -34,8 +35,7 @@ byte sum(byte sum::a , byte sum::b) sum: scope:[sum] from main::@1 sum::b#1 = phi( main::@1/sum::b#0 ) sum::a#1 = phi( main::@1/sum::a#0 ) - sum::$0 = sum::a#1 + sum::b#1 - sum::r#0 = sum::$0 + sum::r#0 = sum::a#1 + sum::b#1 sum::return#1 = sum::r#0 to:sum::@return sum::@return: scope:[sum] from sum @@ -76,7 +76,6 @@ byte main::i#1 byte main::i#2 byte main::i#3 byte sum(byte sum::a , byte sum::b) -byte~ sum::$0 byte sum::a byte sum::a#0 byte sum::a#1 @@ -97,7 +96,7 @@ Successful SSA optimization PassNCastSimplification Alias sum::return#0 = sum::return#3 Alias main::i#2 = main::i#3 Alias main::b#2 = main::b#3 -Alias sum::return#1 = sum::r#0 sum::$0 sum::return#4 sum::return#2 +Alias sum::return#1 = sum::r#0 sum::return#4 sum::return#2 Successful SSA optimization Pass2AliasElimination Identical Phi Values sum::a#1 sum::a#0 Identical Phi Values sum::b#1 sum::b#0 @@ -299,6 +298,7 @@ main: { // sum(byte register(A) b) sum: { // [11] sum::return#1 = a + sum::b#0 -- vbuaa=vbuc1_plus_vbuaa + // calculate the sum clc adc #@a jmp __breturn @@ -422,8 +422,9 @@ main: { // Returns the sum pf the two bytes // sum(byte register(A) b) sum: { - // a+b + // byte r = a+b // [11] sum::return#1 = a + sum::b#0 -- vbuaa=vbuc1_plus_vbuaa + // calculate the sum clc adc #@a // sum::@return diff --git a/src/test/ref/test-comparisons-sword.log b/src/test/ref/test-comparisons-sword.log index dae180262..20b2da36a 100644 --- a/src/test/ref/test-comparisons-sword.log +++ b/src/test/ref/test-comparisons-sword.log @@ -1,5 +1,6 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call __init +Eliminating unused variable with no statement memset::$2 CONTROL FLOW GRAPH SSA @@ -209,8 +210,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -854,7 +854,6 @@ signed word main::w2#5 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -1124,14 +1123,14 @@ Finalized unsigned number type (byte) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in print_uchar::$2 = print_uchar::b#3 & $f Inversing boolean not [97] memset::$1 = memset::num#1 <= 0 from [96] memset::$0 = memset::num#1 > 0 -Inversing boolean not [139] main::$3 = main::s#1 != 3 from [138] main::$2 = main::s#1 == 3 -Inversing boolean not [172] compare::$22 = compare::w1#1 >= compare::w2#1 from [171] compare::$21 = compare::w1#1 < compare::w2#1 -Inversing boolean not [179] compare::$20 = compare::w1#2 > compare::w2#2 from [178] compare::$19 = compare::w1#2 <= compare::w2#2 -Inversing boolean not [186] compare::$18 = compare::w1#3 <= compare::w2#3 from [185] compare::$17 = compare::w1#3 > compare::w2#3 -Inversing boolean not [193] compare::$16 = compare::w1#4 < compare::w2#4 from [192] compare::$15 = compare::w1#4 >= compare::w2#4 -Inversing boolean not [200] compare::$14 = compare::w1#5 != compare::w2#5 from [199] compare::$13 = compare::w1#5 == compare::w2#5 -Inversing boolean not [204] compare::$6 = compare::op#6 != NE from [203] compare::$5 = compare::op#6 == NE -Inversing boolean not [208] compare::$12 = compare::w1#6 == compare::w2#6 from [207] compare::$11 = compare::w1#6 != compare::w2#6 +Inversing boolean not [138] main::$3 = main::s#1 != 3 from [137] main::$2 = main::s#1 == 3 +Inversing boolean not [171] compare::$22 = compare::w1#1 >= compare::w2#1 from [170] compare::$21 = compare::w1#1 < compare::w2#1 +Inversing boolean not [178] compare::$20 = compare::w1#2 > compare::w2#2 from [177] compare::$19 = compare::w1#2 <= compare::w2#2 +Inversing boolean not [185] compare::$18 = compare::w1#3 <= compare::w2#3 from [184] compare::$17 = compare::w1#3 > compare::w2#3 +Inversing boolean not [192] compare::$16 = compare::w1#4 < compare::w2#4 from [191] compare::$15 = compare::w1#4 >= compare::w2#4 +Inversing boolean not [199] compare::$14 = compare::w1#5 != compare::w2#5 from [198] compare::$13 = compare::w1#5 == compare::w2#5 +Inversing boolean not [203] compare::$6 = compare::op#6 != NE from [202] compare::$5 = compare::op#6 == NE +Inversing boolean not [207] compare::$12 = compare::w1#6 == compare::w2#6 from [206] compare::$11 = compare::w1#6 != compare::w2#6 Successful SSA optimization Pass2UnaryNotSimplification Alias print_str::str#2 = print_str::str#3 print_str::str#4 Alias print_char_cursor#1 = print_char_cursor#58 print_char_cursor#59 print_char_cursor#31 @@ -1157,7 +1156,6 @@ Alias memset::return#1 = memset::str#1 memset::return#3 memset::return#2 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 diff --git a/src/test/ref/test-comparisons-word.log b/src/test/ref/test-comparisons-word.log index 171b46765..20a461d5f 100644 --- a/src/test/ref/test-comparisons-word.log +++ b/src/test/ref/test-comparisons-word.log @@ -1,5 +1,6 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call __init +Eliminating unused variable with no statement memset::$2 CONTROL FLOW GRAPH SSA @@ -162,8 +163,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -807,7 +807,6 @@ word main::w2#5 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -1069,14 +1068,14 @@ Finalized unsigned number type (byte) 5 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in print_uchar::$2 = print_uchar::b#3 & $f Inversing boolean not [74] memset::$1 = memset::num#1 <= 0 from [73] memset::$0 = memset::num#1 > 0 -Inversing boolean not [116] main::$3 = main::s#1 != 3 from [115] main::$2 = main::s#1 == 3 -Inversing boolean not [149] compare::$23 = compare::w1#1 >= compare::w2#1 from [148] compare::$22 = compare::w1#1 < compare::w2#1 -Inversing boolean not [156] compare::$21 = compare::w1#2 > compare::w2#2 from [155] compare::$20 = compare::w1#2 <= compare::w2#2 -Inversing boolean not [163] compare::$19 = compare::w1#3 <= compare::w2#3 from [162] compare::$18 = compare::w1#3 > compare::w2#3 -Inversing boolean not [170] compare::$17 = compare::w1#4 < compare::w2#4 from [169] compare::$16 = compare::w1#4 >= compare::w2#4 -Inversing boolean not [177] compare::$15 = compare::w1#5 != compare::w2#5 from [176] compare::$14 = compare::w1#5 == compare::w2#5 -Inversing boolean not [181] compare::$6 = compare::op#6 != 5 from [180] compare::$5 = compare::op#6 == 5 -Inversing boolean not [185] compare::$13 = compare::w1#6 == compare::w2#6 from [184] compare::$12 = compare::w1#6 != compare::w2#6 +Inversing boolean not [115] main::$3 = main::s#1 != 3 from [114] main::$2 = main::s#1 == 3 +Inversing boolean not [148] compare::$23 = compare::w1#1 >= compare::w2#1 from [147] compare::$22 = compare::w1#1 < compare::w2#1 +Inversing boolean not [155] compare::$21 = compare::w1#2 > compare::w2#2 from [154] compare::$20 = compare::w1#2 <= compare::w2#2 +Inversing boolean not [162] compare::$19 = compare::w1#3 <= compare::w2#3 from [161] compare::$18 = compare::w1#3 > compare::w2#3 +Inversing boolean not [169] compare::$17 = compare::w1#4 < compare::w2#4 from [168] compare::$16 = compare::w1#4 >= compare::w2#4 +Inversing boolean not [176] compare::$15 = compare::w1#5 != compare::w2#5 from [175] compare::$14 = compare::w1#5 == compare::w2#5 +Inversing boolean not [180] compare::$6 = compare::op#6 != 5 from [179] compare::$5 = compare::op#6 == 5 +Inversing boolean not [184] compare::$13 = compare::w1#6 == compare::w2#6 from [183] compare::$12 = compare::w1#6 != compare::w2#6 Successful SSA optimization Pass2UnaryNotSimplification Alias print_str::str#2 = print_str::str#3 print_str::str#4 Alias print_char_cursor#1 = print_char_cursor#52 print_char_cursor#53 print_char_cursor#28 @@ -1096,7 +1095,6 @@ Alias memset::return#1 = memset::str#1 memset::return#3 memset::return#2 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 diff --git a/src/test/ref/test-keyboard-space.asm b/src/test/ref/test-keyboard-space.asm index 2b8966617..7eaa90692 100644 --- a/src/test/ref/test-keyboard-space.asm +++ b/src/test/ref/test-keyboard-space.asm @@ -99,7 +99,7 @@ keyboard_matrix_read: { // CIA1->PORT_A = keyboard_matrix_row_bitmask[rowid] lda keyboard_matrix_row_bitmask+keyboard_key_pressed.rowidx sta CIA1 - // ~CIA1->PORT_B + // char row_pressed_bits = ~CIA1->PORT_B lda CIA1+OFFSET_STRUCT_MOS6526_CIA_PORT_B eor #$ff // } diff --git a/src/test/ref/test-keyboard-space.log b/src/test/ref/test-keyboard-space.log index 15c94a696..a84ded319 100644 --- a/src/test/ref/test-keyboard-space.log +++ b/src/test/ref/test-keyboard-space.log @@ -1,5 +1,8 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call __init +Eliminating unused variable with no statement keyboard_matrix_read::$0 +Eliminating unused variable with no statement keyboard_key_pressed::$0 +Eliminating unused variable with no statement keyboard_key_pressed::$1 CONTROL FLOW GRAPH SSA @@ -16,8 +19,7 @@ byte keyboard_matrix_read(byte keyboard_matrix_read::rowid) keyboard_matrix_read: scope:[keyboard_matrix_read] from keyboard_key_pressed keyboard_matrix_read::rowid#1 = phi( keyboard_key_pressed/keyboard_matrix_read::rowid#0 ) *((byte*)CIA1+OFFSET_STRUCT_MOS6526_CIA_PORT_A) = keyboard_matrix_row_bitmask[keyboard_matrix_read::rowid#1] - keyboard_matrix_read::$0 = ~ *((byte*)CIA1+OFFSET_STRUCT_MOS6526_CIA_PORT_B) - keyboard_matrix_read::row_pressed_bits#0 = keyboard_matrix_read::$0 + keyboard_matrix_read::row_pressed_bits#0 = ~ *((byte*)CIA1+OFFSET_STRUCT_MOS6526_CIA_PORT_B) keyboard_matrix_read::return#0 = keyboard_matrix_read::row_pressed_bits#0 to:keyboard_matrix_read::@return keyboard_matrix_read::@return: scope:[keyboard_matrix_read] from keyboard_matrix_read @@ -29,10 +31,8 @@ keyboard_matrix_read::@return: scope:[keyboard_matrix_read] from keyboard_matri byte keyboard_key_pressed(byte keyboard_key_pressed::key) keyboard_key_pressed: scope:[keyboard_key_pressed] from main::@3 keyboard_key_pressed::key#1 = phi( main::@3/keyboard_key_pressed::key#0 ) - keyboard_key_pressed::$0 = keyboard_key_pressed::key#1 & 7 - keyboard_key_pressed::colidx#0 = keyboard_key_pressed::$0 - keyboard_key_pressed::$1 = keyboard_key_pressed::key#1 >> 3 - keyboard_key_pressed::rowidx#0 = keyboard_key_pressed::$1 + keyboard_key_pressed::colidx#0 = keyboard_key_pressed::key#1 & 7 + keyboard_key_pressed::rowidx#0 = keyboard_key_pressed::key#1 >> 3 keyboard_matrix_read::rowid#0 = keyboard_key_pressed::rowidx#0 call keyboard_matrix_read keyboard_matrix_read::return#2 = keyboard_matrix_read::return#1 @@ -112,8 +112,6 @@ constant byte* const RASTER = (byte*)$d012 void __start() void keyboard_init() byte keyboard_key_pressed(byte keyboard_key_pressed::key) -number~ keyboard_key_pressed::$0 -byte~ keyboard_key_pressed::$1 byte~ keyboard_key_pressed::$2 byte~ keyboard_key_pressed::$3 byte keyboard_key_pressed::colidx @@ -132,7 +130,6 @@ byte keyboard_key_pressed::rowidx byte keyboard_key_pressed::rowidx#0 constant byte* keyboard_matrix_col_bitmask[8] = { 1, 2, 4, 8, $10, $20, $40, $80 } byte keyboard_matrix_read(byte keyboard_matrix_read::rowid) -byte~ keyboard_matrix_read::$0 byte keyboard_matrix_read::return byte keyboard_matrix_read::return#0 byte keyboard_matrix_read::return#1 @@ -152,9 +149,8 @@ bool~ main::$3 Adding number conversion cast (unumber) $ff in *((byte*)CIA1+OFFSET_STRUCT_MOS6526_CIA_PORT_A_DDR) = $ff Adding number conversion cast (unumber) 0 in *((byte*)CIA1+OFFSET_STRUCT_MOS6526_CIA_PORT_B_DDR) = 0 -Adding number conversion cast (unumber) 7 in keyboard_key_pressed::$0 = keyboard_key_pressed::key#1 & 7 -Adding number conversion cast (unumber) keyboard_key_pressed::$0 in keyboard_key_pressed::$0 = keyboard_key_pressed::key#1 & (unumber)7 -Adding number conversion cast (unumber) 3 in keyboard_key_pressed::$1 = keyboard_key_pressed::key#1 >> 3 +Adding number conversion cast (unumber) 7 in keyboard_key_pressed::colidx#0 = keyboard_key_pressed::key#1 & 7 +Adding number conversion cast (unumber) 3 in keyboard_key_pressed::rowidx#0 = keyboard_key_pressed::key#1 >> 3 Adding number conversion cast (unumber) $ff in main::$1 = *RASTER != $ff Adding number conversion cast (unumber) 0 in main::$3 = main::$2 != 0 Successful SSA optimization PassNAddNumberTypeConversions @@ -178,11 +174,9 @@ Finalized unsigned number type (byte) 3 Finalized unsigned number type (byte) $ff Finalized unsigned number type (byte) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to byte in keyboard_key_pressed::$0 = keyboard_key_pressed::key#1 & 7 -Alias keyboard_matrix_read::return#0 = keyboard_matrix_read::row_pressed_bits#0 keyboard_matrix_read::$0 keyboard_matrix_read::return#3 keyboard_matrix_read::return#1 -Alias keyboard_key_pressed::colidx#0 = keyboard_key_pressed::$0 keyboard_key_pressed::colidx#1 -Alias keyboard_key_pressed::rowidx#0 = keyboard_key_pressed::$1 +Alias keyboard_matrix_read::return#0 = keyboard_matrix_read::row_pressed_bits#0 keyboard_matrix_read::return#3 keyboard_matrix_read::return#1 Alias keyboard_matrix_read::return#2 = keyboard_matrix_read::return#4 +Alias keyboard_key_pressed::colidx#0 = keyboard_key_pressed::colidx#1 Alias keyboard_key_pressed::return#0 = keyboard_key_pressed::$3 keyboard_key_pressed::return#3 keyboard_key_pressed::return#1 Alias keyboard_key_pressed::return#2 = keyboard_key_pressed::return#4 Successful SSA optimization Pass2AliasElimination @@ -733,7 +727,7 @@ keyboard_matrix_read: { // [19] *((byte*)CIA1) = *(keyboard_matrix_row_bitmask+keyboard_key_pressed::rowidx#0) -- _deref_pbuc1=_deref_pbuc2 lda keyboard_matrix_row_bitmask+keyboard_key_pressed.rowidx sta CIA1 - // ~CIA1->PORT_B + // char row_pressed_bits = ~CIA1->PORT_B // [20] keyboard_matrix_read::return#0 = ~ *((byte*)CIA1+OFFSET_STRUCT_MOS6526_CIA_PORT_B) -- vbuaa=_bnot__deref_pbuc1 lda CIA1+OFFSET_STRUCT_MOS6526_CIA_PORT_B eor #$ff diff --git a/src/test/ref/test-keyboard.asm b/src/test/ref/test-keyboard.asm index 278858c8a..8c2c3fd3e 100644 --- a/src/test/ref/test-keyboard.asm +++ b/src/test/ref/test-keyboard.asm @@ -107,10 +107,9 @@ main: { sta.z row // Read & print keyboard matrix __b5: - // keyboard_matrix_read(row) + // byte row_pressed_bits = keyboard_matrix_read(row) ldx.z row jsr keyboard_matrix_read - // keyboard_matrix_read(row) // byte row_pressed_bits = keyboard_matrix_read(row) tax ldy #0 @@ -158,10 +157,9 @@ main: { sta.z i sta.z ch __b12: - // keyboard_get_keycode(ch) + // byte key = keyboard_get_keycode(ch) ldx.z ch jsr keyboard_get_keycode - // byte key = keyboard_get_keycode(ch) // if(key!=$3f) cmp #$3f beq __b13 @@ -236,7 +234,7 @@ keyboard_matrix_read: { // CIA1->PORT_A = keyboard_matrix_row_bitmask[rowid] lda keyboard_matrix_row_bitmask,x sta CIA1 - // ~CIA1->PORT_B + // char row_pressed_bits = ~CIA1->PORT_B lda CIA1+OFFSET_STRUCT_MOS6526_CIA_PORT_B eor #$ff // } diff --git a/src/test/ref/test-keyboard.log b/src/test/ref/test-keyboard.log index 1364c6186..89fa51203 100644 --- a/src/test/ref/test-keyboard.log +++ b/src/test/ref/test-keyboard.log @@ -1,5 +1,10 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call __init +Eliminating unused variable with no statement keyboard_matrix_read::$0 +Eliminating unused variable with no statement keyboard_key_pressed::$0 +Eliminating unused variable with no statement keyboard_key_pressed::$1 +Eliminating unused variable with no statement main::$3 +Eliminating unused variable with no statement main::$11 CONTROL FLOW GRAPH SSA @@ -16,8 +21,7 @@ byte keyboard_matrix_read(byte keyboard_matrix_read::rowid) keyboard_matrix_read: scope:[keyboard_matrix_read] from keyboard_key_pressed main::@7 keyboard_matrix_read::rowid#2 = phi( keyboard_key_pressed/keyboard_matrix_read::rowid#0, main::@7/keyboard_matrix_read::rowid#1 ) *((byte*)CIA1+OFFSET_STRUCT_MOS6526_CIA_PORT_A) = keyboard_matrix_row_bitmask[keyboard_matrix_read::rowid#2] - keyboard_matrix_read::$0 = ~ *((byte*)CIA1+OFFSET_STRUCT_MOS6526_CIA_PORT_B) - keyboard_matrix_read::row_pressed_bits#0 = keyboard_matrix_read::$0 + keyboard_matrix_read::row_pressed_bits#0 = ~ *((byte*)CIA1+OFFSET_STRUCT_MOS6526_CIA_PORT_B) keyboard_matrix_read::return#0 = keyboard_matrix_read::row_pressed_bits#0 to:keyboard_matrix_read::@return keyboard_matrix_read::@return: scope:[keyboard_matrix_read] from keyboard_matrix_read @@ -29,10 +33,8 @@ keyboard_matrix_read::@return: scope:[keyboard_matrix_read] from keyboard_matri byte keyboard_key_pressed(byte keyboard_key_pressed::key) keyboard_key_pressed: scope:[keyboard_key_pressed] from main::@16 keyboard_key_pressed::key#1 = phi( main::@16/keyboard_key_pressed::key#0 ) - keyboard_key_pressed::$0 = keyboard_key_pressed::key#1 & 7 - keyboard_key_pressed::colidx#0 = keyboard_key_pressed::$0 - keyboard_key_pressed::$1 = keyboard_key_pressed::key#1 >> 3 - keyboard_key_pressed::rowidx#0 = keyboard_key_pressed::$1 + keyboard_key_pressed::colidx#0 = keyboard_key_pressed::key#1 & 7 + keyboard_key_pressed::rowidx#0 = keyboard_key_pressed::key#1 >> 3 keyboard_matrix_read::rowid#0 = keyboard_key_pressed::rowidx#0 call keyboard_matrix_read keyboard_matrix_read::return#2 = keyboard_matrix_read::return#1 @@ -102,8 +104,7 @@ main::@20: scope:[main] from main::@7 main::row#8 = phi( main::@7/main::row#2 ) main::screen#13 = phi( main::@7/main::screen#16 ) keyboard_matrix_read::return#6 = phi( main::@7/keyboard_matrix_read::return#3 ) - main::$3 = keyboard_matrix_read::return#6 - main::row_pressed_bits#0 = main::$3 + main::row_pressed_bits#0 = keyboard_matrix_read::return#6 main::col#0 = 0 to:main::@8 main::@8: scope:[main] from main::@10 main::@20 @@ -169,8 +170,7 @@ main::@21: scope:[main] from main::@14 main::screen#14 = phi( main::@14/main::screen#17 ) main::ch#5 = phi( main::@14/main::ch#2 ) keyboard_get_keycode::return#4 = phi( main::@14/keyboard_get_keycode::return#2 ) - main::$11 = keyboard_get_keycode::return#4 - main::key#0 = main::$11 + main::key#0 = keyboard_get_keycode::return#4 main::$12 = main::key#0 != $3f main::$13 = ! main::$12 if(main::$13) goto main::@15 @@ -306,8 +306,6 @@ byte keyboard_get_keycode::return#3 byte keyboard_get_keycode::return#4 void keyboard_init() byte keyboard_key_pressed(byte keyboard_key_pressed::key) -number~ keyboard_key_pressed::$0 -byte~ keyboard_key_pressed::$1 byte~ keyboard_key_pressed::$2 byte~ keyboard_key_pressed::$3 byte keyboard_key_pressed::colidx @@ -326,7 +324,6 @@ byte keyboard_key_pressed::rowidx byte keyboard_key_pressed::rowidx#0 constant byte* keyboard_matrix_col_bitmask[8] = { 1, 2, 4, 8, $10, $20, $40, $80 } byte keyboard_matrix_read(byte keyboard_matrix_read::rowid) -byte~ keyboard_matrix_read::$0 byte keyboard_matrix_read::return byte keyboard_matrix_read::return#0 byte keyboard_matrix_read::return#1 @@ -345,7 +342,6 @@ constant byte* keyboard_matrix_row_bitmask[8] = { $fe, $fd, $fb, $f7, $ef, $df, void main() bool~ main::$1 byte*~ main::$10 -byte~ main::$11 bool~ main::$12 bool~ main::$13 byte~ main::$14 @@ -354,7 +350,6 @@ bool~ main::$16 bool~ main::$17 bool~ main::$18 bool~ main::$2 -byte~ main::$3 number~ main::$4 bool~ main::$5 number~ main::$6 @@ -435,9 +430,8 @@ byte* main::screen#9 Adding number conversion cast (unumber) $ff in *((byte*)CIA1+OFFSET_STRUCT_MOS6526_CIA_PORT_A_DDR) = $ff Adding number conversion cast (unumber) 0 in *((byte*)CIA1+OFFSET_STRUCT_MOS6526_CIA_PORT_B_DDR) = 0 -Adding number conversion cast (unumber) 7 in keyboard_key_pressed::$0 = keyboard_key_pressed::key#1 & 7 -Adding number conversion cast (unumber) keyboard_key_pressed::$0 in keyboard_key_pressed::$0 = keyboard_key_pressed::key#1 & (unumber)7 -Adding number conversion cast (unumber) 3 in keyboard_key_pressed::$1 = keyboard_key_pressed::key#1 >> 3 +Adding number conversion cast (unumber) 7 in keyboard_key_pressed::colidx#0 = keyboard_key_pressed::key#1 & 7 +Adding number conversion cast (unumber) 3 in keyboard_key_pressed::rowidx#0 = keyboard_key_pressed::key#1 >> 3 Adding number conversion cast (unumber) $400+$3e8 in main::$1 = main::sc#2 < $400+$3e8 Adding number conversion cast (unumber) $ff in main::$2 = *RASTER != $ff Adding number conversion cast (unumber) $80 in main::$4 = main::row_pressed_bits#2 & $80 @@ -486,23 +480,20 @@ Finalized unsigned number type (byte) $3f Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) 5 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to byte in keyboard_key_pressed::$0 = keyboard_key_pressed::key#1 & 7 Inferred type updated to byte in main::$4 = main::row_pressed_bits#2 & $80 Inferred type updated to byte in main::$6 = main::row_pressed_bits#3 * 2 -Inversing boolean not [85] main::$13 = main::key#0 == $3f from [84] main::$12 = main::key#0 != $3f -Inversing boolean not [98] main::$16 = main::$14 == 0 from [97] main::$15 = main::$14 != 0 +Inversing boolean not [80] main::$13 = main::key#0 == $3f from [79] main::$12 = main::key#0 != $3f +Inversing boolean not [93] main::$16 = main::$14 == 0 from [92] main::$15 = main::$14 != 0 Successful SSA optimization Pass2UnaryNotSimplification -Alias keyboard_matrix_read::return#0 = keyboard_matrix_read::row_pressed_bits#0 keyboard_matrix_read::$0 keyboard_matrix_read::return#4 keyboard_matrix_read::return#1 -Alias keyboard_key_pressed::colidx#0 = keyboard_key_pressed::$0 keyboard_key_pressed::colidx#1 -Alias keyboard_key_pressed::rowidx#0 = keyboard_key_pressed::$1 +Alias keyboard_matrix_read::return#0 = keyboard_matrix_read::row_pressed_bits#0 keyboard_matrix_read::return#4 keyboard_matrix_read::return#1 Alias keyboard_matrix_read::return#2 = keyboard_matrix_read::return#5 +Alias keyboard_key_pressed::colidx#0 = keyboard_key_pressed::colidx#1 Alias keyboard_key_pressed::return#0 = keyboard_key_pressed::$3 keyboard_key_pressed::return#3 keyboard_key_pressed::return#1 Alias keyboard_get_keycode::return#0 = keyboard_get_keycode::return#3 keyboard_get_keycode::return#1 Alias main::sc#2 = main::sc#3 Alias keyboard_matrix_read::return#3 = keyboard_matrix_read::return#6 Alias main::screen#13 = main::screen#16 Alias main::row#2 = main::row#8 -Alias main::row_pressed_bits#0 = main::$3 Alias main::screen#3 = main::screen#9 main::screen#4 Alias main::col#2 = main::col#5 main::col#3 Alias main::row_pressed_bits#2 = main::row_pressed_bits#5 main::row_pressed_bits#4 @@ -516,7 +507,7 @@ Alias keyboard_get_keycode::return#2 = keyboard_get_keycode::return#4 Alias main::ch#2 = main::ch#5 main::ch#7 main::ch#6 main::ch#4 Alias main::screen#11 = main::screen#14 main::screen#17 main::screen#15 main::screen#7 Alias main::i#3 = main::i#7 main::i#9 main::i#8 main::i#5 -Alias main::key#0 = main::$11 main::key#1 +Alias main::key#0 = main::key#1 Alias keyboard_key_pressed::return#2 = keyboard_key_pressed::return#4 Successful SSA optimization Pass2AliasElimination Alias main::row_pressed_bits#2 = main::row_pressed_bits#3 @@ -1805,17 +1796,16 @@ main: { // [6] phi main::row#2 = main::row#1 [phi:main::@10->main::@5#1] -- register_copy // main::@5 __b5: - // keyboard_matrix_read(row) + // byte row_pressed_bits = keyboard_matrix_read(row) // [7] keyboard_matrix_read::rowid#1 = main::row#2 -- vbuxx=vbuz1 ldx.z row // [8] call keyboard_matrix_read // [48] phi from main::@5 to keyboard_matrix_read [phi:main::@5->keyboard_matrix_read] // [48] phi keyboard_matrix_read::rowid#2 = keyboard_matrix_read::rowid#1 [phi:main::@5->keyboard_matrix_read#0] -- register_copy jsr keyboard_matrix_read - // keyboard_matrix_read(row) + // byte row_pressed_bits = keyboard_matrix_read(row) // [9] keyboard_matrix_read::return#3 = keyboard_matrix_read::return#0 // main::@17 - // byte row_pressed_bits = keyboard_matrix_read(row) // [10] main::row_pressed_bits#0 = keyboard_matrix_read::return#3 -- vbuxx=vbuaa tax // [11] phi from main::@17 to main::@6 [phi:main::@17->main::@6] @@ -1891,14 +1881,13 @@ main: { // [22] phi main::ch#2 = main::ch#1 [phi:main::@13->main::@12#1] -- register_copy // main::@12 __b12: - // keyboard_get_keycode(ch) + // byte key = keyboard_get_keycode(ch) // [23] keyboard_get_keycode::ch#0 = main::ch#2 -- vbuxx=vbuz1 ldx.z ch // [24] call keyboard_get_keycode jsr keyboard_get_keycode // [25] keyboard_get_keycode::return#2 = keyboard_get_keycode::return#0 // main::@18 - // byte key = keyboard_get_keycode(ch) // [26] main::key#0 = keyboard_get_keycode::return#2 // if(key!=$3f) // [27] if(main::key#0==$3f) goto main::@13 -- vbuaa_eq_vbuc1_then_la1 @@ -2010,7 +1999,7 @@ keyboard_matrix_read: { // [49] *((byte*)CIA1) = keyboard_matrix_row_bitmask[keyboard_matrix_read::rowid#2] -- _deref_pbuc1=pbuc2_derefidx_vbuxx lda keyboard_matrix_row_bitmask,x sta CIA1 - // ~CIA1->PORT_B + // char row_pressed_bits = ~CIA1->PORT_B // [50] keyboard_matrix_read::return#0 = ~ *((byte*)CIA1+OFFSET_STRUCT_MOS6526_CIA_PORT_B) -- vbuaa=_bnot__deref_pbuc1 lda CIA1+OFFSET_STRUCT_MOS6526_CIA_PORT_B eor #$ff diff --git a/src/test/ref/test-lowhigh.log b/src/test/ref/test-lowhigh.log index 2eacdf97e..db187b962 100644 --- a/src/test/ref/test-lowhigh.log +++ b/src/test/ref/test-lowhigh.log @@ -1,4 +1,5 @@ Inlined call call __init +Eliminating unused variable with no statement memset::$2 CONTROL FLOW GRAPH SSA @@ -158,8 +159,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -447,7 +447,6 @@ dword main::dw2#9 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -708,7 +707,6 @@ Alias memset::return#1 = memset::str#1 memset::return#3 memset::return#2 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 diff --git a/src/test/ref/test-signed-word-minus-byte.log b/src/test/ref/test-signed-word-minus-byte.log index 139ed1327..84b4f0fb7 100644 --- a/src/test/ref/test-signed-word-minus-byte.log +++ b/src/test/ref/test-signed-word-minus-byte.log @@ -1,4 +1,6 @@ Inlined call call __init +Eliminating unused variable with no statement memset::$2 +Eliminating unused variable with no statement main::$1 CONTROL FLOW GRAPH SSA @@ -179,8 +181,7 @@ memset::@2: scope:[memset] from memset memset::num#2 = phi( memset/memset::num#1 ) memset::str#2 = phi( memset/memset::str#3 ) memset::$4 = (byte*)memset::str#2 - memset::$2 = memset::$4 + memset::num#2 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#2 memset::dst#0 = ((byte*)) memset::str#2 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -226,8 +227,7 @@ main::@1: scope:[main] from main::@2 main::@6 print_line_cursor#25 = phi( main::@2/print_line_cursor#4, main::@6/print_line_cursor#5 ) print_char_cursor#55 = phi( main::@2/print_char_cursor#16, main::@6/print_char_cursor#20 ) main::w1#2 = phi( main::@2/main::w1#3, main::@6/main::w1#4 ) - main::$1 = main::w1#2 - $5b - main::w2#0 = main::$1 + main::w2#0 = main::w1#2 - $5b main::$2 = main::w2#0 - $29 main::w1#1 = main::$2 print_sint::w#1 = main::w1#1 @@ -318,7 +318,6 @@ constant byte RADIX::HEXADECIMAL = $10 constant byte RADIX::OCTAL = 8 void __start() void main() -number~ main::$1 number~ main::$2 bool~ main::$7 byte main::i @@ -345,7 +344,6 @@ signed word main::w2#2 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -523,8 +521,7 @@ Adding number conversion cast (unumber) $f in print_uchar::$2 = print_uchar::b#3 Adding number conversion cast (unumber) print_uchar::$2 in print_uchar::$2 = print_uchar::b#3 & (unumber)$f Adding number conversion cast (unumber) $3e8 in memset::num#0 = $3e8 Adding number conversion cast (unumber) 0 in memset::$0 = memset::num#1 > 0 -Adding number conversion cast (snumber) $5b in main::$1 = main::w1#2 - $5b -Adding number conversion cast (snumber) main::$1 in main::$1 = main::w1#2 - (snumber)$5b +Adding number conversion cast (snumber) $5b in main::w2#0 = main::w1#2 - $5b Adding number conversion cast (snumber) $29 in main::$2 = main::w2#0 - $29 Adding number conversion cast (snumber) main::$2 in main::$2 = main::w2#0 - (snumber)$29 Successful SSA optimization PassNAddNumberTypeConversions @@ -551,7 +548,6 @@ Finalized signed number type (signed byte) $5b Finalized signed number type (signed byte) $29 Successful SSA optimization PassNFinalizeNumberTypeConversions Inferred type updated to byte in print_uchar::$2 = print_uchar::b#3 & $f -Inferred type updated to signed word in main::$1 = main::w1#2 - $5b Inferred type updated to signed word in main::$2 = main::w2#0 - $29 Inversing boolean not [84] memset::$1 = memset::num#1 <= 0 from [83] memset::$0 = memset::num#1 > 0 Successful SSA optimization Pass2UnaryNotSimplification @@ -576,7 +572,6 @@ Alias memset::return#1 = memset::str#1 memset::return#3 memset::return#2 Alias memset::str#2 = memset::str#3 Alias memset::num#1 = memset::num#2 Alias memset::c#3 = memset::c#4 -Alias memset::end#0 = memset::$2 Alias memset::c#1 = memset::c#2 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -584,8 +579,8 @@ Alias memset::str#4 = memset::str#5 Alias main::w1#0 = main::w1#3 Alias print_line_cursor#14 = print_line_cursor#4 Alias print_char_cursor#16 = print_char_cursor#40 -Alias main::w2#0 = main::$1 main::w2#2 main::w2#1 Alias main::w1#1 = main::$2 main::w1#7 main::w1#6 main::w1#5 main::w1#4 +Alias main::w2#0 = main::w2#2 main::w2#1 Alias print_line_cursor#21 = print_line_cursor#24 print_line_cursor#25 print_line_cursor#23 Alias main::i#2 = main::i#5 main::i#6 main::i#4 main::i#3 Alias print_char_cursor#17 = print_char_cursor#41 diff --git a/src/test/ref/tod-1.asm b/src/test/ref/tod-1.asm index 77e1b7ec8..d3e7ccc25 100644 --- a/src/test/ref/tod-1.asm +++ b/src/test/ref/tod-1.asm @@ -123,12 +123,11 @@ gotoxy: { sta.z conio_cursor_x // conio_cursor_y = y stx.z conio_cursor_y - // (unsigned int)y*CONIO_WIDTH + // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH txa sta.z __7 lda #0 sta.z __7+1 - // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH lda.z __7 asl sta.z __8 diff --git a/src/test/ref/tod-1.log b/src/test/ref/tod-1.log index 9a5b8fb53..b4d5df21f 100644 --- a/src/test/ref/tod-1.log +++ b/src/test/ref/tod-1.log @@ -1,5 +1,8 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call call __init +Eliminating unused variable with no statement gotoxy::$4 +Eliminating unused variable with no statement memcpy::$0 +Eliminating unused variable with no statement memset::$2 Eliminating unused variable with no statement main::$2 Unwinding list assignment { main::$2_TENTHS, main::$2_SEC, main::$2_MIN, main::$2_HOURS } = { tod_read::return_TENTHS, tod_read::return_SEC, tod_read::return_MIN, tod_read::return_HOURS } Unwinding list assignment { tod_read::return_TENTHS#1, tod_read::return_SEC#1, tod_read::return_MIN#1, tod_read::return_HOURS#1 } = { tod_read::return_TENTHS#2, tod_read::return_SEC#2, tod_read::return_MIN#2, tod_read::return_HOURS#2 } @@ -31,8 +34,7 @@ gotoxy::@2: scope:[gotoxy] from gotoxy::@1 gotoxy::@4 conio_cursor_x = gotoxy::x#5 conio_cursor_y = gotoxy::y#5 gotoxy::$7 = (word)gotoxy::y#5 - gotoxy::$4 = gotoxy::$7 * $28 - gotoxy::line_offset#0 = gotoxy::$4 + gotoxy::line_offset#0 = gotoxy::$7 * $28 gotoxy::$5 = CONIO_SCREEN_TEXT + gotoxy::line_offset#0 conio_line_text = gotoxy::$5 gotoxy::$6 = CONIO_SCREEN_COLORS + gotoxy::line_offset#0 @@ -124,8 +126,7 @@ memcpy: scope:[memcpy] from cscroll::@3 cscroll::@4 memcpy::src#0 = ((byte*)) memcpy::source#2 memcpy::dst#0 = ((byte*)) memcpy::destination#2 memcpy::$2 = (byte*)memcpy::source#2 - memcpy::$0 = memcpy::$2 + memcpy::num#2 - memcpy::src_end#0 = memcpy::$0 + memcpy::src_end#0 = memcpy::$2 + memcpy::num#2 to:memcpy::@1 memcpy::@1: scope:[memcpy] from memcpy memcpy::@2 memcpy::destination#4 = phi( memcpy/memcpy::destination#2, memcpy::@2/memcpy::destination#5 ) @@ -172,8 +173,7 @@ memset::@2: scope:[memset] from memset memset::num#3 = phi( memset/memset::num#2 ) memset::str#3 = phi( memset/memset::str#4 ) memset::$4 = (byte*)memset::str#3 - memset::$2 = memset::$4 + memset::num#3 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#3 memset::dst#0 = ((byte*)) memset::str#3 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -497,7 +497,6 @@ bool~ gotoxy::$0 bool~ gotoxy::$1 bool~ gotoxy::$2 bool~ gotoxy::$3 -number~ gotoxy::$4 byte*~ gotoxy::$5 byte*~ gotoxy::$6 word~ gotoxy::$7 @@ -529,7 +528,6 @@ byte~ main::$2_TENTHS byte*~ main::$3 bool~ main::$5 void* memcpy(void* memcpy::destination , void* memcpy::source , word memcpy::num) -byte*~ memcpy::$0 bool~ memcpy::$1 byte*~ memcpy::$2 void* memcpy::destination @@ -570,7 +568,6 @@ byte* memcpy::src_end#2 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -703,8 +700,7 @@ byte tod_str::tod_TENTHS#1 Adding number conversion cast (unumber) $19 in gotoxy::$0 = gotoxy::y#4 > $19 Adding number conversion cast (unumber) $28 in gotoxy::$2 = gotoxy::x#4 >= $28 Adding number conversion cast (unumber) 0 in gotoxy::y#0 = 0 -Adding number conversion cast (unumber) $28 in gotoxy::$4 = gotoxy::$7 * $28 -Adding number conversion cast (unumber) gotoxy::$4 in gotoxy::$4 = gotoxy::$7 * (unumber)$28 +Adding number conversion cast (unumber) $28 in gotoxy::line_offset#0 = gotoxy::$7 * $28 Adding number conversion cast (unumber) 0 in gotoxy::x#0 = 0 Adding number conversion cast (unumber) $28 in cputc::$1 = conio_cursor_x == $28 Adding number conversion cast (unumber) $28 in conio_line_text = conio_line_text + $28 @@ -873,7 +869,6 @@ Finalized unsigned number type (byte) $a Finalized unsigned number type (byte) 0 Finalized unsigned number type (byte) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to word in gotoxy::$4 = gotoxy::$7 * $28 Inferred type updated to byte in tod_str::$2 = tod_str::tod_HOURS#1 & $f Inferred type updated to byte in tod_str::$3 = '0' + tod_str::$2 Inferred type updated to byte in tod_str::$6 = tod_str::tod_MIN#1 & $f @@ -884,20 +879,18 @@ Inferred type updated to byte in tod_str::$14 = tod_str::tod_TENTHS#1 & $f Inferred type updated to byte in tod_str::$15 = '0' + tod_str::$14 Inversing boolean not [2] gotoxy::$1 = gotoxy::y#4 <= $19 from [1] gotoxy::$0 = gotoxy::y#4 > $19 Inversing boolean not [6] gotoxy::$3 = gotoxy::x#4 < $28 from [5] gotoxy::$2 = gotoxy::x#4 >= $28 -Inversing boolean not [32] cputc::$2 = conio_cursor_x != $28 from [31] cputc::$1 = conio_cursor_x == $28 -Inversing boolean not [75] memset::$1 = memset::num#2 <= 0 from [74] memset::$0 = memset::num#2 > 0 -Inversing boolean not [94] cscroll::$1 = conio_cursor_y != $19 from [93] cscroll::$0 = conio_cursor_y == $19 -Inversing boolean not [127] conio_c64_init::$1 = conio_c64_init::line#0 < $19 from [126] conio_c64_init::$0 = conio_c64_init::line#0 >= $19 +Inversing boolean not [31] cputc::$2 = conio_cursor_x != $28 from [30] cputc::$1 = conio_cursor_x == $28 +Inversing boolean not [73] memset::$1 = memset::num#2 <= 0 from [72] memset::$0 = memset::num#2 > 0 +Inversing boolean not [91] cscroll::$1 = conio_cursor_y != $19 from [90] cscroll::$0 = conio_cursor_y == $19 +Inversing boolean not [124] conio_c64_init::$1 = conio_c64_init::line#0 < $19 from [123] conio_c64_init::$0 = conio_c64_init::line#0 >= $19 Successful SSA optimization Pass2UnaryNotSimplification Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 Alias gotoxy::x#6 = gotoxy::x#7 -Alias gotoxy::line_offset#0 = gotoxy::$4 Alias gotoxy::y#6 = gotoxy::y#7 Alias cputc::c#1 = cputc::c#2 Alias cputs::c#1 = cputs::$0 cputs::c#2 Alias cputs::s#0 = cputs::s#5 cputs::s#4 -Alias memcpy::src_end#0 = memcpy::$0 Alias memcpy::src#2 = memcpy::src#3 Alias memcpy::dst#2 = memcpy::dst#3 Alias memcpy::src_end#1 = memcpy::src_end#2 @@ -906,7 +899,6 @@ Alias memset::return#0 = memset::str#2 memset::return#4 memset::return#1 Alias memset::str#3 = memset::str#4 Alias memset::num#2 = memset::num#3 Alias memset::c#4 = memset::c#5 -Alias memset::end#0 = memset::$2 Alias memset::c#2 = memset::c#3 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -3339,13 +3331,12 @@ gotoxy: { // conio_cursor_y = y // [41] conio_cursor_y = gotoxy::y#5 -- vbuz1=vbuxx stx.z conio_cursor_y - // (unsigned int)y*CONIO_WIDTH + // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH // [42] gotoxy::$7 = (word)gotoxy::y#5 -- vwuz1=_word_vbuxx txa sta.z __7 lda #0 sta.z __7+1 - // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH // [43] gotoxy::$8 = gotoxy::$7 << 2 -- vwuz1=vwuz2_rol_2 lda.z __7 asl diff --git a/src/test/ref/toupper-1.asm b/src/test/ref/toupper-1.asm index e77142d0a..2f12683e0 100644 --- a/src/test/ref/toupper-1.asm +++ b/src/test/ref/toupper-1.asm @@ -121,12 +121,11 @@ gotoxy: { sta.z conio_cursor_x // conio_cursor_y = y stx.z conio_cursor_y - // (unsigned int)y*CONIO_WIDTH + // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH txa sta.z __7 lda #0 sta.z __7+1 - // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH lda.z __7 asl sta.z __8 diff --git a/src/test/ref/toupper-1.log b/src/test/ref/toupper-1.log index 204e5acc7..bfbbf6f4f 100644 --- a/src/test/ref/toupper-1.log +++ b/src/test/ref/toupper-1.log @@ -1,6 +1,9 @@ Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx Inlined call main::$1 = call wherey Inlined call call __init +Eliminating unused variable with no statement gotoxy::$4 +Eliminating unused variable with no statement memcpy::$0 +Eliminating unused variable with no statement memset::$2 CONTROL FLOW GRAPH SSA @@ -83,8 +86,7 @@ gotoxy::@2: scope:[gotoxy] from gotoxy::@1 gotoxy::@4 conio_cursor_x = gotoxy::x#5 conio_cursor_y = gotoxy::y#5 gotoxy::$7 = (word)gotoxy::y#5 - gotoxy::$4 = gotoxy::$7 * $28 - gotoxy::line_offset#0 = gotoxy::$4 + gotoxy::line_offset#0 = gotoxy::$7 * $28 gotoxy::$5 = CONIO_SCREEN_TEXT + gotoxy::line_offset#0 conio_line_text = gotoxy::$5 gotoxy::$6 = CONIO_SCREEN_COLORS + gotoxy::line_offset#0 @@ -150,8 +152,7 @@ memcpy: scope:[memcpy] from cscroll::@3 cscroll::@4 memcpy::src#0 = ((byte*)) memcpy::source#2 memcpy::dst#0 = ((byte*)) memcpy::destination#2 memcpy::$2 = (byte*)memcpy::source#2 - memcpy::$0 = memcpy::$2 + memcpy::num#2 - memcpy::src_end#0 = memcpy::$0 + memcpy::src_end#0 = memcpy::$2 + memcpy::num#2 to:memcpy::@1 memcpy::@1: scope:[memcpy] from memcpy memcpy::@2 memcpy::destination#4 = phi( memcpy/memcpy::destination#2, memcpy::@2/memcpy::destination#5 ) @@ -198,8 +199,7 @@ memset::@2: scope:[memset] from memset memset::num#3 = phi( memset/memset::num#2 ) memset::str#3 = phi( memset/memset::str#4 ) memset::$4 = (byte*)memset::str#3 - memset::$2 = memset::$4 + memset::num#3 - memset::end#0 = memset::$2 + memset::end#0 = memset::$4 + memset::num#3 memset::dst#0 = ((byte*)) memset::str#3 to:memset::@3 memset::@3: scope:[memset] from memset::@2 memset::@4 @@ -479,7 +479,6 @@ bool~ gotoxy::$0 bool~ gotoxy::$1 bool~ gotoxy::$2 bool~ gotoxy::$3 -number~ gotoxy::$4 byte*~ gotoxy::$5 byte*~ gotoxy::$6 word~ gotoxy::$7 @@ -526,7 +525,6 @@ byte main::wherey1_return#1 byte main::wherey1_return#2 byte main::wherey1_return#3 void* memcpy(void* memcpy::destination , void* memcpy::source , word memcpy::num) -byte*~ memcpy::$0 bool~ memcpy::$1 byte*~ memcpy::$2 void* memcpy::destination @@ -567,7 +565,6 @@ byte* memcpy::src_end#2 void* memset(void* memset::str , byte memset::c , word memset::num) bool~ memset::$0 bool~ memset::$1 -byte*~ memset::$2 bool~ memset::$3 byte*~ memset::$4 byte memset::c @@ -632,8 +629,7 @@ Adding number conversion cast (unumber) $28 in clrscr::line_cols#1 = clrscr::lin Adding number conversion cast (unumber) $19 in gotoxy::$0 = gotoxy::y#4 > $19 Adding number conversion cast (unumber) $28 in gotoxy::$2 = gotoxy::x#4 >= $28 Adding number conversion cast (unumber) 0 in gotoxy::y#0 = 0 -Adding number conversion cast (unumber) $28 in gotoxy::$4 = gotoxy::$7 * $28 -Adding number conversion cast (unumber) gotoxy::$4 in gotoxy::$4 = gotoxy::$7 * (unumber)$28 +Adding number conversion cast (unumber) $28 in gotoxy::line_offset#0 = gotoxy::$7 * $28 Adding number conversion cast (unumber) 0 in gotoxy::x#0 = 0 Adding number conversion cast (unumber) $28 in cputc::$1 = conio_cursor_x == $28 Adding number conversion cast (unumber) $28 in conio_line_text = conio_line_text + $28 @@ -755,14 +751,13 @@ Finalized unsigned number type (byte) $17 Finalized unsigned number type (byte) 2 Finalized unsigned number type (byte) 0 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to word in gotoxy::$4 = gotoxy::$7 * $28 Inferred type updated to byte in main::$2 = main::$1 + 2 Inversing boolean not [26] gotoxy::$1 = gotoxy::y#4 <= $19 from [25] gotoxy::$0 = gotoxy::y#4 > $19 Inversing boolean not [30] gotoxy::$3 = gotoxy::x#4 < $28 from [29] gotoxy::$2 = gotoxy::x#4 >= $28 -Inversing boolean not [56] cputc::$2 = conio_cursor_x != $28 from [55] cputc::$1 = conio_cursor_x == $28 -Inversing boolean not [86] memset::$1 = memset::num#2 <= 0 from [85] memset::$0 = memset::num#2 > 0 -Inversing boolean not [118] cscroll::$1 = conio_cursor_y != $19 from [117] cscroll::$0 = conio_cursor_y == $19 -Inversing boolean not [151] conio_c64_init::$1 = conio_c64_init::line#0 < $19 from [150] conio_c64_init::$0 = conio_c64_init::line#0 >= $19 +Inversing boolean not [55] cputc::$2 = conio_cursor_x != $28 from [54] cputc::$1 = conio_cursor_x == $28 +Inversing boolean not [84] memset::$1 = memset::num#2 <= 0 from [83] memset::$0 = memset::num#2 > 0 +Inversing boolean not [115] cscroll::$1 = conio_cursor_y != $19 from [114] cscroll::$0 = conio_cursor_y == $19 +Inversing boolean not [148] conio_c64_init::$1 = conio_c64_init::line#0 < $19 from [147] conio_c64_init::$0 = conio_c64_init::line#0 >= $19 Successful SSA optimization Pass2UnaryNotSimplification Alias candidate removed (volatile)conio_line_text = gotoxy::$5 Alias candidate removed (volatile)conio_line_color = gotoxy::$6 @@ -774,10 +769,8 @@ Alias clrscr::c#2 = clrscr::c#3 Alias clrscr::line_cols#2 = clrscr::line_cols#4 clrscr::line_cols#3 Alias clrscr::l#3 = clrscr::l#6 clrscr::l#4 Alias gotoxy::x#6 = gotoxy::x#7 -Alias gotoxy::line_offset#0 = gotoxy::$4 Alias gotoxy::y#6 = gotoxy::y#7 Alias cputc::c#2 = cputc::c#3 -Alias memcpy::src_end#0 = memcpy::$0 Alias memcpy::src#2 = memcpy::src#3 Alias memcpy::dst#2 = memcpy::dst#3 Alias memcpy::src_end#1 = memcpy::src_end#2 @@ -786,7 +779,6 @@ Alias memset::return#0 = memset::str#2 memset::return#4 memset::return#1 Alias memset::str#3 = memset::str#4 Alias memset::num#2 = memset::num#3 Alias memset::c#4 = memset::c#5 -Alias memset::end#0 = memset::$2 Alias memset::c#2 = memset::c#3 Alias memset::dst#2 = memset::dst#3 Alias memset::end#1 = memset::end#2 @@ -2937,13 +2929,12 @@ gotoxy: { // conio_cursor_y = y // [40] conio_cursor_y = gotoxy::y#5 -- vbuz1=vbuxx stx.z conio_cursor_y - // (unsigned int)y*CONIO_WIDTH + // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH // [41] gotoxy::$7 = (word)gotoxy::y#5 -- vwuz1=_word_vbuxx txa sta.z __7 lda #0 sta.z __7+1 - // unsigned int line_offset = (unsigned int)y*CONIO_WIDTH // [42] gotoxy::$8 = gotoxy::$7 << 2 -- vwuz1=vwuz2_rol_2 lda.z __7 asl diff --git a/src/test/ref/true-inline-words.asm b/src/test/ref/true-inline-words.asm index 9fafe7f3f..4f5c61261 100644 --- a/src/test/ref/true-inline-words.asm +++ b/src/test/ref/true-inline-words.asm @@ -10,6 +10,7 @@ main: { // constant byte array .const b = 4 + // constant byte .const w = b*$100 .const w2 = 1*$100+1+w // Test the result diff --git a/src/test/ref/true-inline-words.log b/src/test/ref/true-inline-words.log index 76f260d15..598ac6bc2 100644 --- a/src/test/ref/true-inline-words.log +++ b/src/test/ref/true-inline-words.log @@ -1,13 +1,13 @@ +Eliminating unused variable with no statement main::$0 +Eliminating unused variable with no statement main::$2 CONTROL FLOW GRAPH SSA void main() main: scope:[main] from __start - main::$0 = main::b w= 0 - main::w#0 = main::$0 + main::w#0 = main::b w= 0 main::$1 = 1w=1 + main::w#0 - main::$2 = main::$1 + 0w=0 - main::w2#0 = main::$2 + main::w2#0 = main::$1 + 0w=0 main::sc#0 = (byte*)main::w2#0 *main::sc#0 = main::bs[1] main::$3 = *main::pos == 'm' @@ -36,9 +36,7 @@ __start::@return: scope:[__start] from __start::@1 SYMBOL TABLE SSA void __start() void main() -word~ main::$0 word~ main::$1 -word~ main::$2 bool~ main::$3 constant byte* main::BG_COLOR = (byte*)$d021 constant byte main::b = 4 @@ -51,7 +49,7 @@ word main::w#0 word main::w2 word main::w2#0 -Adding number conversion cast (unumber) 0 in main::$0 = main::b w= 0 +Adding number conversion cast (unumber) 0 in main::w#0 = main::b w= 0 Adding number conversion cast (unumber) 1 in *main::sc#0 = main::bs[1] Adding number conversion cast (unumber) 5 in *main::BG_COLOR = 5 Adding number conversion cast (unumber) 2 in *main::BG_COLOR = 2 @@ -71,9 +69,6 @@ Finalized unsigned number type (byte) 1 Finalized unsigned number type (byte) 5 Finalized unsigned number type (byte) 2 Successful SSA optimization PassNFinalizeNumberTypeConversions -Alias main::w#0 = main::$0 -Alias main::w2#0 = main::$2 -Successful SSA optimization Pass2AliasElimination Simple Condition main::$3 [6] if(*main::pos=='m') goto main::@1 Successful SSA optimization Pass2ConditionalJumpSimplification Constant right-side identified [0] main::w#0 = main::b w= 0 @@ -174,6 +169,7 @@ ASSEMBLER BEFORE OPTIMIZATION main: { // constant byte array .const b = 4 + // constant byte .const w = b*$100 .const w2 = 1*$100+1+w // Test the result @@ -256,6 +252,7 @@ Score: 40 main: { // constant byte array .const b = 4 + // constant byte .const w = b*$100 .const w2 = 1*$100+1+w // Test the result diff --git a/src/test/ref/unused-vars.log b/src/test/ref/unused-vars.log index 5df40539b..f369d9104 100644 --- a/src/test/ref/unused-vars.log +++ b/src/test/ref/unused-vars.log @@ -1,4 +1,6 @@ Inlined call call __init +Eliminating unused variable with no statement main::$1 +Eliminating unused variable with no statement main::$3 CONTROL FLOW GRAPH SSA diff --git a/src/test/ref/var-register-zp.asm b/src/test/ref/var-register-zp.asm index 6b36d5998..524f9704e 100644 --- a/src/test/ref/var-register-zp.asm +++ b/src/test/ref/var-register-zp.asm @@ -42,12 +42,11 @@ main: { bne !+ inc.z j+1 !: - // (int)i*2 + // int k = (int)i*2 lda.z i sta.z __4 lda #0 sta.z __4+1 - // int k = (int)i*2 asl.z k rol.z k+1 // SCREEN[i++] = k diff --git a/src/test/ref/var-register-zp.log b/src/test/ref/var-register-zp.log index 9be8b0900..d9f67186c 100644 --- a/src/test/ref/var-register-zp.log +++ b/src/test/ref/var-register-zp.log @@ -1,4 +1,5 @@ Inlined call call __init +Eliminating unused variable with no statement main::$1 CONTROL FLOW GRAPH SSA @@ -17,8 +18,7 @@ main::@2: scope:[main] from main::@1 main::i = ++ main::i main::j = ++ main::j main::$4 = (signed word)main::i - main::$1 = main::$4 * 2 - main::k#0 = main::$1 + main::k#0 = main::$4 * 2 main::$3 = main::i * SIZEOF_SIGNED_WORD SCREEN[main::$3] = main::k#0 main::i = ++ main::i @@ -47,7 +47,6 @@ constant byte SIZEOF_SIGNED_WORD = 2 void __start() void main() bool~ main::$0 -number~ main::$1 byte~ main::$2 byte~ main::$3 signed word~ main::$4 @@ -57,8 +56,7 @@ signed word main::k signed word main::k#0 Adding number conversion cast (unumber) 4 in main::$0 = main::i < 4 -Adding number conversion cast (snumber) 2 in main::$1 = main::$4 * 2 -Adding number conversion cast (snumber) main::$1 in main::$1 = main::$4 * (snumber)2 +Adding number conversion cast (snumber) 2 in main::k#0 = main::$4 * 2 Successful SSA optimization PassNAddNumberTypeConversions Simplifying constant pointer cast (signed word*) 1024 Simplifying constant integer cast 4 @@ -67,9 +65,6 @@ Successful SSA optimization PassNCastSimplification Finalized unsigned number type (byte) 4 Finalized signed number type (signed byte) 2 Successful SSA optimization PassNFinalizeNumberTypeConversions -Inferred type updated to signed word in main::$1 = main::$4 * 2 -Alias main::k#0 = main::$1 -Successful SSA optimization Pass2AliasElimination Simple Condition main::$0 [3] if(main::i<4) goto main::@2 Successful SSA optimization Pass2ConditionalJumpSimplification Removing unused procedure __start @@ -343,13 +338,12 @@ main: { bne !+ inc.z j+1 !: - // (int)i*2 + // int k = (int)i*2 // [8] main::$4 = (signed word)main::i -- vwsz1=_sword_vbuz2 lda.z i sta.z __4 lda #0 sta.z __4+1 - // int k = (int)i*2 // [9] main::k#0 = main::$4 << 1 -- vwsz1=vwsz1_rol_1 asl.z k rol.z k+1 diff --git a/src/test/ref/var-register.log b/src/test/ref/var-register.log index a7a61c2e0..682acfc14 100644 --- a/src/test/ref/var-register.log +++ b/src/test/ref/var-register.log @@ -1,3 +1,4 @@ +Eliminating unused variable with no statement main::$0 CONTROL FLOW GRAPH SSA @@ -18,8 +19,7 @@ main::@3: scope:[main] from main::@2 main::@6 main::y#2 = phi( main::@2/main::y#4, main::@6/main::y#5 ) main::x#2 = phi( main::@2/main::x#4, main::@6/main::x#5 ) main::a#2 = phi( main::@2/main::a#0, main::@6/main::a#1 ) - main::$0 = main::a#2 + main::x#2 - main::val1#0 = main::$0 + main::val1#0 = main::a#2 + main::x#2 print::idx#0 = main::y#2 print::val#0 = main::val1#0 call print @@ -72,7 +72,6 @@ __start::@return: scope:[__start] from __start::@1 SYMBOL TABLE SSA void __start() void main() -byte~ main::$0 bool~ main::$2 bool~ main::$3 bool~ main::$4 @@ -110,7 +109,6 @@ byte print::val#1 Simplifying constant pointer cast (byte*) 1024 Successful SSA optimization PassNCastSimplification -Alias main::val1#0 = main::$0 Alias main::a#2 = main::a#3 Alias main::x#2 = main::x#5 main::x#6 main::x#3 Alias main::y#2 = main::y#5 main::y#3 diff --git a/src/test/ref/varcall-4.asm b/src/test/ref/varcall-4.asm index e1183819f..b7634b817 100644 --- a/src/test/ref/varcall-4.asm +++ b/src/test/ref/varcall-4.asm @@ -32,7 +32,7 @@ fg_sum: { rts } main: { - // fg_sum(a, b) + // char sum1 = fg_sum(a, b) lda a sta.z fg_sum.a_border lda a+OFFSET_STRUCT_COLS_BG @@ -46,7 +46,6 @@ main: { lda b+OFFSET_STRUCT_COLS_FG sta.z fg_sum.b_fg jsr fg_sum - // char sum1 = fg_sum(a, b) lda.z fg_sum.return // *COLS = sum1 sta COLS @@ -57,7 +56,7 @@ main: { sta d-1,y dey bne !- - // fg_sum(c, d) + // char sum2 = fg_sum(c, d) lda c sta.z fg_sum.a_border lda c+OFFSET_STRUCT_COLS_BG @@ -71,7 +70,6 @@ main: { lda d+OFFSET_STRUCT_COLS_FG sta.z fg_sum.b_fg jsr fg_sum - // char sum2 = fg_sum(c, d) lda.z fg_sum.return // *COLS = sum2 sta COLS diff --git a/src/test/ref/varcall-4.log b/src/test/ref/varcall-4.log index 42cb18e76..0c4f86778 100644 --- a/src/test/ref/varcall-4.log +++ b/src/test/ref/varcall-4.log @@ -1,12 +1,14 @@ Converting parameter in __varcall procedure to load/store fg_sum::a Converting parameter in __varcall procedure to load/store fg_sum::b Converting return in __varcall procedure to load/store fg_sum::return +Eliminating unused variable with no statement main::$0 +Eliminating unused variable with no statement main::$1 Eliminating unused variable with no statement fg_sum::a Eliminating unused variable with no statement fg_sum::b -Calling convention __varcall adding prepare/execute/finalize for main::$0 = call fg_sum *((byte*)&a+OFFSET_STRUCT_COLS_BORDER) *((byte*)&a+OFFSET_STRUCT_COLS_BG) *((byte*)&a+OFFSET_STRUCT_COLS_FG) *((byte*)&b+OFFSET_STRUCT_COLS_BORDER) *((byte*)&b+OFFSET_STRUCT_COLS_BG) *((byte*)&b+OFFSET_STRUCT_COLS_FG) -Calling convention __varcall adding prepare/execute/finalize for main::$1 = call fg_sum *((byte*)&c+OFFSET_STRUCT_COLS_BORDER) *((byte*)&c+OFFSET_STRUCT_COLS_BG) *((byte*)&c+OFFSET_STRUCT_COLS_FG) *((byte*)&d+OFFSET_STRUCT_COLS_BORDER) *((byte*)&d+OFFSET_STRUCT_COLS_BG) *((byte*)&d+OFFSET_STRUCT_COLS_FG) -Calling convention VAR_CALL adding return value assignment main::$0 = fg_sum::return -Calling convention VAR_CALL adding return value assignment main::$1 = fg_sum::return +Calling convention __varcall adding prepare/execute/finalize for main::sum1 = call fg_sum *((byte*)&a+OFFSET_STRUCT_COLS_BORDER) *((byte*)&a+OFFSET_STRUCT_COLS_BG) *((byte*)&a+OFFSET_STRUCT_COLS_FG) *((byte*)&b+OFFSET_STRUCT_COLS_BORDER) *((byte*)&b+OFFSET_STRUCT_COLS_BG) *((byte*)&b+OFFSET_STRUCT_COLS_FG) +Calling convention __varcall adding prepare/execute/finalize for main::sum2 = call fg_sum *((byte*)&c+OFFSET_STRUCT_COLS_BORDER) *((byte*)&c+OFFSET_STRUCT_COLS_BG) *((byte*)&c+OFFSET_STRUCT_COLS_FG) *((byte*)&d+OFFSET_STRUCT_COLS_BORDER) *((byte*)&d+OFFSET_STRUCT_COLS_BG) *((byte*)&d+OFFSET_STRUCT_COLS_FG) +Calling convention VAR_CALL adding return value assignment main::sum1 = fg_sum::return +Calling convention VAR_CALL adding return value assignment main::sum2 = fg_sum::return Removing C-classic struct-unwound assignment d = struct-unwound {*(&d)} CONTROL FLOW GRAPH SSA @@ -20,8 +22,7 @@ main: scope:[main] from __start fg_sum::b_bg = *((byte*)&b+OFFSET_STRUCT_COLS_BG) fg_sum::b_fg = *((byte*)&b+OFFSET_STRUCT_COLS_FG) callexecute fg_sum - main::$0 = fg_sum::return - main::sum1#0 = main::$0 + main::sum1#0 = fg_sum::return *COLS = main::sum1#0 *(&d) = memcpy(*(&b), struct Cols, SIZEOF_STRUCT_COLS) fg_sum::a_border = *((byte*)&c+OFFSET_STRUCT_COLS_BORDER) @@ -31,8 +32,7 @@ main: scope:[main] from __start fg_sum::b_bg = *((byte*)&d+OFFSET_STRUCT_COLS_BG) fg_sum::b_fg = *((byte*)&d+OFFSET_STRUCT_COLS_FG) callexecute fg_sum - main::$1 = fg_sum::return - main::sum2#0 = main::$1 + main::sum2#0 = fg_sum::return *COLS = main::sum2#0 to:main::@return main::@return: scope:[main] from main @@ -79,8 +79,6 @@ byte fg_sum::b_border loadstore byte fg_sum::b_fg loadstore byte fg_sum::return loadstore void main() -byte~ main::$0 -byte~ main::$1 byte main::sum1 byte main::sum1#0 byte main::sum2 @@ -89,10 +87,6 @@ byte main::sum2#0 Simplifying constant pointer cast (byte*) 53280 Successful SSA optimization PassNCastSimplification Alias candidate removed (volatile)fg_sum::return = fg_sum::$0 -Alias main::sum1#0 = main::$0 -Alias main::sum2#0 = main::$1 -Successful SSA optimization Pass2AliasElimination -Alias candidate removed (volatile)fg_sum::return = fg_sum::$0 Simplifying expression containing zero (byte*)&a in [0] fg_sum::a_border = *((byte*)&a+OFFSET_STRUCT_COLS_BORDER) Simplifying expression containing zero (byte*)&b in [3] fg_sum::b_border = *((byte*)&b+OFFSET_STRUCT_COLS_BORDER) Simplifying expression containing zero (byte*)&c in [10] fg_sum::a_border = *((byte*)&c+OFFSET_STRUCT_COLS_BORDER) @@ -483,7 +477,7 @@ fg_sum: { } // main main: { - // fg_sum(a, b) + // char sum1 = fg_sum(a, b) // [3] fg_sum::a_border = *((byte*)&a) -- vbuz1=_deref_pbuc1 lda a sta.z fg_sum.a_border @@ -504,7 +498,6 @@ main: { sta.z fg_sum.b_fg // [9] callexecute fg_sum -- jsr jsr fg_sum - // char sum1 = fg_sum(a, b) // [10] main::sum1#0 = fg_sum::return -- vbuaa=vbuz1 lda.z fg_sum.return // *COLS = sum1 @@ -518,7 +511,7 @@ main: { sta d-1,y dey bne !- - // fg_sum(c, d) + // char sum2 = fg_sum(c, d) // [13] fg_sum::a_border = *((byte*)&c) -- vbuz1=_deref_pbuc1 lda c sta.z fg_sum.a_border @@ -539,7 +532,6 @@ main: { sta.z fg_sum.b_fg // [19] callexecute fg_sum -- jsr jsr fg_sum - // char sum2 = fg_sum(c, d) // [20] main::sum2#0 = fg_sum::return -- vbuaa=vbuz1 lda.z fg_sum.return // *COLS = sum2 diff --git a/src/test/ref/voronoi.asm b/src/test/ref/voronoi.asm index 763bdb1e6..cb73207cc 100644 --- a/src/test/ref/voronoi.asm +++ b/src/test/ref/voronoi.asm @@ -67,11 +67,10 @@ render: { lda #0 sta.z x __b2: - // findcol(x, y) - jsr findcol - // findcol(x, y) - txa // byte col = findcol(x, y) + jsr findcol + // byte col = findcol(x, y) + txa // colline[x] = col ldy.z x sta (colline),y diff --git a/src/test/ref/voronoi.log b/src/test/ref/voronoi.log index 37ee1313e..3184fe3fe 100644 --- a/src/test/ref/voronoi.log +++ b/src/test/ref/voronoi.log @@ -1,4 +1,5 @@ Inlined call call __init +Eliminating unused variable with no statement render::$0 CONTROL FLOW GRAPH SSA @@ -128,8 +129,7 @@ render::@4: scope:[render] from render::@2 render::x#3 = phi( render::@2/render::x#2 ) render::colline#2 = phi( render::@2/render::colline#4 ) findcol::return#4 = phi( render::@2/findcol::return#0 ) - render::$0 = findcol::return#4 - render::col#0 = render::$0 + render::col#0 = findcol::return#4 render::colline#2[render::x#3] = render::col#0 render::x#1 = render::x#3 + rangenext(0,$27) render::$1 = render::x#1 != rangelast(0,$27) @@ -474,7 +474,6 @@ byte* initscreen::screen#3 void main() constant byte numpoints = 6 void render() -byte~ render::$0 bool~ render::$1 byte*~ render::$2 bool~ render::$3 @@ -670,16 +669,15 @@ Inversing boolean not [19] animate::$8 = XPOS[1] != $ff from [18] animate::$7 = Inversing boolean not [25] animate::$11 = YPOS[2] != $19 from [24] animate::$10 = YPOS[2] == $19 Inversing boolean not [31] animate::$14 = YPOS[3] != $ff from [30] animate::$13 = YPOS[3] == $ff Inversing boolean not [38] animate::$17 = XPOS[3] < $28 from [37] animate::$16 = XPOS[3] >= $28 -Inversing boolean not [86] findcol::$2 = findcol::x#1 != findcol::xp#0 from [85] findcol::$1 = findcol::x#1 == findcol::xp#0 -Inversing boolean not [96] findcol::$4 = findcol::y#1 != findcol::yp#1 from [95] findcol::$3 = findcol::y#1 == findcol::yp#1 -Inversing boolean not [121] findcol::$14 = findcol::diff#7 >= findcol::mindiff#2 from [120] findcol::$13 = findcol::diff#7 < findcol::mindiff#2 +Inversing boolean not [85] findcol::$2 = findcol::x#1 != findcol::xp#0 from [84] findcol::$1 = findcol::x#1 == findcol::xp#0 +Inversing boolean not [95] findcol::$4 = findcol::y#1 != findcol::yp#1 from [94] findcol::$3 = findcol::y#1 == findcol::yp#1 +Inversing boolean not [120] findcol::$14 = findcol::diff#7 >= findcol::mindiff#2 from [119] findcol::$13 = findcol::diff#7 < findcol::mindiff#2 Successful SSA optimization Pass2UnaryNotSimplification Alias initscreen::screen#2 = initscreen::screen#3 Alias findcol::return#0 = findcol::return#4 Alias render::colline#2 = render::colline#4 render::colline#3 Alias render::x#2 = render::x#3 Alias render::y#2 = render::y#5 render::y#3 -Alias render::col#0 = render::$0 Alias render::colline#1 = render::$2 Alias findcol::i#13 = findcol::i#3 findcol::i#2 Alias findcol::x#1 = findcol::x#5 findcol::x#6 @@ -2063,17 +2061,16 @@ render: { // [14] phi render::x#2 = render::x#1 [phi:render::@4->render::@2#0] -- register_copy // render::@2 __b2: - // findcol(x, y) + // byte col = findcol(x, y) // [15] findcol::x#0 = render::x#2 // [16] findcol::y#0 = render::y#4 // [17] call findcol // [53] phi from render::@2 to findcol [phi:render::@2->findcol] jsr findcol - // findcol(x, y) + // byte col = findcol(x, y) // [18] findcol::return#0 = findcol::return#3 -- vbuaa=vbuxx txa // render::@4 - // byte col = findcol(x, y) // [19] render::col#0 = findcol::return#0 // colline[x] = col // [20] render::colline#5[render::x#2] = render::col#0 -- pbuz1_derefidx_vbuz2=vbuaa diff --git a/src/test/ref/word-pointer-math-1.log b/src/test/ref/word-pointer-math-1.log index 0308328b2..3e0763d42 100644 --- a/src/test/ref/word-pointer-math-1.log +++ b/src/test/ref/word-pointer-math-1.log @@ -1,11 +1,11 @@ +Eliminating unused variable with no statement main::$0 CONTROL FLOW GRAPH SSA void main() main: scope:[main] from __start main::$1 = main::w2 - main::w1 - main::$0 = main::$1 / SIZEOF_WORD - main::wd#0 = main::$0 + main::wd#0 = main::$1 / SIZEOF_WORD *main::SCREEN = main::wd#0 to:main::@return main::@return: scope:[main] from main @@ -26,7 +26,6 @@ SYMBOL TABLE SSA constant byte SIZEOF_WORD = 2 void __start() void main() -word~ main::$0 word~ main::$1 constant word* const main::SCREEN = (word*)$400 constant word* main::w1 = (word*)$1000 @@ -38,8 +37,6 @@ Simplifying constant pointer cast (word*) 1024 Simplifying constant pointer cast (word*) 4096 Simplifying constant pointer cast (word*) 4416 Successful SSA optimization PassNCastSimplification -Alias main::wd#0 = main::$0 -Successful SSA optimization Pass2AliasElimination Constant right-side identified [0] main::$1 = main::w2 - main::w1 Successful SSA optimization Pass2ConstantRValueConsolidation Constant main::$1 = main::w2-main::w1 diff --git a/src/test/ref/zp-reserve-coalesce-problem.log b/src/test/ref/zp-reserve-coalesce-problem.log index 4e5d3e522..59d25f730 100644 --- a/src/test/ref/zp-reserve-coalesce-problem.log +++ b/src/test/ref/zp-reserve-coalesce-problem.log @@ -1,3 +1,4 @@ +Eliminating unused variable with no statement benchmarkLandscape::$2 CONTROL FLOW GRAPH SSA @@ -70,8 +71,7 @@ benchmarkLandscape::@4: scope:[benchmarkLandscape] from benchmarkLandscape::@3 benchmarkLandscape::@5: scope:[benchmarkLandscape] from benchmarkLandscape::@4 benchmarkLandscape::z#10 = phi( benchmarkLandscape::@4/benchmarkLandscape::z#3 ) benchmarkLandscape::x#3 = phi( benchmarkLandscape::@4/benchmarkLandscape::x#2 ) - benchmarkLandscape::$2 = lms + benchmarkLandscape::x#3 - benchmarkLandscape::screenAddress#0 = benchmarkLandscape::$2 + benchmarkLandscape::screenAddress#0 = lms + benchmarkLandscape::x#3 benchmarkLandscape::start#0 = 0 benchmarkLandscape::c#0 = $d to:benchmarkLandscape::@7 @@ -163,7 +163,6 @@ signed byte benchmarkCountdownFor::b loadstore !zp[-1]:75 void benchmarkLandscape() bool~ benchmarkLandscape::$0 bool~ benchmarkLandscape::$1 -byte*~ benchmarkLandscape::$2 bool~ benchmarkLandscape::$3 bool~ benchmarkLandscape::$4 number~ benchmarkLandscape::$5 @@ -280,7 +279,6 @@ Inferred type updated to byte in benchmarkLandscape::$7 = benchmarkLandscape::$5 Alias benchmarkLandscape::z#4 = benchmarkLandscape::z#6 Alias benchmarkLandscape::x#2 = benchmarkLandscape::x#3 Alias benchmarkLandscape::z#10 = benchmarkLandscape::z#3 benchmarkLandscape::z#2 -Alias benchmarkLandscape::screenAddress#0 = benchmarkLandscape::$2 Alias benchmarkLandscape::c#2 = benchmarkLandscape::c#3 Alias benchmarkLandscape::start#5 = benchmarkLandscape::start#6 Alias benchmarkLandscape::screenAddress#4 = benchmarkLandscape::screenAddress#5 diff --git a/src/test/ref/zpptr.log b/src/test/ref/zpptr.log index 97d768bff..784ec8fce 100644 --- a/src/test/ref/zpptr.log +++ b/src/test/ref/zpptr.log @@ -1,3 +1,4 @@ +Eliminating unused variable with no statement main::$0 CONTROL FLOW GRAPH SSA @@ -18,8 +19,7 @@ main::@3: scope:[main] from main::@2 main::@3 main::k#2 = phi( main::@2/main::k#0, main::@3/main::k#1 ) main::j#2 = phi( main::@2/main::j#4, main::@3/main::j#2 ) main::i#2 = phi( main::@2/main::i#4, main::@3/main::i#2 ) - main::$0 = main::zpptr + main::i#2 - main::zpptr2#0 = main::$0 + main::zpptr2#0 = main::zpptr + main::i#2 main::w#0 = (word)main::j#2 main::$1 = main::zpptr2#0 + main::w#0 main::zpptr2#1 = main::$1 @@ -58,7 +58,6 @@ __start::@return: scope:[__start] from __start::@1 SYMBOL TABLE SSA void __start() void main() -byte*~ main::$0 byte*~ main::$1 bool~ main::$2 bool~ main::$3 @@ -90,7 +89,6 @@ byte* main::zpptr2#1 Simplifying constant pointer cast (byte*) 4096 Successful SSA optimization PassNCastSimplification -Alias main::zpptr2#0 = main::$0 Alias main::zpptr2#1 = main::$1 Alias main::i#2 = main::i#3 Alias main::j#2 = main::j#5 main::j#3