diff --git a/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentInstanceSpec.java b/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentInstanceSpec.java index 96f6edd5b..a7541d9a6 100644 --- a/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentInstanceSpec.java +++ b/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentInstanceSpec.java @@ -303,6 +303,8 @@ public class AsmFragmentInstanceSpec { return "vds"; } else if(SymbolType.STRING.equals(type)) { return "pbu"; + } else if(SymbolType.BOOLEAN.equals(type)) { + return "vbo"; } else if(type instanceof SymbolTypePointer) { SymbolType elementType = ((SymbolTypePointer) type).getElementType(); if(SymbolType.isByte(elementType)) { @@ -330,7 +332,8 @@ public class AsmFragmentInstanceSpec { */ private String getRegisterName(Registers.Register register) { if( - Registers.RegisterType.ZP_BYTE.equals(register.getType()) || + Registers.RegisterType.ZP_BOOL.equals(register.getType()) || + Registers.RegisterType.ZP_BYTE.equals(register.getType()) || Registers.RegisterType.ZP_WORD.equals(register.getType()) || Registers.RegisterType.ZP_DWORD.equals(register.getType()) ) { diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vboaa_or_vboz1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vboaa_or_vboz1.asm new file mode 100644 index 000000000..9f3dc4a4c --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vboaa_or_vboz1.asm @@ -0,0 +1 @@ +ora {z1} \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vboz1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vboz1.asm new file mode 100644 index 000000000..89049a799 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vboz1.asm @@ -0,0 +1 @@ +lda {z1} \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuaa_eq_vbuc1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuaa_eq_vbuc1.asm new file mode 100644 index 000000000..8860e24bd --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuaa_eq_vbuc1.asm @@ -0,0 +1,5 @@ +cmp #{c1} +beq !+ +lda #1 +!: +eor #1 \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/unused/vboaa=vbuaa_lt_vbuc1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuaa_lt_vbuc1.asm similarity index 100% rename from src/main/java/dk/camelot64/kickc/fragment/asm/unused/vboaa=vbuaa_lt_vbuc1.asm rename to src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuaa_lt_vbuc1.asm diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuaa_neq_vbuc1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuaa_neq_vbuc1.asm new file mode 100644 index 000000000..9f587078f --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuaa_neq_vbuc1.asm @@ -0,0 +1,4 @@ +cmp #{c1} +beq !+ +lda #1 +!: \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuxx_eq_vbuc1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuxx_eq_vbuc1.asm new file mode 100644 index 000000000..6d9476b55 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuxx_eq_vbuc1.asm @@ -0,0 +1,5 @@ +cpx #{c1} +beq !+ +lda #1 +!: +eor #1 \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/unused/vboaa=vbuxx_lt_vbuc1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuxx_lt_vbuc1.asm similarity index 100% rename from src/main/java/dk/camelot64/kickc/fragment/asm/unused/vboaa=vbuxx_lt_vbuc1.asm rename to src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuxx_lt_vbuc1.asm diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuxx_neq_vbuc1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuxx_neq_vbuc1.asm new file mode 100644 index 000000000..117f16d1e --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuxx_neq_vbuc1.asm @@ -0,0 +1,4 @@ +cpx #{c1} +beq !+ +lda #1 +!: \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuyy_eq_vbuc1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuyy_eq_vbuc1.asm new file mode 100644 index 000000000..5b3311c04 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuyy_eq_vbuc1.asm @@ -0,0 +1,5 @@ +cpy #{c1} +beq !+ +lda #1 +!: +eor #1 \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/unused/vboaa=vbuyy_lt_vbuc1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuyy_lt_vbuc1.asm similarity index 100% rename from src/main/java/dk/camelot64/kickc/fragment/asm/unused/vboaa=vbuyy_lt_vbuc1.asm rename to src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuyy_lt_vbuc1.asm diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuyy_neq_vbuc1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuyy_neq_vbuc1.asm new file mode 100644 index 000000000..c61308114 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa=vbuyy_neq_vbuc1.asm @@ -0,0 +1,4 @@ +cpy #{c1} +beq !+ +lda #1 +!: \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa_then_la1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa_then_la1.asm new file mode 100644 index 000000000..76f89204f --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/vboaa_then_la1.asm @@ -0,0 +1,2 @@ +cmp #0 +bne {la1} \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/vboxx=vboz1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/vboxx=vboz1.asm new file mode 100644 index 000000000..65e41102e --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/vboxx=vboz1.asm @@ -0,0 +1 @@ +ldx {z1} \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/vboxx_then_la1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/vboxx_then_la1.asm new file mode 100644 index 000000000..0f99f0508 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/vboxx_then_la1.asm @@ -0,0 +1,2 @@ +cpx #0 +bne {la1} \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/vboyy=vboz1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/vboyy=vboz1.asm new file mode 100644 index 000000000..7081bc9bc --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/vboyy=vboz1.asm @@ -0,0 +1 @@ +ldy {z1} \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/vboyy_then_la1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/vboyy_then_la1.asm new file mode 100644 index 000000000..6d094f911 --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/vboyy_then_la1.asm @@ -0,0 +1,2 @@ +cpy #0 +bne {la1} \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/vboz1=vboaa.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/vboz1=vboaa.asm new file mode 100644 index 000000000..87728c08d --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/vboz1=vboaa.asm @@ -0,0 +1 @@ +sta {z1} \ No newline at end of file diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass4RegisterUpliftPotentialInitialize.java b/src/main/java/dk/camelot64/kickc/passes/Pass4RegisterUpliftPotentialInitialize.java index f56a500e3..77c4293b3 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass4RegisterUpliftPotentialInitialize.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass4RegisterUpliftPotentialInitialize.java @@ -53,6 +53,9 @@ public class Pass4RegisterUpliftPotentialInitialize extends Pass2Base { potentials.add(Registers.getRegisterX()); potentials.add(Registers.getRegisterY()); } + if(registerType.equals(Registers.RegisterType.ZP_BOOL) && !varRefExtracted(equivalenceClass)) { + potentials.add(Registers.getRegisterA()); + } registerPotentials.setPotentialRegisters(equivalenceClass, potentials); } } diff --git a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java index ec3d17ae7..811651398 100644 --- a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java +++ b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java @@ -99,17 +99,26 @@ public class TestPrograms { compileAndCompare("const-condition"); } - @Test public void testBoolConst() throws IOException, URISyntaxException { compileAndCompare("bool-const"); } + @Test + public void testBoolIfs() throws IOException, URISyntaxException { + compileAndCompare("bool-ifs"); + } + @Test public void testBoolVars() throws IOException, URISyntaxException { compileAndCompare("bool-vars"); } + @Test + public void testBoolFunction() throws IOException, URISyntaxException { + compileAndCompare("bool-function"); + } + @Test public void testC64DtvBlitterMin() throws IOException, URISyntaxException { compileAndCompare("c64dtv-blittermin"); diff --git a/src/test/java/dk/camelot64/kickc/test/kc/bool-function.kc b/src/test/java/dk/camelot64/kickc/test/kc/bool-function.kc new file mode 100644 index 000000000..a86b6b872 --- /dev/null +++ b/src/test/java/dk/camelot64/kickc/test/kc/bool-function.kc @@ -0,0 +1,18 @@ +// Test a function taking boolean parameter and returning boolean result + +void main() { + byte* screen = $400; + for(byte i: 0..100) { + if( isSet(i, (i&1)==0)) { + screen[i] = '*'; + } else { + screen[i] = ' '; + } + } +} + +// Determine whether to set a char to '*. +// Returns true if i&8!=0 or b=true +boolean isSet(byte i, boolean b) { + return b || ((i&8)!=0); +} \ No newline at end of file diff --git a/src/test/java/dk/camelot64/kickc/test/kc/bool-ifs.kc b/src/test/java/dk/camelot64/kickc/test/kc/bool-ifs.kc new file mode 100644 index 000000000..06fb48134 --- /dev/null +++ b/src/test/java/dk/camelot64/kickc/test/kc/bool-ifs.kc @@ -0,0 +1,52 @@ +// A test of boolean conditions using && || and ! + +void main() { + bool_and(); + bool_or(); + bool_not(); + bool_complex(); +} + +void bool_and() { + const byte* screen = $400; + for( byte i : 0..20) { + if( (i<10) && ((i&1)==0) ) { + screen[i] = '*'; + } else { + screen[i] = ' '; + } + } +} + +void bool_or() { + const byte* screen = $428; + for( byte i : 0..20) { + if( (i<10) || ((i&1)==0) ) { + screen[i] = '*'; + } else { + screen[i] = ' '; + } + } +} + +void bool_not() { + const byte* screen = $450; + for( byte i : 0..20) { + if( !((i<10) || (i&1)==0)) { + screen[i] = '*'; + } else { + screen[i] = ' '; + } + } +} + +void bool_complex() { + const byte* screen = $478; + for( byte i : 0..20) { + if( ((i<10) && (i&1)==0) || !((i<10) || (i&1)==0) ) { + screen[i] = '*'; + } else { + screen[i] = ' '; + } + } +} diff --git a/src/test/java/dk/camelot64/kickc/test/kc/bool-vars.kc b/src/test/java/dk/camelot64/kickc/test/kc/bool-vars.kc index 0f2840995..cf2fa4ad3 100644 --- a/src/test/java/dk/camelot64/kickc/test/kc/bool-vars.kc +++ b/src/test/java/dk/camelot64/kickc/test/kc/bool-vars.kc @@ -10,7 +10,10 @@ void main() { void bool_and() { const byte* screen = $400; for( byte i : 0..20) { - if( (i<10) && ((i&1)==0) ) { + boolean o1 = (i<10); + boolean o2 = ((i&1)==0); + boolean o3 = o1 && o2; + if(o3) { screen[i] = '*'; } else { screen[i] = ' '; @@ -21,7 +24,10 @@ void bool_and() { void bool_or() { const byte* screen = $428; for( byte i : 0..20) { - if( (i<10) || ((i&1)==0) ) { + boolean o1 = (i<10); + boolean o2 = ((i&1)==0); + boolean o3 = o1 || o2; + if(o3) { screen[i] = '*'; } else { screen[i] = ' '; @@ -32,8 +38,10 @@ void bool_or() { void bool_not() { const byte* screen = $450; for( byte i : 0..20) { - boolean o1 = (i&1)==0; - if( !((i<10) || ((i&1)==0)) ) { + boolean o1 = (i<10); + boolean o2 = (i&1)==0; + boolean o3 = !( o1 || o2); + if(o3) { screen[i] = '*'; } else { screen[i] = ' '; @@ -44,8 +52,12 @@ void bool_not() { void bool_complex() { const byte* screen = $478; for( byte i : 0..20) { - boolean o1 = (i&1)==0; - if( ((i<10) && ((i&1)==0)) || !((i<10) || ((i&1)==0)) ) { + boolean o1 = (i<10); + boolean o2 = (i&1)==0; + boolean o3 = (o1 && o2); + boolean o4 = !(o1 || o2); + boolean o5 = o3 || o4; + if( o5 ) { screen[i] = '*'; } else { screen[i] = ' '; diff --git a/src/test/java/dk/camelot64/kickc/test/ref/bool-function.asm b/src/test/java/dk/camelot64/kickc/test/ref/bool-function.asm new file mode 100644 index 000000000..d1dbb00a1 --- /dev/null +++ b/src/test/java/dk/camelot64/kickc/test/ref/bool-function.asm @@ -0,0 +1,42 @@ +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" + jsr main +main: { + .label screen = $400 + ldx #0 + b1: + txa + and #1 + cmp #0 + beq !+ + lda #1 + !: + eor #1 + sta isSet.b + jsr isSet + cmp #0 + bne b2 + lda #' ' + sta screen,x + b3: + inx + cpx #$65 + bne b1 + rts + b2: + lda #'*' + sta screen,x + jmp b3 +} +isSet: { + .label b = 2 + txa + and #8 + cmp #0 + beq !+ + lda #1 + !: + ora b + rts +} diff --git a/src/test/java/dk/camelot64/kickc/test/ref/bool-function.cfg b/src/test/java/dk/camelot64/kickc/test/ref/bool-function.cfg new file mode 100644 index 000000000..8108b55e2 --- /dev/null +++ b/src/test/java/dk/camelot64/kickc/test/ref/bool-function.cfg @@ -0,0 +1,45 @@ +@begin: scope:[] from + [0] phi() [ ] ( ) + to:@2 +@2: scope:[] from @begin + [1] phi() [ ] ( ) + [2] call main param-assignment [ ] ( ) + to:@end +@end: scope:[] from @2 + [3] phi() [ ] ( ) +main: scope:[main] from @2 + [4] phi() [ ] ( main:2 [ ] ) + to:main::@1 +main::@1: scope:[main] from main main::@3 + [5] (byte) main::i#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@3/(byte) main::i#1 ) [ main::i#2 ] ( main:2 [ main::i#2 ] ) + [6] (byte~) main::$0 ← (byte) main::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::i#2 main::$0 ] ( main:2 [ main::i#2 main::$0 ] ) + [7] (boolean) isSet::b#0 ← (byte~) main::$0 == (byte/signed byte/word/signed word/dword/signed dword) 0 [ main::i#2 isSet::b#0 ] ( main:2 [ main::i#2 isSet::b#0 ] ) + [8] (byte) isSet::i#0 ← (byte) main::i#2 [ main::i#2 isSet::b#0 isSet::i#0 ] ( main:2 [ main::i#2 isSet::b#0 isSet::i#0 ] ) + [9] call isSet param-assignment [ main::i#2 isSet::return#1 ] ( main:2 [ main::i#2 isSet::return#1 ] ) + [10] (boolean) isSet::return#0 ← (boolean) isSet::return#1 [ main::i#2 isSet::return#0 ] ( main:2 [ main::i#2 isSet::return#0 ] ) + to:main::@7 +main::@7: scope:[main] from main::@1 + [11] (boolean~) main::$2 ← (boolean) isSet::return#0 [ main::i#2 main::$2 ] ( main:2 [ main::i#2 main::$2 ] ) + [12] if((boolean~) main::$2) goto main::@2 [ main::i#2 ] ( main:2 [ main::i#2 ] ) + to:main::@4 +main::@4: scope:[main] from main::@7 + [13] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) ' ' [ main::i#2 ] ( main:2 [ main::i#2 ] ) + to:main::@3 +main::@3: scope:[main] from main::@2 main::@4 + [14] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] ( main:2 [ main::i#1 ] ) + [15] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) + to:main::@return +main::@return: scope:[main] from main::@3 + [16] return [ ] ( main:2 [ ] ) + to:@return +main::@2: scope:[main] from main::@7 + [17] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) '*' [ main::i#2 ] ( main:2 [ main::i#2 ] ) + to:main::@3 +isSet: scope:[isSet] from main::@1 + [18] (byte~) isSet::$0 ← (byte) isSet::i#0 & (byte/signed byte/word/signed word/dword/signed dword) 8 [ isSet::b#0 isSet::$0 ] ( main:2::isSet:9 [ main::i#2 isSet::b#0 isSet::$0 ] ) + [19] (boolean~) isSet::$1 ← (byte~) isSet::$0 != (byte/signed byte/word/signed word/dword/signed dword) 0 [ isSet::b#0 isSet::$1 ] ( main:2::isSet:9 [ main::i#2 isSet::b#0 isSet::$1 ] ) + [20] (boolean) isSet::return#1 ← (boolean) isSet::b#0 || (boolean~) isSet::$1 [ isSet::return#1 ] ( main:2::isSet:9 [ main::i#2 isSet::return#1 ] ) + to:isSet::@return +isSet::@return: scope:[isSet] from isSet + [21] return [ isSet::return#1 ] ( main:2::isSet:9 [ main::i#2 isSet::return#1 ] ) + to:@return diff --git a/src/test/java/dk/camelot64/kickc/test/ref/bool-function.log b/src/test/java/dk/camelot64/kickc/test/ref/bool-function.log new file mode 100644 index 000000000..26ff03633 --- /dev/null +++ b/src/test/java/dk/camelot64/kickc/test/ref/bool-function.log @@ -0,0 +1,854 @@ +PARSING src/test/java/dk/camelot64/kickc/test/kc/bool-function.kc +// Test a function taking boolean parameter and returning boolean result + +void main() { + byte* screen = $400; + for(byte i: 0..100) { + if( isSet(i, (i&1)==0)) { + screen[i] = '*'; + } else { + screen[i] = ' '; + } + } +} + +// Determine whether to set a char to '*. +// Returns true if i&8!=0 or b=true +boolean isSet(byte i, boolean b) { + return b || ((i&8)!=0); +} +SYMBOLS +(label) @1 +(label) @2 +(label) @begin +(label) @end +(boolean()) isSet((byte) isSet::i , (boolean) isSet::b) +(byte~) isSet::$0 +(boolean~) isSet::$1 +(boolean~) isSet::$2 +(label) isSet::@1 +(label) isSet::@return +(boolean) isSet::b +(byte) isSet::i +(boolean) isSet::return +(void()) main() +(byte~) main::$0 +(boolean~) main::$1 +(boolean~) main::$2 +(boolean~) main::$3 +(label) main::@1 +(label) main::@2 +(label) main::@3 +(label) main::@4 +(label) main::@5 +(label) main::@6 +(label) main::@return +(byte) main::i +(byte*) main::screen + +Promoting word/signed word/dword/signed dword to byte* in main::screen ← ((byte*)) 1024 +INITIAL CONTROL FLOW GRAPH +@begin: scope:[] from + to:@1 +main: scope:[main] from + (byte*) main::screen ← ((byte*)) (word/signed word/dword/signed dword) 1024 + (byte) main::i ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:main::@1 +main::@1: scope:[main] from main main::@3 + (byte~) main::$0 ← (byte) main::i & (byte/signed byte/word/signed word/dword/signed dword) 1 + (boolean~) main::$1 ← (byte~) main::$0 == (byte/signed byte/word/signed word/dword/signed dword) 0 + (boolean~) main::$2 ← call isSet (byte) main::i (boolean~) main::$1 + if((boolean~) main::$2) goto main::@2 + to:main::@4 +main::@2: scope:[main] from main::@1 main::@5 + *((byte*) main::screen + (byte) main::i) ← (byte) '*' + to:main::@3 +main::@4: scope:[main] from main::@1 + *((byte*) main::screen + (byte) main::i) ← (byte) ' ' + to:main::@3 +main::@3: scope:[main] from main::@2 main::@4 + (byte) main::i ← ++ (byte) main::i + (boolean~) main::$3 ← (byte) main::i != (byte/signed byte/word/signed word/dword/signed dword) 101 + if((boolean~) main::$3) goto main::@1 + to:main::@6 +main::@5: scope:[main] from + to:main::@2 +main::@6: scope:[main] from main::@3 + to:main::@return +main::@return: scope:[main] from main::@6 + return + to:@return +@1: scope:[] from @begin + to:@2 +isSet: scope:[isSet] from + (byte~) isSet::$0 ← (byte) isSet::i & (byte/signed byte/word/signed word/dword/signed dword) 8 + (boolean~) isSet::$1 ← (byte~) isSet::$0 != (byte/signed byte/word/signed word/dword/signed dword) 0 + (boolean~) isSet::$2 ← (boolean) isSet::b || (boolean~) isSet::$1 + (boolean) isSet::return ← (boolean~) isSet::$2 + to:isSet::@return +isSet::@return: scope:[isSet] from isSet isSet::@1 + (boolean) isSet::return ← (boolean) isSet::return + return (boolean) isSet::return + to:@return +isSet::@1: scope:[isSet] from + to:isSet::@return +@2: scope:[] from @1 + call main + to:@end +@end: scope:[] from @2 + +Removing empty block main::@5 +Removing empty block main::@6 +Removing empty block @1 +Removing empty block isSet::@1 +PROCEDURE MODIFY VARIABLE ANALYSIS + +Completing Phi functions... +Completing Phi functions... +Completing Phi functions... +Completing Phi functions... + +CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN +@begin: scope:[] from + to:@2 +main: scope:[main] from @2 + (byte*) main::screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 + (byte) main::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:main::@1 +main::@1: scope:[main] from main main::@3 + (byte*) main::screen#4 ← phi( main/(byte*) main::screen#0 main::@3/(byte*) main::screen#5 ) + (byte) main::i#2 ← phi( main/(byte) main::i#0 main::@3/(byte) main::i#1 ) + (byte~) main::$0 ← (byte) main::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 + (boolean~) main::$1 ← (byte~) main::$0 == (byte/signed byte/word/signed word/dword/signed dword) 0 + (byte) isSet::i#0 ← (byte) main::i#2 + (boolean) isSet::b#0 ← (boolean~) main::$1 + call isSet param-assignment + (boolean) isSet::return#0 ← (boolean) isSet::return#2 + to:main::@7 +main::@7: scope:[main] from main::@1 + (byte) main::i#6 ← phi( main::@1/(byte) main::i#2 ) + (byte*) main::screen#3 ← phi( main::@1/(byte*) main::screen#4 ) + (boolean) isSet::return#3 ← phi( main::@1/(boolean) isSet::return#0 ) + (boolean~) main::$2 ← (boolean) isSet::return#3 + if((boolean~) main::$2) goto main::@2 + to:main::@4 +main::@2: scope:[main] from main::@7 + (byte) main::i#3 ← phi( main::@7/(byte) main::i#6 ) + (byte*) main::screen#1 ← phi( main::@7/(byte*) main::screen#3 ) + *((byte*) main::screen#1 + (byte) main::i#3) ← (byte) '*' + to:main::@3 +main::@4: scope:[main] from main::@7 + (byte) main::i#4 ← phi( main::@7/(byte) main::i#6 ) + (byte*) main::screen#2 ← phi( main::@7/(byte*) main::screen#3 ) + *((byte*) main::screen#2 + (byte) main::i#4) ← (byte) ' ' + to:main::@3 +main::@3: scope:[main] from main::@2 main::@4 + (byte*) main::screen#5 ← phi( main::@2/(byte*) main::screen#1 main::@4/(byte*) main::screen#2 ) + (byte) main::i#5 ← phi( main::@2/(byte) main::i#3 main::@4/(byte) main::i#4 ) + (byte) main::i#1 ← ++ (byte) main::i#5 + (boolean~) main::$3 ← (byte) main::i#1 != (byte/signed byte/word/signed word/dword/signed dword) 101 + if((boolean~) main::$3) goto main::@1 + to:main::@return +main::@return: scope:[main] from main::@3 + return + to:@return +isSet: scope:[isSet] from main::@1 + (boolean) isSet::b#1 ← phi( main::@1/(boolean) isSet::b#0 ) + (byte) isSet::i#1 ← phi( main::@1/(byte) isSet::i#0 ) + (byte~) isSet::$0 ← (byte) isSet::i#1 & (byte/signed byte/word/signed word/dword/signed dword) 8 + (boolean~) isSet::$1 ← (byte~) isSet::$0 != (byte/signed byte/word/signed word/dword/signed dword) 0 + (boolean~) isSet::$2 ← (boolean) isSet::b#1 || (boolean~) isSet::$1 + (boolean) isSet::return#1 ← (boolean~) isSet::$2 + to:isSet::@return +isSet::@return: scope:[isSet] from isSet + (boolean) isSet::return#4 ← phi( isSet/(boolean) isSet::return#1 ) + (boolean) isSet::return#2 ← (boolean) isSet::return#4 + return + to:@return +@2: scope:[] from @begin + call main param-assignment + to:@3 +@3: scope:[] from @2 + to:@end +@end: scope:[] from @3 + +SYMBOL TABLE SSA +(label) @2 +(label) @3 +(label) @begin +(label) @end +(boolean()) isSet((byte) isSet::i , (boolean) isSet::b) +(byte~) isSet::$0 +(boolean~) isSet::$1 +(boolean~) isSet::$2 +(label) isSet::@return +(boolean) isSet::b +(boolean) isSet::b#0 +(boolean) isSet::b#1 +(byte) isSet::i +(byte) isSet::i#0 +(byte) isSet::i#1 +(boolean) isSet::return +(boolean) isSet::return#0 +(boolean) isSet::return#1 +(boolean) isSet::return#2 +(boolean) isSet::return#3 +(boolean) isSet::return#4 +(void()) main() +(byte~) main::$0 +(boolean~) main::$1 +(boolean~) main::$2 +(boolean~) main::$3 +(label) main::@1 +(label) main::@2 +(label) main::@3 +(label) main::@4 +(label) main::@7 +(label) main::@return +(byte) main::i +(byte) main::i#0 +(byte) main::i#1 +(byte) main::i#2 +(byte) main::i#3 +(byte) main::i#4 +(byte) main::i#5 +(byte) main::i#6 +(byte*) main::screen +(byte*) main::screen#0 +(byte*) main::screen#1 +(byte*) main::screen#2 +(byte*) main::screen#3 +(byte*) main::screen#4 +(byte*) main::screen#5 + +OPTIMIZING CONTROL FLOW GRAPH +Culled Empty Block (label) @3 +Succesful SSA optimization Pass2CullEmptyBlocks +Not aliassing across scopes: isSet::i#0 main::i#2 +Not aliassing across scopes: isSet::return#0 isSet::return#2 +Not aliassing across scopes: main::$2 isSet::return#3 +Not aliassing across scopes: isSet::i#1 isSet::i#0 +Not aliassing across scopes: isSet::b#1 isSet::b#0 +Alias (boolean) isSet::b#0 = (boolean~) main::$1 +Alias (boolean) isSet::return#0 = (boolean) isSet::return#3 +Alias (byte*) main::screen#1 = (byte*) main::screen#3 (byte*) main::screen#4 (byte*) main::screen#2 +Alias (byte) main::i#2 = (byte) main::i#6 (byte) main::i#3 (byte) main::i#4 +Alias (boolean) isSet::return#1 = (boolean~) isSet::$2 (boolean) isSet::return#4 (boolean) isSet::return#2 +Succesful SSA optimization Pass2AliasElimination +Not aliassing across scopes: isSet::i#0 main::i#2 +Not aliassing across scopes: isSet::return#0 isSet::return#1 +Not aliassing across scopes: main::$2 isSet::return#0 +Not aliassing across scopes: isSet::i#1 isSet::i#0 +Not aliassing across scopes: isSet::b#1 isSet::b#0 +Alias (byte) main::i#2 = (byte) main::i#5 +Alias (byte*) main::screen#1 = (byte*) main::screen#5 +Succesful SSA optimization Pass2AliasElimination +Not aliassing across scopes: isSet::i#0 main::i#2 +Not aliassing across scopes: isSet::return#0 isSet::return#1 +Not aliassing across scopes: main::$2 isSet::return#0 +Not aliassing across scopes: isSet::i#1 isSet::i#0 +Not aliassing across scopes: isSet::b#1 isSet::b#0 +Self Phi Eliminated (byte*) main::screen#1 +Succesful SSA optimization Pass2SelfPhiElimination +Redundant Phi (byte*) main::screen#1 (byte*) main::screen#0 +Redundant Phi (byte) isSet::i#1 (byte) isSet::i#0 +Redundant Phi (boolean) isSet::b#1 (boolean) isSet::b#0 +Succesful SSA optimization Pass2RedundantPhiElimination +Simple Condition (boolean~) main::$3 if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 +Succesful SSA optimization Pass2ConditionalJumpSimplification +Constant (const byte*) main::screen#0 = ((byte*))1024 +Constant (const byte) main::i#0 = 0 +Succesful SSA optimization Pass2ConstantIdentification +Not aliassing across scopes: isSet::i#0 main::i#2 +Not aliassing across scopes: isSet::return#0 isSet::return#1 +Not aliassing across scopes: main::$2 isSet::return#0 +OPTIMIZING CONTROL FLOW GRAPH +Inlining constant with var siblings (const byte) main::i#0 +Inlining constant with var siblings (const byte) main::i#0 +Constant inlined main::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 +Succesful SSA optimization Pass2ConstantInlining +Block Sequence Planned @begin @2 @end main main::@1 main::@7 main::@4 main::@3 main::@return main::@2 isSet isSet::@return +Added new block during phi lifting main::@8(between main::@3 and main::@1) +Block Sequence Planned @begin @2 @end main main::@1 main::@7 main::@4 main::@3 main::@return main::@8 main::@2 isSet isSet::@return +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @2 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +CALL GRAPH +Calls in [] to main:2 +Calls in [main] to isSet:9 + +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Created 1 initial phi equivalence classes +Coalesced [17] main::i#7 ← main::i#1 +Coalesced down to 1 phi equivalence classes +Culled Empty Block (label) main::@8 +Block Sequence Planned @begin @2 @end main main::@1 main::@7 main::@4 main::@3 main::@return main::@2 isSet isSet::@return +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @2 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... + +FINAL CONTROL FLOW GRAPH +@begin: scope:[] from + [0] phi() [ ] ( ) + to:@2 +@2: scope:[] from @begin + [1] phi() [ ] ( ) + [2] call main param-assignment [ ] ( ) + to:@end +@end: scope:[] from @2 + [3] phi() [ ] ( ) +main: scope:[main] from @2 + [4] phi() [ ] ( main:2 [ ] ) + to:main::@1 +main::@1: scope:[main] from main main::@3 + [5] (byte) main::i#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@3/(byte) main::i#1 ) [ main::i#2 ] ( main:2 [ main::i#2 ] ) + [6] (byte~) main::$0 ← (byte) main::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::i#2 main::$0 ] ( main:2 [ main::i#2 main::$0 ] ) + [7] (boolean) isSet::b#0 ← (byte~) main::$0 == (byte/signed byte/word/signed word/dword/signed dword) 0 [ main::i#2 isSet::b#0 ] ( main:2 [ main::i#2 isSet::b#0 ] ) + [8] (byte) isSet::i#0 ← (byte) main::i#2 [ main::i#2 isSet::b#0 isSet::i#0 ] ( main:2 [ main::i#2 isSet::b#0 isSet::i#0 ] ) + [9] call isSet param-assignment [ main::i#2 isSet::return#1 ] ( main:2 [ main::i#2 isSet::return#1 ] ) + [10] (boolean) isSet::return#0 ← (boolean) isSet::return#1 [ main::i#2 isSet::return#0 ] ( main:2 [ main::i#2 isSet::return#0 ] ) + to:main::@7 +main::@7: scope:[main] from main::@1 + [11] (boolean~) main::$2 ← (boolean) isSet::return#0 [ main::i#2 main::$2 ] ( main:2 [ main::i#2 main::$2 ] ) + [12] if((boolean~) main::$2) goto main::@2 [ main::i#2 ] ( main:2 [ main::i#2 ] ) + to:main::@4 +main::@4: scope:[main] from main::@7 + [13] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) ' ' [ main::i#2 ] ( main:2 [ main::i#2 ] ) + to:main::@3 +main::@3: scope:[main] from main::@2 main::@4 + [14] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] ( main:2 [ main::i#1 ] ) + [15] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) + to:main::@return +main::@return: scope:[main] from main::@3 + [16] return [ ] ( main:2 [ ] ) + to:@return +main::@2: scope:[main] from main::@7 + [17] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) '*' [ main::i#2 ] ( main:2 [ main::i#2 ] ) + to:main::@3 +isSet: scope:[isSet] from main::@1 + [18] (byte~) isSet::$0 ← (byte) isSet::i#0 & (byte/signed byte/word/signed word/dword/signed dword) 8 [ isSet::b#0 isSet::$0 ] ( main:2::isSet:9 [ main::i#2 isSet::b#0 isSet::$0 ] ) + [19] (boolean~) isSet::$1 ← (byte~) isSet::$0 != (byte/signed byte/word/signed word/dword/signed dword) 0 [ isSet::b#0 isSet::$1 ] ( main:2::isSet:9 [ main::i#2 isSet::b#0 isSet::$1 ] ) + [20] (boolean) isSet::return#1 ← (boolean) isSet::b#0 || (boolean~) isSet::$1 [ isSet::return#1 ] ( main:2::isSet:9 [ main::i#2 isSet::return#1 ] ) + to:isSet::@return +isSet::@return: scope:[isSet] from isSet + [21] return [ isSet::return#1 ] ( main:2::isSet:9 [ main::i#2 isSet::return#1 ] ) + to:@return + +DOMINATORS +@begin dominated by @begin +@2 dominated by @2 @begin +@end dominated by @2 @begin @end +main dominated by @2 @begin main +main::@1 dominated by @2 @begin main::@1 main +main::@7 dominated by @2 main::@7 @begin main::@1 main +main::@4 dominated by @2 main::@7 @begin main::@1 main main::@4 +main::@3 dominated by @2 main::@7 @begin main::@1 main main::@3 +main::@return dominated by main::@return @2 main::@7 @begin main::@1 main main::@3 +main::@2 dominated by @2 main::@7 @begin main::@1 main::@2 main +isSet dominated by @2 @begin isSet main::@1 main +isSet::@return dominated by @2 @begin isSet main::@1 isSet::@return main + +NATURAL LOOPS +Found back edge: Loop head: main::@1 tails: main::@3 blocks: null +Populated: Loop head: main::@1 tails: main::@3 blocks: main::@3 main::@2 main::@4 main::@7 main::@1 +Loop head: main::@1 tails: main::@3 blocks: main::@3 main::@2 main::@4 main::@7 main::@1 + +NATURAL LOOPS WITH DEPTH +Found 0 loops in scope [] +Found 1 loops in scope [main] + Loop head: main::@1 tails: main::@3 blocks: main::@3 main::@2 main::@4 main::@7 main::@1 +Found 0 loops in scope [isSet] +Loop head: main::@1 tails: main::@3 blocks: main::@3 main::@2 main::@4 main::@7 main::@1 depth: 1 + + +VARIABLE REGISTER WEIGHTS +(boolean()) isSet((byte) isSet::i , (boolean) isSet::b) +(byte~) isSet::$0 4.0 +(boolean~) isSet::$1 4.0 +(boolean) isSet::b +(boolean) isSet::b#0 3.25 +(byte) isSet::i +(byte) isSet::i#0 13.0 +(boolean) isSet::return +(boolean) isSet::return#0 22.0 +(boolean) isSet::return#1 4.333333333333333 +(void()) main() +(byte~) main::$0 22.0 +(boolean~) main::$2 22.0 +(byte) main::i +(byte) main::i#1 16.5 +(byte) main::i#2 6.6 +(byte*) main::screen + +Initial phi equivalence classes +[ main::i#2 main::i#1 ] +Added variable main::$0 to zero page equivalence class [ main::$0 ] +Added variable isSet::b#0 to zero page equivalence class [ isSet::b#0 ] +Added variable isSet::i#0 to zero page equivalence class [ isSet::i#0 ] +Added variable isSet::return#0 to zero page equivalence class [ isSet::return#0 ] +Added variable main::$2 to zero page equivalence class [ main::$2 ] +Added variable isSet::$0 to zero page equivalence class [ isSet::$0 ] +Added variable isSet::$1 to zero page equivalence class [ isSet::$1 ] +Added variable isSet::return#1 to zero page equivalence class [ isSet::return#1 ] +Complete equivalence classes +[ main::i#2 main::i#1 ] +[ main::$0 ] +[ isSet::b#0 ] +[ isSet::i#0 ] +[ isSet::return#0 ] +[ main::$2 ] +[ isSet::$0 ] +[ isSet::$1 ] +[ isSet::return#1 ] +Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ] +Allocated zp ZP_BYTE:3 [ main::$0 ] +Allocated zp ZP_BOOL:4 [ isSet::b#0 ] +Allocated zp ZP_BYTE:5 [ isSet::i#0 ] +Allocated zp ZP_BOOL:6 [ isSet::return#0 ] +Allocated zp ZP_BOOL:7 [ main::$2 ] +Allocated zp ZP_BYTE:8 [ isSet::$0 ] +Allocated zp ZP_BOOL:9 [ isSet::$1 ] +Allocated zp ZP_BOOL:10 [ isSet::return#1 ] + +INITIAL ASM +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG1 Global Constants & labels +//SEG2 @begin +bbegin: +//SEG3 [1] phi from @begin to @2 [phi:@begin->@2] +b2_from_bbegin: + jmp b2 +//SEG4 @2 +b2: +//SEG5 [2] call main param-assignment [ ] ( ) +//SEG6 [4] phi from @2 to main [phi:@2->main] +main_from_b2: + jsr main +//SEG7 [3] phi from @2 to @end [phi:@2->@end] +bend_from_b2: + jmp bend +//SEG8 @end +bend: +//SEG9 main +main: { + .label screen = $400 + .label _0 = 3 + .label _2 = 7 + .label i = 2 + //SEG10 [5] phi from main to main::@1 [phi:main->main::@1] + b1_from_main: + //SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 + lda #0 + sta i + jmp b1 + //SEG12 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1] + b1_from_b3: + //SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#0] -- register_copy + jmp b1 + //SEG14 main::@1 + b1: + //SEG15 [6] (byte~) main::$0 ← (byte) main::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::i#2 main::$0 ] ( main:2 [ main::i#2 main::$0 ] ) -- vbuz1=vbuz2_band_vbuc1 + lda #1 + and i + sta _0 + //SEG16 [7] (boolean) isSet::b#0 ← (byte~) main::$0 == (byte/signed byte/word/signed word/dword/signed dword) 0 [ main::i#2 isSet::b#0 ] ( main:2 [ main::i#2 isSet::b#0 ] ) -- vboz1=vbuz2_eq_vbuc1 + lda _0 + cmp #0 + beq !+ + lda #1 + !: + eor #1 + sta isSet.b + //SEG17 [8] (byte) isSet::i#0 ← (byte) main::i#2 [ main::i#2 isSet::b#0 isSet::i#0 ] ( main:2 [ main::i#2 isSet::b#0 isSet::i#0 ] ) -- vbuz1=vbuz2 + lda i + sta isSet.i + //SEG18 [9] call isSet param-assignment [ main::i#2 isSet::return#1 ] ( main:2 [ main::i#2 isSet::return#1 ] ) + jsr isSet + //SEG19 [10] (boolean) isSet::return#0 ← (boolean) isSet::return#1 [ main::i#2 isSet::return#0 ] ( main:2 [ main::i#2 isSet::return#0 ] ) -- vboz1=vboz2 + lda isSet.return_1 + sta isSet.return + jmp b7 + //SEG20 main::@7 + b7: + //SEG21 [11] (boolean~) main::$2 ← (boolean) isSet::return#0 [ main::i#2 main::$2 ] ( main:2 [ main::i#2 main::$2 ] ) -- vboz1=vboz2 + lda isSet.return + sta _2 + //SEG22 [12] if((boolean~) main::$2) goto main::@2 [ main::i#2 ] ( main:2 [ main::i#2 ] ) -- vboz1_then_la1 + lda _2 + cmp #0 + bne b2 + jmp b4 + //SEG23 main::@4 + b4: + //SEG24 [13] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) ' ' [ main::i#2 ] ( main:2 [ main::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 + ldy i + lda #' ' + sta screen,y + jmp b3 + //SEG25 main::@3 + b3: + //SEG26 [14] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] ( main:2 [ main::i#1 ] ) -- vbuz1=_inc_vbuz1 + inc i + //SEG27 [15] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) -- vbuz1_neq_vbuc1_then_la1 + lda i + cmp #$65 + bne b1_from_b3 + jmp breturn + //SEG28 main::@return + breturn: + //SEG29 [16] return [ ] ( main:2 [ ] ) + rts + //SEG30 main::@2 + b2: + //SEG31 [17] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) '*' [ main::i#2 ] ( main:2 [ main::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 + ldy i + lda #'*' + sta screen,y + jmp b3 +} +//SEG32 isSet +isSet: { + .label _0 = 8 + .label _1 = 9 + .label i = 5 + .label b = 4 + .label return = 6 + .label return_1 = $a + //SEG33 [18] (byte~) isSet::$0 ← (byte) isSet::i#0 & (byte/signed byte/word/signed word/dword/signed dword) 8 [ isSet::b#0 isSet::$0 ] ( main:2::isSet:9 [ main::i#2 isSet::b#0 isSet::$0 ] ) -- vbuz1=vbuz2_band_vbuc1 + lda #8 + and i + sta _0 + //SEG34 [19] (boolean~) isSet::$1 ← (byte~) isSet::$0 != (byte/signed byte/word/signed word/dword/signed dword) 0 [ isSet::b#0 isSet::$1 ] ( main:2::isSet:9 [ main::i#2 isSet::b#0 isSet::$1 ] ) -- vboz1=vbuz2_neq_vbuc1 + lda _0 + cmp #0 + beq !+ + lda #1 + !: + sta _1 + //SEG35 [20] (boolean) isSet::return#1 ← (boolean) isSet::b#0 || (boolean~) isSet::$1 [ isSet::return#1 ] ( main:2::isSet:9 [ main::i#2 isSet::return#1 ] ) -- vboz1=vboz2_or_vboz3 + lda b + ora _1 + sta return_1 + jmp breturn + //SEG36 isSet::@return + breturn: + //SEG37 [21] return [ isSet::return#1 ] ( main:2::isSet:9 [ main::i#2 isSet::return#1 ] ) + rts +} + +REGISTER UPLIFT POTENTIAL REGISTERS +Statement [6] (byte~) main::$0 ← (byte) main::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::i#2 main::$0 ] ( main:2 [ main::i#2 main::$0 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::i#2 main::i#1 ] +Statement [7] (boolean) isSet::b#0 ← (byte~) main::$0 == (byte/signed byte/word/signed word/dword/signed dword) 0 [ main::i#2 isSet::b#0 ] ( main:2 [ main::i#2 isSet::b#0 ] ) always clobbers reg byte a +Statement [13] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) ' ' [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a +Statement [17] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) '*' [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a +Statement [18] (byte~) isSet::$0 ← (byte) isSet::i#0 & (byte/signed byte/word/signed word/dword/signed dword) 8 [ isSet::b#0 isSet::$0 ] ( main:2::isSet:9 [ main::i#2 isSet::b#0 isSet::$0 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BOOL:4 [ isSet::b#0 ] +Statement [19] (boolean~) isSet::$1 ← (byte~) isSet::$0 != (byte/signed byte/word/signed word/dword/signed dword) 0 [ isSet::b#0 isSet::$1 ] ( main:2::isSet:9 [ main::i#2 isSet::b#0 isSet::$1 ] ) always clobbers reg byte a +Statement [20] (boolean) isSet::return#1 ← (boolean) isSet::b#0 || (boolean~) isSet::$1 [ isSet::return#1 ] ( main:2::isSet:9 [ main::i#2 isSet::return#1 ] ) always clobbers reg byte a +Statement [6] (byte~) main::$0 ← (byte) main::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::i#2 main::$0 ] ( main:2 [ main::i#2 main::$0 ] ) always clobbers reg byte a +Statement [7] (boolean) isSet::b#0 ← (byte~) main::$0 == (byte/signed byte/word/signed word/dword/signed dword) 0 [ main::i#2 isSet::b#0 ] ( main:2 [ main::i#2 isSet::b#0 ] ) always clobbers reg byte a +Statement [13] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) ' ' [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a +Statement [17] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) '*' [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a +Statement [18] (byte~) isSet::$0 ← (byte) isSet::i#0 & (byte/signed byte/word/signed word/dword/signed dword) 8 [ isSet::b#0 isSet::$0 ] ( main:2::isSet:9 [ main::i#2 isSet::b#0 isSet::$0 ] ) always clobbers reg byte a +Statement [19] (boolean~) isSet::$1 ← (byte~) isSet::$0 != (byte/signed byte/word/signed word/dword/signed dword) 0 [ isSet::b#0 isSet::$1 ] ( main:2::isSet:9 [ main::i#2 isSet::b#0 isSet::$1 ] ) always clobbers reg byte a +Statement [20] (boolean) isSet::return#1 ← (boolean) isSet::b#0 || (boolean~) isSet::$1 [ isSet::return#1 ] ( main:2::isSet:9 [ main::i#2 isSet::return#1 ] ) always clobbers reg byte a +Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:3 [ main::$0 ] : zp ZP_BYTE:3 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BOOL:4 [ isSet::b#0 ] : zp ZP_BOOL:4 , +Potential registers zp ZP_BYTE:5 [ isSet::i#0 ] : zp ZP_BYTE:5 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BOOL:6 [ isSet::return#0 ] : zp ZP_BOOL:6 , reg byte a , +Potential registers zp ZP_BOOL:7 [ main::$2 ] : zp ZP_BOOL:7 , reg byte a , +Potential registers zp ZP_BYTE:8 [ isSet::$0 ] : zp ZP_BYTE:8 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BOOL:9 [ isSet::$1 ] : zp ZP_BOOL:9 , reg byte a , +Potential registers zp ZP_BOOL:10 [ isSet::return#1 ] : zp ZP_BOOL:10 , reg byte a , + +REGISTER UPLIFT SCOPES +Uplift Scope [main] 23.1: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] 22: zp ZP_BYTE:3 [ main::$0 ] 22: zp ZP_BOOL:7 [ main::$2 ] +Uplift Scope [isSet] 22: zp ZP_BOOL:6 [ isSet::return#0 ] 13: zp ZP_BYTE:5 [ isSet::i#0 ] 4.33: zp ZP_BOOL:10 [ isSet::return#1 ] 4: zp ZP_BYTE:8 [ isSet::$0 ] 4: zp ZP_BOOL:9 [ isSet::$1 ] 3.25: zp ZP_BOOL:4 [ isSet::b#0 ] +Uplift Scope [] + +Uplifting [main] best 871 combination reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::$0 ] reg byte a [ main::$2 ] +Uplifting [isSet] best 735 combination reg byte a [ isSet::return#0 ] reg byte x [ isSet::i#0 ] reg byte a [ isSet::return#1 ] reg byte a [ isSet::$0 ] reg byte a [ isSet::$1 ] zp ZP_BOOL:4 [ isSet::b#0 ] +Limited combination testing to 100 combinations of 128 possible. +Uplifting [] best 735 combination +Allocated (was zp ZP_BOOL:4) zp ZP_BOOL:2 [ isSet::b#0 ] + +ASSEMBLER BEFORE OPTIMIZATION +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG1 Global Constants & labels +//SEG2 @begin +bbegin: +//SEG3 [1] phi from @begin to @2 [phi:@begin->@2] +b2_from_bbegin: + jmp b2 +//SEG4 @2 +b2: +//SEG5 [2] call main param-assignment [ ] ( ) +//SEG6 [4] phi from @2 to main [phi:@2->main] +main_from_b2: + jsr main +//SEG7 [3] phi from @2 to @end [phi:@2->@end] +bend_from_b2: + jmp bend +//SEG8 @end +bend: +//SEG9 main +main: { + .label screen = $400 + //SEG10 [5] phi from main to main::@1 [phi:main->main::@1] + b1_from_main: + //SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 + ldx #0 + jmp b1 + //SEG12 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1] + b1_from_b3: + //SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#0] -- register_copy + jmp b1 + //SEG14 main::@1 + b1: + //SEG15 [6] (byte~) main::$0 ← (byte) main::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::i#2 main::$0 ] ( main:2 [ main::i#2 main::$0 ] ) -- vbuaa=vbuxx_band_vbuc1 + txa + and #1 + //SEG16 [7] (boolean) isSet::b#0 ← (byte~) main::$0 == (byte/signed byte/word/signed word/dword/signed dword) 0 [ main::i#2 isSet::b#0 ] ( main:2 [ main::i#2 isSet::b#0 ] ) -- vboz1=vbuaa_eq_vbuc1 + cmp #0 + beq !+ + lda #1 + !: + eor #1 + sta isSet.b + //SEG17 [8] (byte) isSet::i#0 ← (byte) main::i#2 [ main::i#2 isSet::b#0 isSet::i#0 ] ( main:2 [ main::i#2 isSet::b#0 isSet::i#0 ] ) + // (byte) isSet::i#0 = (byte) main::i#2 // register copy reg byte x + //SEG18 [9] call isSet param-assignment [ main::i#2 isSet::return#1 ] ( main:2 [ main::i#2 isSet::return#1 ] ) + jsr isSet + //SEG19 [10] (boolean) isSet::return#0 ← (boolean) isSet::return#1 [ main::i#2 isSet::return#0 ] ( main:2 [ main::i#2 isSet::return#0 ] ) + // (boolean) isSet::return#0 = (boolean) isSet::return#1 // register copy reg byte a + jmp b7 + //SEG20 main::@7 + b7: + //SEG21 [11] (boolean~) main::$2 ← (boolean) isSet::return#0 [ main::i#2 main::$2 ] ( main:2 [ main::i#2 main::$2 ] ) + // (boolean~) main::$2 = (boolean) isSet::return#0 // register copy reg byte a + //SEG22 [12] if((boolean~) main::$2) goto main::@2 [ main::i#2 ] ( main:2 [ main::i#2 ] ) -- vboaa_then_la1 + cmp #0 + bne b2 + jmp b4 + //SEG23 main::@4 + b4: + //SEG24 [13] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) ' ' [ main::i#2 ] ( main:2 [ main::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + lda #' ' + sta screen,x + jmp b3 + //SEG25 main::@3 + b3: + //SEG26 [14] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] ( main:2 [ main::i#1 ] ) -- vbuxx=_inc_vbuxx + inx + //SEG27 [15] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 + cpx #$65 + bne b1_from_b3 + jmp breturn + //SEG28 main::@return + breturn: + //SEG29 [16] return [ ] ( main:2 [ ] ) + rts + //SEG30 main::@2 + b2: + //SEG31 [17] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) '*' [ main::i#2 ] ( main:2 [ main::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + lda #'*' + sta screen,x + jmp b3 +} +//SEG32 isSet +isSet: { + .label b = 2 + //SEG33 [18] (byte~) isSet::$0 ← (byte) isSet::i#0 & (byte/signed byte/word/signed word/dword/signed dword) 8 [ isSet::b#0 isSet::$0 ] ( main:2::isSet:9 [ main::i#2 isSet::b#0 isSet::$0 ] ) -- vbuaa=vbuxx_band_vbuc1 + txa + and #8 + //SEG34 [19] (boolean~) isSet::$1 ← (byte~) isSet::$0 != (byte/signed byte/word/signed word/dword/signed dword) 0 [ isSet::b#0 isSet::$1 ] ( main:2::isSet:9 [ main::i#2 isSet::b#0 isSet::$1 ] ) -- vboaa=vbuaa_neq_vbuc1 + cmp #0 + beq !+ + lda #1 + !: + //SEG35 [20] (boolean) isSet::return#1 ← (boolean) isSet::b#0 || (boolean~) isSet::$1 [ isSet::return#1 ] ( main:2::isSet:9 [ main::i#2 isSet::return#1 ] ) -- vboaa=vboz1_or_vboaa + ora b + jmp breturn + //SEG36 isSet::@return + breturn: + //SEG37 [21] return [ isSet::return#1 ] ( main:2::isSet:9 [ main::i#2 isSet::return#1 ] ) + rts +} + +ASSEMBLER OPTIMIZATIONS +Removing instruction jmp b2 +Removing instruction jmp bend +Removing instruction jmp b1 +Removing instruction jmp b7 +Removing instruction jmp b4 +Removing instruction jmp b3 +Removing instruction jmp breturn +Removing instruction jmp breturn +Succesful ASM optimization Pass5NextJumpElimination +Replacing label b1_from_b3 with b1 +Removing instruction bbegin: +Removing instruction b2_from_bbegin: +Removing instruction main_from_b2: +Removing instruction bend_from_b2: +Removing instruction b1_from_b3: +Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction b2: +Removing instruction bend: +Removing instruction b1_from_main: +Removing instruction b7: +Removing instruction b4: +Removing instruction breturn: +Removing instruction breturn: +Succesful ASM optimization Pass5UnusedLabelElimination +Removing instruction jmp b1 +Succesful ASM optimization Pass5NextJumpElimination + +FINAL SYMBOL TABLE +(label) @2 +(label) @begin +(label) @end +(boolean()) isSet((byte) isSet::i , (boolean) isSet::b) +(byte~) isSet::$0 reg byte a 4.0 +(boolean~) isSet::$1 reg byte a 4.0 +(label) isSet::@return +(boolean) isSet::b +(boolean) isSet::b#0 b zp ZP_BOOL:2 3.25 +(byte) isSet::i +(byte) isSet::i#0 reg byte x 13.0 +(boolean) isSet::return +(boolean) isSet::return#0 reg byte a 22.0 +(boolean) isSet::return#1 reg byte a 4.333333333333333 +(void()) main() +(byte~) main::$0 reg byte a 22.0 +(boolean~) main::$2 reg byte a 22.0 +(label) main::@1 +(label) main::@2 +(label) main::@3 +(label) main::@4 +(label) main::@7 +(label) main::@return +(byte) main::i +(byte) main::i#1 reg byte x 16.5 +(byte) main::i#2 reg byte x 6.6 +(byte*) main::screen +(const byte*) main::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) 1024 + +reg byte x [ main::i#2 main::i#1 ] +reg byte a [ main::$0 ] +zp ZP_BOOL:2 [ isSet::b#0 ] +reg byte x [ isSet::i#0 ] +reg byte a [ isSet::return#0 ] +reg byte a [ main::$2 ] +reg byte a [ isSet::$0 ] +reg byte a [ isSet::$1 ] +reg byte a [ isSet::return#1 ] + + +FINAL ASSEMBLER +Score: 546 + +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG1 Global Constants & labels +//SEG2 @begin +//SEG3 [1] phi from @begin to @2 [phi:@begin->@2] +//SEG4 @2 +//SEG5 [2] call main param-assignment [ ] ( ) +//SEG6 [4] phi from @2 to main [phi:@2->main] + jsr main +//SEG7 [3] phi from @2 to @end [phi:@2->@end] +//SEG8 @end +//SEG9 main +main: { + .label screen = $400 + //SEG10 [5] phi from main to main::@1 [phi:main->main::@1] + //SEG11 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 + ldx #0 + //SEG12 [5] phi from main::@3 to main::@1 [phi:main::@3->main::@1] + //SEG13 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@3->main::@1#0] -- register_copy + //SEG14 main::@1 + b1: + //SEG15 [6] (byte~) main::$0 ← (byte) main::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::i#2 main::$0 ] ( main:2 [ main::i#2 main::$0 ] ) -- vbuaa=vbuxx_band_vbuc1 + txa + and #1 + //SEG16 [7] (boolean) isSet::b#0 ← (byte~) main::$0 == (byte/signed byte/word/signed word/dword/signed dword) 0 [ main::i#2 isSet::b#0 ] ( main:2 [ main::i#2 isSet::b#0 ] ) -- vboz1=vbuaa_eq_vbuc1 + cmp #0 + beq !+ + lda #1 + !: + eor #1 + sta isSet.b + //SEG17 [8] (byte) isSet::i#0 ← (byte) main::i#2 [ main::i#2 isSet::b#0 isSet::i#0 ] ( main:2 [ main::i#2 isSet::b#0 isSet::i#0 ] ) + // (byte) isSet::i#0 = (byte) main::i#2 // register copy reg byte x + //SEG18 [9] call isSet param-assignment [ main::i#2 isSet::return#1 ] ( main:2 [ main::i#2 isSet::return#1 ] ) + jsr isSet + //SEG19 [10] (boolean) isSet::return#0 ← (boolean) isSet::return#1 [ main::i#2 isSet::return#0 ] ( main:2 [ main::i#2 isSet::return#0 ] ) + // (boolean) isSet::return#0 = (boolean) isSet::return#1 // register copy reg byte a + //SEG20 main::@7 + //SEG21 [11] (boolean~) main::$2 ← (boolean) isSet::return#0 [ main::i#2 main::$2 ] ( main:2 [ main::i#2 main::$2 ] ) + // (boolean~) main::$2 = (boolean) isSet::return#0 // register copy reg byte a + //SEG22 [12] if((boolean~) main::$2) goto main::@2 [ main::i#2 ] ( main:2 [ main::i#2 ] ) -- vboaa_then_la1 + cmp #0 + bne b2 + //SEG23 main::@4 + //SEG24 [13] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) ' ' [ main::i#2 ] ( main:2 [ main::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + lda #' ' + sta screen,x + //SEG25 main::@3 + b3: + //SEG26 [14] (byte) main::i#1 ← ++ (byte) main::i#2 [ main::i#1 ] ( main:2 [ main::i#1 ] ) -- vbuxx=_inc_vbuxx + inx + //SEG27 [15] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 101) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 + cpx #$65 + bne b1 + //SEG28 main::@return + //SEG29 [16] return [ ] ( main:2 [ ] ) + rts + //SEG30 main::@2 + b2: + //SEG31 [17] *((const byte*) main::screen#0 + (byte) main::i#2) ← (byte) '*' [ main::i#2 ] ( main:2 [ main::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + lda #'*' + sta screen,x + jmp b3 +} +//SEG32 isSet +isSet: { + .label b = 2 + //SEG33 [18] (byte~) isSet::$0 ← (byte) isSet::i#0 & (byte/signed byte/word/signed word/dword/signed dword) 8 [ isSet::b#0 isSet::$0 ] ( main:2::isSet:9 [ main::i#2 isSet::b#0 isSet::$0 ] ) -- vbuaa=vbuxx_band_vbuc1 + txa + and #8 + //SEG34 [19] (boolean~) isSet::$1 ← (byte~) isSet::$0 != (byte/signed byte/word/signed word/dword/signed dword) 0 [ isSet::b#0 isSet::$1 ] ( main:2::isSet:9 [ main::i#2 isSet::b#0 isSet::$1 ] ) -- vboaa=vbuaa_neq_vbuc1 + cmp #0 + beq !+ + lda #1 + !: + //SEG35 [20] (boolean) isSet::return#1 ← (boolean) isSet::b#0 || (boolean~) isSet::$1 [ isSet::return#1 ] ( main:2::isSet:9 [ main::i#2 isSet::return#1 ] ) -- vboaa=vboz1_or_vboaa + ora b + //SEG36 isSet::@return + //SEG37 [21] return [ isSet::return#1 ] ( main:2::isSet:9 [ main::i#2 isSet::return#1 ] ) + rts +} + diff --git a/src/test/java/dk/camelot64/kickc/test/ref/bool-function.sym b/src/test/java/dk/camelot64/kickc/test/ref/bool-function.sym new file mode 100644 index 000000000..a706cc529 --- /dev/null +++ b/src/test/java/dk/camelot64/kickc/test/ref/bool-function.sym @@ -0,0 +1,38 @@ +(label) @2 +(label) @begin +(label) @end +(boolean()) isSet((byte) isSet::i , (boolean) isSet::b) +(byte~) isSet::$0 reg byte a 4.0 +(boolean~) isSet::$1 reg byte a 4.0 +(label) isSet::@return +(boolean) isSet::b +(boolean) isSet::b#0 b zp ZP_BOOL:2 3.25 +(byte) isSet::i +(byte) isSet::i#0 reg byte x 13.0 +(boolean) isSet::return +(boolean) isSet::return#0 reg byte a 22.0 +(boolean) isSet::return#1 reg byte a 4.333333333333333 +(void()) main() +(byte~) main::$0 reg byte a 22.0 +(boolean~) main::$2 reg byte a 22.0 +(label) main::@1 +(label) main::@2 +(label) main::@3 +(label) main::@4 +(label) main::@7 +(label) main::@return +(byte) main::i +(byte) main::i#1 reg byte x 16.5 +(byte) main::i#2 reg byte x 6.6 +(byte*) main::screen +(const byte*) main::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) 1024 + +reg byte x [ main::i#2 main::i#1 ] +reg byte a [ main::$0 ] +zp ZP_BOOL:2 [ isSet::b#0 ] +reg byte x [ isSet::i#0 ] +reg byte a [ isSet::return#0 ] +reg byte a [ main::$2 ] +reg byte a [ isSet::$0 ] +reg byte a [ isSet::$1 ] +reg byte a [ isSet::return#1 ] diff --git a/src/test/java/dk/camelot64/kickc/test/ref/bool-ifs.asm b/src/test/java/dk/camelot64/kickc/test/ref/bool-ifs.asm new file mode 100644 index 000000000..d4569c203 --- /dev/null +++ b/src/test/java/dk/camelot64/kickc/test/ref/bool-ifs.asm @@ -0,0 +1,113 @@ +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" + jsr main +main: { + jsr bool_and + jsr bool_or + jsr bool_not + jsr bool_complex + rts +} +bool_complex: { + .label screen = $478 + ldy #0 + b1: + tya + and #1 + tax + tya + and #1 + cpy #$a + bcc b8 + b7: + cpy #$a + bcc b4 + cmp #0 + beq b4 + b2: + lda #'*' + sta screen,y + b3: + iny + cpy #$15 + bne b1 + rts + b4: + lda #' ' + sta screen,y + jmp b3 + b8: + cpx #0 + beq b2 + jmp b7 +} +bool_not: { + .label screen = $450 + ldx #0 + b1: + txa + and #1 + cpx #$a + bcc b4 + cmp #0 + beq b4 + lda #'*' + sta screen,x + b3: + inx + cpx #$15 + bne b1 + rts + b4: + lda #' ' + sta screen,x + jmp b3 +} +bool_or: { + .label screen = $428 + ldx #0 + b1: + txa + and #1 + cpx #$a + bcc b2 + cmp #0 + beq b2 + lda #' ' + sta screen,x + b3: + inx + cpx #$15 + bne b1 + rts + b2: + lda #'*' + sta screen,x + jmp b3 +} +bool_and: { + .label screen = $400 + ldx #0 + b1: + txa + and #1 + cpx #$a + bcc b7 + b4: + lda #' ' + sta screen,x + b3: + inx + cpx #$15 + bne b1 + rts + b7: + cmp #0 + beq b2 + jmp b4 + b2: + lda #'*' + sta screen,x + jmp b3 +} diff --git a/src/test/java/dk/camelot64/kickc/test/ref/bool-ifs.cfg b/src/test/java/dk/camelot64/kickc/test/ref/bool-ifs.cfg new file mode 100644 index 000000000..98865515b --- /dev/null +++ b/src/test/java/dk/camelot64/kickc/test/ref/bool-ifs.cfg @@ -0,0 +1,131 @@ +@begin: scope:[] from + [0] phi() [ ] ( ) + to:@5 +@5: scope:[] from @begin + [1] phi() [ ] ( ) + [2] call main param-assignment [ ] ( ) + to:@end +@end: scope:[] from @5 + [3] phi() [ ] ( ) +main: scope:[main] from @5 + [4] phi() [ ] ( main:2 [ ] ) + [5] call bool_and param-assignment [ ] ( main:2 [ ] ) + to:main::@1 +main::@1: scope:[main] from main + [6] phi() [ ] ( main:2 [ ] ) + [7] call bool_or param-assignment [ ] ( main:2 [ ] ) + to:main::@2 +main::@2: scope:[main] from main::@1 + [8] phi() [ ] ( main:2 [ ] ) + [9] call bool_not param-assignment [ ] ( main:2 [ ] ) + to:main::@3 +main::@3: scope:[main] from main::@2 + [10] phi() [ ] ( main:2 [ ] ) + [11] call bool_complex param-assignment [ ] ( main:2 [ ] ) + to:main::@return +main::@return: scope:[main] from main::@3 + [12] return [ ] ( main:2 [ ] ) + to:@return +bool_complex: scope:[bool_complex] from main::@3 + [13] phi() [ ] ( main:2::bool_complex:11 [ ] ) + to:bool_complex::@1 +bool_complex::@1: scope:[bool_complex] from bool_complex bool_complex::@3 + [14] (byte) bool_complex::i#2 ← phi( bool_complex/(byte/signed byte/word/signed word/dword/signed dword) 0 bool_complex::@3/(byte) bool_complex::i#1 ) [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) + [15] (byte~) bool_complex::$1 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$1 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$1 ] ) + [16] (byte~) bool_complex::$5 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ) + [17] if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@8 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ) + to:bool_complex::@7 +bool_complex::@7: scope:[bool_complex] from bool_complex::@1 bool_complex::@8 + [18] if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@4 [ bool_complex::i#2 bool_complex::$5 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$5 ] ) + to:bool_complex::@9 +bool_complex::@9: scope:[bool_complex] from bool_complex::@7 + [19] if((byte~) bool_complex::$5==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@4 [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) + to:bool_complex::@2 +bool_complex::@2: scope:[bool_complex] from bool_complex::@8 bool_complex::@9 + [20] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) '*' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) + to:bool_complex::@3 +bool_complex::@3: scope:[bool_complex] from bool_complex::@2 bool_complex::@4 + [21] (byte) bool_complex::i#1 ← ++ (byte) bool_complex::i#2 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) + [22] if((byte) bool_complex::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_complex::@1 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) + to:bool_complex::@return +bool_complex::@return: scope:[bool_complex] from bool_complex::@3 + [23] return [ ] ( main:2::bool_complex:11 [ ] ) + to:@return +bool_complex::@4: scope:[bool_complex] from bool_complex::@7 bool_complex::@9 + [24] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) ' ' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) + to:bool_complex::@3 +bool_complex::@8: scope:[bool_complex] from bool_complex::@1 + [25] if((byte~) bool_complex::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@2 [ bool_complex::i#2 bool_complex::$5 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$5 ] ) + to:bool_complex::@7 +bool_not: scope:[bool_not] from main::@2 + [26] phi() [ ] ( main:2::bool_not:9 [ ] ) + to:bool_not::@1 +bool_not::@1: scope:[bool_not] from bool_not bool_not::@3 + [27] (byte) bool_not::i#2 ← phi( bool_not/(byte/signed byte/word/signed word/dword/signed dword) 0 bool_not::@3/(byte) bool_not::i#1 ) [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) + [28] (byte~) bool_not::$1 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) + [29] if((byte) bool_not::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_not::@4 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) + to:bool_not::@7 +bool_not::@7: scope:[bool_not] from bool_not::@1 + [30] if((byte~) bool_not::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_not::@4 [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) + to:bool_not::@2 +bool_not::@2: scope:[bool_not] from bool_not::@7 + [31] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) '*' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) + to:bool_not::@3 +bool_not::@3: scope:[bool_not] from bool_not::@2 bool_not::@4 + [32] (byte) bool_not::i#1 ← ++ (byte) bool_not::i#2 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) + [33] if((byte) bool_not::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_not::@1 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) + to:bool_not::@return +bool_not::@return: scope:[bool_not] from bool_not::@3 + [34] return [ ] ( main:2::bool_not:9 [ ] ) + to:@return +bool_not::@4: scope:[bool_not] from bool_not::@1 bool_not::@7 + [35] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) ' ' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) + to:bool_not::@3 +bool_or: scope:[bool_or] from main::@1 + [36] phi() [ ] ( main:2::bool_or:7 [ ] ) + to:bool_or::@1 +bool_or::@1: scope:[bool_or] from bool_or bool_or::@3 + [37] (byte) bool_or::i#2 ← phi( bool_or/(byte/signed byte/word/signed word/dword/signed dword) 0 bool_or::@3/(byte) bool_or::i#1 ) [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) + [38] (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) + [39] if((byte) bool_or::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_or::@2 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) + to:bool_or::@7 +bool_or::@7: scope:[bool_or] from bool_or::@1 + [40] if((byte~) bool_or::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_or::@2 [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) + to:bool_or::@4 +bool_or::@4: scope:[bool_or] from bool_or::@7 + [41] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) ' ' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) + to:bool_or::@3 +bool_or::@3: scope:[bool_or] from bool_or::@2 bool_or::@4 + [42] (byte) bool_or::i#1 ← ++ (byte) bool_or::i#2 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) + [43] if((byte) bool_or::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_or::@1 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) + to:bool_or::@return +bool_or::@return: scope:[bool_or] from bool_or::@3 + [44] return [ ] ( main:2::bool_or:7 [ ] ) + to:@return +bool_or::@2: scope:[bool_or] from bool_or::@1 bool_or::@7 + [45] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) '*' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) + to:bool_or::@3 +bool_and: scope:[bool_and] from main + [46] phi() [ ] ( main:2::bool_and:5 [ ] ) + to:bool_and::@1 +bool_and::@1: scope:[bool_and] from bool_and bool_and::@3 + [47] (byte) bool_and::i#2 ← phi( bool_and/(byte/signed byte/word/signed word/dword/signed dword) 0 bool_and::@3/(byte) bool_and::i#1 ) [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) + [48] (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) + [49] if((byte) bool_and::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_and::@7 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) + to:bool_and::@4 +bool_and::@4: scope:[bool_and] from bool_and::@1 bool_and::@7 + [50] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) ' ' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) + to:bool_and::@3 +bool_and::@3: scope:[bool_and] from bool_and::@2 bool_and::@4 + [51] (byte) bool_and::i#1 ← ++ (byte) bool_and::i#2 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) + [52] if((byte) bool_and::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_and::@1 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) + to:bool_and::@return +bool_and::@return: scope:[bool_and] from bool_and::@3 + [53] return [ ] ( main:2::bool_and:5 [ ] ) + to:@return +bool_and::@7: scope:[bool_and] from bool_and::@1 + [54] if((byte~) bool_and::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_and::@2 [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) + to:bool_and::@4 +bool_and::@2: scope:[bool_and] from bool_and::@7 + [55] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) '*' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) + to:bool_and::@3 diff --git a/src/test/java/dk/camelot64/kickc/test/ref/bool-ifs.log b/src/test/java/dk/camelot64/kickc/test/ref/bool-ifs.log new file mode 100644 index 000000000..062d8835f --- /dev/null +++ b/src/test/java/dk/camelot64/kickc/test/ref/bool-ifs.log @@ -0,0 +1,1977 @@ +PARSING src/test/java/dk/camelot64/kickc/test/kc/bool-ifs.kc +// A test of boolean conditions using && || and ! + +void main() { + bool_and(); + bool_or(); + bool_not(); + bool_complex(); +} + +void bool_and() { + const byte* screen = $400; + for( byte i : 0..20) { + if( (i<10) && ((i&1)==0) ) { + screen[i] = '*'; + } else { + screen[i] = ' '; + } + } +} + +void bool_or() { + const byte* screen = $428; + for( byte i : 0..20) { + if( (i<10) || ((i&1)==0) ) { + screen[i] = '*'; + } else { + screen[i] = ' '; + } + } +} + +void bool_not() { + const byte* screen = $450; + for( byte i : 0..20) { + if( !((i<10) || (i&1)==0)) { + screen[i] = '*'; + } else { + screen[i] = ' '; + } + } +} + +void bool_complex() { + const byte* screen = $478; + for( byte i : 0..20) { + if( ((i<10) && (i&1)==0) || !((i<10) || (i&1)==0) ) { + screen[i] = '*'; + } else { + screen[i] = ' '; + } + } +} + +SYMBOLS +(label) @1 +(label) @2 +(label) @3 +(label) @4 +(label) @5 +(label) @begin +(label) @end +(void()) bool_and() +(boolean~) bool_and::$0 +(byte~) bool_and::$1 +(boolean~) bool_and::$2 +(boolean~) bool_and::$3 +(boolean~) bool_and::$4 +(label) bool_and::@1 +(label) bool_and::@2 +(label) bool_and::@3 +(label) bool_and::@4 +(label) bool_and::@5 +(label) bool_and::@6 +(label) bool_and::@return +(byte) bool_and::i +(byte*) bool_and::screen +(void()) bool_complex() +(boolean~) bool_complex::$0 +(byte~) bool_complex::$1 +(boolean~) bool_complex::$10 +(boolean~) bool_complex::$2 +(boolean~) bool_complex::$3 +(boolean~) bool_complex::$4 +(byte~) bool_complex::$5 +(boolean~) bool_complex::$6 +(boolean~) bool_complex::$7 +(boolean~) bool_complex::$8 +(boolean~) bool_complex::$9 +(label) bool_complex::@1 +(label) bool_complex::@2 +(label) bool_complex::@3 +(label) bool_complex::@4 +(label) bool_complex::@5 +(label) bool_complex::@6 +(label) bool_complex::@return +(byte) bool_complex::i +(byte*) bool_complex::screen +(void()) bool_not() +(boolean~) bool_not::$0 +(byte~) bool_not::$1 +(boolean~) bool_not::$2 +(boolean~) bool_not::$3 +(boolean~) bool_not::$4 +(boolean~) bool_not::$5 +(label) bool_not::@1 +(label) bool_not::@2 +(label) bool_not::@3 +(label) bool_not::@4 +(label) bool_not::@5 +(label) bool_not::@6 +(label) bool_not::@return +(byte) bool_not::i +(byte*) bool_not::screen +(void()) bool_or() +(boolean~) bool_or::$0 +(byte~) bool_or::$1 +(boolean~) bool_or::$2 +(boolean~) bool_or::$3 +(boolean~) bool_or::$4 +(label) bool_or::@1 +(label) bool_or::@2 +(label) bool_or::@3 +(label) bool_or::@4 +(label) bool_or::@5 +(label) bool_or::@6 +(label) bool_or::@return +(byte) bool_or::i +(byte*) bool_or::screen +(void()) main() +(void~) main::$0 +(void~) main::$1 +(void~) main::$2 +(void~) main::$3 +(label) main::@return + +Promoting word/signed word/dword/signed dword to byte* in bool_and::screen ← ((byte*)) 1024 +Promoting word/signed word/dword/signed dword to byte* in bool_or::screen ← ((byte*)) 1064 +Promoting word/signed word/dword/signed dword to byte* in bool_not::screen ← ((byte*)) 1104 +Promoting word/signed word/dword/signed dword to byte* in bool_complex::screen ← ((byte*)) 1144 +INITIAL CONTROL FLOW GRAPH +@begin: scope:[] from + to:@1 +main: scope:[main] from + (void~) main::$0 ← call bool_and + (void~) main::$1 ← call bool_or + (void~) main::$2 ← call bool_not + (void~) main::$3 ← call bool_complex + to:main::@return +main::@return: scope:[main] from main + return + to:@return +@1: scope:[] from @begin + to:@2 +bool_and: scope:[bool_and] from + (byte*) bool_and::screen ← ((byte*)) (word/signed word/dword/signed dword) 1024 + (byte) bool_and::i ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:bool_and::@1 +bool_and::@1: scope:[bool_and] from bool_and bool_and::@3 + (boolean~) bool_and::$0 ← (byte) bool_and::i < (byte/signed byte/word/signed word/dword/signed dword) 10 + (byte~) bool_and::$1 ← (byte) bool_and::i & (byte/signed byte/word/signed word/dword/signed dword) 1 + (boolean~) bool_and::$2 ← (byte~) bool_and::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 + (boolean~) bool_and::$3 ← (boolean~) bool_and::$0 && (boolean~) bool_and::$2 + if((boolean~) bool_and::$3) goto bool_and::@2 + to:bool_and::@4 +bool_and::@2: scope:[bool_and] from bool_and::@1 bool_and::@5 + *((byte*) bool_and::screen + (byte) bool_and::i) ← (byte) '*' + to:bool_and::@3 +bool_and::@4: scope:[bool_and] from bool_and::@1 + *((byte*) bool_and::screen + (byte) bool_and::i) ← (byte) ' ' + to:bool_and::@3 +bool_and::@3: scope:[bool_and] from bool_and::@2 bool_and::@4 + (byte) bool_and::i ← ++ (byte) bool_and::i + (boolean~) bool_and::$4 ← (byte) bool_and::i != (byte/signed byte/word/signed word/dword/signed dword) 21 + if((boolean~) bool_and::$4) goto bool_and::@1 + to:bool_and::@6 +bool_and::@5: scope:[bool_and] from + to:bool_and::@2 +bool_and::@6: scope:[bool_and] from bool_and::@3 + to:bool_and::@return +bool_and::@return: scope:[bool_and] from bool_and::@6 + return + to:@return +@2: scope:[] from @1 + to:@3 +bool_or: scope:[bool_or] from + (byte*) bool_or::screen ← ((byte*)) (word/signed word/dword/signed dword) 1064 + (byte) bool_or::i ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:bool_or::@1 +bool_or::@1: scope:[bool_or] from bool_or bool_or::@3 + (boolean~) bool_or::$0 ← (byte) bool_or::i < (byte/signed byte/word/signed word/dword/signed dword) 10 + (byte~) bool_or::$1 ← (byte) bool_or::i & (byte/signed byte/word/signed word/dword/signed dword) 1 + (boolean~) bool_or::$2 ← (byte~) bool_or::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 + (boolean~) bool_or::$3 ← (boolean~) bool_or::$0 || (boolean~) bool_or::$2 + if((boolean~) bool_or::$3) goto bool_or::@2 + to:bool_or::@4 +bool_or::@2: scope:[bool_or] from bool_or::@1 bool_or::@5 + *((byte*) bool_or::screen + (byte) bool_or::i) ← (byte) '*' + to:bool_or::@3 +bool_or::@4: scope:[bool_or] from bool_or::@1 + *((byte*) bool_or::screen + (byte) bool_or::i) ← (byte) ' ' + to:bool_or::@3 +bool_or::@3: scope:[bool_or] from bool_or::@2 bool_or::@4 + (byte) bool_or::i ← ++ (byte) bool_or::i + (boolean~) bool_or::$4 ← (byte) bool_or::i != (byte/signed byte/word/signed word/dword/signed dword) 21 + if((boolean~) bool_or::$4) goto bool_or::@1 + to:bool_or::@6 +bool_or::@5: scope:[bool_or] from + to:bool_or::@2 +bool_or::@6: scope:[bool_or] from bool_or::@3 + to:bool_or::@return +bool_or::@return: scope:[bool_or] from bool_or::@6 + return + to:@return +@3: scope:[] from @2 + to:@4 +bool_not: scope:[bool_not] from + (byte*) bool_not::screen ← ((byte*)) (word/signed word/dword/signed dword) 1104 + (byte) bool_not::i ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:bool_not::@1 +bool_not::@1: scope:[bool_not] from bool_not bool_not::@3 + (boolean~) bool_not::$0 ← (byte) bool_not::i < (byte/signed byte/word/signed word/dword/signed dword) 10 + (byte~) bool_not::$1 ← (byte) bool_not::i & (byte/signed byte/word/signed word/dword/signed dword) 1 + (boolean~) bool_not::$2 ← (byte~) bool_not::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 + (boolean~) bool_not::$3 ← (boolean~) bool_not::$0 || (boolean~) bool_not::$2 + (boolean~) bool_not::$4 ← ! (boolean~) bool_not::$3 + if((boolean~) bool_not::$4) goto bool_not::@2 + to:bool_not::@4 +bool_not::@2: scope:[bool_not] from bool_not::@1 bool_not::@5 + *((byte*) bool_not::screen + (byte) bool_not::i) ← (byte) '*' + to:bool_not::@3 +bool_not::@4: scope:[bool_not] from bool_not::@1 + *((byte*) bool_not::screen + (byte) bool_not::i) ← (byte) ' ' + to:bool_not::@3 +bool_not::@3: scope:[bool_not] from bool_not::@2 bool_not::@4 + (byte) bool_not::i ← ++ (byte) bool_not::i + (boolean~) bool_not::$5 ← (byte) bool_not::i != (byte/signed byte/word/signed word/dword/signed dword) 21 + if((boolean~) bool_not::$5) goto bool_not::@1 + to:bool_not::@6 +bool_not::@5: scope:[bool_not] from + to:bool_not::@2 +bool_not::@6: scope:[bool_not] from bool_not::@3 + to:bool_not::@return +bool_not::@return: scope:[bool_not] from bool_not::@6 + return + to:@return +@4: scope:[] from @3 + to:@5 +bool_complex: scope:[bool_complex] from + (byte*) bool_complex::screen ← ((byte*)) (word/signed word/dword/signed dword) 1144 + (byte) bool_complex::i ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:bool_complex::@1 +bool_complex::@1: scope:[bool_complex] from bool_complex bool_complex::@3 + (boolean~) bool_complex::$0 ← (byte) bool_complex::i < (byte/signed byte/word/signed word/dword/signed dword) 10 + (byte~) bool_complex::$1 ← (byte) bool_complex::i & (byte/signed byte/word/signed word/dword/signed dword) 1 + (boolean~) bool_complex::$2 ← (byte~) bool_complex::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 + (boolean~) bool_complex::$3 ← (boolean~) bool_complex::$0 && (boolean~) bool_complex::$2 + (boolean~) bool_complex::$4 ← (byte) bool_complex::i < (byte/signed byte/word/signed word/dword/signed dword) 10 + (byte~) bool_complex::$5 ← (byte) bool_complex::i & (byte/signed byte/word/signed word/dword/signed dword) 1 + (boolean~) bool_complex::$6 ← (byte~) bool_complex::$5 == (byte/signed byte/word/signed word/dword/signed dword) 0 + (boolean~) bool_complex::$7 ← (boolean~) bool_complex::$4 || (boolean~) bool_complex::$6 + (boolean~) bool_complex::$8 ← ! (boolean~) bool_complex::$7 + (boolean~) bool_complex::$9 ← (boolean~) bool_complex::$3 || (boolean~) bool_complex::$8 + if((boolean~) bool_complex::$9) goto bool_complex::@2 + to:bool_complex::@4 +bool_complex::@2: scope:[bool_complex] from bool_complex::@1 bool_complex::@5 + *((byte*) bool_complex::screen + (byte) bool_complex::i) ← (byte) '*' + to:bool_complex::@3 +bool_complex::@4: scope:[bool_complex] from bool_complex::@1 + *((byte*) bool_complex::screen + (byte) bool_complex::i) ← (byte) ' ' + to:bool_complex::@3 +bool_complex::@3: scope:[bool_complex] from bool_complex::@2 bool_complex::@4 + (byte) bool_complex::i ← ++ (byte) bool_complex::i + (boolean~) bool_complex::$10 ← (byte) bool_complex::i != (byte/signed byte/word/signed word/dword/signed dword) 21 + if((boolean~) bool_complex::$10) goto bool_complex::@1 + to:bool_complex::@6 +bool_complex::@5: scope:[bool_complex] from + to:bool_complex::@2 +bool_complex::@6: scope:[bool_complex] from bool_complex::@3 + to:bool_complex::@return +bool_complex::@return: scope:[bool_complex] from bool_complex::@6 + return + to:@return +@5: scope:[] from @4 + call main + to:@end +@end: scope:[] from @5 + +Eliminating unused variable - keeping the call (void~) main::$0 +Eliminating unused variable - keeping the call (void~) main::$1 +Eliminating unused variable - keeping the call (void~) main::$2 +Eliminating unused variable - keeping the call (void~) main::$3 +Removing empty block @1 +Removing empty block bool_and::@5 +Removing empty block bool_and::@6 +Removing empty block @2 +Removing empty block bool_or::@5 +Removing empty block bool_or::@6 +Removing empty block @3 +Removing empty block bool_not::@5 +Removing empty block bool_not::@6 +Removing empty block @4 +Removing empty block bool_complex::@5 +Removing empty block bool_complex::@6 +PROCEDURE MODIFY VARIABLE ANALYSIS + +Completing Phi functions... + +CONTROL FLOW GRAPH SSA WITH ASSIGNMENT CALL & RETURN +@begin: scope:[] from + to:@5 +main: scope:[main] from @5 + call bool_and param-assignment + to:main::@1 +main::@1: scope:[main] from main + call bool_or param-assignment + to:main::@2 +main::@2: scope:[main] from main::@1 + call bool_not param-assignment + to:main::@3 +main::@3: scope:[main] from main::@2 + call bool_complex param-assignment + to:main::@4 +main::@4: scope:[main] from main::@3 + to:main::@return +main::@return: scope:[main] from main::@4 + return + to:@return +bool_and: scope:[bool_and] from main + (byte*) bool_and::screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 + (byte) bool_and::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:bool_and::@1 +bool_and::@1: scope:[bool_and] from bool_and bool_and::@3 + (byte) bool_and::i#2 ← phi( bool_and/(byte) bool_and::i#0 bool_and::@3/(byte) bool_and::i#1 ) + (boolean~) bool_and::$0 ← (byte) bool_and::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10 + (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 + (boolean~) bool_and::$2 ← (byte~) bool_and::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 + (boolean~) bool_and::$3 ← (boolean~) bool_and::$0 && (boolean~) bool_and::$2 + if((boolean~) bool_and::$3) goto bool_and::@2 + to:bool_and::@4 +bool_and::@2: scope:[bool_and] from bool_and::@1 + (byte) bool_and::i#3 ← phi( bool_and::@1/(byte) bool_and::i#2 ) + *((byte*) bool_and::screen#0 + (byte) bool_and::i#3) ← (byte) '*' + to:bool_and::@3 +bool_and::@4: scope:[bool_and] from bool_and::@1 + (byte) bool_and::i#4 ← phi( bool_and::@1/(byte) bool_and::i#2 ) + *((byte*) bool_and::screen#0 + (byte) bool_and::i#4) ← (byte) ' ' + to:bool_and::@3 +bool_and::@3: scope:[bool_and] from bool_and::@2 bool_and::@4 + (byte) bool_and::i#5 ← phi( bool_and::@2/(byte) bool_and::i#3 bool_and::@4/(byte) bool_and::i#4 ) + (byte) bool_and::i#1 ← ++ (byte) bool_and::i#5 + (boolean~) bool_and::$4 ← (byte) bool_and::i#1 != (byte/signed byte/word/signed word/dword/signed dword) 21 + if((boolean~) bool_and::$4) goto bool_and::@1 + to:bool_and::@return +bool_and::@return: scope:[bool_and] from bool_and::@3 + return + to:@return +bool_or: scope:[bool_or] from main::@1 + (byte*) bool_or::screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1064 + (byte) bool_or::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:bool_or::@1 +bool_or::@1: scope:[bool_or] from bool_or bool_or::@3 + (byte) bool_or::i#2 ← phi( bool_or/(byte) bool_or::i#0 bool_or::@3/(byte) bool_or::i#1 ) + (boolean~) bool_or::$0 ← (byte) bool_or::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10 + (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 + (boolean~) bool_or::$2 ← (byte~) bool_or::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 + (boolean~) bool_or::$3 ← (boolean~) bool_or::$0 || (boolean~) bool_or::$2 + if((boolean~) bool_or::$3) goto bool_or::@2 + to:bool_or::@4 +bool_or::@2: scope:[bool_or] from bool_or::@1 + (byte) bool_or::i#3 ← phi( bool_or::@1/(byte) bool_or::i#2 ) + *((byte*) bool_or::screen#0 + (byte) bool_or::i#3) ← (byte) '*' + to:bool_or::@3 +bool_or::@4: scope:[bool_or] from bool_or::@1 + (byte) bool_or::i#4 ← phi( bool_or::@1/(byte) bool_or::i#2 ) + *((byte*) bool_or::screen#0 + (byte) bool_or::i#4) ← (byte) ' ' + to:bool_or::@3 +bool_or::@3: scope:[bool_or] from bool_or::@2 bool_or::@4 + (byte) bool_or::i#5 ← phi( bool_or::@2/(byte) bool_or::i#3 bool_or::@4/(byte) bool_or::i#4 ) + (byte) bool_or::i#1 ← ++ (byte) bool_or::i#5 + (boolean~) bool_or::$4 ← (byte) bool_or::i#1 != (byte/signed byte/word/signed word/dword/signed dword) 21 + if((boolean~) bool_or::$4) goto bool_or::@1 + to:bool_or::@return +bool_or::@return: scope:[bool_or] from bool_or::@3 + return + to:@return +bool_not: scope:[bool_not] from main::@2 + (byte*) bool_not::screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1104 + (byte) bool_not::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:bool_not::@1 +bool_not::@1: scope:[bool_not] from bool_not bool_not::@3 + (byte) bool_not::i#2 ← phi( bool_not/(byte) bool_not::i#0 bool_not::@3/(byte) bool_not::i#1 ) + (boolean~) bool_not::$0 ← (byte) bool_not::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10 + (byte~) bool_not::$1 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 + (boolean~) bool_not::$2 ← (byte~) bool_not::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 + (boolean~) bool_not::$3 ← (boolean~) bool_not::$0 || (boolean~) bool_not::$2 + (boolean~) bool_not::$4 ← ! (boolean~) bool_not::$3 + if((boolean~) bool_not::$4) goto bool_not::@2 + to:bool_not::@4 +bool_not::@2: scope:[bool_not] from bool_not::@1 + (byte) bool_not::i#3 ← phi( bool_not::@1/(byte) bool_not::i#2 ) + *((byte*) bool_not::screen#0 + (byte) bool_not::i#3) ← (byte) '*' + to:bool_not::@3 +bool_not::@4: scope:[bool_not] from bool_not::@1 + (byte) bool_not::i#4 ← phi( bool_not::@1/(byte) bool_not::i#2 ) + *((byte*) bool_not::screen#0 + (byte) bool_not::i#4) ← (byte) ' ' + to:bool_not::@3 +bool_not::@3: scope:[bool_not] from bool_not::@2 bool_not::@4 + (byte) bool_not::i#5 ← phi( bool_not::@2/(byte) bool_not::i#3 bool_not::@4/(byte) bool_not::i#4 ) + (byte) bool_not::i#1 ← ++ (byte) bool_not::i#5 + (boolean~) bool_not::$5 ← (byte) bool_not::i#1 != (byte/signed byte/word/signed word/dword/signed dword) 21 + if((boolean~) bool_not::$5) goto bool_not::@1 + to:bool_not::@return +bool_not::@return: scope:[bool_not] from bool_not::@3 + return + to:@return +bool_complex: scope:[bool_complex] from main::@3 + (byte*) bool_complex::screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1144 + (byte) bool_complex::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:bool_complex::@1 +bool_complex::@1: scope:[bool_complex] from bool_complex bool_complex::@3 + (byte) bool_complex::i#2 ← phi( bool_complex/(byte) bool_complex::i#0 bool_complex::@3/(byte) bool_complex::i#1 ) + (boolean~) bool_complex::$0 ← (byte) bool_complex::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10 + (byte~) bool_complex::$1 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 + (boolean~) bool_complex::$2 ← (byte~) bool_complex::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 + (boolean~) bool_complex::$3 ← (boolean~) bool_complex::$0 && (boolean~) bool_complex::$2 + (boolean~) bool_complex::$4 ← (byte) bool_complex::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10 + (byte~) bool_complex::$5 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 + (boolean~) bool_complex::$6 ← (byte~) bool_complex::$5 == (byte/signed byte/word/signed word/dword/signed dword) 0 + (boolean~) bool_complex::$7 ← (boolean~) bool_complex::$4 || (boolean~) bool_complex::$6 + (boolean~) bool_complex::$8 ← ! (boolean~) bool_complex::$7 + (boolean~) bool_complex::$9 ← (boolean~) bool_complex::$3 || (boolean~) bool_complex::$8 + if((boolean~) bool_complex::$9) goto bool_complex::@2 + to:bool_complex::@4 +bool_complex::@2: scope:[bool_complex] from bool_complex::@1 + (byte) bool_complex::i#3 ← phi( bool_complex::@1/(byte) bool_complex::i#2 ) + *((byte*) bool_complex::screen#0 + (byte) bool_complex::i#3) ← (byte) '*' + to:bool_complex::@3 +bool_complex::@4: scope:[bool_complex] from bool_complex::@1 + (byte) bool_complex::i#4 ← phi( bool_complex::@1/(byte) bool_complex::i#2 ) + *((byte*) bool_complex::screen#0 + (byte) bool_complex::i#4) ← (byte) ' ' + to:bool_complex::@3 +bool_complex::@3: scope:[bool_complex] from bool_complex::@2 bool_complex::@4 + (byte) bool_complex::i#5 ← phi( bool_complex::@2/(byte) bool_complex::i#3 bool_complex::@4/(byte) bool_complex::i#4 ) + (byte) bool_complex::i#1 ← ++ (byte) bool_complex::i#5 + (boolean~) bool_complex::$10 ← (byte) bool_complex::i#1 != (byte/signed byte/word/signed word/dword/signed dword) 21 + if((boolean~) bool_complex::$10) goto bool_complex::@1 + to:bool_complex::@return +bool_complex::@return: scope:[bool_complex] from bool_complex::@3 + return + to:@return +@5: scope:[] from @begin + call main param-assignment + to:@6 +@6: scope:[] from @5 + to:@end +@end: scope:[] from @6 + +SYMBOL TABLE SSA +(label) @5 +(label) @6 +(label) @begin +(label) @end +(void()) bool_and() +(boolean~) bool_and::$0 +(byte~) bool_and::$1 +(boolean~) bool_and::$2 +(boolean~) bool_and::$3 +(boolean~) bool_and::$4 +(label) bool_and::@1 +(label) bool_and::@2 +(label) bool_and::@3 +(label) bool_and::@4 +(label) bool_and::@return +(byte) bool_and::i +(byte) bool_and::i#0 +(byte) bool_and::i#1 +(byte) bool_and::i#2 +(byte) bool_and::i#3 +(byte) bool_and::i#4 +(byte) bool_and::i#5 +(byte*) bool_and::screen +(byte*) bool_and::screen#0 +(void()) bool_complex() +(boolean~) bool_complex::$0 +(byte~) bool_complex::$1 +(boolean~) bool_complex::$10 +(boolean~) bool_complex::$2 +(boolean~) bool_complex::$3 +(boolean~) bool_complex::$4 +(byte~) bool_complex::$5 +(boolean~) bool_complex::$6 +(boolean~) bool_complex::$7 +(boolean~) bool_complex::$8 +(boolean~) bool_complex::$9 +(label) bool_complex::@1 +(label) bool_complex::@2 +(label) bool_complex::@3 +(label) bool_complex::@4 +(label) bool_complex::@return +(byte) bool_complex::i +(byte) bool_complex::i#0 +(byte) bool_complex::i#1 +(byte) bool_complex::i#2 +(byte) bool_complex::i#3 +(byte) bool_complex::i#4 +(byte) bool_complex::i#5 +(byte*) bool_complex::screen +(byte*) bool_complex::screen#0 +(void()) bool_not() +(boolean~) bool_not::$0 +(byte~) bool_not::$1 +(boolean~) bool_not::$2 +(boolean~) bool_not::$3 +(boolean~) bool_not::$4 +(boolean~) bool_not::$5 +(label) bool_not::@1 +(label) bool_not::@2 +(label) bool_not::@3 +(label) bool_not::@4 +(label) bool_not::@return +(byte) bool_not::i +(byte) bool_not::i#0 +(byte) bool_not::i#1 +(byte) bool_not::i#2 +(byte) bool_not::i#3 +(byte) bool_not::i#4 +(byte) bool_not::i#5 +(byte*) bool_not::screen +(byte*) bool_not::screen#0 +(void()) bool_or() +(boolean~) bool_or::$0 +(byte~) bool_or::$1 +(boolean~) bool_or::$2 +(boolean~) bool_or::$3 +(boolean~) bool_or::$4 +(label) bool_or::@1 +(label) bool_or::@2 +(label) bool_or::@3 +(label) bool_or::@4 +(label) bool_or::@return +(byte) bool_or::i +(byte) bool_or::i#0 +(byte) bool_or::i#1 +(byte) bool_or::i#2 +(byte) bool_or::i#3 +(byte) bool_or::i#4 +(byte) bool_or::i#5 +(byte*) bool_or::screen +(byte*) bool_or::screen#0 +(void()) main() +(label) main::@1 +(label) main::@2 +(label) main::@3 +(label) main::@4 +(label) main::@return + +OPTIMIZING CONTROL FLOW GRAPH +Culled Empty Block (label) main::@4 +Culled Empty Block (label) @6 +Succesful SSA optimization Pass2CullEmptyBlocks +Alias (byte) bool_and::i#2 = (byte) bool_and::i#3 (byte) bool_and::i#4 +Alias (byte) bool_or::i#2 = (byte) bool_or::i#3 (byte) bool_or::i#4 +Alias (byte) bool_not::i#2 = (byte) bool_not::i#3 (byte) bool_not::i#4 +Alias (byte) bool_complex::i#2 = (byte) bool_complex::i#3 (byte) bool_complex::i#4 +Succesful SSA optimization Pass2AliasElimination +Alias (byte) bool_and::i#2 = (byte) bool_and::i#5 +Alias (byte) bool_or::i#2 = (byte) bool_or::i#5 +Alias (byte) bool_not::i#2 = (byte) bool_not::i#5 +Alias (byte) bool_complex::i#2 = (byte) bool_complex::i#5 +Succesful SSA optimization Pass2AliasElimination +Simple Condition (boolean~) bool_and::$4 if((byte) bool_and::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_and::@1 +Simple Condition (boolean~) bool_or::$4 if((byte) bool_or::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_or::@1 +Simple Condition (boolean~) bool_not::$5 if((byte) bool_not::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_not::@1 +Simple Condition (boolean~) bool_complex::$10 if((byte) bool_complex::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_complex::@1 +Succesful SSA optimization Pass2ConditionalJumpSimplification +Rewriting && if()-condition to two if()s (boolean~) bool_and::$3 ← (boolean~) bool_and::$0 && (boolean~) bool_and::$2 +Succesful SSA optimization Pass2ConditionalAndOrRewriting +Rewriting || if()-condition to two if()s (boolean~) bool_or::$3 ← (boolean~) bool_or::$0 || (boolean~) bool_or::$2 +Succesful SSA optimization Pass2ConditionalAndOrRewriting +Rewriting ! if()-condition to reversed if() (boolean~) bool_not::$4 ← ! (boolean~) bool_not::$3 +Succesful SSA optimization Pass2ConditionalAndOrRewriting +Rewriting || if()-condition to two if()s (boolean~) bool_not::$3 ← (boolean~) bool_not::$0 || (boolean~) bool_not::$2 +Succesful SSA optimization Pass2ConditionalAndOrRewriting +Rewriting || if()-condition to two if()s (boolean~) bool_complex::$9 ← (boolean~) bool_complex::$3 || (boolean~) bool_complex::$8 +Succesful SSA optimization Pass2ConditionalAndOrRewriting +Rewriting && if()-condition to two if()s (boolean~) bool_complex::$3 ← (boolean~) bool_complex::$0 && (boolean~) bool_complex::$2 +Succesful SSA optimization Pass2ConditionalAndOrRewriting +Rewriting ! if()-condition to reversed if() (boolean~) bool_complex::$8 ← ! (boolean~) bool_complex::$7 +Succesful SSA optimization Pass2ConditionalAndOrRewriting +Rewriting || if()-condition to two if()s (boolean~) bool_complex::$7 ← (boolean~) bool_complex::$4 || (boolean~) bool_complex::$6 +Succesful SSA optimization Pass2ConditionalAndOrRewriting +Constant (const byte*) bool_and::screen#0 = ((byte*))1024 +Constant (const byte) bool_and::i#0 = 0 +Constant (const byte*) bool_or::screen#0 = ((byte*))1064 +Constant (const byte) bool_or::i#0 = 0 +Constant (const byte*) bool_not::screen#0 = ((byte*))1104 +Constant (const byte) bool_not::i#0 = 0 +Constant (const byte*) bool_complex::screen#0 = ((byte*))1144 +Constant (const byte) bool_complex::i#0 = 0 +Succesful SSA optimization Pass2ConstantIdentification +Simple Condition (boolean~) bool_and::$0 if((byte) bool_and::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_and::@7 +Simple Condition (boolean~) bool_or::$0 if((byte) bool_or::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_or::@2 +Simple Condition (boolean~) bool_not::$0 if((byte) bool_not::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_not::@4 +Simple Condition (boolean~) bool_complex::$0 if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@8 +Simple Condition (boolean~) bool_and::$2 if((byte~) bool_and::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_and::@2 +Simple Condition (boolean~) bool_or::$2 if((byte~) bool_or::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_or::@2 +Simple Condition (boolean~) bool_not::$2 if((byte~) bool_not::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_not::@4 +Simple Condition (boolean~) bool_complex::$4 if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@4 +Simple Condition (boolean~) bool_complex::$2 if((byte~) bool_complex::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@2 +Simple Condition (boolean~) bool_complex::$6 if((byte~) bool_complex::$5==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@4 +Succesful SSA optimization Pass2ConditionalJumpSimplification +OPTIMIZING CONTROL FLOW GRAPH +Inlining constant with var siblings (const byte) bool_and::i#0 +Inlining constant with var siblings (const byte) bool_and::i#0 +Inlining constant with var siblings (const byte) bool_or::i#0 +Inlining constant with var siblings (const byte) bool_or::i#0 +Inlining constant with var siblings (const byte) bool_not::i#0 +Inlining constant with var siblings (const byte) bool_not::i#0 +Inlining constant with var siblings (const byte) bool_complex::i#0 +Inlining constant with var siblings (const byte) bool_complex::i#0 +Constant inlined bool_complex::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 +Constant inlined bool_or::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 +Constant inlined bool_not::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 +Constant inlined bool_and::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 +Succesful SSA optimization Pass2ConstantInlining +Block Sequence Planned @begin @5 @end main main::@1 main::@2 main::@3 main::@return bool_complex bool_complex::@1 bool_complex::@7 bool_complex::@9 bool_complex::@2 bool_complex::@3 bool_complex::@return bool_complex::@4 bool_complex::@8 bool_not bool_not::@1 bool_not::@7 bool_not::@2 bool_not::@3 bool_not::@return bool_not::@4 bool_or bool_or::@1 bool_or::@7 bool_or::@4 bool_or::@3 bool_or::@return bool_or::@2 bool_and bool_and::@1 bool_and::@4 bool_and::@3 bool_and::@return bool_and::@7 bool_and::@2 +Added new block during phi lifting bool_complex::@10(between bool_complex::@3 and bool_complex::@1) +Added new block during phi lifting bool_not::@8(between bool_not::@3 and bool_not::@1) +Added new block during phi lifting bool_or::@8(between bool_or::@3 and bool_or::@1) +Added new block during phi lifting bool_and::@8(between bool_and::@3 and bool_and::@1) +Block Sequence Planned @begin @5 @end main main::@1 main::@2 main::@3 main::@return bool_complex bool_complex::@1 bool_complex::@7 bool_complex::@9 bool_complex::@2 bool_complex::@3 bool_complex::@return bool_complex::@10 bool_complex::@4 bool_complex::@8 bool_not bool_not::@1 bool_not::@7 bool_not::@2 bool_not::@3 bool_not::@return bool_not::@8 bool_not::@4 bool_or bool_or::@1 bool_or::@7 bool_or::@4 bool_or::@3 bool_or::@return bool_or::@8 bool_or::@2 bool_and bool_and::@1 bool_and::@4 bool_and::@3 bool_and::@return bool_and::@8 bool_and::@7 bool_and::@2 +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @5 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of main::@1 +Adding NOP phi() at start of main::@2 +Adding NOP phi() at start of main::@3 +Adding NOP phi() at start of bool_complex +Adding NOP phi() at start of bool_not +Adding NOP phi() at start of bool_or +Adding NOP phi() at start of bool_and +CALL GRAPH +Calls in [] to main:2 +Calls in [main] to bool_and:5 bool_or:7 bool_not:9 bool_complex:11 + +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Created 4 initial phi equivalence classes +Coalesced [24] bool_complex::i#6 ← bool_complex::i#1 +Coalesced [36] bool_not::i#6 ← bool_not::i#1 +Coalesced [47] bool_or::i#6 ← bool_or::i#1 +Coalesced [57] bool_and::i#6 ← bool_and::i#1 +Coalesced down to 4 phi equivalence classes +Culled Empty Block (label) bool_complex::@10 +Culled Empty Block (label) bool_not::@8 +Culled Empty Block (label) bool_or::@8 +Culled Empty Block (label) bool_and::@8 +Block Sequence Planned @begin @5 @end main main::@1 main::@2 main::@3 main::@return bool_complex bool_complex::@1 bool_complex::@7 bool_complex::@9 bool_complex::@2 bool_complex::@3 bool_complex::@return bool_complex::@4 bool_complex::@8 bool_not bool_not::@1 bool_not::@7 bool_not::@2 bool_not::@3 bool_not::@return bool_not::@4 bool_or bool_or::@1 bool_or::@7 bool_or::@4 bool_or::@3 bool_or::@return bool_or::@2 bool_and bool_and::@1 bool_and::@4 bool_and::@3 bool_and::@return bool_and::@7 bool_and::@2 +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @5 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of main::@1 +Adding NOP phi() at start of main::@2 +Adding NOP phi() at start of main::@3 +Adding NOP phi() at start of bool_complex +Adding NOP phi() at start of bool_not +Adding NOP phi() at start of bool_or +Adding NOP phi() at start of bool_and +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... +Propagating live ranges... + +FINAL CONTROL FLOW GRAPH +@begin: scope:[] from + [0] phi() [ ] ( ) + to:@5 +@5: scope:[] from @begin + [1] phi() [ ] ( ) + [2] call main param-assignment [ ] ( ) + to:@end +@end: scope:[] from @5 + [3] phi() [ ] ( ) +main: scope:[main] from @5 + [4] phi() [ ] ( main:2 [ ] ) + [5] call bool_and param-assignment [ ] ( main:2 [ ] ) + to:main::@1 +main::@1: scope:[main] from main + [6] phi() [ ] ( main:2 [ ] ) + [7] call bool_or param-assignment [ ] ( main:2 [ ] ) + to:main::@2 +main::@2: scope:[main] from main::@1 + [8] phi() [ ] ( main:2 [ ] ) + [9] call bool_not param-assignment [ ] ( main:2 [ ] ) + to:main::@3 +main::@3: scope:[main] from main::@2 + [10] phi() [ ] ( main:2 [ ] ) + [11] call bool_complex param-assignment [ ] ( main:2 [ ] ) + to:main::@return +main::@return: scope:[main] from main::@3 + [12] return [ ] ( main:2 [ ] ) + to:@return +bool_complex: scope:[bool_complex] from main::@3 + [13] phi() [ ] ( main:2::bool_complex:11 [ ] ) + to:bool_complex::@1 +bool_complex::@1: scope:[bool_complex] from bool_complex bool_complex::@3 + [14] (byte) bool_complex::i#2 ← phi( bool_complex/(byte/signed byte/word/signed word/dword/signed dword) 0 bool_complex::@3/(byte) bool_complex::i#1 ) [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) + [15] (byte~) bool_complex::$1 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$1 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$1 ] ) + [16] (byte~) bool_complex::$5 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ) + [17] if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@8 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ) + to:bool_complex::@7 +bool_complex::@7: scope:[bool_complex] from bool_complex::@1 bool_complex::@8 + [18] if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@4 [ bool_complex::i#2 bool_complex::$5 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$5 ] ) + to:bool_complex::@9 +bool_complex::@9: scope:[bool_complex] from bool_complex::@7 + [19] if((byte~) bool_complex::$5==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@4 [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) + to:bool_complex::@2 +bool_complex::@2: scope:[bool_complex] from bool_complex::@8 bool_complex::@9 + [20] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) '*' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) + to:bool_complex::@3 +bool_complex::@3: scope:[bool_complex] from bool_complex::@2 bool_complex::@4 + [21] (byte) bool_complex::i#1 ← ++ (byte) bool_complex::i#2 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) + [22] if((byte) bool_complex::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_complex::@1 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) + to:bool_complex::@return +bool_complex::@return: scope:[bool_complex] from bool_complex::@3 + [23] return [ ] ( main:2::bool_complex:11 [ ] ) + to:@return +bool_complex::@4: scope:[bool_complex] from bool_complex::@7 bool_complex::@9 + [24] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) ' ' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) + to:bool_complex::@3 +bool_complex::@8: scope:[bool_complex] from bool_complex::@1 + [25] if((byte~) bool_complex::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@2 [ bool_complex::i#2 bool_complex::$5 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$5 ] ) + to:bool_complex::@7 +bool_not: scope:[bool_not] from main::@2 + [26] phi() [ ] ( main:2::bool_not:9 [ ] ) + to:bool_not::@1 +bool_not::@1: scope:[bool_not] from bool_not bool_not::@3 + [27] (byte) bool_not::i#2 ← phi( bool_not/(byte/signed byte/word/signed word/dword/signed dword) 0 bool_not::@3/(byte) bool_not::i#1 ) [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) + [28] (byte~) bool_not::$1 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) + [29] if((byte) bool_not::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_not::@4 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) + to:bool_not::@7 +bool_not::@7: scope:[bool_not] from bool_not::@1 + [30] if((byte~) bool_not::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_not::@4 [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) + to:bool_not::@2 +bool_not::@2: scope:[bool_not] from bool_not::@7 + [31] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) '*' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) + to:bool_not::@3 +bool_not::@3: scope:[bool_not] from bool_not::@2 bool_not::@4 + [32] (byte) bool_not::i#1 ← ++ (byte) bool_not::i#2 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) + [33] if((byte) bool_not::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_not::@1 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) + to:bool_not::@return +bool_not::@return: scope:[bool_not] from bool_not::@3 + [34] return [ ] ( main:2::bool_not:9 [ ] ) + to:@return +bool_not::@4: scope:[bool_not] from bool_not::@1 bool_not::@7 + [35] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) ' ' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) + to:bool_not::@3 +bool_or: scope:[bool_or] from main::@1 + [36] phi() [ ] ( main:2::bool_or:7 [ ] ) + to:bool_or::@1 +bool_or::@1: scope:[bool_or] from bool_or bool_or::@3 + [37] (byte) bool_or::i#2 ← phi( bool_or/(byte/signed byte/word/signed word/dword/signed dword) 0 bool_or::@3/(byte) bool_or::i#1 ) [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) + [38] (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) + [39] if((byte) bool_or::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_or::@2 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) + to:bool_or::@7 +bool_or::@7: scope:[bool_or] from bool_or::@1 + [40] if((byte~) bool_or::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_or::@2 [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) + to:bool_or::@4 +bool_or::@4: scope:[bool_or] from bool_or::@7 + [41] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) ' ' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) + to:bool_or::@3 +bool_or::@3: scope:[bool_or] from bool_or::@2 bool_or::@4 + [42] (byte) bool_or::i#1 ← ++ (byte) bool_or::i#2 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) + [43] if((byte) bool_or::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_or::@1 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) + to:bool_or::@return +bool_or::@return: scope:[bool_or] from bool_or::@3 + [44] return [ ] ( main:2::bool_or:7 [ ] ) + to:@return +bool_or::@2: scope:[bool_or] from bool_or::@1 bool_or::@7 + [45] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) '*' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) + to:bool_or::@3 +bool_and: scope:[bool_and] from main + [46] phi() [ ] ( main:2::bool_and:5 [ ] ) + to:bool_and::@1 +bool_and::@1: scope:[bool_and] from bool_and bool_and::@3 + [47] (byte) bool_and::i#2 ← phi( bool_and/(byte/signed byte/word/signed word/dword/signed dword) 0 bool_and::@3/(byte) bool_and::i#1 ) [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) + [48] (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) + [49] if((byte) bool_and::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_and::@7 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) + to:bool_and::@4 +bool_and::@4: scope:[bool_and] from bool_and::@1 bool_and::@7 + [50] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) ' ' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) + to:bool_and::@3 +bool_and::@3: scope:[bool_and] from bool_and::@2 bool_and::@4 + [51] (byte) bool_and::i#1 ← ++ (byte) bool_and::i#2 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) + [52] if((byte) bool_and::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_and::@1 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) + to:bool_and::@return +bool_and::@return: scope:[bool_and] from bool_and::@3 + [53] return [ ] ( main:2::bool_and:5 [ ] ) + to:@return +bool_and::@7: scope:[bool_and] from bool_and::@1 + [54] if((byte~) bool_and::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_and::@2 [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) + to:bool_and::@4 +bool_and::@2: scope:[bool_and] from bool_and::@7 + [55] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) '*' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) + to:bool_and::@3 + +DOMINATORS +@begin dominated by @begin +@5 dominated by @begin @5 +@end dominated by @end @begin @5 +main dominated by main @begin @5 +main::@1 dominated by main main::@1 @begin @5 +main::@2 dominated by main main::@1 main::@2 @begin @5 +main::@3 dominated by main main::@1 main::@2 main::@3 @begin @5 +main::@return dominated by main::@return main main::@1 main::@2 main::@3 @begin @5 +bool_complex dominated by bool_complex main main::@1 main::@2 main::@3 @begin @5 +bool_complex::@1 dominated by bool_complex main main::@1 main::@2 main::@3 @begin bool_complex::@1 @5 +bool_complex::@7 dominated by bool_complex main main::@1 main::@2 main::@3 @begin bool_complex::@7 bool_complex::@1 @5 +bool_complex::@9 dominated by bool_complex main main::@1 main::@2 main::@3 @begin bool_complex::@7 bool_complex::@9 bool_complex::@1 @5 +bool_complex::@2 dominated by bool_complex main main::@1 main::@2 main::@3 @begin bool_complex::@1 @5 bool_complex::@2 +bool_complex::@3 dominated by bool_complex main main::@1 main::@2 main::@3 @begin bool_complex::@1 @5 bool_complex::@3 +bool_complex::@return dominated by bool_complex main bool_complex::@return main::@1 main::@2 main::@3 @begin bool_complex::@1 @5 bool_complex::@3 +bool_complex::@4 dominated by bool_complex main main::@1 main::@2 main::@3 @begin bool_complex::@7 bool_complex::@1 @5 bool_complex::@4 +bool_complex::@8 dominated by bool_complex main main::@1 main::@2 main::@3 @begin bool_complex::@8 bool_complex::@1 @5 +bool_not dominated by main main::@1 main::@2 @begin bool_not @5 +bool_not::@1 dominated by main main::@1 main::@2 @begin bool_not::@1 bool_not @5 +bool_not::@7 dominated by main main::@1 main::@2 @begin bool_not::@1 bool_not bool_not::@7 @5 +bool_not::@2 dominated by main main::@1 main::@2 @begin bool_not::@1 bool_not bool_not::@7 @5 bool_not::@2 +bool_not::@3 dominated by main main::@1 main::@2 @begin bool_not::@1 bool_not @5 bool_not::@3 +bool_not::@return dominated by main main::@1 main::@2 @begin bool_not::@1 bool_not bool_not::@return @5 bool_not::@3 +bool_not::@4 dominated by main main::@1 main::@2 @begin bool_not::@1 bool_not bool_not::@4 @5 +bool_or dominated by bool_or main main::@1 @begin @5 +bool_or::@1 dominated by bool_or::@1 bool_or main main::@1 @begin @5 +bool_or::@7 dominated by bool_or::@1 bool_or bool_or::@7 main main::@1 @begin @5 +bool_or::@4 dominated by bool_or::@1 bool_or bool_or::@7 bool_or::@4 main main::@1 @begin @5 +bool_or::@3 dominated by bool_or::@3 bool_or::@1 bool_or main main::@1 @begin @5 +bool_or::@return dominated by bool_or::@3 bool_or::@1 bool_or main bool_or::@return main::@1 @begin @5 +bool_or::@2 dominated by bool_or::@2 bool_or::@1 bool_or main main::@1 @begin @5 +bool_and dominated by main bool_and @begin @5 +bool_and::@1 dominated by main bool_and::@1 bool_and @begin @5 +bool_and::@4 dominated by bool_and::@4 main bool_and::@1 bool_and @begin @5 +bool_and::@3 dominated by main bool_and::@3 bool_and::@1 bool_and @begin @5 +bool_and::@return dominated by main bool_and::@3 bool_and::@1 bool_and @begin bool_and::@return @5 +bool_and::@7 dominated by bool_and::@7 main bool_and::@1 bool_and @begin @5 +bool_and::@2 dominated by bool_and::@7 main bool_and::@2 bool_and::@1 bool_and @begin @5 + +NATURAL LOOPS +Found back edge: Loop head: bool_complex::@1 tails: bool_complex::@3 blocks: null +Found back edge: Loop head: bool_not::@1 tails: bool_not::@3 blocks: null +Found back edge: Loop head: bool_or::@1 tails: bool_or::@3 blocks: null +Found back edge: Loop head: bool_and::@1 tails: bool_and::@3 blocks: null +Populated: Loop head: bool_complex::@1 tails: bool_complex::@3 blocks: bool_complex::@3 bool_complex::@2 bool_complex::@4 bool_complex::@8 bool_complex::@9 bool_complex::@7 bool_complex::@1 +Populated: Loop head: bool_not::@1 tails: bool_not::@3 blocks: bool_not::@3 bool_not::@2 bool_not::@4 bool_not::@7 bool_not::@1 +Populated: Loop head: bool_or::@1 tails: bool_or::@3 blocks: bool_or::@3 bool_or::@2 bool_or::@4 bool_or::@1 bool_or::@7 +Populated: Loop head: bool_and::@1 tails: bool_and::@3 blocks: bool_and::@3 bool_and::@2 bool_and::@4 bool_and::@7 bool_and::@1 +Loop head: bool_complex::@1 tails: bool_complex::@3 blocks: bool_complex::@3 bool_complex::@2 bool_complex::@4 bool_complex::@8 bool_complex::@9 bool_complex::@7 bool_complex::@1 +Loop head: bool_not::@1 tails: bool_not::@3 blocks: bool_not::@3 bool_not::@2 bool_not::@4 bool_not::@7 bool_not::@1 +Loop head: bool_or::@1 tails: bool_or::@3 blocks: bool_or::@3 bool_or::@2 bool_or::@4 bool_or::@1 bool_or::@7 +Loop head: bool_and::@1 tails: bool_and::@3 blocks: bool_and::@3 bool_and::@2 bool_and::@4 bool_and::@7 bool_and::@1 + +NATURAL LOOPS WITH DEPTH +Found 0 loops in scope [] +Found 0 loops in scope [main] +Found 1 loops in scope [bool_and] + Loop head: bool_and::@1 tails: bool_and::@3 blocks: bool_and::@3 bool_and::@2 bool_and::@4 bool_and::@7 bool_and::@1 +Found 1 loops in scope [bool_or] + Loop head: bool_or::@1 tails: bool_or::@3 blocks: bool_or::@3 bool_or::@2 bool_or::@4 bool_or::@1 bool_or::@7 +Found 1 loops in scope [bool_not] + Loop head: bool_not::@1 tails: bool_not::@3 blocks: bool_not::@3 bool_not::@2 bool_not::@4 bool_not::@7 bool_not::@1 +Found 1 loops in scope [bool_complex] + Loop head: bool_complex::@1 tails: bool_complex::@3 blocks: bool_complex::@3 bool_complex::@2 bool_complex::@4 bool_complex::@8 bool_complex::@9 bool_complex::@7 bool_complex::@1 +Loop head: bool_complex::@1 tails: bool_complex::@3 blocks: bool_complex::@3 bool_complex::@2 bool_complex::@4 bool_complex::@8 bool_complex::@9 bool_complex::@7 bool_complex::@1 depth: 1 +Loop head: bool_not::@1 tails: bool_not::@3 blocks: bool_not::@3 bool_not::@2 bool_not::@4 bool_not::@7 bool_not::@1 depth: 1 +Loop head: bool_or::@1 tails: bool_or::@3 blocks: bool_or::@3 bool_or::@2 bool_or::@4 bool_or::@1 bool_or::@7 depth: 1 +Loop head: bool_and::@1 tails: bool_and::@3 blocks: bool_and::@3 bool_and::@2 bool_and::@4 bool_and::@7 bool_and::@1 depth: 1 + + +VARIABLE REGISTER WEIGHTS +(void()) bool_and() +(byte~) bool_and::$1 11.0 +(byte) bool_and::i +(byte) bool_and::i#1 16.5 +(byte) bool_and::i#2 11.0 +(byte*) bool_and::screen +(void()) bool_complex() +(byte~) bool_complex::$1 7.333333333333333 +(byte~) bool_complex::$5 5.5 +(byte) bool_complex::i +(byte) bool_complex::i#1 16.5 +(byte) bool_complex::i#2 9.777777777777779 +(byte*) bool_complex::screen +(void()) bool_not() +(byte~) bool_not::$1 11.0 +(byte) bool_not::i +(byte) bool_not::i#1 16.5 +(byte) bool_not::i#2 11.0 +(byte*) bool_not::screen +(void()) bool_or() +(byte~) bool_or::$1 11.0 +(byte) bool_or::i +(byte) bool_or::i#1 16.5 +(byte) bool_or::i#2 11.0 +(byte*) bool_or::screen +(void()) main() + +Initial phi equivalence classes +[ bool_complex::i#2 bool_complex::i#1 ] +[ bool_not::i#2 bool_not::i#1 ] +[ bool_or::i#2 bool_or::i#1 ] +[ bool_and::i#2 bool_and::i#1 ] +Added variable bool_complex::$1 to zero page equivalence class [ bool_complex::$1 ] +Added variable bool_complex::$5 to zero page equivalence class [ bool_complex::$5 ] +Added variable bool_not::$1 to zero page equivalence class [ bool_not::$1 ] +Added variable bool_or::$1 to zero page equivalence class [ bool_or::$1 ] +Added variable bool_and::$1 to zero page equivalence class [ bool_and::$1 ] +Complete equivalence classes +[ bool_complex::i#2 bool_complex::i#1 ] +[ bool_not::i#2 bool_not::i#1 ] +[ bool_or::i#2 bool_or::i#1 ] +[ bool_and::i#2 bool_and::i#1 ] +[ bool_complex::$1 ] +[ bool_complex::$5 ] +[ bool_not::$1 ] +[ bool_or::$1 ] +[ bool_and::$1 ] +Allocated zp ZP_BYTE:2 [ bool_complex::i#2 bool_complex::i#1 ] +Allocated zp ZP_BYTE:3 [ bool_not::i#2 bool_not::i#1 ] +Allocated zp ZP_BYTE:4 [ bool_or::i#2 bool_or::i#1 ] +Allocated zp ZP_BYTE:5 [ bool_and::i#2 bool_and::i#1 ] +Allocated zp ZP_BYTE:6 [ bool_complex::$1 ] +Allocated zp ZP_BYTE:7 [ bool_complex::$5 ] +Allocated zp ZP_BYTE:8 [ bool_not::$1 ] +Allocated zp ZP_BYTE:9 [ bool_or::$1 ] +Allocated zp ZP_BYTE:10 [ bool_and::$1 ] + +INITIAL ASM +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG1 Global Constants & labels +//SEG2 @begin +bbegin: +//SEG3 [1] phi from @begin to @5 [phi:@begin->@5] +b5_from_bbegin: + jmp b5 +//SEG4 @5 +b5: +//SEG5 [2] call main param-assignment [ ] ( ) +//SEG6 [4] phi from @5 to main [phi:@5->main] +main_from_b5: + jsr main +//SEG7 [3] phi from @5 to @end [phi:@5->@end] +bend_from_b5: + jmp bend +//SEG8 @end +bend: +//SEG9 main +main: { + //SEG10 [5] call bool_and param-assignment [ ] ( main:2 [ ] ) + //SEG11 [46] phi from main to bool_and [phi:main->bool_and] + bool_and_from_main: + jsr bool_and + //SEG12 [6] phi from main to main::@1 [phi:main->main::@1] + b1_from_main: + jmp b1 + //SEG13 main::@1 + b1: + //SEG14 [7] call bool_or param-assignment [ ] ( main:2 [ ] ) + //SEG15 [36] phi from main::@1 to bool_or [phi:main::@1->bool_or] + bool_or_from_b1: + jsr bool_or + //SEG16 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + b2_from_b1: + jmp b2 + //SEG17 main::@2 + b2: + //SEG18 [9] call bool_not param-assignment [ ] ( main:2 [ ] ) + //SEG19 [26] phi from main::@2 to bool_not [phi:main::@2->bool_not] + bool_not_from_b2: + jsr bool_not + //SEG20 [10] phi from main::@2 to main::@3 [phi:main::@2->main::@3] + b3_from_b2: + jmp b3 + //SEG21 main::@3 + b3: + //SEG22 [11] call bool_complex param-assignment [ ] ( main:2 [ ] ) + //SEG23 [13] phi from main::@3 to bool_complex [phi:main::@3->bool_complex] + bool_complex_from_b3: + jsr bool_complex + jmp breturn + //SEG24 main::@return + breturn: + //SEG25 [12] return [ ] ( main:2 [ ] ) + rts +} +//SEG26 bool_complex +bool_complex: { + .label screen = $478 + .label _1 = 6 + .label _5 = 7 + .label i = 2 + //SEG27 [14] phi from bool_complex to bool_complex::@1 [phi:bool_complex->bool_complex::@1] + b1_from_bool_complex: + //SEG28 [14] phi (byte) bool_complex::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_complex->bool_complex::@1#0] -- vbuz1=vbuc1 + lda #0 + sta i + jmp b1 + //SEG29 [14] phi from bool_complex::@3 to bool_complex::@1 [phi:bool_complex::@3->bool_complex::@1] + b1_from_b3: + //SEG30 [14] phi (byte) bool_complex::i#2 = (byte) bool_complex::i#1 [phi:bool_complex::@3->bool_complex::@1#0] -- register_copy + jmp b1 + //SEG31 bool_complex::@1 + b1: + //SEG32 [15] (byte~) bool_complex::$1 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$1 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$1 ] ) -- vbuz1=vbuz2_band_vbuc1 + lda #1 + and i + sta _1 + //SEG33 [16] (byte~) bool_complex::$5 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ) -- vbuz1=vbuz2_band_vbuc1 + lda #1 + and i + sta _5 + //SEG34 [17] if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@8 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ) -- vbuz1_lt_vbuc1_then_la1 + lda i + cmp #$a + bcc b8 + jmp b7 + //SEG35 bool_complex::@7 + b7: + //SEG36 [18] if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@4 [ bool_complex::i#2 bool_complex::$5 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$5 ] ) -- vbuz1_lt_vbuc1_then_la1 + lda i + cmp #$a + bcc b4 + jmp b9 + //SEG37 bool_complex::@9 + b9: + //SEG38 [19] if((byte~) bool_complex::$5==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@4 [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- vbuz1_eq_0_then_la1 + lda _5 + beq b4 + jmp b2 + //SEG39 bool_complex::@2 + b2: + //SEG40 [20] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) '*' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 + ldy i + lda #'*' + sta screen,y + jmp b3 + //SEG41 bool_complex::@3 + b3: + //SEG42 [21] (byte) bool_complex::i#1 ← ++ (byte) bool_complex::i#2 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) -- vbuz1=_inc_vbuz1 + inc i + //SEG43 [22] if((byte) bool_complex::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_complex::@1 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) -- vbuz1_neq_vbuc1_then_la1 + lda i + cmp #$15 + bne b1_from_b3 + jmp breturn + //SEG44 bool_complex::@return + breturn: + //SEG45 [23] return [ ] ( main:2::bool_complex:11 [ ] ) + rts + //SEG46 bool_complex::@4 + b4: + //SEG47 [24] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) ' ' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 + ldy i + lda #' ' + sta screen,y + jmp b3 + //SEG48 bool_complex::@8 + b8: + //SEG49 [25] if((byte~) bool_complex::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@2 [ bool_complex::i#2 bool_complex::$5 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$5 ] ) -- vbuz1_eq_0_then_la1 + lda _1 + beq b2 + jmp b7 +} +//SEG50 bool_not +bool_not: { + .label screen = $450 + .label _1 = 8 + .label i = 3 + //SEG51 [27] phi from bool_not to bool_not::@1 [phi:bool_not->bool_not::@1] + b1_from_bool_not: + //SEG52 [27] phi (byte) bool_not::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_not->bool_not::@1#0] -- vbuz1=vbuc1 + lda #0 + sta i + jmp b1 + //SEG53 [27] phi from bool_not::@3 to bool_not::@1 [phi:bool_not::@3->bool_not::@1] + b1_from_b3: + //SEG54 [27] phi (byte) bool_not::i#2 = (byte) bool_not::i#1 [phi:bool_not::@3->bool_not::@1#0] -- register_copy + jmp b1 + //SEG55 bool_not::@1 + b1: + //SEG56 [28] (byte~) bool_not::$1 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) -- vbuz1=vbuz2_band_vbuc1 + lda #1 + and i + sta _1 + //SEG57 [29] if((byte) bool_not::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_not::@4 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) -- vbuz1_lt_vbuc1_then_la1 + lda i + cmp #$a + bcc b4 + jmp b7 + //SEG58 bool_not::@7 + b7: + //SEG59 [30] if((byte~) bool_not::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_not::@4 [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- vbuz1_eq_0_then_la1 + lda _1 + beq b4 + jmp b2 + //SEG60 bool_not::@2 + b2: + //SEG61 [31] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) '*' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 + ldy i + lda #'*' + sta screen,y + jmp b3 + //SEG62 bool_not::@3 + b3: + //SEG63 [32] (byte) bool_not::i#1 ← ++ (byte) bool_not::i#2 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) -- vbuz1=_inc_vbuz1 + inc i + //SEG64 [33] if((byte) bool_not::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_not::@1 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) -- vbuz1_neq_vbuc1_then_la1 + lda i + cmp #$15 + bne b1_from_b3 + jmp breturn + //SEG65 bool_not::@return + breturn: + //SEG66 [34] return [ ] ( main:2::bool_not:9 [ ] ) + rts + //SEG67 bool_not::@4 + b4: + //SEG68 [35] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) ' ' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 + ldy i + lda #' ' + sta screen,y + jmp b3 +} +//SEG69 bool_or +bool_or: { + .label screen = $428 + .label _1 = 9 + .label i = 4 + //SEG70 [37] phi from bool_or to bool_or::@1 [phi:bool_or->bool_or::@1] + b1_from_bool_or: + //SEG71 [37] phi (byte) bool_or::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_or->bool_or::@1#0] -- vbuz1=vbuc1 + lda #0 + sta i + jmp b1 + //SEG72 [37] phi from bool_or::@3 to bool_or::@1 [phi:bool_or::@3->bool_or::@1] + b1_from_b3: + //SEG73 [37] phi (byte) bool_or::i#2 = (byte) bool_or::i#1 [phi:bool_or::@3->bool_or::@1#0] -- register_copy + jmp b1 + //SEG74 bool_or::@1 + b1: + //SEG75 [38] (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) -- vbuz1=vbuz2_band_vbuc1 + lda #1 + and i + sta _1 + //SEG76 [39] if((byte) bool_or::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_or::@2 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) -- vbuz1_lt_vbuc1_then_la1 + lda i + cmp #$a + bcc b2 + jmp b7 + //SEG77 bool_or::@7 + b7: + //SEG78 [40] if((byte~) bool_or::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_or::@2 [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- vbuz1_eq_0_then_la1 + lda _1 + beq b2 + jmp b4 + //SEG79 bool_or::@4 + b4: + //SEG80 [41] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) ' ' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 + ldy i + lda #' ' + sta screen,y + jmp b3 + //SEG81 bool_or::@3 + b3: + //SEG82 [42] (byte) bool_or::i#1 ← ++ (byte) bool_or::i#2 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) -- vbuz1=_inc_vbuz1 + inc i + //SEG83 [43] if((byte) bool_or::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_or::@1 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) -- vbuz1_neq_vbuc1_then_la1 + lda i + cmp #$15 + bne b1_from_b3 + jmp breturn + //SEG84 bool_or::@return + breturn: + //SEG85 [44] return [ ] ( main:2::bool_or:7 [ ] ) + rts + //SEG86 bool_or::@2 + b2: + //SEG87 [45] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) '*' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 + ldy i + lda #'*' + sta screen,y + jmp b3 +} +//SEG88 bool_and +bool_and: { + .label screen = $400 + .label _1 = $a + .label i = 5 + //SEG89 [47] phi from bool_and to bool_and::@1 [phi:bool_and->bool_and::@1] + b1_from_bool_and: + //SEG90 [47] phi (byte) bool_and::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_and->bool_and::@1#0] -- vbuz1=vbuc1 + lda #0 + sta i + jmp b1 + //SEG91 [47] phi from bool_and::@3 to bool_and::@1 [phi:bool_and::@3->bool_and::@1] + b1_from_b3: + //SEG92 [47] phi (byte) bool_and::i#2 = (byte) bool_and::i#1 [phi:bool_and::@3->bool_and::@1#0] -- register_copy + jmp b1 + //SEG93 bool_and::@1 + b1: + //SEG94 [48] (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) -- vbuz1=vbuz2_band_vbuc1 + lda #1 + and i + sta _1 + //SEG95 [49] if((byte) bool_and::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_and::@7 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) -- vbuz1_lt_vbuc1_then_la1 + lda i + cmp #$a + bcc b7 + jmp b4 + //SEG96 bool_and::@4 + b4: + //SEG97 [50] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) ' ' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 + ldy i + lda #' ' + sta screen,y + jmp b3 + //SEG98 bool_and::@3 + b3: + //SEG99 [51] (byte) bool_and::i#1 ← ++ (byte) bool_and::i#2 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) -- vbuz1=_inc_vbuz1 + inc i + //SEG100 [52] if((byte) bool_and::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_and::@1 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) -- vbuz1_neq_vbuc1_then_la1 + lda i + cmp #$15 + bne b1_from_b3 + jmp breturn + //SEG101 bool_and::@return + breturn: + //SEG102 [53] return [ ] ( main:2::bool_and:5 [ ] ) + rts + //SEG103 bool_and::@7 + b7: + //SEG104 [54] if((byte~) bool_and::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_and::@2 [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- vbuz1_eq_0_then_la1 + lda _1 + beq b2 + jmp b4 + //SEG105 bool_and::@2 + b2: + //SEG106 [55] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) '*' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 + ldy i + lda #'*' + sta screen,y + jmp b3 +} + +REGISTER UPLIFT POTENTIAL REGISTERS +Statement [15] (byte~) bool_complex::$1 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$1 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$1 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ bool_complex::i#2 bool_complex::i#1 ] +Statement [16] (byte~) bool_complex::$5 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ bool_complex::$1 ] +Statement [20] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) '*' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) always clobbers reg byte a +Statement [24] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) ' ' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) always clobbers reg byte a +Statement [28] (byte~) bool_not::$1 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ bool_not::i#2 bool_not::i#1 ] +Statement [31] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) '*' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) always clobbers reg byte a +Statement [35] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) ' ' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) always clobbers reg byte a +Statement [38] (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ bool_or::i#2 bool_or::i#1 ] +Statement [41] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) ' ' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) always clobbers reg byte a +Statement [45] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) '*' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) always clobbers reg byte a +Statement [48] (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ bool_and::i#2 bool_and::i#1 ] +Statement [50] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) ' ' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) always clobbers reg byte a +Statement [55] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) '*' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) always clobbers reg byte a +Statement [15] (byte~) bool_complex::$1 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$1 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$1 ] ) always clobbers reg byte a +Statement [16] (byte~) bool_complex::$5 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ) always clobbers reg byte a +Statement [20] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) '*' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) always clobbers reg byte a +Statement [24] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) ' ' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) always clobbers reg byte a +Statement [28] (byte~) bool_not::$1 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) always clobbers reg byte a +Statement [31] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) '*' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) always clobbers reg byte a +Statement [35] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) ' ' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) always clobbers reg byte a +Statement [38] (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) always clobbers reg byte a +Statement [41] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) ' ' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) always clobbers reg byte a +Statement [45] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) '*' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) always clobbers reg byte a +Statement [48] (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) always clobbers reg byte a +Statement [50] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) ' ' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) always clobbers reg byte a +Statement [55] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) '*' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) always clobbers reg byte a +Potential registers zp ZP_BYTE:2 [ bool_complex::i#2 bool_complex::i#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:3 [ bool_not::i#2 bool_not::i#1 ] : zp ZP_BYTE:3 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:4 [ bool_or::i#2 bool_or::i#1 ] : zp ZP_BYTE:4 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:5 [ bool_and::i#2 bool_and::i#1 ] : zp ZP_BYTE:5 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:6 [ bool_complex::$1 ] : zp ZP_BYTE:6 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:7 [ bool_complex::$5 ] : zp ZP_BYTE:7 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:8 [ bool_not::$1 ] : zp ZP_BYTE:8 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:9 [ bool_or::$1 ] : zp ZP_BYTE:9 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:10 [ bool_and::$1 ] : zp ZP_BYTE:10 , reg byte a , reg byte x , reg byte y , + +REGISTER UPLIFT SCOPES +Uplift Scope [bool_complex] 26.28: zp ZP_BYTE:2 [ bool_complex::i#2 bool_complex::i#1 ] 7.33: zp ZP_BYTE:6 [ bool_complex::$1 ] 5.5: zp ZP_BYTE:7 [ bool_complex::$5 ] +Uplift Scope [bool_and] 27.5: zp ZP_BYTE:5 [ bool_and::i#2 bool_and::i#1 ] 11: zp ZP_BYTE:10 [ bool_and::$1 ] +Uplift Scope [bool_or] 27.5: zp ZP_BYTE:4 [ bool_or::i#2 bool_or::i#1 ] 11: zp ZP_BYTE:9 [ bool_or::$1 ] +Uplift Scope [bool_not] 27.5: zp ZP_BYTE:3 [ bool_not::i#2 bool_not::i#1 ] 11: zp ZP_BYTE:8 [ bool_not::$1 ] +Uplift Scope [main] +Uplift Scope [] + +Uplifting [bool_complex] best 3238 combination reg byte y [ bool_complex::i#2 bool_complex::i#1 ] reg byte x [ bool_complex::$1 ] reg byte a [ bool_complex::$5 ] +Uplifting [bool_and] best 3008 combination reg byte x [ bool_and::i#2 bool_and::i#1 ] reg byte a [ bool_and::$1 ] +Uplifting [bool_or] best 2778 combination reg byte x [ bool_or::i#2 bool_or::i#1 ] reg byte a [ bool_or::$1 ] +Uplifting [bool_not] best 2548 combination reg byte x [ bool_not::i#2 bool_not::i#1 ] reg byte a [ bool_not::$1 ] +Uplifting [main] best 2548 combination +Uplifting [] best 2548 combination + +ASSEMBLER BEFORE OPTIMIZATION +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG1 Global Constants & labels +//SEG2 @begin +bbegin: +//SEG3 [1] phi from @begin to @5 [phi:@begin->@5] +b5_from_bbegin: + jmp b5 +//SEG4 @5 +b5: +//SEG5 [2] call main param-assignment [ ] ( ) +//SEG6 [4] phi from @5 to main [phi:@5->main] +main_from_b5: + jsr main +//SEG7 [3] phi from @5 to @end [phi:@5->@end] +bend_from_b5: + jmp bend +//SEG8 @end +bend: +//SEG9 main +main: { + //SEG10 [5] call bool_and param-assignment [ ] ( main:2 [ ] ) + //SEG11 [46] phi from main to bool_and [phi:main->bool_and] + bool_and_from_main: + jsr bool_and + //SEG12 [6] phi from main to main::@1 [phi:main->main::@1] + b1_from_main: + jmp b1 + //SEG13 main::@1 + b1: + //SEG14 [7] call bool_or param-assignment [ ] ( main:2 [ ] ) + //SEG15 [36] phi from main::@1 to bool_or [phi:main::@1->bool_or] + bool_or_from_b1: + jsr bool_or + //SEG16 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + b2_from_b1: + jmp b2 + //SEG17 main::@2 + b2: + //SEG18 [9] call bool_not param-assignment [ ] ( main:2 [ ] ) + //SEG19 [26] phi from main::@2 to bool_not [phi:main::@2->bool_not] + bool_not_from_b2: + jsr bool_not + //SEG20 [10] phi from main::@2 to main::@3 [phi:main::@2->main::@3] + b3_from_b2: + jmp b3 + //SEG21 main::@3 + b3: + //SEG22 [11] call bool_complex param-assignment [ ] ( main:2 [ ] ) + //SEG23 [13] phi from main::@3 to bool_complex [phi:main::@3->bool_complex] + bool_complex_from_b3: + jsr bool_complex + jmp breturn + //SEG24 main::@return + breturn: + //SEG25 [12] return [ ] ( main:2 [ ] ) + rts +} +//SEG26 bool_complex +bool_complex: { + .label screen = $478 + //SEG27 [14] phi from bool_complex to bool_complex::@1 [phi:bool_complex->bool_complex::@1] + b1_from_bool_complex: + //SEG28 [14] phi (byte) bool_complex::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_complex->bool_complex::@1#0] -- vbuyy=vbuc1 + ldy #0 + jmp b1 + //SEG29 [14] phi from bool_complex::@3 to bool_complex::@1 [phi:bool_complex::@3->bool_complex::@1] + b1_from_b3: + //SEG30 [14] phi (byte) bool_complex::i#2 = (byte) bool_complex::i#1 [phi:bool_complex::@3->bool_complex::@1#0] -- register_copy + jmp b1 + //SEG31 bool_complex::@1 + b1: + //SEG32 [15] (byte~) bool_complex::$1 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$1 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$1 ] ) -- vbuxx=vbuyy_band_vbuc1 + tya + and #1 + tax + //SEG33 [16] (byte~) bool_complex::$5 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ) -- vbuaa=vbuyy_band_vbuc1 + tya + and #1 + //SEG34 [17] if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@8 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ) -- vbuyy_lt_vbuc1_then_la1 + cpy #$a + bcc b8 + jmp b7 + //SEG35 bool_complex::@7 + b7: + //SEG36 [18] if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@4 [ bool_complex::i#2 bool_complex::$5 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$5 ] ) -- vbuyy_lt_vbuc1_then_la1 + cpy #$a + bcc b4 + jmp b9 + //SEG37 bool_complex::@9 + b9: + //SEG38 [19] if((byte~) bool_complex::$5==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@4 [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- vbuaa_eq_0_then_la1 + cmp #0 + beq b4 + jmp b2 + //SEG39 bool_complex::@2 + b2: + //SEG40 [20] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) '*' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- pbuc1_derefidx_vbuyy=vbuc2 + lda #'*' + sta screen,y + jmp b3 + //SEG41 bool_complex::@3 + b3: + //SEG42 [21] (byte) bool_complex::i#1 ← ++ (byte) bool_complex::i#2 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) -- vbuyy=_inc_vbuyy + iny + //SEG43 [22] if((byte) bool_complex::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_complex::@1 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) -- vbuyy_neq_vbuc1_then_la1 + cpy #$15 + bne b1_from_b3 + jmp breturn + //SEG44 bool_complex::@return + breturn: + //SEG45 [23] return [ ] ( main:2::bool_complex:11 [ ] ) + rts + //SEG46 bool_complex::@4 + b4: + //SEG47 [24] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) ' ' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- pbuc1_derefidx_vbuyy=vbuc2 + lda #' ' + sta screen,y + jmp b3 + //SEG48 bool_complex::@8 + b8: + //SEG49 [25] if((byte~) bool_complex::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@2 [ bool_complex::i#2 bool_complex::$5 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$5 ] ) -- vbuxx_eq_0_then_la1 + cpx #0 + beq b2 + jmp b7 +} +//SEG50 bool_not +bool_not: { + .label screen = $450 + //SEG51 [27] phi from bool_not to bool_not::@1 [phi:bool_not->bool_not::@1] + b1_from_bool_not: + //SEG52 [27] phi (byte) bool_not::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_not->bool_not::@1#0] -- vbuxx=vbuc1 + ldx #0 + jmp b1 + //SEG53 [27] phi from bool_not::@3 to bool_not::@1 [phi:bool_not::@3->bool_not::@1] + b1_from_b3: + //SEG54 [27] phi (byte) bool_not::i#2 = (byte) bool_not::i#1 [phi:bool_not::@3->bool_not::@1#0] -- register_copy + jmp b1 + //SEG55 bool_not::@1 + b1: + //SEG56 [28] (byte~) bool_not::$1 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) -- vbuaa=vbuxx_band_vbuc1 + txa + and #1 + //SEG57 [29] if((byte) bool_not::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_not::@4 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) -- vbuxx_lt_vbuc1_then_la1 + cpx #$a + bcc b4 + jmp b7 + //SEG58 bool_not::@7 + b7: + //SEG59 [30] if((byte~) bool_not::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_not::@4 [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- vbuaa_eq_0_then_la1 + cmp #0 + beq b4 + jmp b2 + //SEG60 bool_not::@2 + b2: + //SEG61 [31] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) '*' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + lda #'*' + sta screen,x + jmp b3 + //SEG62 bool_not::@3 + b3: + //SEG63 [32] (byte) bool_not::i#1 ← ++ (byte) bool_not::i#2 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) -- vbuxx=_inc_vbuxx + inx + //SEG64 [33] if((byte) bool_not::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_not::@1 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 + cpx #$15 + bne b1_from_b3 + jmp breturn + //SEG65 bool_not::@return + breturn: + //SEG66 [34] return [ ] ( main:2::bool_not:9 [ ] ) + rts + //SEG67 bool_not::@4 + b4: + //SEG68 [35] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) ' ' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + lda #' ' + sta screen,x + jmp b3 +} +//SEG69 bool_or +bool_or: { + .label screen = $428 + //SEG70 [37] phi from bool_or to bool_or::@1 [phi:bool_or->bool_or::@1] + b1_from_bool_or: + //SEG71 [37] phi (byte) bool_or::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_or->bool_or::@1#0] -- vbuxx=vbuc1 + ldx #0 + jmp b1 + //SEG72 [37] phi from bool_or::@3 to bool_or::@1 [phi:bool_or::@3->bool_or::@1] + b1_from_b3: + //SEG73 [37] phi (byte) bool_or::i#2 = (byte) bool_or::i#1 [phi:bool_or::@3->bool_or::@1#0] -- register_copy + jmp b1 + //SEG74 bool_or::@1 + b1: + //SEG75 [38] (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) -- vbuaa=vbuxx_band_vbuc1 + txa + and #1 + //SEG76 [39] if((byte) bool_or::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_or::@2 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) -- vbuxx_lt_vbuc1_then_la1 + cpx #$a + bcc b2 + jmp b7 + //SEG77 bool_or::@7 + b7: + //SEG78 [40] if((byte~) bool_or::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_or::@2 [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- vbuaa_eq_0_then_la1 + cmp #0 + beq b2 + jmp b4 + //SEG79 bool_or::@4 + b4: + //SEG80 [41] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) ' ' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + lda #' ' + sta screen,x + jmp b3 + //SEG81 bool_or::@3 + b3: + //SEG82 [42] (byte) bool_or::i#1 ← ++ (byte) bool_or::i#2 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) -- vbuxx=_inc_vbuxx + inx + //SEG83 [43] if((byte) bool_or::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_or::@1 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 + cpx #$15 + bne b1_from_b3 + jmp breturn + //SEG84 bool_or::@return + breturn: + //SEG85 [44] return [ ] ( main:2::bool_or:7 [ ] ) + rts + //SEG86 bool_or::@2 + b2: + //SEG87 [45] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) '*' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + lda #'*' + sta screen,x + jmp b3 +} +//SEG88 bool_and +bool_and: { + .label screen = $400 + //SEG89 [47] phi from bool_and to bool_and::@1 [phi:bool_and->bool_and::@1] + b1_from_bool_and: + //SEG90 [47] phi (byte) bool_and::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_and->bool_and::@1#0] -- vbuxx=vbuc1 + ldx #0 + jmp b1 + //SEG91 [47] phi from bool_and::@3 to bool_and::@1 [phi:bool_and::@3->bool_and::@1] + b1_from_b3: + //SEG92 [47] phi (byte) bool_and::i#2 = (byte) bool_and::i#1 [phi:bool_and::@3->bool_and::@1#0] -- register_copy + jmp b1 + //SEG93 bool_and::@1 + b1: + //SEG94 [48] (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) -- vbuaa=vbuxx_band_vbuc1 + txa + and #1 + //SEG95 [49] if((byte) bool_and::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_and::@7 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) -- vbuxx_lt_vbuc1_then_la1 + cpx #$a + bcc b7 + jmp b4 + //SEG96 bool_and::@4 + b4: + //SEG97 [50] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) ' ' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + lda #' ' + sta screen,x + jmp b3 + //SEG98 bool_and::@3 + b3: + //SEG99 [51] (byte) bool_and::i#1 ← ++ (byte) bool_and::i#2 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) -- vbuxx=_inc_vbuxx + inx + //SEG100 [52] if((byte) bool_and::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_and::@1 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 + cpx #$15 + bne b1_from_b3 + jmp breturn + //SEG101 bool_and::@return + breturn: + //SEG102 [53] return [ ] ( main:2::bool_and:5 [ ] ) + rts + //SEG103 bool_and::@7 + b7: + //SEG104 [54] if((byte~) bool_and::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_and::@2 [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- vbuaa_eq_0_then_la1 + cmp #0 + beq b2 + jmp b4 + //SEG105 bool_and::@2 + b2: + //SEG106 [55] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) '*' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + lda #'*' + sta screen,x + jmp b3 +} + +ASSEMBLER OPTIMIZATIONS +Removing instruction jmp b5 +Removing instruction jmp bend +Removing instruction jmp b1 +Removing instruction jmp b2 +Removing instruction jmp b3 +Removing instruction jmp breturn +Removing instruction jmp b1 +Removing instruction jmp b7 +Removing instruction jmp b9 +Removing instruction jmp b2 +Removing instruction jmp b3 +Removing instruction jmp breturn +Removing instruction jmp b1 +Removing instruction jmp b7 +Removing instruction jmp b2 +Removing instruction jmp b3 +Removing instruction jmp breturn +Removing instruction jmp b1 +Removing instruction jmp b7 +Removing instruction jmp b4 +Removing instruction jmp b3 +Removing instruction jmp breturn +Removing instruction jmp b1 +Removing instruction jmp b4 +Removing instruction jmp b3 +Removing instruction jmp breturn +Succesful ASM optimization Pass5NextJumpElimination +Replacing label b1_from_b3 with b1 +Replacing label b1_from_b3 with b1 +Replacing label b1_from_b3 with b1 +Replacing label b1_from_b3 with b1 +Removing instruction bbegin: +Removing instruction b5_from_bbegin: +Removing instruction main_from_b5: +Removing instruction bend_from_b5: +Removing instruction b1_from_main: +Removing instruction bool_or_from_b1: +Removing instruction b2_from_b1: +Removing instruction bool_not_from_b2: +Removing instruction b3_from_b2: +Removing instruction bool_complex_from_b3: +Removing instruction b1_from_b3: +Removing instruction b1_from_b3: +Removing instruction b1_from_b3: +Removing instruction b1_from_b3: +Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction b5: +Removing instruction bend: +Removing instruction bool_and_from_main: +Removing instruction b1: +Removing instruction b2: +Removing instruction b3: +Removing instruction breturn: +Removing instruction b1_from_bool_complex: +Removing instruction b9: +Removing instruction breturn: +Removing instruction b1_from_bool_not: +Removing instruction b7: +Removing instruction b2: +Removing instruction breturn: +Removing instruction b1_from_bool_or: +Removing instruction b7: +Removing instruction b4: +Removing instruction breturn: +Removing instruction b1_from_bool_and: +Removing instruction breturn: +Succesful ASM optimization Pass5UnusedLabelElimination +Removing instruction jmp b1 +Removing instruction jmp b1 +Removing instruction jmp b1 +Removing instruction jmp b1 +Succesful ASM optimization Pass5NextJumpElimination + +FINAL SYMBOL TABLE +(label) @5 +(label) @begin +(label) @end +(void()) bool_and() +(byte~) bool_and::$1 reg byte a 11.0 +(label) bool_and::@1 +(label) bool_and::@2 +(label) bool_and::@3 +(label) bool_and::@4 +(label) bool_and::@7 +(label) bool_and::@return +(byte) bool_and::i +(byte) bool_and::i#1 reg byte x 16.5 +(byte) bool_and::i#2 reg byte x 11.0 +(byte*) bool_and::screen +(const byte*) bool_and::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) 1024 +(void()) bool_complex() +(byte~) bool_complex::$1 reg byte x 7.333333333333333 +(byte~) bool_complex::$5 reg byte a 5.5 +(label) bool_complex::@1 +(label) bool_complex::@2 +(label) bool_complex::@3 +(label) bool_complex::@4 +(label) bool_complex::@7 +(label) bool_complex::@8 +(label) bool_complex::@9 +(label) bool_complex::@return +(byte) bool_complex::i +(byte) bool_complex::i#1 reg byte y 16.5 +(byte) bool_complex::i#2 reg byte y 9.777777777777779 +(byte*) bool_complex::screen +(const byte*) bool_complex::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) 1144 +(void()) bool_not() +(byte~) bool_not::$1 reg byte a 11.0 +(label) bool_not::@1 +(label) bool_not::@2 +(label) bool_not::@3 +(label) bool_not::@4 +(label) bool_not::@7 +(label) bool_not::@return +(byte) bool_not::i +(byte) bool_not::i#1 reg byte x 16.5 +(byte) bool_not::i#2 reg byte x 11.0 +(byte*) bool_not::screen +(const byte*) bool_not::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) 1104 +(void()) bool_or() +(byte~) bool_or::$1 reg byte a 11.0 +(label) bool_or::@1 +(label) bool_or::@2 +(label) bool_or::@3 +(label) bool_or::@4 +(label) bool_or::@7 +(label) bool_or::@return +(byte) bool_or::i +(byte) bool_or::i#1 reg byte x 16.5 +(byte) bool_or::i#2 reg byte x 11.0 +(byte*) bool_or::screen +(const byte*) bool_or::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) 1064 +(void()) main() +(label) main::@1 +(label) main::@2 +(label) main::@3 +(label) main::@return + +reg byte y [ bool_complex::i#2 bool_complex::i#1 ] +reg byte x [ bool_not::i#2 bool_not::i#1 ] +reg byte x [ bool_or::i#2 bool_or::i#1 ] +reg byte x [ bool_and::i#2 bool_and::i#1 ] +reg byte x [ bool_complex::$1 ] +reg byte a [ bool_complex::$5 ] +reg byte a [ bool_not::$1 ] +reg byte a [ bool_or::$1 ] +reg byte a [ bool_and::$1 ] + + +FINAL ASSEMBLER +Score: 1810 + +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG1 Global Constants & labels +//SEG2 @begin +//SEG3 [1] phi from @begin to @5 [phi:@begin->@5] +//SEG4 @5 +//SEG5 [2] call main param-assignment [ ] ( ) +//SEG6 [4] phi from @5 to main [phi:@5->main] + jsr main +//SEG7 [3] phi from @5 to @end [phi:@5->@end] +//SEG8 @end +//SEG9 main +main: { + //SEG10 [5] call bool_and param-assignment [ ] ( main:2 [ ] ) + //SEG11 [46] phi from main to bool_and [phi:main->bool_and] + jsr bool_and + //SEG12 [6] phi from main to main::@1 [phi:main->main::@1] + //SEG13 main::@1 + //SEG14 [7] call bool_or param-assignment [ ] ( main:2 [ ] ) + //SEG15 [36] phi from main::@1 to bool_or [phi:main::@1->bool_or] + jsr bool_or + //SEG16 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + //SEG17 main::@2 + //SEG18 [9] call bool_not param-assignment [ ] ( main:2 [ ] ) + //SEG19 [26] phi from main::@2 to bool_not [phi:main::@2->bool_not] + jsr bool_not + //SEG20 [10] phi from main::@2 to main::@3 [phi:main::@2->main::@3] + //SEG21 main::@3 + //SEG22 [11] call bool_complex param-assignment [ ] ( main:2 [ ] ) + //SEG23 [13] phi from main::@3 to bool_complex [phi:main::@3->bool_complex] + jsr bool_complex + //SEG24 main::@return + //SEG25 [12] return [ ] ( main:2 [ ] ) + rts +} +//SEG26 bool_complex +bool_complex: { + .label screen = $478 + //SEG27 [14] phi from bool_complex to bool_complex::@1 [phi:bool_complex->bool_complex::@1] + //SEG28 [14] phi (byte) bool_complex::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_complex->bool_complex::@1#0] -- vbuyy=vbuc1 + ldy #0 + //SEG29 [14] phi from bool_complex::@3 to bool_complex::@1 [phi:bool_complex::@3->bool_complex::@1] + //SEG30 [14] phi (byte) bool_complex::i#2 = (byte) bool_complex::i#1 [phi:bool_complex::@3->bool_complex::@1#0] -- register_copy + //SEG31 bool_complex::@1 + b1: + //SEG32 [15] (byte~) bool_complex::$1 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$1 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$1 ] ) -- vbuxx=vbuyy_band_vbuc1 + tya + and #1 + tax + //SEG33 [16] (byte~) bool_complex::$5 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ) -- vbuaa=vbuyy_band_vbuc1 + tya + and #1 + //SEG34 [17] if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@8 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$1 bool_complex::$5 ] ) -- vbuyy_lt_vbuc1_then_la1 + cpy #$a + bcc b8 + //SEG35 bool_complex::@7 + b7: + //SEG36 [18] if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@4 [ bool_complex::i#2 bool_complex::$5 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$5 ] ) -- vbuyy_lt_vbuc1_then_la1 + cpy #$a + bcc b4 + //SEG37 bool_complex::@9 + //SEG38 [19] if((byte~) bool_complex::$5==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@4 [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- vbuaa_eq_0_then_la1 + cmp #0 + beq b4 + //SEG39 bool_complex::@2 + b2: + //SEG40 [20] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) '*' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- pbuc1_derefidx_vbuyy=vbuc2 + lda #'*' + sta screen,y + //SEG41 bool_complex::@3 + b3: + //SEG42 [21] (byte) bool_complex::i#1 ← ++ (byte) bool_complex::i#2 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) -- vbuyy=_inc_vbuyy + iny + //SEG43 [22] if((byte) bool_complex::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_complex::@1 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) -- vbuyy_neq_vbuc1_then_la1 + cpy #$15 + bne b1 + //SEG44 bool_complex::@return + //SEG45 [23] return [ ] ( main:2::bool_complex:11 [ ] ) + rts + //SEG46 bool_complex::@4 + b4: + //SEG47 [24] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) ' ' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- pbuc1_derefidx_vbuyy=vbuc2 + lda #' ' + sta screen,y + jmp b3 + //SEG48 bool_complex::@8 + b8: + //SEG49 [25] if((byte~) bool_complex::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@2 [ bool_complex::i#2 bool_complex::$5 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$5 ] ) -- vbuxx_eq_0_then_la1 + cpx #0 + beq b2 + jmp b7 +} +//SEG50 bool_not +bool_not: { + .label screen = $450 + //SEG51 [27] phi from bool_not to bool_not::@1 [phi:bool_not->bool_not::@1] + //SEG52 [27] phi (byte) bool_not::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_not->bool_not::@1#0] -- vbuxx=vbuc1 + ldx #0 + //SEG53 [27] phi from bool_not::@3 to bool_not::@1 [phi:bool_not::@3->bool_not::@1] + //SEG54 [27] phi (byte) bool_not::i#2 = (byte) bool_not::i#1 [phi:bool_not::@3->bool_not::@1#0] -- register_copy + //SEG55 bool_not::@1 + b1: + //SEG56 [28] (byte~) bool_not::$1 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) -- vbuaa=vbuxx_band_vbuc1 + txa + and #1 + //SEG57 [29] if((byte) bool_not::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_not::@4 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) -- vbuxx_lt_vbuc1_then_la1 + cpx #$a + bcc b4 + //SEG58 bool_not::@7 + //SEG59 [30] if((byte~) bool_not::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_not::@4 [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- vbuaa_eq_0_then_la1 + cmp #0 + beq b4 + //SEG60 bool_not::@2 + //SEG61 [31] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) '*' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + lda #'*' + sta screen,x + //SEG62 bool_not::@3 + b3: + //SEG63 [32] (byte) bool_not::i#1 ← ++ (byte) bool_not::i#2 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) -- vbuxx=_inc_vbuxx + inx + //SEG64 [33] if((byte) bool_not::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_not::@1 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 + cpx #$15 + bne b1 + //SEG65 bool_not::@return + //SEG66 [34] return [ ] ( main:2::bool_not:9 [ ] ) + rts + //SEG67 bool_not::@4 + b4: + //SEG68 [35] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) ' ' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + lda #' ' + sta screen,x + jmp b3 +} +//SEG69 bool_or +bool_or: { + .label screen = $428 + //SEG70 [37] phi from bool_or to bool_or::@1 [phi:bool_or->bool_or::@1] + //SEG71 [37] phi (byte) bool_or::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_or->bool_or::@1#0] -- vbuxx=vbuc1 + ldx #0 + //SEG72 [37] phi from bool_or::@3 to bool_or::@1 [phi:bool_or::@3->bool_or::@1] + //SEG73 [37] phi (byte) bool_or::i#2 = (byte) bool_or::i#1 [phi:bool_or::@3->bool_or::@1#0] -- register_copy + //SEG74 bool_or::@1 + b1: + //SEG75 [38] (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) -- vbuaa=vbuxx_band_vbuc1 + txa + and #1 + //SEG76 [39] if((byte) bool_or::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_or::@2 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) -- vbuxx_lt_vbuc1_then_la1 + cpx #$a + bcc b2 + //SEG77 bool_or::@7 + //SEG78 [40] if((byte~) bool_or::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_or::@2 [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- vbuaa_eq_0_then_la1 + cmp #0 + beq b2 + //SEG79 bool_or::@4 + //SEG80 [41] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) ' ' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + lda #' ' + sta screen,x + //SEG81 bool_or::@3 + b3: + //SEG82 [42] (byte) bool_or::i#1 ← ++ (byte) bool_or::i#2 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) -- vbuxx=_inc_vbuxx + inx + //SEG83 [43] if((byte) bool_or::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_or::@1 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 + cpx #$15 + bne b1 + //SEG84 bool_or::@return + //SEG85 [44] return [ ] ( main:2::bool_or:7 [ ] ) + rts + //SEG86 bool_or::@2 + b2: + //SEG87 [45] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) '*' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + lda #'*' + sta screen,x + jmp b3 +} +//SEG88 bool_and +bool_and: { + .label screen = $400 + //SEG89 [47] phi from bool_and to bool_and::@1 [phi:bool_and->bool_and::@1] + //SEG90 [47] phi (byte) bool_and::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_and->bool_and::@1#0] -- vbuxx=vbuc1 + ldx #0 + //SEG91 [47] phi from bool_and::@3 to bool_and::@1 [phi:bool_and::@3->bool_and::@1] + //SEG92 [47] phi (byte) bool_and::i#2 = (byte) bool_and::i#1 [phi:bool_and::@3->bool_and::@1#0] -- register_copy + //SEG93 bool_and::@1 + b1: + //SEG94 [48] (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) -- vbuaa=vbuxx_band_vbuc1 + txa + and #1 + //SEG95 [49] if((byte) bool_and::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_and::@7 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) -- vbuxx_lt_vbuc1_then_la1 + cpx #$a + bcc b7 + //SEG96 bool_and::@4 + b4: + //SEG97 [50] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) ' ' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + lda #' ' + sta screen,x + //SEG98 bool_and::@3 + b3: + //SEG99 [51] (byte) bool_and::i#1 ← ++ (byte) bool_and::i#2 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) -- vbuxx=_inc_vbuxx + inx + //SEG100 [52] if((byte) bool_and::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_and::@1 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 + cpx #$15 + bne b1 + //SEG101 bool_and::@return + //SEG102 [53] return [ ] ( main:2::bool_and:5 [ ] ) + rts + //SEG103 bool_and::@7 + b7: + //SEG104 [54] if((byte~) bool_and::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_and::@2 [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- vbuaa_eq_0_then_la1 + cmp #0 + beq b2 + jmp b4 + //SEG105 bool_and::@2 + b2: + //SEG106 [55] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) '*' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + lda #'*' + sta screen,x + jmp b3 +} + diff --git a/src/test/java/dk/camelot64/kickc/test/ref/bool-ifs.sym b/src/test/java/dk/camelot64/kickc/test/ref/bool-ifs.sym new file mode 100644 index 000000000..244458d71 --- /dev/null +++ b/src/test/java/dk/camelot64/kickc/test/ref/bool-ifs.sym @@ -0,0 +1,73 @@ +(label) @5 +(label) @begin +(label) @end +(void()) bool_and() +(byte~) bool_and::$1 reg byte a 11.0 +(label) bool_and::@1 +(label) bool_and::@2 +(label) bool_and::@3 +(label) bool_and::@4 +(label) bool_and::@7 +(label) bool_and::@return +(byte) bool_and::i +(byte) bool_and::i#1 reg byte x 16.5 +(byte) bool_and::i#2 reg byte x 11.0 +(byte*) bool_and::screen +(const byte*) bool_and::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) 1024 +(void()) bool_complex() +(byte~) bool_complex::$1 reg byte x 7.333333333333333 +(byte~) bool_complex::$5 reg byte a 5.5 +(label) bool_complex::@1 +(label) bool_complex::@2 +(label) bool_complex::@3 +(label) bool_complex::@4 +(label) bool_complex::@7 +(label) bool_complex::@8 +(label) bool_complex::@9 +(label) bool_complex::@return +(byte) bool_complex::i +(byte) bool_complex::i#1 reg byte y 16.5 +(byte) bool_complex::i#2 reg byte y 9.777777777777779 +(byte*) bool_complex::screen +(const byte*) bool_complex::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) 1144 +(void()) bool_not() +(byte~) bool_not::$1 reg byte a 11.0 +(label) bool_not::@1 +(label) bool_not::@2 +(label) bool_not::@3 +(label) bool_not::@4 +(label) bool_not::@7 +(label) bool_not::@return +(byte) bool_not::i +(byte) bool_not::i#1 reg byte x 16.5 +(byte) bool_not::i#2 reg byte x 11.0 +(byte*) bool_not::screen +(const byte*) bool_not::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) 1104 +(void()) bool_or() +(byte~) bool_or::$1 reg byte a 11.0 +(label) bool_or::@1 +(label) bool_or::@2 +(label) bool_or::@3 +(label) bool_or::@4 +(label) bool_or::@7 +(label) bool_or::@return +(byte) bool_or::i +(byte) bool_or::i#1 reg byte x 16.5 +(byte) bool_or::i#2 reg byte x 11.0 +(byte*) bool_or::screen +(const byte*) bool_or::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) 1064 +(void()) main() +(label) main::@1 +(label) main::@2 +(label) main::@3 +(label) main::@return + +reg byte y [ bool_complex::i#2 bool_complex::i#1 ] +reg byte x [ bool_not::i#2 bool_not::i#1 ] +reg byte x [ bool_or::i#2 bool_or::i#1 ] +reg byte x [ bool_and::i#2 bool_and::i#1 ] +reg byte x [ bool_complex::$1 ] +reg byte a [ bool_complex::$5 ] +reg byte a [ bool_not::$1 ] +reg byte a [ bool_or::$1 ] +reg byte a [ bool_and::$1 ] diff --git a/src/test/java/dk/camelot64/kickc/test/ref/bool-vars.asm b/src/test/java/dk/camelot64/kickc/test/ref/bool-vars.asm index d4569c203..7d8ed63ba 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/bool-vars.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/bool-vars.asm @@ -11,35 +11,49 @@ main: { } bool_complex: { .label screen = $478 - ldy #0 + .label o1 = 2 + .label o2 = 3 + ldx #0 b1: - tya + cpx #$a + lda #0 + rol + eor #1 + sta o1 + txa and #1 - tax - tya - and #1 - cpy #$a - bcc b8 - b7: - cpy #$a - bcc b4 cmp #0 - beq b4 + beq !+ + lda #1 + !: + eor #1 + sta o2 + lda o1 + cmp #0 + bne b8 + b7: + lda o1 + cmp #0 + bne b4 + lda o2 + cmp #0 + bne b4 b2: lda #'*' - sta screen,y + sta screen,x b3: - iny - cpy #$15 + inx + cpx #$15 bne b1 rts b4: lda #' ' - sta screen,y + sta screen,x jmp b3 b8: - cpx #0 - beq b2 + lda o2 + cmp #0 + bne b2 jmp b7 } bool_not: { diff --git a/src/test/java/dk/camelot64/kickc/test/ref/bool-vars.cfg b/src/test/java/dk/camelot64/kickc/test/ref/bool-vars.cfg index bb636965d..0c88324fb 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/bool-vars.cfg +++ b/src/test/java/dk/camelot64/kickc/test/ref/bool-vars.cfg @@ -31,101 +31,102 @@ bool_complex: scope:[bool_complex] from main::@3 to:bool_complex::@1 bool_complex::@1: scope:[bool_complex] from bool_complex bool_complex::@3 [14] (byte) bool_complex::i#2 ← phi( bool_complex/(byte/signed byte/word/signed word/dword/signed dword) 0 bool_complex::@3/(byte) bool_complex::i#1 ) [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) - [15] (byte~) bool_complex::$3 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$3 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$3 ] ) - [16] (byte~) bool_complex::$7 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ) - [17] if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@8 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ) + [15] (boolean) bool_complex::o1#0 ← (byte) bool_complex::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10 [ bool_complex::i#2 bool_complex::o1#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 ] ) + [16] (byte~) bool_complex::$1 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::$1 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::$1 ] ) + [17] (boolean) bool_complex::o2#0 ← (byte~) bool_complex::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ) + [18] if((boolean) bool_complex::o1#0) goto bool_complex::@8 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ) to:bool_complex::@7 bool_complex::@7: scope:[bool_complex] from bool_complex::@1 bool_complex::@8 - [18] if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@4 [ bool_complex::i#2 bool_complex::$7 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$7 ] ) + [19] if((boolean) bool_complex::o1#0) goto bool_complex::@4 [ bool_complex::i#2 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o2#0 ] ) to:bool_complex::@9 bool_complex::@9: scope:[bool_complex] from bool_complex::@7 - [19] if((byte~) bool_complex::$7==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@4 [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) + [20] if((boolean) bool_complex::o2#0) goto bool_complex::@4 [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) to:bool_complex::@2 bool_complex::@2: scope:[bool_complex] from bool_complex::@8 bool_complex::@9 - [20] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) '*' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) + [21] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) '*' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) to:bool_complex::@3 bool_complex::@3: scope:[bool_complex] from bool_complex::@2 bool_complex::@4 - [21] (byte) bool_complex::i#1 ← ++ (byte) bool_complex::i#2 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) - [22] if((byte) bool_complex::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_complex::@1 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) + [22] (byte) bool_complex::i#1 ← ++ (byte) bool_complex::i#2 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) + [23] if((byte) bool_complex::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_complex::@1 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) to:bool_complex::@return bool_complex::@return: scope:[bool_complex] from bool_complex::@3 - [23] return [ ] ( main:2::bool_complex:11 [ ] ) + [24] return [ ] ( main:2::bool_complex:11 [ ] ) to:@return bool_complex::@4: scope:[bool_complex] from bool_complex::@7 bool_complex::@9 - [24] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) ' ' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) + [25] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) ' ' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) to:bool_complex::@3 bool_complex::@8: scope:[bool_complex] from bool_complex::@1 - [25] if((byte~) bool_complex::$3==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@2 [ bool_complex::i#2 bool_complex::$7 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$7 ] ) + [26] if((boolean) bool_complex::o2#0) goto bool_complex::@2 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ) to:bool_complex::@7 bool_not: scope:[bool_not] from main::@2 - [26] phi() [ ] ( main:2::bool_not:9 [ ] ) + [27] phi() [ ] ( main:2::bool_not:9 [ ] ) to:bool_not::@1 bool_not::@1: scope:[bool_not] from bool_not bool_not::@3 - [27] (byte) bool_not::i#2 ← phi( bool_not/(byte/signed byte/word/signed word/dword/signed dword) 0 bool_not::@3/(byte) bool_not::i#1 ) [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) - [28] (byte~) bool_not::$3 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_not::i#2 bool_not::$3 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$3 ] ) - [29] if((byte) bool_not::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_not::@4 [ bool_not::i#2 bool_not::$3 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$3 ] ) + [28] (byte) bool_not::i#2 ← phi( bool_not/(byte/signed byte/word/signed word/dword/signed dword) 0 bool_not::@3/(byte) bool_not::i#1 ) [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) + [29] (byte~) bool_not::$1 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) + [30] if((byte) bool_not::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_not::@4 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) to:bool_not::@7 bool_not::@7: scope:[bool_not] from bool_not::@1 - [30] if((byte~) bool_not::$3==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_not::@4 [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) + [31] if((byte~) bool_not::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_not::@4 [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) to:bool_not::@2 bool_not::@2: scope:[bool_not] from bool_not::@7 - [31] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) '*' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) + [32] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) '*' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) to:bool_not::@3 bool_not::@3: scope:[bool_not] from bool_not::@2 bool_not::@4 - [32] (byte) bool_not::i#1 ← ++ (byte) bool_not::i#2 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) - [33] if((byte) bool_not::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_not::@1 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) + [33] (byte) bool_not::i#1 ← ++ (byte) bool_not::i#2 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) + [34] if((byte) bool_not::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_not::@1 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) to:bool_not::@return bool_not::@return: scope:[bool_not] from bool_not::@3 - [34] return [ ] ( main:2::bool_not:9 [ ] ) + [35] return [ ] ( main:2::bool_not:9 [ ] ) to:@return bool_not::@4: scope:[bool_not] from bool_not::@1 bool_not::@7 - [35] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) ' ' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) + [36] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) ' ' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) to:bool_not::@3 bool_or: scope:[bool_or] from main::@1 - [36] phi() [ ] ( main:2::bool_or:7 [ ] ) + [37] phi() [ ] ( main:2::bool_or:7 [ ] ) to:bool_or::@1 bool_or::@1: scope:[bool_or] from bool_or bool_or::@3 - [37] (byte) bool_or::i#2 ← phi( bool_or/(byte/signed byte/word/signed word/dword/signed dword) 0 bool_or::@3/(byte) bool_or::i#1 ) [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) - [38] (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) - [39] if((byte) bool_or::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_or::@2 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) + [38] (byte) bool_or::i#2 ← phi( bool_or/(byte/signed byte/word/signed word/dword/signed dword) 0 bool_or::@3/(byte) bool_or::i#1 ) [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) + [39] (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) + [40] if((byte) bool_or::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_or::@2 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) to:bool_or::@7 bool_or::@7: scope:[bool_or] from bool_or::@1 - [40] if((byte~) bool_or::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_or::@2 [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) + [41] if((byte~) bool_or::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_or::@2 [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) to:bool_or::@4 bool_or::@4: scope:[bool_or] from bool_or::@7 - [41] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) ' ' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) + [42] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) ' ' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) to:bool_or::@3 bool_or::@3: scope:[bool_or] from bool_or::@2 bool_or::@4 - [42] (byte) bool_or::i#1 ← ++ (byte) bool_or::i#2 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) - [43] if((byte) bool_or::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_or::@1 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) + [43] (byte) bool_or::i#1 ← ++ (byte) bool_or::i#2 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) + [44] if((byte) bool_or::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_or::@1 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) to:bool_or::@return bool_or::@return: scope:[bool_or] from bool_or::@3 - [44] return [ ] ( main:2::bool_or:7 [ ] ) + [45] return [ ] ( main:2::bool_or:7 [ ] ) to:@return bool_or::@2: scope:[bool_or] from bool_or::@1 bool_or::@7 - [45] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) '*' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) + [46] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) '*' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) to:bool_or::@3 bool_and: scope:[bool_and] from main - [46] phi() [ ] ( main:2::bool_and:5 [ ] ) + [47] phi() [ ] ( main:2::bool_and:5 [ ] ) to:bool_and::@1 bool_and::@1: scope:[bool_and] from bool_and bool_and::@3 - [47] (byte) bool_and::i#2 ← phi( bool_and/(byte/signed byte/word/signed word/dword/signed dword) 0 bool_and::@3/(byte) bool_and::i#1 ) [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) - [48] (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) - [49] if((byte) bool_and::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_and::@7 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) + [48] (byte) bool_and::i#2 ← phi( bool_and/(byte/signed byte/word/signed word/dword/signed dword) 0 bool_and::@3/(byte) bool_and::i#1 ) [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) + [49] (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) + [50] if((byte) bool_and::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_and::@7 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) to:bool_and::@4 bool_and::@4: scope:[bool_and] from bool_and::@1 bool_and::@7 - [50] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) ' ' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) + [51] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) ' ' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) to:bool_and::@3 bool_and::@3: scope:[bool_and] from bool_and::@2 bool_and::@4 - [51] (byte) bool_and::i#1 ← ++ (byte) bool_and::i#2 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) - [52] if((byte) bool_and::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_and::@1 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) + [52] (byte) bool_and::i#1 ← ++ (byte) bool_and::i#2 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) + [53] if((byte) bool_and::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_and::@1 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) to:bool_and::@return bool_and::@return: scope:[bool_and] from bool_and::@3 - [53] return [ ] ( main:2::bool_and:5 [ ] ) + [54] return [ ] ( main:2::bool_and:5 [ ] ) to:@return bool_and::@7: scope:[bool_and] from bool_and::@1 - [54] if((byte~) bool_and::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_and::@2 [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) + [55] if((byte~) bool_and::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_and::@2 [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) to:bool_and::@4 bool_and::@2: scope:[bool_and] from bool_and::@7 - [55] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) '*' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) + [56] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) '*' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) to:bool_and::@3 diff --git a/src/test/java/dk/camelot64/kickc/test/ref/bool-vars.log b/src/test/java/dk/camelot64/kickc/test/ref/bool-vars.log index a13f3c56d..1100671da 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/bool-vars.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/bool-vars.log @@ -11,7 +11,10 @@ void main() { void bool_and() { const byte* screen = $400; for( byte i : 0..20) { - if( (i<10) && ((i&1)==0) ) { + boolean o1 = (i<10); + boolean o2 = ((i&1)==0); + boolean o3 = o1 && o2; + if(o3) { screen[i] = '*'; } else { screen[i] = ' '; @@ -22,7 +25,10 @@ void bool_and() { void bool_or() { const byte* screen = $428; for( byte i : 0..20) { - if( (i<10) || ((i&1)==0) ) { + boolean o1 = (i<10); + boolean o2 = ((i&1)==0); + boolean o3 = o1 || o2; + if(o3) { screen[i] = '*'; } else { screen[i] = ' '; @@ -33,8 +39,10 @@ void bool_or() { void bool_not() { const byte* screen = $450; for( byte i : 0..20) { - boolean o1 = (i&1)==0; - if( !((i<10) || ((i&1)==0)) ) { + boolean o1 = (i<10); + boolean o2 = (i&1)==0; + boolean o3 = !( o1 || o2); + if(o3) { screen[i] = '*'; } else { screen[i] = ' '; @@ -45,8 +53,12 @@ void bool_not() { void bool_complex() { const byte* screen = $478; for( byte i : 0..20) { - boolean o1 = (i&1)==0; - if( ((i<10) && ((i&1)==0)) || !((i<10) || ((i&1)==0)) ) { + boolean o1 = (i<10); + boolean o2 = (i&1)==0; + boolean o3 = (o1 && o2); + boolean o4 = !(o1 || o2); + boolean o5 = o3 || o4; + if( o5 ) { screen[i] = '*'; } else { screen[i] = ' '; @@ -76,21 +88,19 @@ SYMBOLS (label) bool_and::@6 (label) bool_and::@return (byte) bool_and::i +(boolean) bool_and::o1 +(boolean) bool_and::o2 +(boolean) bool_and::o3 (byte*) bool_and::screen (void()) bool_complex() -(byte~) bool_complex::$0 -(boolean~) bool_complex::$1 -(boolean~) bool_complex::$10 -(boolean~) bool_complex::$11 -(boolean~) bool_complex::$12 +(boolean~) bool_complex::$0 +(byte~) bool_complex::$1 (boolean~) bool_complex::$2 -(byte~) bool_complex::$3 +(boolean~) bool_complex::$3 (boolean~) bool_complex::$4 (boolean~) bool_complex::$5 (boolean~) bool_complex::$6 -(byte~) bool_complex::$7 -(boolean~) bool_complex::$8 -(boolean~) bool_complex::$9 +(boolean~) bool_complex::$7 (label) bool_complex::@1 (label) bool_complex::@2 (label) bool_complex::@3 @@ -100,16 +110,18 @@ SYMBOLS (label) bool_complex::@return (byte) bool_complex::i (boolean) bool_complex::o1 +(boolean) bool_complex::o2 +(boolean) bool_complex::o3 +(boolean) bool_complex::o4 +(boolean) bool_complex::o5 (byte*) bool_complex::screen (void()) bool_not() -(byte~) bool_not::$0 -(boolean~) bool_not::$1 +(boolean~) bool_not::$0 +(byte~) bool_not::$1 (boolean~) bool_not::$2 -(byte~) bool_not::$3 +(boolean~) bool_not::$3 (boolean~) bool_not::$4 (boolean~) bool_not::$5 -(boolean~) bool_not::$6 -(boolean~) bool_not::$7 (label) bool_not::@1 (label) bool_not::@2 (label) bool_not::@3 @@ -119,6 +131,8 @@ SYMBOLS (label) bool_not::@return (byte) bool_not::i (boolean) bool_not::o1 +(boolean) bool_not::o2 +(boolean) bool_not::o3 (byte*) bool_not::screen (void()) bool_or() (boolean~) bool_or::$0 @@ -134,6 +148,9 @@ SYMBOLS (label) bool_or::@6 (label) bool_or::@return (byte) bool_or::i +(boolean) bool_or::o1 +(boolean) bool_or::o2 +(boolean) bool_or::o3 (byte*) bool_or::screen (void()) main() (void~) main::$0 @@ -166,10 +183,13 @@ bool_and: scope:[bool_and] from to:bool_and::@1 bool_and::@1: scope:[bool_and] from bool_and bool_and::@3 (boolean~) bool_and::$0 ← (byte) bool_and::i < (byte/signed byte/word/signed word/dword/signed dword) 10 + (boolean) bool_and::o1 ← (boolean~) bool_and::$0 (byte~) bool_and::$1 ← (byte) bool_and::i & (byte/signed byte/word/signed word/dword/signed dword) 1 (boolean~) bool_and::$2 ← (byte~) bool_and::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 - (boolean~) bool_and::$3 ← (boolean~) bool_and::$0 && (boolean~) bool_and::$2 - if((boolean~) bool_and::$3) goto bool_and::@2 + (boolean) bool_and::o2 ← (boolean~) bool_and::$2 + (boolean~) bool_and::$3 ← (boolean) bool_and::o1 && (boolean) bool_and::o2 + (boolean) bool_and::o3 ← (boolean~) bool_and::$3 + if((boolean) bool_and::o3) goto bool_and::@2 to:bool_and::@4 bool_and::@2: scope:[bool_and] from bool_and::@1 bool_and::@5 *((byte*) bool_and::screen + (byte) bool_and::i) ← (byte) '*' @@ -197,10 +217,13 @@ bool_or: scope:[bool_or] from to:bool_or::@1 bool_or::@1: scope:[bool_or] from bool_or bool_or::@3 (boolean~) bool_or::$0 ← (byte) bool_or::i < (byte/signed byte/word/signed word/dword/signed dword) 10 + (boolean) bool_or::o1 ← (boolean~) bool_or::$0 (byte~) bool_or::$1 ← (byte) bool_or::i & (byte/signed byte/word/signed word/dword/signed dword) 1 (boolean~) bool_or::$2 ← (byte~) bool_or::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 - (boolean~) bool_or::$3 ← (boolean~) bool_or::$0 || (boolean~) bool_or::$2 - if((boolean~) bool_or::$3) goto bool_or::@2 + (boolean) bool_or::o2 ← (boolean~) bool_or::$2 + (boolean~) bool_or::$3 ← (boolean) bool_or::o1 || (boolean) bool_or::o2 + (boolean) bool_or::o3 ← (boolean~) bool_or::$3 + if((boolean) bool_or::o3) goto bool_or::@2 to:bool_or::@4 bool_or::@2: scope:[bool_or] from bool_or::@1 bool_or::@5 *((byte*) bool_or::screen + (byte) bool_or::i) ← (byte) '*' @@ -227,15 +250,15 @@ bool_not: scope:[bool_not] from (byte) bool_not::i ← (byte/signed byte/word/signed word/dword/signed dword) 0 to:bool_not::@1 bool_not::@1: scope:[bool_not] from bool_not bool_not::@3 - (byte~) bool_not::$0 ← (byte) bool_not::i & (byte/signed byte/word/signed word/dword/signed dword) 1 - (boolean~) bool_not::$1 ← (byte~) bool_not::$0 == (byte/signed byte/word/signed word/dword/signed dword) 0 - (boolean) bool_not::o1 ← (boolean~) bool_not::$1 - (boolean~) bool_not::$2 ← (byte) bool_not::i < (byte/signed byte/word/signed word/dword/signed dword) 10 - (byte~) bool_not::$3 ← (byte) bool_not::i & (byte/signed byte/word/signed word/dword/signed dword) 1 - (boolean~) bool_not::$4 ← (byte~) bool_not::$3 == (byte/signed byte/word/signed word/dword/signed dword) 0 - (boolean~) bool_not::$5 ← (boolean~) bool_not::$2 || (boolean~) bool_not::$4 - (boolean~) bool_not::$6 ← ! (boolean~) bool_not::$5 - if((boolean~) bool_not::$6) goto bool_not::@2 + (boolean~) bool_not::$0 ← (byte) bool_not::i < (byte/signed byte/word/signed word/dword/signed dword) 10 + (boolean) bool_not::o1 ← (boolean~) bool_not::$0 + (byte~) bool_not::$1 ← (byte) bool_not::i & (byte/signed byte/word/signed word/dword/signed dword) 1 + (boolean~) bool_not::$2 ← (byte~) bool_not::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 + (boolean) bool_not::o2 ← (boolean~) bool_not::$2 + (boolean~) bool_not::$3 ← (boolean) bool_not::o1 || (boolean) bool_not::o2 + (boolean~) bool_not::$4 ← ! (boolean~) bool_not::$3 + (boolean) bool_not::o3 ← (boolean~) bool_not::$4 + if((boolean) bool_not::o3) goto bool_not::@2 to:bool_not::@4 bool_not::@2: scope:[bool_not] from bool_not::@1 bool_not::@5 *((byte*) bool_not::screen + (byte) bool_not::i) ← (byte) '*' @@ -245,8 +268,8 @@ bool_not::@4: scope:[bool_not] from bool_not::@1 to:bool_not::@3 bool_not::@3: scope:[bool_not] from bool_not::@2 bool_not::@4 (byte) bool_not::i ← ++ (byte) bool_not::i - (boolean~) bool_not::$7 ← (byte) bool_not::i != (byte/signed byte/word/signed word/dword/signed dword) 21 - if((boolean~) bool_not::$7) goto bool_not::@1 + (boolean~) bool_not::$5 ← (byte) bool_not::i != (byte/signed byte/word/signed word/dword/signed dword) 21 + if((boolean~) bool_not::$5) goto bool_not::@1 to:bool_not::@6 bool_not::@5: scope:[bool_not] from to:bool_not::@2 @@ -262,20 +285,19 @@ bool_complex: scope:[bool_complex] from (byte) bool_complex::i ← (byte/signed byte/word/signed word/dword/signed dword) 0 to:bool_complex::@1 bool_complex::@1: scope:[bool_complex] from bool_complex bool_complex::@3 - (byte~) bool_complex::$0 ← (byte) bool_complex::i & (byte/signed byte/word/signed word/dword/signed dword) 1 - (boolean~) bool_complex::$1 ← (byte~) bool_complex::$0 == (byte/signed byte/word/signed word/dword/signed dword) 0 - (boolean) bool_complex::o1 ← (boolean~) bool_complex::$1 - (boolean~) bool_complex::$2 ← (byte) bool_complex::i < (byte/signed byte/word/signed word/dword/signed dword) 10 - (byte~) bool_complex::$3 ← (byte) bool_complex::i & (byte/signed byte/word/signed word/dword/signed dword) 1 - (boolean~) bool_complex::$4 ← (byte~) bool_complex::$3 == (byte/signed byte/word/signed word/dword/signed dword) 0 - (boolean~) bool_complex::$5 ← (boolean~) bool_complex::$2 && (boolean~) bool_complex::$4 - (boolean~) bool_complex::$6 ← (byte) bool_complex::i < (byte/signed byte/word/signed word/dword/signed dword) 10 - (byte~) bool_complex::$7 ← (byte) bool_complex::i & (byte/signed byte/word/signed word/dword/signed dword) 1 - (boolean~) bool_complex::$8 ← (byte~) bool_complex::$7 == (byte/signed byte/word/signed word/dword/signed dword) 0 - (boolean~) bool_complex::$9 ← (boolean~) bool_complex::$6 || (boolean~) bool_complex::$8 - (boolean~) bool_complex::$10 ← ! (boolean~) bool_complex::$9 - (boolean~) bool_complex::$11 ← (boolean~) bool_complex::$5 || (boolean~) bool_complex::$10 - if((boolean~) bool_complex::$11) goto bool_complex::@2 + (boolean~) bool_complex::$0 ← (byte) bool_complex::i < (byte/signed byte/word/signed word/dword/signed dword) 10 + (boolean) bool_complex::o1 ← (boolean~) bool_complex::$0 + (byte~) bool_complex::$1 ← (byte) bool_complex::i & (byte/signed byte/word/signed word/dword/signed dword) 1 + (boolean~) bool_complex::$2 ← (byte~) bool_complex::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 + (boolean) bool_complex::o2 ← (boolean~) bool_complex::$2 + (boolean~) bool_complex::$3 ← (boolean) bool_complex::o1 && (boolean) bool_complex::o2 + (boolean) bool_complex::o3 ← (boolean~) bool_complex::$3 + (boolean~) bool_complex::$4 ← (boolean) bool_complex::o1 || (boolean) bool_complex::o2 + (boolean~) bool_complex::$5 ← ! (boolean~) bool_complex::$4 + (boolean) bool_complex::o4 ← (boolean~) bool_complex::$5 + (boolean~) bool_complex::$6 ← (boolean) bool_complex::o3 || (boolean) bool_complex::o4 + (boolean) bool_complex::o5 ← (boolean~) bool_complex::$6 + if((boolean) bool_complex::o5) goto bool_complex::@2 to:bool_complex::@4 bool_complex::@2: scope:[bool_complex] from bool_complex::@1 bool_complex::@5 *((byte*) bool_complex::screen + (byte) bool_complex::i) ← (byte) '*' @@ -285,8 +307,8 @@ bool_complex::@4: scope:[bool_complex] from bool_complex::@1 to:bool_complex::@3 bool_complex::@3: scope:[bool_complex] from bool_complex::@2 bool_complex::@4 (byte) bool_complex::i ← ++ (byte) bool_complex::i - (boolean~) bool_complex::$12 ← (byte) bool_complex::i != (byte/signed byte/word/signed word/dword/signed dword) 21 - if((boolean~) bool_complex::$12) goto bool_complex::@1 + (boolean~) bool_complex::$7 ← (byte) bool_complex::i != (byte/signed byte/word/signed word/dword/signed dword) 21 + if((boolean~) bool_complex::$7) goto bool_complex::@1 to:bool_complex::@6 bool_complex::@5: scope:[bool_complex] from to:bool_complex::@2 @@ -304,12 +326,6 @@ Eliminating unused variable - keeping the call (void~) main::$0 Eliminating unused variable - keeping the call (void~) main::$1 Eliminating unused variable - keeping the call (void~) main::$2 Eliminating unused variable - keeping the call (void~) main::$3 -Eliminating unused variable (boolean) bool_not::o1 and assignment [35] (boolean) bool_not::o1 ← (boolean~) bool_not::$1 -Eliminating unused variable (boolean) bool_complex::o1 and assignment [52] (boolean) bool_complex::o1 ← (boolean~) bool_complex::$1 -Eliminating unused variable (boolean~) bool_not::$1 and assignment [34] (boolean~) bool_not::$1 ← (byte~) bool_not::$0 == (byte/signed byte/word/signed word/dword/signed dword) 0 -Eliminating unused variable (boolean~) bool_complex::$1 and assignment [50] (boolean~) bool_complex::$1 ← (byte~) bool_complex::$0 == (byte/signed byte/word/signed word/dword/signed dword) 0 -Eliminating unused variable (byte~) bool_not::$0 and assignment [33] (byte~) bool_not::$0 ← (byte) bool_not::i & (byte/signed byte/word/signed word/dword/signed dword) 1 -Eliminating unused variable (byte~) bool_complex::$0 and assignment [48] (byte~) bool_complex::$0 ← (byte) bool_complex::i & (byte/signed byte/word/signed word/dword/signed dword) 1 Removing empty block @1 Removing empty block bool_and::@5 Removing empty block bool_and::@6 @@ -353,10 +369,13 @@ bool_and: scope:[bool_and] from main bool_and::@1: scope:[bool_and] from bool_and bool_and::@3 (byte) bool_and::i#2 ← phi( bool_and/(byte) bool_and::i#0 bool_and::@3/(byte) bool_and::i#1 ) (boolean~) bool_and::$0 ← (byte) bool_and::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10 + (boolean) bool_and::o1#0 ← (boolean~) bool_and::$0 (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 (boolean~) bool_and::$2 ← (byte~) bool_and::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 - (boolean~) bool_and::$3 ← (boolean~) bool_and::$0 && (boolean~) bool_and::$2 - if((boolean~) bool_and::$3) goto bool_and::@2 + (boolean) bool_and::o2#0 ← (boolean~) bool_and::$2 + (boolean~) bool_and::$3 ← (boolean) bool_and::o1#0 && (boolean) bool_and::o2#0 + (boolean) bool_and::o3#0 ← (boolean~) bool_and::$3 + if((boolean) bool_and::o3#0) goto bool_and::@2 to:bool_and::@4 bool_and::@2: scope:[bool_and] from bool_and::@1 (byte) bool_and::i#3 ← phi( bool_and::@1/(byte) bool_and::i#2 ) @@ -382,10 +401,13 @@ bool_or: scope:[bool_or] from main::@1 bool_or::@1: scope:[bool_or] from bool_or bool_or::@3 (byte) bool_or::i#2 ← phi( bool_or/(byte) bool_or::i#0 bool_or::@3/(byte) bool_or::i#1 ) (boolean~) bool_or::$0 ← (byte) bool_or::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10 + (boolean) bool_or::o1#0 ← (boolean~) bool_or::$0 (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 (boolean~) bool_or::$2 ← (byte~) bool_or::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 - (boolean~) bool_or::$3 ← (boolean~) bool_or::$0 || (boolean~) bool_or::$2 - if((boolean~) bool_or::$3) goto bool_or::@2 + (boolean) bool_or::o2#0 ← (boolean~) bool_or::$2 + (boolean~) bool_or::$3 ← (boolean) bool_or::o1#0 || (boolean) bool_or::o2#0 + (boolean) bool_or::o3#0 ← (boolean~) bool_or::$3 + if((boolean) bool_or::o3#0) goto bool_or::@2 to:bool_or::@4 bool_or::@2: scope:[bool_or] from bool_or::@1 (byte) bool_or::i#3 ← phi( bool_or::@1/(byte) bool_or::i#2 ) @@ -410,12 +432,15 @@ bool_not: scope:[bool_not] from main::@2 to:bool_not::@1 bool_not::@1: scope:[bool_not] from bool_not bool_not::@3 (byte) bool_not::i#2 ← phi( bool_not/(byte) bool_not::i#0 bool_not::@3/(byte) bool_not::i#1 ) - (boolean~) bool_not::$2 ← (byte) bool_not::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10 - (byte~) bool_not::$3 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 - (boolean~) bool_not::$4 ← (byte~) bool_not::$3 == (byte/signed byte/word/signed word/dword/signed dword) 0 - (boolean~) bool_not::$5 ← (boolean~) bool_not::$2 || (boolean~) bool_not::$4 - (boolean~) bool_not::$6 ← ! (boolean~) bool_not::$5 - if((boolean~) bool_not::$6) goto bool_not::@2 + (boolean~) bool_not::$0 ← (byte) bool_not::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10 + (boolean) bool_not::o1#0 ← (boolean~) bool_not::$0 + (byte~) bool_not::$1 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 + (boolean~) bool_not::$2 ← (byte~) bool_not::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 + (boolean) bool_not::o2#0 ← (boolean~) bool_not::$2 + (boolean~) bool_not::$3 ← (boolean) bool_not::o1#0 || (boolean) bool_not::o2#0 + (boolean~) bool_not::$4 ← ! (boolean~) bool_not::$3 + (boolean) bool_not::o3#0 ← (boolean~) bool_not::$4 + if((boolean) bool_not::o3#0) goto bool_not::@2 to:bool_not::@4 bool_not::@2: scope:[bool_not] from bool_not::@1 (byte) bool_not::i#3 ← phi( bool_not::@1/(byte) bool_not::i#2 ) @@ -428,8 +453,8 @@ bool_not::@4: scope:[bool_not] from bool_not::@1 bool_not::@3: scope:[bool_not] from bool_not::@2 bool_not::@4 (byte) bool_not::i#5 ← phi( bool_not::@2/(byte) bool_not::i#3 bool_not::@4/(byte) bool_not::i#4 ) (byte) bool_not::i#1 ← ++ (byte) bool_not::i#5 - (boolean~) bool_not::$7 ← (byte) bool_not::i#1 != (byte/signed byte/word/signed word/dword/signed dword) 21 - if((boolean~) bool_not::$7) goto bool_not::@1 + (boolean~) bool_not::$5 ← (byte) bool_not::i#1 != (byte/signed byte/word/signed word/dword/signed dword) 21 + if((boolean~) bool_not::$5) goto bool_not::@1 to:bool_not::@return bool_not::@return: scope:[bool_not] from bool_not::@3 return @@ -440,17 +465,19 @@ bool_complex: scope:[bool_complex] from main::@3 to:bool_complex::@1 bool_complex::@1: scope:[bool_complex] from bool_complex bool_complex::@3 (byte) bool_complex::i#2 ← phi( bool_complex/(byte) bool_complex::i#0 bool_complex::@3/(byte) bool_complex::i#1 ) - (boolean~) bool_complex::$2 ← (byte) bool_complex::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10 - (byte~) bool_complex::$3 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 - (boolean~) bool_complex::$4 ← (byte~) bool_complex::$3 == (byte/signed byte/word/signed word/dword/signed dword) 0 - (boolean~) bool_complex::$5 ← (boolean~) bool_complex::$2 && (boolean~) bool_complex::$4 - (boolean~) bool_complex::$6 ← (byte) bool_complex::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10 - (byte~) bool_complex::$7 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 - (boolean~) bool_complex::$8 ← (byte~) bool_complex::$7 == (byte/signed byte/word/signed word/dword/signed dword) 0 - (boolean~) bool_complex::$9 ← (boolean~) bool_complex::$6 || (boolean~) bool_complex::$8 - (boolean~) bool_complex::$10 ← ! (boolean~) bool_complex::$9 - (boolean~) bool_complex::$11 ← (boolean~) bool_complex::$5 || (boolean~) bool_complex::$10 - if((boolean~) bool_complex::$11) goto bool_complex::@2 + (boolean~) bool_complex::$0 ← (byte) bool_complex::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10 + (boolean) bool_complex::o1#0 ← (boolean~) bool_complex::$0 + (byte~) bool_complex::$1 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 + (boolean~) bool_complex::$2 ← (byte~) bool_complex::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 + (boolean) bool_complex::o2#0 ← (boolean~) bool_complex::$2 + (boolean~) bool_complex::$3 ← (boolean) bool_complex::o1#0 && (boolean) bool_complex::o2#0 + (boolean) bool_complex::o3#0 ← (boolean~) bool_complex::$3 + (boolean~) bool_complex::$4 ← (boolean) bool_complex::o1#0 || (boolean) bool_complex::o2#0 + (boolean~) bool_complex::$5 ← ! (boolean~) bool_complex::$4 + (boolean) bool_complex::o4#0 ← (boolean~) bool_complex::$5 + (boolean~) bool_complex::$6 ← (boolean) bool_complex::o3#0 || (boolean) bool_complex::o4#0 + (boolean) bool_complex::o5#0 ← (boolean~) bool_complex::$6 + if((boolean) bool_complex::o5#0) goto bool_complex::@2 to:bool_complex::@4 bool_complex::@2: scope:[bool_complex] from bool_complex::@1 (byte) bool_complex::i#3 ← phi( bool_complex::@1/(byte) bool_complex::i#2 ) @@ -463,8 +490,8 @@ bool_complex::@4: scope:[bool_complex] from bool_complex::@1 bool_complex::@3: scope:[bool_complex] from bool_complex::@2 bool_complex::@4 (byte) bool_complex::i#5 ← phi( bool_complex::@2/(byte) bool_complex::i#3 bool_complex::@4/(byte) bool_complex::i#4 ) (byte) bool_complex::i#1 ← ++ (byte) bool_complex::i#5 - (boolean~) bool_complex::$12 ← (byte) bool_complex::i#1 != (byte/signed byte/word/signed word/dword/signed dword) 21 - if((boolean~) bool_complex::$12) goto bool_complex::@1 + (boolean~) bool_complex::$7 ← (byte) bool_complex::i#1 != (byte/signed byte/word/signed word/dword/signed dword) 21 + if((boolean~) bool_complex::$7) goto bool_complex::@1 to:bool_complex::@return bool_complex::@return: scope:[bool_complex] from bool_complex::@3 return @@ -499,20 +526,23 @@ SYMBOL TABLE SSA (byte) bool_and::i#3 (byte) bool_and::i#4 (byte) bool_and::i#5 +(boolean) bool_and::o1 +(boolean) bool_and::o1#0 +(boolean) bool_and::o2 +(boolean) bool_and::o2#0 +(boolean) bool_and::o3 +(boolean) bool_and::o3#0 (byte*) bool_and::screen (byte*) bool_and::screen#0 (void()) bool_complex() -(boolean~) bool_complex::$10 -(boolean~) bool_complex::$11 -(boolean~) bool_complex::$12 +(boolean~) bool_complex::$0 +(byte~) bool_complex::$1 (boolean~) bool_complex::$2 -(byte~) bool_complex::$3 +(boolean~) bool_complex::$3 (boolean~) bool_complex::$4 (boolean~) bool_complex::$5 (boolean~) bool_complex::$6 -(byte~) bool_complex::$7 -(boolean~) bool_complex::$8 -(boolean~) bool_complex::$9 +(boolean~) bool_complex::$7 (label) bool_complex::@1 (label) bool_complex::@2 (label) bool_complex::@3 @@ -525,15 +555,25 @@ SYMBOL TABLE SSA (byte) bool_complex::i#3 (byte) bool_complex::i#4 (byte) bool_complex::i#5 +(boolean) bool_complex::o1 +(boolean) bool_complex::o1#0 +(boolean) bool_complex::o2 +(boolean) bool_complex::o2#0 +(boolean) bool_complex::o3 +(boolean) bool_complex::o3#0 +(boolean) bool_complex::o4 +(boolean) bool_complex::o4#0 +(boolean) bool_complex::o5 +(boolean) bool_complex::o5#0 (byte*) bool_complex::screen (byte*) bool_complex::screen#0 (void()) bool_not() +(boolean~) bool_not::$0 +(byte~) bool_not::$1 (boolean~) bool_not::$2 -(byte~) bool_not::$3 +(boolean~) bool_not::$3 (boolean~) bool_not::$4 (boolean~) bool_not::$5 -(boolean~) bool_not::$6 -(boolean~) bool_not::$7 (label) bool_not::@1 (label) bool_not::@2 (label) bool_not::@3 @@ -546,6 +586,12 @@ SYMBOL TABLE SSA (byte) bool_not::i#3 (byte) bool_not::i#4 (byte) bool_not::i#5 +(boolean) bool_not::o1 +(boolean) bool_not::o1#0 +(boolean) bool_not::o2 +(boolean) bool_not::o2#0 +(boolean) bool_not::o3 +(boolean) bool_not::o3#0 (byte*) bool_not::screen (byte*) bool_not::screen#0 (void()) bool_or() @@ -566,6 +612,12 @@ SYMBOL TABLE SSA (byte) bool_or::i#3 (byte) bool_or::i#4 (byte) bool_or::i#5 +(boolean) bool_or::o1 +(boolean) bool_or::o1#0 +(boolean) bool_or::o2 +(boolean) bool_or::o2#0 +(boolean) bool_or::o3 +(boolean) bool_or::o3#0 (byte*) bool_or::screen (byte*) bool_or::screen#0 (void()) main() @@ -579,9 +631,23 @@ OPTIMIZING CONTROL FLOW GRAPH Culled Empty Block (label) main::@4 Culled Empty Block (label) @6 Succesful SSA optimization Pass2CullEmptyBlocks +Alias (boolean) bool_and::o1#0 = (boolean~) bool_and::$0 +Alias (boolean) bool_and::o2#0 = (boolean~) bool_and::$2 +Alias (boolean) bool_and::o3#0 = (boolean~) bool_and::$3 Alias (byte) bool_and::i#2 = (byte) bool_and::i#3 (byte) bool_and::i#4 +Alias (boolean) bool_or::o1#0 = (boolean~) bool_or::$0 +Alias (boolean) bool_or::o2#0 = (boolean~) bool_or::$2 +Alias (boolean) bool_or::o3#0 = (boolean~) bool_or::$3 Alias (byte) bool_or::i#2 = (byte) bool_or::i#3 (byte) bool_or::i#4 +Alias (boolean) bool_not::o1#0 = (boolean~) bool_not::$0 +Alias (boolean) bool_not::o2#0 = (boolean~) bool_not::$2 +Alias (boolean) bool_not::o3#0 = (boolean~) bool_not::$4 Alias (byte) bool_not::i#2 = (byte) bool_not::i#3 (byte) bool_not::i#4 +Alias (boolean) bool_complex::o1#0 = (boolean~) bool_complex::$0 +Alias (boolean) bool_complex::o2#0 = (boolean~) bool_complex::$2 +Alias (boolean) bool_complex::o3#0 = (boolean~) bool_complex::$3 +Alias (boolean) bool_complex::o4#0 = (boolean~) bool_complex::$5 +Alias (boolean) bool_complex::o5#0 = (boolean~) bool_complex::$6 Alias (byte) bool_complex::i#2 = (byte) bool_complex::i#3 (byte) bool_complex::i#4 Succesful SSA optimization Pass2AliasElimination Alias (byte) bool_and::i#2 = (byte) bool_and::i#5 @@ -591,24 +657,24 @@ Alias (byte) bool_complex::i#2 = (byte) bool_complex::i#5 Succesful SSA optimization Pass2AliasElimination Simple Condition (boolean~) bool_and::$4 if((byte) bool_and::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_and::@1 Simple Condition (boolean~) bool_or::$4 if((byte) bool_or::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_or::@1 -Simple Condition (boolean~) bool_not::$7 if((byte) bool_not::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_not::@1 -Simple Condition (boolean~) bool_complex::$12 if((byte) bool_complex::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_complex::@1 +Simple Condition (boolean~) bool_not::$5 if((byte) bool_not::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_not::@1 +Simple Condition (boolean~) bool_complex::$7 if((byte) bool_complex::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_complex::@1 Succesful SSA optimization Pass2ConditionalJumpSimplification -Rewriting && if()-condition to two if()s (boolean~) bool_and::$3 ← (boolean~) bool_and::$0 && (boolean~) bool_and::$2 +Rewriting && if()-condition to two if()s (boolean) bool_and::o3#0 ← (boolean) bool_and::o1#0 && (boolean) bool_and::o2#0 Succesful SSA optimization Pass2ConditionalAndOrRewriting -Rewriting || if()-condition to two if()s (boolean~) bool_or::$3 ← (boolean~) bool_or::$0 || (boolean~) bool_or::$2 +Rewriting || if()-condition to two if()s (boolean) bool_or::o3#0 ← (boolean) bool_or::o1#0 || (boolean) bool_or::o2#0 Succesful SSA optimization Pass2ConditionalAndOrRewriting -Rewriting ! if()-condition to reversed if() (boolean~) bool_not::$6 ← ! (boolean~) bool_not::$5 +Rewriting ! if()-condition to reversed if() (boolean) bool_not::o3#0 ← ! (boolean~) bool_not::$3 Succesful SSA optimization Pass2ConditionalAndOrRewriting -Rewriting || if()-condition to two if()s (boolean~) bool_not::$5 ← (boolean~) bool_not::$2 || (boolean~) bool_not::$4 +Rewriting || if()-condition to two if()s (boolean~) bool_not::$3 ← (boolean) bool_not::o1#0 || (boolean) bool_not::o2#0 Succesful SSA optimization Pass2ConditionalAndOrRewriting -Rewriting || if()-condition to two if()s (boolean~) bool_complex::$11 ← (boolean~) bool_complex::$5 || (boolean~) bool_complex::$10 +Rewriting || if()-condition to two if()s (boolean) bool_complex::o5#0 ← (boolean) bool_complex::o3#0 || (boolean) bool_complex::o4#0 Succesful SSA optimization Pass2ConditionalAndOrRewriting -Rewriting && if()-condition to two if()s (boolean~) bool_complex::$5 ← (boolean~) bool_complex::$2 && (boolean~) bool_complex::$4 +Rewriting && if()-condition to two if()s (boolean) bool_complex::o3#0 ← (boolean) bool_complex::o1#0 && (boolean) bool_complex::o2#0 Succesful SSA optimization Pass2ConditionalAndOrRewriting -Rewriting ! if()-condition to reversed if() (boolean~) bool_complex::$10 ← ! (boolean~) bool_complex::$9 +Rewriting ! if()-condition to reversed if() (boolean) bool_complex::o4#0 ← ! (boolean~) bool_complex::$4 Succesful SSA optimization Pass2ConditionalAndOrRewriting -Rewriting || if()-condition to two if()s (boolean~) bool_complex::$9 ← (boolean~) bool_complex::$6 || (boolean~) bool_complex::$8 +Rewriting || if()-condition to two if()s (boolean~) bool_complex::$4 ← (boolean) bool_complex::o1#0 || (boolean) bool_complex::o2#0 Succesful SSA optimization Pass2ConditionalAndOrRewriting Constant (const byte*) bool_and::screen#0 = ((byte*))1024 Constant (const byte) bool_and::i#0 = 0 @@ -619,16 +685,12 @@ Constant (const byte) bool_not::i#0 = 0 Constant (const byte*) bool_complex::screen#0 = ((byte*))1144 Constant (const byte) bool_complex::i#0 = 0 Succesful SSA optimization Pass2ConstantIdentification -Simple Condition (boolean~) bool_and::$0 if((byte) bool_and::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_and::@7 -Simple Condition (boolean~) bool_or::$0 if((byte) bool_or::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_or::@2 -Simple Condition (boolean~) bool_not::$2 if((byte) bool_not::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_not::@4 -Simple Condition (boolean~) bool_complex::$2 if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@8 -Simple Condition (boolean~) bool_and::$2 if((byte~) bool_and::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_and::@2 -Simple Condition (boolean~) bool_or::$2 if((byte~) bool_or::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_or::@2 -Simple Condition (boolean~) bool_not::$4 if((byte~) bool_not::$3==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_not::@4 -Simple Condition (boolean~) bool_complex::$6 if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@4 -Simple Condition (boolean~) bool_complex::$4 if((byte~) bool_complex::$3==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@2 -Simple Condition (boolean~) bool_complex::$8 if((byte~) bool_complex::$7==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@4 +Simple Condition (boolean) bool_and::o1#0 if((byte) bool_and::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_and::@7 +Simple Condition (boolean) bool_or::o1#0 if((byte) bool_or::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_or::@2 +Simple Condition (boolean) bool_not::o1#0 if((byte) bool_not::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_not::@4 +Simple Condition (boolean) bool_and::o2#0 if((byte~) bool_and::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_and::@2 +Simple Condition (boolean) bool_or::o2#0 if((byte~) bool_or::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_or::@2 +Simple Condition (boolean) bool_not::o2#0 if((byte~) bool_not::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_not::@4 Succesful SSA optimization Pass2ConditionalJumpSimplification OPTIMIZING CONTROL FLOW GRAPH Inlining constant with var siblings (const byte) bool_and::i#0 @@ -670,10 +732,10 @@ Propagating live ranges... Propagating live ranges... Propagating live ranges... Created 4 initial phi equivalence classes -Coalesced [24] bool_complex::i#6 ← bool_complex::i#1 -Coalesced [36] bool_not::i#6 ← bool_not::i#1 -Coalesced [47] bool_or::i#6 ← bool_or::i#1 -Coalesced [57] bool_and::i#6 ← bool_and::i#1 +Coalesced [25] bool_complex::i#6 ← bool_complex::i#1 +Coalesced [37] bool_not::i#6 ← bool_not::i#1 +Coalesced [48] bool_or::i#6 ← bool_or::i#1 +Coalesced [58] bool_and::i#6 ← bool_and::i#1 Coalesced down to 4 phi equivalence classes Culled Empty Block (label) bool_complex::@10 Culled Empty Block (label) bool_not::@8 @@ -730,103 +792,104 @@ bool_complex: scope:[bool_complex] from main::@3 to:bool_complex::@1 bool_complex::@1: scope:[bool_complex] from bool_complex bool_complex::@3 [14] (byte) bool_complex::i#2 ← phi( bool_complex/(byte/signed byte/word/signed word/dword/signed dword) 0 bool_complex::@3/(byte) bool_complex::i#1 ) [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) - [15] (byte~) bool_complex::$3 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$3 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$3 ] ) - [16] (byte~) bool_complex::$7 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ) - [17] if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@8 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ) + [15] (boolean) bool_complex::o1#0 ← (byte) bool_complex::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10 [ bool_complex::i#2 bool_complex::o1#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 ] ) + [16] (byte~) bool_complex::$1 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::$1 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::$1 ] ) + [17] (boolean) bool_complex::o2#0 ← (byte~) bool_complex::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ) + [18] if((boolean) bool_complex::o1#0) goto bool_complex::@8 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ) to:bool_complex::@7 bool_complex::@7: scope:[bool_complex] from bool_complex::@1 bool_complex::@8 - [18] if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@4 [ bool_complex::i#2 bool_complex::$7 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$7 ] ) + [19] if((boolean) bool_complex::o1#0) goto bool_complex::@4 [ bool_complex::i#2 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o2#0 ] ) to:bool_complex::@9 bool_complex::@9: scope:[bool_complex] from bool_complex::@7 - [19] if((byte~) bool_complex::$7==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@4 [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) + [20] if((boolean) bool_complex::o2#0) goto bool_complex::@4 [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) to:bool_complex::@2 bool_complex::@2: scope:[bool_complex] from bool_complex::@8 bool_complex::@9 - [20] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) '*' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) + [21] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) '*' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) to:bool_complex::@3 bool_complex::@3: scope:[bool_complex] from bool_complex::@2 bool_complex::@4 - [21] (byte) bool_complex::i#1 ← ++ (byte) bool_complex::i#2 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) - [22] if((byte) bool_complex::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_complex::@1 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) + [22] (byte) bool_complex::i#1 ← ++ (byte) bool_complex::i#2 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) + [23] if((byte) bool_complex::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_complex::@1 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) to:bool_complex::@return bool_complex::@return: scope:[bool_complex] from bool_complex::@3 - [23] return [ ] ( main:2::bool_complex:11 [ ] ) + [24] return [ ] ( main:2::bool_complex:11 [ ] ) to:@return bool_complex::@4: scope:[bool_complex] from bool_complex::@7 bool_complex::@9 - [24] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) ' ' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) + [25] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) ' ' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) to:bool_complex::@3 bool_complex::@8: scope:[bool_complex] from bool_complex::@1 - [25] if((byte~) bool_complex::$3==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@2 [ bool_complex::i#2 bool_complex::$7 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$7 ] ) + [26] if((boolean) bool_complex::o2#0) goto bool_complex::@2 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ) to:bool_complex::@7 bool_not: scope:[bool_not] from main::@2 - [26] phi() [ ] ( main:2::bool_not:9 [ ] ) + [27] phi() [ ] ( main:2::bool_not:9 [ ] ) to:bool_not::@1 bool_not::@1: scope:[bool_not] from bool_not bool_not::@3 - [27] (byte) bool_not::i#2 ← phi( bool_not/(byte/signed byte/word/signed word/dword/signed dword) 0 bool_not::@3/(byte) bool_not::i#1 ) [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) - [28] (byte~) bool_not::$3 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_not::i#2 bool_not::$3 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$3 ] ) - [29] if((byte) bool_not::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_not::@4 [ bool_not::i#2 bool_not::$3 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$3 ] ) + [28] (byte) bool_not::i#2 ← phi( bool_not/(byte/signed byte/word/signed word/dword/signed dword) 0 bool_not::@3/(byte) bool_not::i#1 ) [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) + [29] (byte~) bool_not::$1 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) + [30] if((byte) bool_not::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_not::@4 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) to:bool_not::@7 bool_not::@7: scope:[bool_not] from bool_not::@1 - [30] if((byte~) bool_not::$3==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_not::@4 [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) + [31] if((byte~) bool_not::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_not::@4 [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) to:bool_not::@2 bool_not::@2: scope:[bool_not] from bool_not::@7 - [31] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) '*' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) + [32] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) '*' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) to:bool_not::@3 bool_not::@3: scope:[bool_not] from bool_not::@2 bool_not::@4 - [32] (byte) bool_not::i#1 ← ++ (byte) bool_not::i#2 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) - [33] if((byte) bool_not::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_not::@1 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) + [33] (byte) bool_not::i#1 ← ++ (byte) bool_not::i#2 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) + [34] if((byte) bool_not::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_not::@1 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) to:bool_not::@return bool_not::@return: scope:[bool_not] from bool_not::@3 - [34] return [ ] ( main:2::bool_not:9 [ ] ) + [35] return [ ] ( main:2::bool_not:9 [ ] ) to:@return bool_not::@4: scope:[bool_not] from bool_not::@1 bool_not::@7 - [35] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) ' ' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) + [36] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) ' ' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) to:bool_not::@3 bool_or: scope:[bool_or] from main::@1 - [36] phi() [ ] ( main:2::bool_or:7 [ ] ) + [37] phi() [ ] ( main:2::bool_or:7 [ ] ) to:bool_or::@1 bool_or::@1: scope:[bool_or] from bool_or bool_or::@3 - [37] (byte) bool_or::i#2 ← phi( bool_or/(byte/signed byte/word/signed word/dword/signed dword) 0 bool_or::@3/(byte) bool_or::i#1 ) [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) - [38] (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) - [39] if((byte) bool_or::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_or::@2 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) + [38] (byte) bool_or::i#2 ← phi( bool_or/(byte/signed byte/word/signed word/dword/signed dword) 0 bool_or::@3/(byte) bool_or::i#1 ) [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) + [39] (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) + [40] if((byte) bool_or::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_or::@2 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) to:bool_or::@7 bool_or::@7: scope:[bool_or] from bool_or::@1 - [40] if((byte~) bool_or::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_or::@2 [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) + [41] if((byte~) bool_or::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_or::@2 [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) to:bool_or::@4 bool_or::@4: scope:[bool_or] from bool_or::@7 - [41] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) ' ' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) + [42] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) ' ' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) to:bool_or::@3 bool_or::@3: scope:[bool_or] from bool_or::@2 bool_or::@4 - [42] (byte) bool_or::i#1 ← ++ (byte) bool_or::i#2 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) - [43] if((byte) bool_or::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_or::@1 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) + [43] (byte) bool_or::i#1 ← ++ (byte) bool_or::i#2 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) + [44] if((byte) bool_or::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_or::@1 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) to:bool_or::@return bool_or::@return: scope:[bool_or] from bool_or::@3 - [44] return [ ] ( main:2::bool_or:7 [ ] ) + [45] return [ ] ( main:2::bool_or:7 [ ] ) to:@return bool_or::@2: scope:[bool_or] from bool_or::@1 bool_or::@7 - [45] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) '*' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) + [46] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) '*' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) to:bool_or::@3 bool_and: scope:[bool_and] from main - [46] phi() [ ] ( main:2::bool_and:5 [ ] ) + [47] phi() [ ] ( main:2::bool_and:5 [ ] ) to:bool_and::@1 bool_and::@1: scope:[bool_and] from bool_and bool_and::@3 - [47] (byte) bool_and::i#2 ← phi( bool_and/(byte/signed byte/word/signed word/dword/signed dword) 0 bool_and::@3/(byte) bool_and::i#1 ) [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) - [48] (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) - [49] if((byte) bool_and::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_and::@7 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) + [48] (byte) bool_and::i#2 ← phi( bool_and/(byte/signed byte/word/signed word/dword/signed dword) 0 bool_and::@3/(byte) bool_and::i#1 ) [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) + [49] (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) + [50] if((byte) bool_and::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_and::@7 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) to:bool_and::@4 bool_and::@4: scope:[bool_and] from bool_and::@1 bool_and::@7 - [50] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) ' ' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) + [51] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) ' ' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) to:bool_and::@3 bool_and::@3: scope:[bool_and] from bool_and::@2 bool_and::@4 - [51] (byte) bool_and::i#1 ← ++ (byte) bool_and::i#2 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) - [52] if((byte) bool_and::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_and::@1 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) + [52] (byte) bool_and::i#1 ← ++ (byte) bool_and::i#2 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) + [53] if((byte) bool_and::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_and::@1 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) to:bool_and::@return bool_and::@return: scope:[bool_and] from bool_and::@3 - [53] return [ ] ( main:2::bool_and:5 [ ] ) + [54] return [ ] ( main:2::bool_and:5 [ ] ) to:@return bool_and::@7: scope:[bool_and] from bool_and::@1 - [54] if((byte~) bool_and::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_and::@2 [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) + [55] if((byte~) bool_and::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_and::@2 [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) to:bool_and::@4 bool_and::@2: scope:[bool_and] from bool_and::@7 - [55] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) '*' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) + [56] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) '*' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) to:bool_and::@3 DOMINATORS @@ -906,25 +969,40 @@ VARIABLE REGISTER WEIGHTS (byte) bool_and::i (byte) bool_and::i#1 16.5 (byte) bool_and::i#2 11.0 +(boolean) bool_and::o1 +(boolean) bool_and::o2 +(boolean) bool_and::o3 (byte*) bool_and::screen (void()) bool_complex() -(byte~) bool_complex::$3 7.333333333333333 -(byte~) bool_complex::$7 5.5 +(byte~) bool_complex::$1 22.0 (byte) bool_complex::i (byte) bool_complex::i#1 16.5 -(byte) bool_complex::i#2 9.777777777777779 +(byte) bool_complex::i#2 6.6 +(boolean) bool_complex::o1 +(boolean) bool_complex::o1#0 6.6000000000000005 +(boolean) bool_complex::o2 +(boolean) bool_complex::o2#0 8.25 +(boolean) bool_complex::o3 +(boolean) bool_complex::o4 +(boolean) bool_complex::o5 (byte*) bool_complex::screen (void()) bool_not() -(byte~) bool_not::$3 11.0 +(byte~) bool_not::$1 11.0 (byte) bool_not::i (byte) bool_not::i#1 16.5 (byte) bool_not::i#2 11.0 +(boolean) bool_not::o1 +(boolean) bool_not::o2 +(boolean) bool_not::o3 (byte*) bool_not::screen (void()) bool_or() (byte~) bool_or::$1 11.0 (byte) bool_or::i (byte) bool_or::i#1 16.5 (byte) bool_or::i#2 11.0 +(boolean) bool_or::o1 +(boolean) bool_or::o2 +(boolean) bool_or::o3 (byte*) bool_or::screen (void()) main() @@ -933,9 +1011,10 @@ Initial phi equivalence classes [ bool_not::i#2 bool_not::i#1 ] [ bool_or::i#2 bool_or::i#1 ] [ bool_and::i#2 bool_and::i#1 ] -Added variable bool_complex::$3 to zero page equivalence class [ bool_complex::$3 ] -Added variable bool_complex::$7 to zero page equivalence class [ bool_complex::$7 ] -Added variable bool_not::$3 to zero page equivalence class [ bool_not::$3 ] +Added variable bool_complex::o1#0 to zero page equivalence class [ bool_complex::o1#0 ] +Added variable bool_complex::$1 to zero page equivalence class [ bool_complex::$1 ] +Added variable bool_complex::o2#0 to zero page equivalence class [ bool_complex::o2#0 ] +Added variable bool_not::$1 to zero page equivalence class [ bool_not::$1 ] Added variable bool_or::$1 to zero page equivalence class [ bool_or::$1 ] Added variable bool_and::$1 to zero page equivalence class [ bool_and::$1 ] Complete equivalence classes @@ -943,20 +1022,22 @@ Complete equivalence classes [ bool_not::i#2 bool_not::i#1 ] [ bool_or::i#2 bool_or::i#1 ] [ bool_and::i#2 bool_and::i#1 ] -[ bool_complex::$3 ] -[ bool_complex::$7 ] -[ bool_not::$3 ] +[ bool_complex::o1#0 ] +[ bool_complex::$1 ] +[ bool_complex::o2#0 ] +[ bool_not::$1 ] [ bool_or::$1 ] [ bool_and::$1 ] Allocated zp ZP_BYTE:2 [ bool_complex::i#2 bool_complex::i#1 ] Allocated zp ZP_BYTE:3 [ bool_not::i#2 bool_not::i#1 ] Allocated zp ZP_BYTE:4 [ bool_or::i#2 bool_or::i#1 ] Allocated zp ZP_BYTE:5 [ bool_and::i#2 bool_and::i#1 ] -Allocated zp ZP_BYTE:6 [ bool_complex::$3 ] -Allocated zp ZP_BYTE:7 [ bool_complex::$7 ] -Allocated zp ZP_BYTE:8 [ bool_not::$3 ] -Allocated zp ZP_BYTE:9 [ bool_or::$1 ] -Allocated zp ZP_BYTE:10 [ bool_and::$1 ] +Allocated zp ZP_BOOL:6 [ bool_complex::o1#0 ] +Allocated zp ZP_BYTE:7 [ bool_complex::$1 ] +Allocated zp ZP_BOOL:8 [ bool_complex::o2#0 ] +Allocated zp ZP_BYTE:9 [ bool_not::$1 ] +Allocated zp ZP_BYTE:10 [ bool_or::$1 ] +Allocated zp ZP_BYTE:11 [ bool_and::$1 ] INITIAL ASM //SEG0 Basic Upstart @@ -983,7 +1064,7 @@ bend: //SEG9 main main: { //SEG10 [5] call bool_and param-assignment [ ] ( main:2 [ ] ) - //SEG11 [46] phi from main to bool_and [phi:main->bool_and] + //SEG11 [47] phi from main to bool_and [phi:main->bool_and] bool_and_from_main: jsr bool_and //SEG12 [6] phi from main to main::@1 [phi:main->main::@1] @@ -992,7 +1073,7 @@ main: { //SEG13 main::@1 b1: //SEG14 [7] call bool_or param-assignment [ ] ( main:2 [ ] ) - //SEG15 [36] phi from main::@1 to bool_or [phi:main::@1->bool_or] + //SEG15 [37] phi from main::@1 to bool_or [phi:main::@1->bool_or] bool_or_from_b1: jsr bool_or //SEG16 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2] @@ -1001,7 +1082,7 @@ main: { //SEG17 main::@2 b2: //SEG18 [9] call bool_not param-assignment [ ] ( main:2 [ ] ) - //SEG19 [26] phi from main::@2 to bool_not [phi:main::@2->bool_not] + //SEG19 [27] phi from main::@2 to bool_not [phi:main::@2->bool_not] bool_not_from_b2: jsr bool_not //SEG20 [10] phi from main::@2 to main::@3 [phi:main::@2->main::@3] @@ -1022,8 +1103,9 @@ main: { //SEG26 bool_complex bool_complex: { .label screen = $478 - .label _3 = 6 - .label _7 = 7 + .label _1 = 7 + .label o1 = 6 + .label o2 = 8 .label i = 2 //SEG27 [14] phi from bool_complex to bool_complex::@1 [phi:bool_complex->bool_complex::@1] b1_from_bool_complex: @@ -1037,241 +1119,254 @@ bool_complex: { jmp b1 //SEG31 bool_complex::@1 b1: - //SEG32 [15] (byte~) bool_complex::$3 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$3 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$3 ] ) -- vbuz1=vbuz2_band_vbuc1 - lda #1 - and i - sta _3 - //SEG33 [16] (byte~) bool_complex::$7 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ) -- vbuz1=vbuz2_band_vbuc1 - lda #1 - and i - sta _7 - //SEG34 [17] if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@8 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ) -- vbuz1_lt_vbuc1_then_la1 + //SEG32 [15] (boolean) bool_complex::o1#0 ← (byte) bool_complex::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10 [ bool_complex::i#2 bool_complex::o1#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 ] ) -- vboz1=vbuz2_lt_vbuc1 lda i cmp #$a - bcc b8 - jmp b7 - //SEG35 bool_complex::@7 - b7: - //SEG36 [18] if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@4 [ bool_complex::i#2 bool_complex::$7 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$7 ] ) -- vbuz1_lt_vbuc1_then_la1 - lda i - cmp #$a - bcc b4 - jmp b9 - //SEG37 bool_complex::@9 - b9: - //SEG38 [19] if((byte~) bool_complex::$7==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@4 [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- vbuz1_eq_0_then_la1 - lda _7 - beq b4 - jmp b2 - //SEG39 bool_complex::@2 - b2: - //SEG40 [20] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) '*' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 - ldy i - lda #'*' - sta screen,y - jmp b3 - //SEG41 bool_complex::@3 - b3: - //SEG42 [21] (byte) bool_complex::i#1 ← ++ (byte) bool_complex::i#2 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) -- vbuz1=_inc_vbuz1 - inc i - //SEG43 [22] if((byte) bool_complex::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_complex::@1 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) -- vbuz1_neq_vbuc1_then_la1 - lda i - cmp #$15 - bne b1_from_b3 - jmp breturn - //SEG44 bool_complex::@return - breturn: - //SEG45 [23] return [ ] ( main:2::bool_complex:11 [ ] ) - rts - //SEG46 bool_complex::@4 - b4: - //SEG47 [24] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) ' ' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 - ldy i - lda #' ' - sta screen,y - jmp b3 - //SEG48 bool_complex::@8 - b8: - //SEG49 [25] if((byte~) bool_complex::$3==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@2 [ bool_complex::i#2 bool_complex::$7 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$7 ] ) -- vbuz1_eq_0_then_la1 - lda _3 - beq b2 - jmp b7 -} -//SEG50 bool_not -bool_not: { - .label screen = $450 - .label _3 = 8 - .label i = 3 - //SEG51 [27] phi from bool_not to bool_not::@1 [phi:bool_not->bool_not::@1] - b1_from_bool_not: - //SEG52 [27] phi (byte) bool_not::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_not->bool_not::@1#0] -- vbuz1=vbuc1 lda #0 - sta i - jmp b1 - //SEG53 [27] phi from bool_not::@3 to bool_not::@1 [phi:bool_not::@3->bool_not::@1] - b1_from_b3: - //SEG54 [27] phi (byte) bool_not::i#2 = (byte) bool_not::i#1 [phi:bool_not::@3->bool_not::@1#0] -- register_copy - jmp b1 - //SEG55 bool_not::@1 - b1: - //SEG56 [28] (byte~) bool_not::$3 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_not::i#2 bool_not::$3 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$3 ] ) -- vbuz1=vbuz2_band_vbuc1 - lda #1 - and i - sta _3 - //SEG57 [29] if((byte) bool_not::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_not::@4 [ bool_not::i#2 bool_not::$3 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$3 ] ) -- vbuz1_lt_vbuc1_then_la1 - lda i - cmp #$a - bcc b4 - jmp b7 - //SEG58 bool_not::@7 - b7: - //SEG59 [30] if((byte~) bool_not::$3==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_not::@4 [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- vbuz1_eq_0_then_la1 - lda _3 - beq b4 - jmp b2 - //SEG60 bool_not::@2 - b2: - //SEG61 [31] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) '*' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 - ldy i - lda #'*' - sta screen,y - jmp b3 - //SEG62 bool_not::@3 - b3: - //SEG63 [32] (byte) bool_not::i#1 ← ++ (byte) bool_not::i#2 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) -- vbuz1=_inc_vbuz1 - inc i - //SEG64 [33] if((byte) bool_not::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_not::@1 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) -- vbuz1_neq_vbuc1_then_la1 - lda i - cmp #$15 - bne b1_from_b3 - jmp breturn - //SEG65 bool_not::@return - breturn: - //SEG66 [34] return [ ] ( main:2::bool_not:9 [ ] ) - rts - //SEG67 bool_not::@4 - b4: - //SEG68 [35] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) ' ' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 - ldy i - lda #' ' - sta screen,y - jmp b3 -} -//SEG69 bool_or -bool_or: { - .label screen = $428 - .label _1 = 9 - .label i = 4 - //SEG70 [37] phi from bool_or to bool_or::@1 [phi:bool_or->bool_or::@1] - b1_from_bool_or: - //SEG71 [37] phi (byte) bool_or::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_or->bool_or::@1#0] -- vbuz1=vbuc1 - lda #0 - sta i - jmp b1 - //SEG72 [37] phi from bool_or::@3 to bool_or::@1 [phi:bool_or::@3->bool_or::@1] - b1_from_b3: - //SEG73 [37] phi (byte) bool_or::i#2 = (byte) bool_or::i#1 [phi:bool_or::@3->bool_or::@1#0] -- register_copy - jmp b1 - //SEG74 bool_or::@1 - b1: - //SEG75 [38] (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) -- vbuz1=vbuz2_band_vbuc1 + rol + eor #1 + sta o1 + //SEG33 [16] (byte~) bool_complex::$1 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::$1 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::$1 ] ) -- vbuz1=vbuz2_band_vbuc1 lda #1 and i sta _1 - //SEG76 [39] if((byte) bool_or::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_or::@2 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) -- vbuz1_lt_vbuc1_then_la1 + //SEG34 [17] (boolean) bool_complex::o2#0 ← (byte~) bool_complex::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ) -- vboz1=vbuz2_eq_vbuc1 + lda _1 + cmp #0 + beq !+ + lda #1 + !: + eor #1 + sta o2 + //SEG35 [18] if((boolean) bool_complex::o1#0) goto bool_complex::@8 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ) -- vboz1_then_la1 + lda o1 + cmp #0 + bne b8 + jmp b7 + //SEG36 bool_complex::@7 + b7: + //SEG37 [19] if((boolean) bool_complex::o1#0) goto bool_complex::@4 [ bool_complex::i#2 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o2#0 ] ) -- vboz1_then_la1 + lda o1 + cmp #0 + bne b4 + jmp b9 + //SEG38 bool_complex::@9 + b9: + //SEG39 [20] if((boolean) bool_complex::o2#0) goto bool_complex::@4 [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- vboz1_then_la1 + lda o2 + cmp #0 + bne b4 + jmp b2 + //SEG40 bool_complex::@2 + b2: + //SEG41 [21] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) '*' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 + ldy i + lda #'*' + sta screen,y + jmp b3 + //SEG42 bool_complex::@3 + b3: + //SEG43 [22] (byte) bool_complex::i#1 ← ++ (byte) bool_complex::i#2 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) -- vbuz1=_inc_vbuz1 + inc i + //SEG44 [23] if((byte) bool_complex::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_complex::@1 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) -- vbuz1_neq_vbuc1_then_la1 + lda i + cmp #$15 + bne b1_from_b3 + jmp breturn + //SEG45 bool_complex::@return + breturn: + //SEG46 [24] return [ ] ( main:2::bool_complex:11 [ ] ) + rts + //SEG47 bool_complex::@4 + b4: + //SEG48 [25] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) ' ' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 + ldy i + lda #' ' + sta screen,y + jmp b3 + //SEG49 bool_complex::@8 + b8: + //SEG50 [26] if((boolean) bool_complex::o2#0) goto bool_complex::@2 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ) -- vboz1_then_la1 + lda o2 + cmp #0 + bne b2 + jmp b7 +} +//SEG51 bool_not +bool_not: { + .label screen = $450 + .label _1 = 9 + .label i = 3 + //SEG52 [28] phi from bool_not to bool_not::@1 [phi:bool_not->bool_not::@1] + b1_from_bool_not: + //SEG53 [28] phi (byte) bool_not::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_not->bool_not::@1#0] -- vbuz1=vbuc1 + lda #0 + sta i + jmp b1 + //SEG54 [28] phi from bool_not::@3 to bool_not::@1 [phi:bool_not::@3->bool_not::@1] + b1_from_b3: + //SEG55 [28] phi (byte) bool_not::i#2 = (byte) bool_not::i#1 [phi:bool_not::@3->bool_not::@1#0] -- register_copy + jmp b1 + //SEG56 bool_not::@1 + b1: + //SEG57 [29] (byte~) bool_not::$1 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) -- vbuz1=vbuz2_band_vbuc1 + lda #1 + and i + sta _1 + //SEG58 [30] if((byte) bool_not::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_not::@4 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) -- vbuz1_lt_vbuc1_then_la1 + lda i + cmp #$a + bcc b4 + jmp b7 + //SEG59 bool_not::@7 + b7: + //SEG60 [31] if((byte~) bool_not::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_not::@4 [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- vbuz1_eq_0_then_la1 + lda _1 + beq b4 + jmp b2 + //SEG61 bool_not::@2 + b2: + //SEG62 [32] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) '*' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 + ldy i + lda #'*' + sta screen,y + jmp b3 + //SEG63 bool_not::@3 + b3: + //SEG64 [33] (byte) bool_not::i#1 ← ++ (byte) bool_not::i#2 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) -- vbuz1=_inc_vbuz1 + inc i + //SEG65 [34] if((byte) bool_not::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_not::@1 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) -- vbuz1_neq_vbuc1_then_la1 + lda i + cmp #$15 + bne b1_from_b3 + jmp breturn + //SEG66 bool_not::@return + breturn: + //SEG67 [35] return [ ] ( main:2::bool_not:9 [ ] ) + rts + //SEG68 bool_not::@4 + b4: + //SEG69 [36] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) ' ' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 + ldy i + lda #' ' + sta screen,y + jmp b3 +} +//SEG70 bool_or +bool_or: { + .label screen = $428 + .label _1 = $a + .label i = 4 + //SEG71 [38] phi from bool_or to bool_or::@1 [phi:bool_or->bool_or::@1] + b1_from_bool_or: + //SEG72 [38] phi (byte) bool_or::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_or->bool_or::@1#0] -- vbuz1=vbuc1 + lda #0 + sta i + jmp b1 + //SEG73 [38] phi from bool_or::@3 to bool_or::@1 [phi:bool_or::@3->bool_or::@1] + b1_from_b3: + //SEG74 [38] phi (byte) bool_or::i#2 = (byte) bool_or::i#1 [phi:bool_or::@3->bool_or::@1#0] -- register_copy + jmp b1 + //SEG75 bool_or::@1 + b1: + //SEG76 [39] (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) -- vbuz1=vbuz2_band_vbuc1 + lda #1 + and i + sta _1 + //SEG77 [40] if((byte) bool_or::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_or::@2 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) -- vbuz1_lt_vbuc1_then_la1 lda i cmp #$a bcc b2 jmp b7 - //SEG77 bool_or::@7 + //SEG78 bool_or::@7 b7: - //SEG78 [40] if((byte~) bool_or::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_or::@2 [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- vbuz1_eq_0_then_la1 + //SEG79 [41] if((byte~) bool_or::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_or::@2 [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- vbuz1_eq_0_then_la1 lda _1 beq b2 jmp b4 - //SEG79 bool_or::@4 + //SEG80 bool_or::@4 b4: - //SEG80 [41] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) ' ' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 + //SEG81 [42] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) ' ' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 ldy i lda #' ' sta screen,y jmp b3 - //SEG81 bool_or::@3 + //SEG82 bool_or::@3 b3: - //SEG82 [42] (byte) bool_or::i#1 ← ++ (byte) bool_or::i#2 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) -- vbuz1=_inc_vbuz1 + //SEG83 [43] (byte) bool_or::i#1 ← ++ (byte) bool_or::i#2 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) -- vbuz1=_inc_vbuz1 inc i - //SEG83 [43] if((byte) bool_or::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_or::@1 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) -- vbuz1_neq_vbuc1_then_la1 + //SEG84 [44] if((byte) bool_or::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_or::@1 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) -- vbuz1_neq_vbuc1_then_la1 lda i cmp #$15 bne b1_from_b3 jmp breturn - //SEG84 bool_or::@return + //SEG85 bool_or::@return breturn: - //SEG85 [44] return [ ] ( main:2::bool_or:7 [ ] ) + //SEG86 [45] return [ ] ( main:2::bool_or:7 [ ] ) rts - //SEG86 bool_or::@2 + //SEG87 bool_or::@2 b2: - //SEG87 [45] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) '*' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 + //SEG88 [46] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) '*' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 ldy i lda #'*' sta screen,y jmp b3 } -//SEG88 bool_and +//SEG89 bool_and bool_and: { .label screen = $400 - .label _1 = $a + .label _1 = $b .label i = 5 - //SEG89 [47] phi from bool_and to bool_and::@1 [phi:bool_and->bool_and::@1] + //SEG90 [48] phi from bool_and to bool_and::@1 [phi:bool_and->bool_and::@1] b1_from_bool_and: - //SEG90 [47] phi (byte) bool_and::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_and->bool_and::@1#0] -- vbuz1=vbuc1 + //SEG91 [48] phi (byte) bool_and::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_and->bool_and::@1#0] -- vbuz1=vbuc1 lda #0 sta i jmp b1 - //SEG91 [47] phi from bool_and::@3 to bool_and::@1 [phi:bool_and::@3->bool_and::@1] + //SEG92 [48] phi from bool_and::@3 to bool_and::@1 [phi:bool_and::@3->bool_and::@1] b1_from_b3: - //SEG92 [47] phi (byte) bool_and::i#2 = (byte) bool_and::i#1 [phi:bool_and::@3->bool_and::@1#0] -- register_copy + //SEG93 [48] phi (byte) bool_and::i#2 = (byte) bool_and::i#1 [phi:bool_and::@3->bool_and::@1#0] -- register_copy jmp b1 - //SEG93 bool_and::@1 + //SEG94 bool_and::@1 b1: - //SEG94 [48] (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) -- vbuz1=vbuz2_band_vbuc1 + //SEG95 [49] (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) -- vbuz1=vbuz2_band_vbuc1 lda #1 and i sta _1 - //SEG95 [49] if((byte) bool_and::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_and::@7 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) -- vbuz1_lt_vbuc1_then_la1 + //SEG96 [50] if((byte) bool_and::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_and::@7 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) -- vbuz1_lt_vbuc1_then_la1 lda i cmp #$a bcc b7 jmp b4 - //SEG96 bool_and::@4 + //SEG97 bool_and::@4 b4: - //SEG97 [50] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) ' ' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 + //SEG98 [51] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) ' ' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 ldy i lda #' ' sta screen,y jmp b3 - //SEG98 bool_and::@3 + //SEG99 bool_and::@3 b3: - //SEG99 [51] (byte) bool_and::i#1 ← ++ (byte) bool_and::i#2 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) -- vbuz1=_inc_vbuz1 + //SEG100 [52] (byte) bool_and::i#1 ← ++ (byte) bool_and::i#2 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) -- vbuz1=_inc_vbuz1 inc i - //SEG100 [52] if((byte) bool_and::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_and::@1 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) -- vbuz1_neq_vbuc1_then_la1 + //SEG101 [53] if((byte) bool_and::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_and::@1 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) -- vbuz1_neq_vbuc1_then_la1 lda i cmp #$15 bne b1_from_b3 jmp breturn - //SEG101 bool_and::@return + //SEG102 bool_and::@return breturn: - //SEG102 [53] return [ ] ( main:2::bool_and:5 [ ] ) + //SEG103 [54] return [ ] ( main:2::bool_and:5 [ ] ) rts - //SEG103 bool_and::@7 + //SEG104 bool_and::@7 b7: - //SEG104 [54] if((byte~) bool_and::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_and::@2 [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- vbuz1_eq_0_then_la1 + //SEG105 [55] if((byte~) bool_and::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_and::@2 [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- vbuz1_eq_0_then_la1 lda _1 beq b2 jmp b4 - //SEG105 bool_and::@2 + //SEG106 bool_and::@2 b2: - //SEG106 [55] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) '*' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 + //SEG107 [56] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) '*' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- pbuc1_derefidx_vbuz1=vbuc2 ldy i lda #'*' sta screen,y @@ -1279,61 +1374,75 @@ bool_and: { } REGISTER UPLIFT POTENTIAL REGISTERS -Statement [15] (byte~) bool_complex::$3 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$3 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$3 ] ) always clobbers reg byte a +Statement [15] (boolean) bool_complex::o1#0 ← (byte) bool_complex::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10 [ bool_complex::i#2 bool_complex::o1#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 ] ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ bool_complex::i#2 bool_complex::i#1 ] -Statement [16] (byte~) bool_complex::$7 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ) always clobbers reg byte a -Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ bool_complex::$3 ] -Statement [20] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) '*' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) always clobbers reg byte a -Statement [24] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) ' ' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) always clobbers reg byte a -Statement [28] (byte~) bool_not::$3 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_not::i#2 bool_not::$3 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$3 ] ) always clobbers reg byte a +Statement [16] (byte~) bool_complex::$1 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::$1 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::$1 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BOOL:6 [ bool_complex::o1#0 ] +Statement [17] (boolean) bool_complex::o2#0 ← (byte~) bool_complex::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ) always clobbers reg byte a +Statement [18] if((boolean) bool_complex::o1#0) goto bool_complex::@8 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BOOL:8 [ bool_complex::o2#0 ] +Statement [19] if((boolean) bool_complex::o1#0) goto bool_complex::@4 [ bool_complex::i#2 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o2#0 ] ) always clobbers reg byte a +Statement [20] if((boolean) bool_complex::o2#0) goto bool_complex::@4 [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) always clobbers reg byte a +Statement [21] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) '*' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) always clobbers reg byte a +Statement [25] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) ' ' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) always clobbers reg byte a +Statement [26] if((boolean) bool_complex::o2#0) goto bool_complex::@2 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ) always clobbers reg byte a +Statement [29] (byte~) bool_not::$1 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ bool_not::i#2 bool_not::i#1 ] -Statement [31] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) '*' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) always clobbers reg byte a -Statement [35] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) ' ' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) always clobbers reg byte a -Statement [38] (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) always clobbers reg byte a +Statement [32] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) '*' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) always clobbers reg byte a +Statement [36] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) ' ' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) always clobbers reg byte a +Statement [39] (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ bool_or::i#2 bool_or::i#1 ] -Statement [41] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) ' ' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) always clobbers reg byte a -Statement [45] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) '*' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) always clobbers reg byte a -Statement [48] (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) always clobbers reg byte a +Statement [42] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) ' ' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) always clobbers reg byte a +Statement [46] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) '*' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) always clobbers reg byte a +Statement [49] (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ bool_and::i#2 bool_and::i#1 ] -Statement [50] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) ' ' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) always clobbers reg byte a -Statement [55] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) '*' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) always clobbers reg byte a -Statement [15] (byte~) bool_complex::$3 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$3 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$3 ] ) always clobbers reg byte a -Statement [16] (byte~) bool_complex::$7 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ) always clobbers reg byte a -Statement [20] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) '*' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) always clobbers reg byte a -Statement [24] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) ' ' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) always clobbers reg byte a -Statement [28] (byte~) bool_not::$3 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_not::i#2 bool_not::$3 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$3 ] ) always clobbers reg byte a -Statement [31] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) '*' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) always clobbers reg byte a -Statement [35] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) ' ' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) always clobbers reg byte a -Statement [38] (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) always clobbers reg byte a -Statement [41] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) ' ' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) always clobbers reg byte a -Statement [45] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) '*' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) always clobbers reg byte a -Statement [48] (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) always clobbers reg byte a -Statement [50] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) ' ' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) always clobbers reg byte a -Statement [55] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) '*' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) always clobbers reg byte a +Statement [51] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) ' ' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) always clobbers reg byte a +Statement [56] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) '*' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) always clobbers reg byte a +Statement [15] (boolean) bool_complex::o1#0 ← (byte) bool_complex::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10 [ bool_complex::i#2 bool_complex::o1#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 ] ) always clobbers reg byte a +Statement [16] (byte~) bool_complex::$1 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::$1 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::$1 ] ) always clobbers reg byte a +Statement [17] (boolean) bool_complex::o2#0 ← (byte~) bool_complex::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ) always clobbers reg byte a +Statement [18] if((boolean) bool_complex::o1#0) goto bool_complex::@8 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ) always clobbers reg byte a +Statement [19] if((boolean) bool_complex::o1#0) goto bool_complex::@4 [ bool_complex::i#2 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o2#0 ] ) always clobbers reg byte a +Statement [20] if((boolean) bool_complex::o2#0) goto bool_complex::@4 [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) always clobbers reg byte a +Statement [21] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) '*' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) always clobbers reg byte a +Statement [25] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) ' ' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) always clobbers reg byte a +Statement [26] if((boolean) bool_complex::o2#0) goto bool_complex::@2 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ) always clobbers reg byte a +Statement [29] (byte~) bool_not::$1 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) always clobbers reg byte a +Statement [32] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) '*' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) always clobbers reg byte a +Statement [36] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) ' ' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) always clobbers reg byte a +Statement [39] (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) always clobbers reg byte a +Statement [42] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) ' ' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) always clobbers reg byte a +Statement [46] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) '*' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) always clobbers reg byte a +Statement [49] (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) always clobbers reg byte a +Statement [51] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) ' ' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) always clobbers reg byte a +Statement [56] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) '*' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) always clobbers reg byte a Potential registers zp ZP_BYTE:2 [ bool_complex::i#2 bool_complex::i#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y , Potential registers zp ZP_BYTE:3 [ bool_not::i#2 bool_not::i#1 ] : zp ZP_BYTE:3 , reg byte x , reg byte y , Potential registers zp ZP_BYTE:4 [ bool_or::i#2 bool_or::i#1 ] : zp ZP_BYTE:4 , reg byte x , reg byte y , Potential registers zp ZP_BYTE:5 [ bool_and::i#2 bool_and::i#1 ] : zp ZP_BYTE:5 , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:6 [ bool_complex::$3 ] : zp ZP_BYTE:6 , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:7 [ bool_complex::$7 ] : zp ZP_BYTE:7 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:8 [ bool_not::$3 ] : zp ZP_BYTE:8 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:9 [ bool_or::$1 ] : zp ZP_BYTE:9 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:10 [ bool_and::$1 ] : zp ZP_BYTE:10 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BOOL:6 [ bool_complex::o1#0 ] : zp ZP_BOOL:6 , +Potential registers zp ZP_BYTE:7 [ bool_complex::$1 ] : zp ZP_BYTE:7 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BOOL:8 [ bool_complex::o2#0 ] : zp ZP_BOOL:8 , +Potential registers zp ZP_BYTE:9 [ bool_not::$1 ] : zp ZP_BYTE:9 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:10 [ bool_or::$1 ] : zp ZP_BYTE:10 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:11 [ bool_and::$1 ] : zp ZP_BYTE:11 , reg byte a , reg byte x , reg byte y , REGISTER UPLIFT SCOPES -Uplift Scope [bool_complex] 26.28: zp ZP_BYTE:2 [ bool_complex::i#2 bool_complex::i#1 ] 7.33: zp ZP_BYTE:6 [ bool_complex::$3 ] 5.5: zp ZP_BYTE:7 [ bool_complex::$7 ] -Uplift Scope [bool_and] 27.5: zp ZP_BYTE:5 [ bool_and::i#2 bool_and::i#1 ] 11: zp ZP_BYTE:10 [ bool_and::$1 ] -Uplift Scope [bool_or] 27.5: zp ZP_BYTE:4 [ bool_or::i#2 bool_or::i#1 ] 11: zp ZP_BYTE:9 [ bool_or::$1 ] -Uplift Scope [bool_not] 27.5: zp ZP_BYTE:3 [ bool_not::i#2 bool_not::i#1 ] 11: zp ZP_BYTE:8 [ bool_not::$3 ] +Uplift Scope [bool_complex] 23.1: zp ZP_BYTE:2 [ bool_complex::i#2 bool_complex::i#1 ] 22: zp ZP_BYTE:7 [ bool_complex::$1 ] 8.25: zp ZP_BOOL:8 [ bool_complex::o2#0 ] 6.6: zp ZP_BOOL:6 [ bool_complex::o1#0 ] +Uplift Scope [bool_and] 27.5: zp ZP_BYTE:5 [ bool_and::i#2 bool_and::i#1 ] 11: zp ZP_BYTE:11 [ bool_and::$1 ] +Uplift Scope [bool_or] 27.5: zp ZP_BYTE:4 [ bool_or::i#2 bool_or::i#1 ] 11: zp ZP_BYTE:10 [ bool_or::$1 ] +Uplift Scope [bool_not] 27.5: zp ZP_BYTE:3 [ bool_not::i#2 bool_not::i#1 ] 11: zp ZP_BYTE:9 [ bool_not::$1 ] Uplift Scope [main] Uplift Scope [] -Uplifting [bool_complex] best 3238 combination reg byte y [ bool_complex::i#2 bool_complex::i#1 ] reg byte x [ bool_complex::$3 ] reg byte a [ bool_complex::$7 ] -Uplifting [bool_and] best 3008 combination reg byte x [ bool_and::i#2 bool_and::i#1 ] reg byte a [ bool_and::$1 ] -Uplifting [bool_or] best 2778 combination reg byte x [ bool_or::i#2 bool_or::i#1 ] reg byte a [ bool_or::$1 ] -Uplifting [bool_not] best 2548 combination reg byte x [ bool_not::i#2 bool_not::i#1 ] reg byte a [ bool_not::$3 ] -Uplifting [main] best 2548 combination -Uplifting [] best 2548 combination +Uplifting [bool_complex] best 3523 combination reg byte x [ bool_complex::i#2 bool_complex::i#1 ] reg byte a [ bool_complex::$1 ] zp ZP_BOOL:8 [ bool_complex::o2#0 ] zp ZP_BOOL:6 [ bool_complex::o1#0 ] +Uplifting [bool_and] best 3293 combination reg byte x [ bool_and::i#2 bool_and::i#1 ] reg byte a [ bool_and::$1 ] +Uplifting [bool_or] best 3063 combination reg byte x [ bool_or::i#2 bool_or::i#1 ] reg byte a [ bool_or::$1 ] +Uplifting [bool_not] best 2833 combination reg byte x [ bool_not::i#2 bool_not::i#1 ] reg byte a [ bool_not::$1 ] +Uplifting [main] best 2833 combination +Uplifting [] best 2833 combination +Allocated (was zp ZP_BOOL:6) zp ZP_BOOL:2 [ bool_complex::o1#0 ] +Allocated (was zp ZP_BOOL:8) zp ZP_BOOL:3 [ bool_complex::o2#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart @@ -1360,7 +1469,7 @@ bend: //SEG9 main main: { //SEG10 [5] call bool_and param-assignment [ ] ( main:2 [ ] ) - //SEG11 [46] phi from main to bool_and [phi:main->bool_and] + //SEG11 [47] phi from main to bool_and [phi:main->bool_and] bool_and_from_main: jsr bool_and //SEG12 [6] phi from main to main::@1 [phi:main->main::@1] @@ -1369,7 +1478,7 @@ main: { //SEG13 main::@1 b1: //SEG14 [7] call bool_or param-assignment [ ] ( main:2 [ ] ) - //SEG15 [36] phi from main::@1 to bool_or [phi:main::@1->bool_or] + //SEG15 [37] phi from main::@1 to bool_or [phi:main::@1->bool_or] bool_or_from_b1: jsr bool_or //SEG16 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2] @@ -1378,7 +1487,7 @@ main: { //SEG17 main::@2 b2: //SEG18 [9] call bool_not param-assignment [ ] ( main:2 [ ] ) - //SEG19 [26] phi from main::@2 to bool_not [phi:main::@2->bool_not] + //SEG19 [27] phi from main::@2 to bool_not [phi:main::@2->bool_not] bool_not_from_b2: jsr bool_not //SEG20 [10] phi from main::@2 to main::@3 [phi:main::@2->main::@3] @@ -1399,10 +1508,12 @@ main: { //SEG26 bool_complex bool_complex: { .label screen = $478 + .label o1 = 2 + .label o2 = 3 //SEG27 [14] phi from bool_complex to bool_complex::@1 [phi:bool_complex->bool_complex::@1] b1_from_bool_complex: - //SEG28 [14] phi (byte) bool_complex::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_complex->bool_complex::@1#0] -- vbuyy=vbuc1 - ldy #0 + //SEG28 [14] phi (byte) bool_complex::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_complex->bool_complex::@1#0] -- vbuxx=vbuc1 + ldx #0 jmp b1 //SEG29 [14] phi from bool_complex::@3 to bool_complex::@1 [phi:bool_complex::@3->bool_complex::@1] b1_from_b3: @@ -1410,212 +1521,225 @@ bool_complex: { jmp b1 //SEG31 bool_complex::@1 b1: - //SEG32 [15] (byte~) bool_complex::$3 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$3 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$3 ] ) -- vbuxx=vbuyy_band_vbuc1 - tya - and #1 - tax - //SEG33 [16] (byte~) bool_complex::$7 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ) -- vbuaa=vbuyy_band_vbuc1 - tya - and #1 - //SEG34 [17] if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@8 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ) -- vbuyy_lt_vbuc1_then_la1 - cpy #$a - bcc b8 - jmp b7 - //SEG35 bool_complex::@7 - b7: - //SEG36 [18] if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@4 [ bool_complex::i#2 bool_complex::$7 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$7 ] ) -- vbuyy_lt_vbuc1_then_la1 - cpy #$a - bcc b4 - jmp b9 - //SEG37 bool_complex::@9 - b9: - //SEG38 [19] if((byte~) bool_complex::$7==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@4 [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- vbuaa_eq_0_then_la1 - cmp #0 - beq b4 - jmp b2 - //SEG39 bool_complex::@2 - b2: - //SEG40 [20] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) '*' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- pbuc1_derefidx_vbuyy=vbuc2 - lda #'*' - sta screen,y - jmp b3 - //SEG41 bool_complex::@3 - b3: - //SEG42 [21] (byte) bool_complex::i#1 ← ++ (byte) bool_complex::i#2 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) -- vbuyy=_inc_vbuyy - iny - //SEG43 [22] if((byte) bool_complex::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_complex::@1 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) -- vbuyy_neq_vbuc1_then_la1 - cpy #$15 - bne b1_from_b3 - jmp breturn - //SEG44 bool_complex::@return - breturn: - //SEG45 [23] return [ ] ( main:2::bool_complex:11 [ ] ) - rts - //SEG46 bool_complex::@4 - b4: - //SEG47 [24] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) ' ' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- pbuc1_derefidx_vbuyy=vbuc2 - lda #' ' - sta screen,y - jmp b3 - //SEG48 bool_complex::@8 - b8: - //SEG49 [25] if((byte~) bool_complex::$3==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@2 [ bool_complex::i#2 bool_complex::$7 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$7 ] ) -- vbuxx_eq_0_then_la1 - cpx #0 - beq b2 - jmp b7 -} -//SEG50 bool_not -bool_not: { - .label screen = $450 - //SEG51 [27] phi from bool_not to bool_not::@1 [phi:bool_not->bool_not::@1] - b1_from_bool_not: - //SEG52 [27] phi (byte) bool_not::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_not->bool_not::@1#0] -- vbuxx=vbuc1 - ldx #0 - jmp b1 - //SEG53 [27] phi from bool_not::@3 to bool_not::@1 [phi:bool_not::@3->bool_not::@1] - b1_from_b3: - //SEG54 [27] phi (byte) bool_not::i#2 = (byte) bool_not::i#1 [phi:bool_not::@3->bool_not::@1#0] -- register_copy - jmp b1 - //SEG55 bool_not::@1 - b1: - //SEG56 [28] (byte~) bool_not::$3 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_not::i#2 bool_not::$3 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$3 ] ) -- vbuaa=vbuxx_band_vbuc1 + //SEG32 [15] (boolean) bool_complex::o1#0 ← (byte) bool_complex::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10 [ bool_complex::i#2 bool_complex::o1#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 ] ) -- vboz1=vbuxx_lt_vbuc1 + cpx #$a + lda #0 + rol + eor #1 + sta o1 + //SEG33 [16] (byte~) bool_complex::$1 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::$1 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::$1 ] ) -- vbuaa=vbuxx_band_vbuc1 txa and #1 - //SEG57 [29] if((byte) bool_not::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_not::@4 [ bool_not::i#2 bool_not::$3 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$3 ] ) -- vbuxx_lt_vbuc1_then_la1 - cpx #$a - bcc b4 - jmp b7 - //SEG58 bool_not::@7 - b7: - //SEG59 [30] if((byte~) bool_not::$3==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_not::@4 [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- vbuaa_eq_0_then_la1 + //SEG34 [17] (boolean) bool_complex::o2#0 ← (byte~) bool_complex::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ) -- vboz1=vbuaa_eq_vbuc1 cmp #0 - beq b4 + beq !+ + lda #1 + !: + eor #1 + sta o2 + //SEG35 [18] if((boolean) bool_complex::o1#0) goto bool_complex::@8 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ) -- vboz1_then_la1 + lda o1 + cmp #0 + bne b8 + jmp b7 + //SEG36 bool_complex::@7 + b7: + //SEG37 [19] if((boolean) bool_complex::o1#0) goto bool_complex::@4 [ bool_complex::i#2 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o2#0 ] ) -- vboz1_then_la1 + lda o1 + cmp #0 + bne b4 + jmp b9 + //SEG38 bool_complex::@9 + b9: + //SEG39 [20] if((boolean) bool_complex::o2#0) goto bool_complex::@4 [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- vboz1_then_la1 + lda o2 + cmp #0 + bne b4 jmp b2 - //SEG60 bool_not::@2 + //SEG40 bool_complex::@2 b2: - //SEG61 [31] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) '*' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + //SEG41 [21] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) '*' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 lda #'*' sta screen,x jmp b3 - //SEG62 bool_not::@3 + //SEG42 bool_complex::@3 b3: - //SEG63 [32] (byte) bool_not::i#1 ← ++ (byte) bool_not::i#2 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) -- vbuxx=_inc_vbuxx + //SEG43 [22] (byte) bool_complex::i#1 ← ++ (byte) bool_complex::i#2 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) -- vbuxx=_inc_vbuxx inx - //SEG64 [33] if((byte) bool_not::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_not::@1 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 + //SEG44 [23] if((byte) bool_complex::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_complex::@1 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 cpx #$15 bne b1_from_b3 jmp breturn - //SEG65 bool_not::@return + //SEG45 bool_complex::@return breturn: - //SEG66 [34] return [ ] ( main:2::bool_not:9 [ ] ) + //SEG46 [24] return [ ] ( main:2::bool_complex:11 [ ] ) rts - //SEG67 bool_not::@4 + //SEG47 bool_complex::@4 b4: - //SEG68 [35] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) ' ' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + //SEG48 [25] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) ' ' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + lda #' ' + sta screen,x + jmp b3 + //SEG49 bool_complex::@8 + b8: + //SEG50 [26] if((boolean) bool_complex::o2#0) goto bool_complex::@2 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ) -- vboz1_then_la1 + lda o2 + cmp #0 + bne b2 + jmp b7 +} +//SEG51 bool_not +bool_not: { + .label screen = $450 + //SEG52 [28] phi from bool_not to bool_not::@1 [phi:bool_not->bool_not::@1] + b1_from_bool_not: + //SEG53 [28] phi (byte) bool_not::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_not->bool_not::@1#0] -- vbuxx=vbuc1 + ldx #0 + jmp b1 + //SEG54 [28] phi from bool_not::@3 to bool_not::@1 [phi:bool_not::@3->bool_not::@1] + b1_from_b3: + //SEG55 [28] phi (byte) bool_not::i#2 = (byte) bool_not::i#1 [phi:bool_not::@3->bool_not::@1#0] -- register_copy + jmp b1 + //SEG56 bool_not::@1 + b1: + //SEG57 [29] (byte~) bool_not::$1 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) -- vbuaa=vbuxx_band_vbuc1 + txa + and #1 + //SEG58 [30] if((byte) bool_not::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_not::@4 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) -- vbuxx_lt_vbuc1_then_la1 + cpx #$a + bcc b4 + jmp b7 + //SEG59 bool_not::@7 + b7: + //SEG60 [31] if((byte~) bool_not::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_not::@4 [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- vbuaa_eq_0_then_la1 + cmp #0 + beq b4 + jmp b2 + //SEG61 bool_not::@2 + b2: + //SEG62 [32] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) '*' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + lda #'*' + sta screen,x + jmp b3 + //SEG63 bool_not::@3 + b3: + //SEG64 [33] (byte) bool_not::i#1 ← ++ (byte) bool_not::i#2 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) -- vbuxx=_inc_vbuxx + inx + //SEG65 [34] if((byte) bool_not::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_not::@1 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 + cpx #$15 + bne b1_from_b3 + jmp breturn + //SEG66 bool_not::@return + breturn: + //SEG67 [35] return [ ] ( main:2::bool_not:9 [ ] ) + rts + //SEG68 bool_not::@4 + b4: + //SEG69 [36] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) ' ' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 lda #' ' sta screen,x jmp b3 } -//SEG69 bool_or +//SEG70 bool_or bool_or: { .label screen = $428 - //SEG70 [37] phi from bool_or to bool_or::@1 [phi:bool_or->bool_or::@1] + //SEG71 [38] phi from bool_or to bool_or::@1 [phi:bool_or->bool_or::@1] b1_from_bool_or: - //SEG71 [37] phi (byte) bool_or::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_or->bool_or::@1#0] -- vbuxx=vbuc1 + //SEG72 [38] phi (byte) bool_or::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_or->bool_or::@1#0] -- vbuxx=vbuc1 ldx #0 jmp b1 - //SEG72 [37] phi from bool_or::@3 to bool_or::@1 [phi:bool_or::@3->bool_or::@1] + //SEG73 [38] phi from bool_or::@3 to bool_or::@1 [phi:bool_or::@3->bool_or::@1] b1_from_b3: - //SEG73 [37] phi (byte) bool_or::i#2 = (byte) bool_or::i#1 [phi:bool_or::@3->bool_or::@1#0] -- register_copy + //SEG74 [38] phi (byte) bool_or::i#2 = (byte) bool_or::i#1 [phi:bool_or::@3->bool_or::@1#0] -- register_copy jmp b1 - //SEG74 bool_or::@1 + //SEG75 bool_or::@1 b1: - //SEG75 [38] (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) -- vbuaa=vbuxx_band_vbuc1 + //SEG76 [39] (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) -- vbuaa=vbuxx_band_vbuc1 txa and #1 - //SEG76 [39] if((byte) bool_or::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_or::@2 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) -- vbuxx_lt_vbuc1_then_la1 + //SEG77 [40] if((byte) bool_or::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_or::@2 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) -- vbuxx_lt_vbuc1_then_la1 cpx #$a bcc b2 jmp b7 - //SEG77 bool_or::@7 + //SEG78 bool_or::@7 b7: - //SEG78 [40] if((byte~) bool_or::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_or::@2 [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- vbuaa_eq_0_then_la1 + //SEG79 [41] if((byte~) bool_or::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_or::@2 [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- vbuaa_eq_0_then_la1 cmp #0 beq b2 jmp b4 - //SEG79 bool_or::@4 + //SEG80 bool_or::@4 b4: - //SEG80 [41] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) ' ' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + //SEG81 [42] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) ' ' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 lda #' ' sta screen,x jmp b3 - //SEG81 bool_or::@3 + //SEG82 bool_or::@3 b3: - //SEG82 [42] (byte) bool_or::i#1 ← ++ (byte) bool_or::i#2 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) -- vbuxx=_inc_vbuxx + //SEG83 [43] (byte) bool_or::i#1 ← ++ (byte) bool_or::i#2 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) -- vbuxx=_inc_vbuxx inx - //SEG83 [43] if((byte) bool_or::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_or::@1 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 + //SEG84 [44] if((byte) bool_or::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_or::@1 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 cpx #$15 bne b1_from_b3 jmp breturn - //SEG84 bool_or::@return + //SEG85 bool_or::@return breturn: - //SEG85 [44] return [ ] ( main:2::bool_or:7 [ ] ) + //SEG86 [45] return [ ] ( main:2::bool_or:7 [ ] ) rts - //SEG86 bool_or::@2 + //SEG87 bool_or::@2 b2: - //SEG87 [45] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) '*' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + //SEG88 [46] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) '*' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 lda #'*' sta screen,x jmp b3 } -//SEG88 bool_and +//SEG89 bool_and bool_and: { .label screen = $400 - //SEG89 [47] phi from bool_and to bool_and::@1 [phi:bool_and->bool_and::@1] + //SEG90 [48] phi from bool_and to bool_and::@1 [phi:bool_and->bool_and::@1] b1_from_bool_and: - //SEG90 [47] phi (byte) bool_and::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_and->bool_and::@1#0] -- vbuxx=vbuc1 + //SEG91 [48] phi (byte) bool_and::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_and->bool_and::@1#0] -- vbuxx=vbuc1 ldx #0 jmp b1 - //SEG91 [47] phi from bool_and::@3 to bool_and::@1 [phi:bool_and::@3->bool_and::@1] + //SEG92 [48] phi from bool_and::@3 to bool_and::@1 [phi:bool_and::@3->bool_and::@1] b1_from_b3: - //SEG92 [47] phi (byte) bool_and::i#2 = (byte) bool_and::i#1 [phi:bool_and::@3->bool_and::@1#0] -- register_copy + //SEG93 [48] phi (byte) bool_and::i#2 = (byte) bool_and::i#1 [phi:bool_and::@3->bool_and::@1#0] -- register_copy jmp b1 - //SEG93 bool_and::@1 + //SEG94 bool_and::@1 b1: - //SEG94 [48] (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) -- vbuaa=vbuxx_band_vbuc1 + //SEG95 [49] (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) -- vbuaa=vbuxx_band_vbuc1 txa and #1 - //SEG95 [49] if((byte) bool_and::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_and::@7 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) -- vbuxx_lt_vbuc1_then_la1 + //SEG96 [50] if((byte) bool_and::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_and::@7 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) -- vbuxx_lt_vbuc1_then_la1 cpx #$a bcc b7 jmp b4 - //SEG96 bool_and::@4 + //SEG97 bool_and::@4 b4: - //SEG97 [50] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) ' ' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + //SEG98 [51] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) ' ' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 lda #' ' sta screen,x jmp b3 - //SEG98 bool_and::@3 + //SEG99 bool_and::@3 b3: - //SEG99 [51] (byte) bool_and::i#1 ← ++ (byte) bool_and::i#2 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) -- vbuxx=_inc_vbuxx + //SEG100 [52] (byte) bool_and::i#1 ← ++ (byte) bool_and::i#2 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) -- vbuxx=_inc_vbuxx inx - //SEG100 [52] if((byte) bool_and::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_and::@1 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 + //SEG101 [53] if((byte) bool_and::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_and::@1 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 cpx #$15 bne b1_from_b3 jmp breturn - //SEG101 bool_and::@return + //SEG102 bool_and::@return breturn: - //SEG102 [53] return [ ] ( main:2::bool_and:5 [ ] ) + //SEG103 [54] return [ ] ( main:2::bool_and:5 [ ] ) rts - //SEG103 bool_and::@7 + //SEG104 bool_and::@7 b7: - //SEG104 [54] if((byte~) bool_and::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_and::@2 [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- vbuaa_eq_0_then_la1 + //SEG105 [55] if((byte~) bool_and::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_and::@2 [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- vbuaa_eq_0_then_la1 cmp #0 beq b2 jmp b4 - //SEG105 bool_and::@2 + //SEG106 bool_and::@2 b2: - //SEG106 [55] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) '*' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + //SEG107 [56] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) '*' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 lda #'*' sta screen,x jmp b3 @@ -1710,11 +1834,13 @@ FINAL SYMBOL TABLE (byte) bool_and::i (byte) bool_and::i#1 reg byte x 16.5 (byte) bool_and::i#2 reg byte x 11.0 +(boolean) bool_and::o1 +(boolean) bool_and::o2 +(boolean) bool_and::o3 (byte*) bool_and::screen (const byte*) bool_and::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) 1024 (void()) bool_complex() -(byte~) bool_complex::$3 reg byte x 7.333333333333333 -(byte~) bool_complex::$7 reg byte a 5.5 +(byte~) bool_complex::$1 reg byte a 22.0 (label) bool_complex::@1 (label) bool_complex::@2 (label) bool_complex::@3 @@ -1724,12 +1850,19 @@ FINAL SYMBOL TABLE (label) bool_complex::@9 (label) bool_complex::@return (byte) bool_complex::i -(byte) bool_complex::i#1 reg byte y 16.5 -(byte) bool_complex::i#2 reg byte y 9.777777777777779 +(byte) bool_complex::i#1 reg byte x 16.5 +(byte) bool_complex::i#2 reg byte x 6.6 +(boolean) bool_complex::o1 +(boolean) bool_complex::o1#0 o1 zp ZP_BOOL:2 6.6000000000000005 +(boolean) bool_complex::o2 +(boolean) bool_complex::o2#0 o2 zp ZP_BOOL:3 8.25 +(boolean) bool_complex::o3 +(boolean) bool_complex::o4 +(boolean) bool_complex::o5 (byte*) bool_complex::screen (const byte*) bool_complex::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) 1144 (void()) bool_not() -(byte~) bool_not::$3 reg byte a 11.0 +(byte~) bool_not::$1 reg byte a 11.0 (label) bool_not::@1 (label) bool_not::@2 (label) bool_not::@3 @@ -1739,6 +1872,9 @@ FINAL SYMBOL TABLE (byte) bool_not::i (byte) bool_not::i#1 reg byte x 16.5 (byte) bool_not::i#2 reg byte x 11.0 +(boolean) bool_not::o1 +(boolean) bool_not::o2 +(boolean) bool_not::o3 (byte*) bool_not::screen (const byte*) bool_not::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) 1104 (void()) bool_or() @@ -1752,6 +1888,9 @@ FINAL SYMBOL TABLE (byte) bool_or::i (byte) bool_or::i#1 reg byte x 16.5 (byte) bool_or::i#2 reg byte x 11.0 +(boolean) bool_or::o1 +(boolean) bool_or::o2 +(boolean) bool_or::o3 (byte*) bool_or::screen (const byte*) bool_or::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) 1064 (void()) main() @@ -1760,19 +1899,20 @@ FINAL SYMBOL TABLE (label) main::@3 (label) main::@return -reg byte y [ bool_complex::i#2 bool_complex::i#1 ] +reg byte x [ bool_complex::i#2 bool_complex::i#1 ] reg byte x [ bool_not::i#2 bool_not::i#1 ] reg byte x [ bool_or::i#2 bool_or::i#1 ] reg byte x [ bool_and::i#2 bool_and::i#1 ] -reg byte x [ bool_complex::$3 ] -reg byte a [ bool_complex::$7 ] -reg byte a [ bool_not::$3 ] +zp ZP_BOOL:2 [ bool_complex::o1#0 ] +reg byte a [ bool_complex::$1 ] +zp ZP_BOOL:3 [ bool_complex::o2#0 ] +reg byte a [ bool_not::$1 ] reg byte a [ bool_or::$1 ] reg byte a [ bool_and::$1 ] FINAL ASSEMBLER -Score: 1810 +Score: 2095 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -1790,17 +1930,17 @@ Score: 1810 //SEG9 main main: { //SEG10 [5] call bool_and param-assignment [ ] ( main:2 [ ] ) - //SEG11 [46] phi from main to bool_and [phi:main->bool_and] + //SEG11 [47] phi from main to bool_and [phi:main->bool_and] jsr bool_and //SEG12 [6] phi from main to main::@1 [phi:main->main::@1] //SEG13 main::@1 //SEG14 [7] call bool_or param-assignment [ ] ( main:2 [ ] ) - //SEG15 [36] phi from main::@1 to bool_or [phi:main::@1->bool_or] + //SEG15 [37] phi from main::@1 to bool_or [phi:main::@1->bool_or] jsr bool_or //SEG16 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2] //SEG17 main::@2 //SEG18 [9] call bool_not param-assignment [ ] ( main:2 [ ] ) - //SEG19 [26] phi from main::@2 to bool_not [phi:main::@2->bool_not] + //SEG19 [27] phi from main::@2 to bool_not [phi:main::@2->bool_not] jsr bool_not //SEG20 [10] phi from main::@2 to main::@3 [phi:main::@2->main::@3] //SEG21 main::@3 @@ -1814,182 +1954,197 @@ main: { //SEG26 bool_complex bool_complex: { .label screen = $478 + .label o1 = 2 + .label o2 = 3 //SEG27 [14] phi from bool_complex to bool_complex::@1 [phi:bool_complex->bool_complex::@1] - //SEG28 [14] phi (byte) bool_complex::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_complex->bool_complex::@1#0] -- vbuyy=vbuc1 - ldy #0 + //SEG28 [14] phi (byte) bool_complex::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_complex->bool_complex::@1#0] -- vbuxx=vbuc1 + ldx #0 //SEG29 [14] phi from bool_complex::@3 to bool_complex::@1 [phi:bool_complex::@3->bool_complex::@1] //SEG30 [14] phi (byte) bool_complex::i#2 = (byte) bool_complex::i#1 [phi:bool_complex::@3->bool_complex::@1#0] -- register_copy //SEG31 bool_complex::@1 b1: - //SEG32 [15] (byte~) bool_complex::$3 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$3 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$3 ] ) -- vbuxx=vbuyy_band_vbuc1 - tya + //SEG32 [15] (boolean) bool_complex::o1#0 ← (byte) bool_complex::i#2 < (byte/signed byte/word/signed word/dword/signed dword) 10 [ bool_complex::i#2 bool_complex::o1#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 ] ) -- vboz1=vbuxx_lt_vbuc1 + cpx #$a + lda #0 + rol + eor #1 + sta o1 + //SEG33 [16] (byte~) bool_complex::$1 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::$1 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::$1 ] ) -- vbuaa=vbuxx_band_vbuc1 + txa and #1 - tax - //SEG33 [16] (byte~) bool_complex::$7 ← (byte) bool_complex::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ) -- vbuaa=vbuyy_band_vbuc1 - tya - and #1 - //SEG34 [17] if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@8 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$3 bool_complex::$7 ] ) -- vbuyy_lt_vbuc1_then_la1 - cpy #$a - bcc b8 - //SEG35 bool_complex::@7 - b7: - //SEG36 [18] if((byte) bool_complex::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_complex::@4 [ bool_complex::i#2 bool_complex::$7 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$7 ] ) -- vbuyy_lt_vbuc1_then_la1 - cpy #$a - bcc b4 - //SEG37 bool_complex::@9 - //SEG38 [19] if((byte~) bool_complex::$7==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@4 [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- vbuaa_eq_0_then_la1 + //SEG34 [17] (boolean) bool_complex::o2#0 ← (byte~) bool_complex::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ) -- vboz1=vbuaa_eq_vbuc1 cmp #0 - beq b4 - //SEG39 bool_complex::@2 + beq !+ + lda #1 + !: + eor #1 + sta o2 + //SEG35 [18] if((boolean) bool_complex::o1#0) goto bool_complex::@8 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ) -- vboz1_then_la1 + lda o1 + cmp #0 + bne b8 + //SEG36 bool_complex::@7 + b7: + //SEG37 [19] if((boolean) bool_complex::o1#0) goto bool_complex::@4 [ bool_complex::i#2 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o2#0 ] ) -- vboz1_then_la1 + lda o1 + cmp #0 + bne b4 + //SEG38 bool_complex::@9 + //SEG39 [20] if((boolean) bool_complex::o2#0) goto bool_complex::@4 [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- vboz1_then_la1 + lda o2 + cmp #0 + bne b4 + //SEG40 bool_complex::@2 b2: - //SEG40 [20] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) '*' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- pbuc1_derefidx_vbuyy=vbuc2 + //SEG41 [21] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) '*' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 lda #'*' - sta screen,y - //SEG41 bool_complex::@3 + sta screen,x + //SEG42 bool_complex::@3 b3: - //SEG42 [21] (byte) bool_complex::i#1 ← ++ (byte) bool_complex::i#2 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) -- vbuyy=_inc_vbuyy - iny - //SEG43 [22] if((byte) bool_complex::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_complex::@1 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) -- vbuyy_neq_vbuc1_then_la1 - cpy #$15 + //SEG43 [22] (byte) bool_complex::i#1 ← ++ (byte) bool_complex::i#2 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) -- vbuxx=_inc_vbuxx + inx + //SEG44 [23] if((byte) bool_complex::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_complex::@1 [ bool_complex::i#1 ] ( main:2::bool_complex:11 [ bool_complex::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 + cpx #$15 bne b1 - //SEG44 bool_complex::@return - //SEG45 [23] return [ ] ( main:2::bool_complex:11 [ ] ) + //SEG45 bool_complex::@return + //SEG46 [24] return [ ] ( main:2::bool_complex:11 [ ] ) rts - //SEG46 bool_complex::@4 + //SEG47 bool_complex::@4 b4: - //SEG47 [24] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) ' ' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- pbuc1_derefidx_vbuyy=vbuc2 + //SEG48 [25] *((const byte*) bool_complex::screen#0 + (byte) bool_complex::i#2) ← (byte) ' ' [ bool_complex::i#2 ] ( main:2::bool_complex:11 [ bool_complex::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 lda #' ' - sta screen,y + sta screen,x jmp b3 - //SEG48 bool_complex::@8 + //SEG49 bool_complex::@8 b8: - //SEG49 [25] if((byte~) bool_complex::$3==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_complex::@2 [ bool_complex::i#2 bool_complex::$7 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::$7 ] ) -- vbuxx_eq_0_then_la1 - cpx #0 - beq b2 + //SEG50 [26] if((boolean) bool_complex::o2#0) goto bool_complex::@2 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ( main:2::bool_complex:11 [ bool_complex::i#2 bool_complex::o1#0 bool_complex::o2#0 ] ) -- vboz1_then_la1 + lda o2 + cmp #0 + bne b2 jmp b7 } -//SEG50 bool_not +//SEG51 bool_not bool_not: { .label screen = $450 - //SEG51 [27] phi from bool_not to bool_not::@1 [phi:bool_not->bool_not::@1] - //SEG52 [27] phi (byte) bool_not::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_not->bool_not::@1#0] -- vbuxx=vbuc1 + //SEG52 [28] phi from bool_not to bool_not::@1 [phi:bool_not->bool_not::@1] + //SEG53 [28] phi (byte) bool_not::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_not->bool_not::@1#0] -- vbuxx=vbuc1 ldx #0 - //SEG53 [27] phi from bool_not::@3 to bool_not::@1 [phi:bool_not::@3->bool_not::@1] - //SEG54 [27] phi (byte) bool_not::i#2 = (byte) bool_not::i#1 [phi:bool_not::@3->bool_not::@1#0] -- register_copy - //SEG55 bool_not::@1 + //SEG54 [28] phi from bool_not::@3 to bool_not::@1 [phi:bool_not::@3->bool_not::@1] + //SEG55 [28] phi (byte) bool_not::i#2 = (byte) bool_not::i#1 [phi:bool_not::@3->bool_not::@1#0] -- register_copy + //SEG56 bool_not::@1 b1: - //SEG56 [28] (byte~) bool_not::$3 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_not::i#2 bool_not::$3 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$3 ] ) -- vbuaa=vbuxx_band_vbuc1 + //SEG57 [29] (byte~) bool_not::$1 ← (byte) bool_not::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) -- vbuaa=vbuxx_band_vbuc1 txa and #1 - //SEG57 [29] if((byte) bool_not::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_not::@4 [ bool_not::i#2 bool_not::$3 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$3 ] ) -- vbuxx_lt_vbuc1_then_la1 + //SEG58 [30] if((byte) bool_not::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_not::@4 [ bool_not::i#2 bool_not::$1 ] ( main:2::bool_not:9 [ bool_not::i#2 bool_not::$1 ] ) -- vbuxx_lt_vbuc1_then_la1 cpx #$a bcc b4 - //SEG58 bool_not::@7 - //SEG59 [30] if((byte~) bool_not::$3==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_not::@4 [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- vbuaa_eq_0_then_la1 + //SEG59 bool_not::@7 + //SEG60 [31] if((byte~) bool_not::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_not::@4 [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- vbuaa_eq_0_then_la1 cmp #0 beq b4 - //SEG60 bool_not::@2 - //SEG61 [31] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) '*' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + //SEG61 bool_not::@2 + //SEG62 [32] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) '*' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 lda #'*' sta screen,x - //SEG62 bool_not::@3 + //SEG63 bool_not::@3 b3: - //SEG63 [32] (byte) bool_not::i#1 ← ++ (byte) bool_not::i#2 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) -- vbuxx=_inc_vbuxx + //SEG64 [33] (byte) bool_not::i#1 ← ++ (byte) bool_not::i#2 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) -- vbuxx=_inc_vbuxx inx - //SEG64 [33] if((byte) bool_not::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_not::@1 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 + //SEG65 [34] if((byte) bool_not::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_not::@1 [ bool_not::i#1 ] ( main:2::bool_not:9 [ bool_not::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 cpx #$15 bne b1 - //SEG65 bool_not::@return - //SEG66 [34] return [ ] ( main:2::bool_not:9 [ ] ) + //SEG66 bool_not::@return + //SEG67 [35] return [ ] ( main:2::bool_not:9 [ ] ) rts - //SEG67 bool_not::@4 + //SEG68 bool_not::@4 b4: - //SEG68 [35] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) ' ' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + //SEG69 [36] *((const byte*) bool_not::screen#0 + (byte) bool_not::i#2) ← (byte) ' ' [ bool_not::i#2 ] ( main:2::bool_not:9 [ bool_not::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 lda #' ' sta screen,x jmp b3 } -//SEG69 bool_or +//SEG70 bool_or bool_or: { .label screen = $428 - //SEG70 [37] phi from bool_or to bool_or::@1 [phi:bool_or->bool_or::@1] - //SEG71 [37] phi (byte) bool_or::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_or->bool_or::@1#0] -- vbuxx=vbuc1 + //SEG71 [38] phi from bool_or to bool_or::@1 [phi:bool_or->bool_or::@1] + //SEG72 [38] phi (byte) bool_or::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_or->bool_or::@1#0] -- vbuxx=vbuc1 ldx #0 - //SEG72 [37] phi from bool_or::@3 to bool_or::@1 [phi:bool_or::@3->bool_or::@1] - //SEG73 [37] phi (byte) bool_or::i#2 = (byte) bool_or::i#1 [phi:bool_or::@3->bool_or::@1#0] -- register_copy - //SEG74 bool_or::@1 + //SEG73 [38] phi from bool_or::@3 to bool_or::@1 [phi:bool_or::@3->bool_or::@1] + //SEG74 [38] phi (byte) bool_or::i#2 = (byte) bool_or::i#1 [phi:bool_or::@3->bool_or::@1#0] -- register_copy + //SEG75 bool_or::@1 b1: - //SEG75 [38] (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) -- vbuaa=vbuxx_band_vbuc1 + //SEG76 [39] (byte~) bool_or::$1 ← (byte) bool_or::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) -- vbuaa=vbuxx_band_vbuc1 txa and #1 - //SEG76 [39] if((byte) bool_or::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_or::@2 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) -- vbuxx_lt_vbuc1_then_la1 + //SEG77 [40] if((byte) bool_or::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_or::@2 [ bool_or::i#2 bool_or::$1 ] ( main:2::bool_or:7 [ bool_or::i#2 bool_or::$1 ] ) -- vbuxx_lt_vbuc1_then_la1 cpx #$a bcc b2 - //SEG77 bool_or::@7 - //SEG78 [40] if((byte~) bool_or::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_or::@2 [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- vbuaa_eq_0_then_la1 + //SEG78 bool_or::@7 + //SEG79 [41] if((byte~) bool_or::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_or::@2 [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- vbuaa_eq_0_then_la1 cmp #0 beq b2 - //SEG79 bool_or::@4 - //SEG80 [41] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) ' ' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + //SEG80 bool_or::@4 + //SEG81 [42] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) ' ' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 lda #' ' sta screen,x - //SEG81 bool_or::@3 + //SEG82 bool_or::@3 b3: - //SEG82 [42] (byte) bool_or::i#1 ← ++ (byte) bool_or::i#2 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) -- vbuxx=_inc_vbuxx + //SEG83 [43] (byte) bool_or::i#1 ← ++ (byte) bool_or::i#2 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) -- vbuxx=_inc_vbuxx inx - //SEG83 [43] if((byte) bool_or::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_or::@1 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 + //SEG84 [44] if((byte) bool_or::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_or::@1 [ bool_or::i#1 ] ( main:2::bool_or:7 [ bool_or::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 cpx #$15 bne b1 - //SEG84 bool_or::@return - //SEG85 [44] return [ ] ( main:2::bool_or:7 [ ] ) + //SEG85 bool_or::@return + //SEG86 [45] return [ ] ( main:2::bool_or:7 [ ] ) rts - //SEG86 bool_or::@2 + //SEG87 bool_or::@2 b2: - //SEG87 [45] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) '*' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + //SEG88 [46] *((const byte*) bool_or::screen#0 + (byte) bool_or::i#2) ← (byte) '*' [ bool_or::i#2 ] ( main:2::bool_or:7 [ bool_or::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 lda #'*' sta screen,x jmp b3 } -//SEG88 bool_and +//SEG89 bool_and bool_and: { .label screen = $400 - //SEG89 [47] phi from bool_and to bool_and::@1 [phi:bool_and->bool_and::@1] - //SEG90 [47] phi (byte) bool_and::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_and->bool_and::@1#0] -- vbuxx=vbuc1 + //SEG90 [48] phi from bool_and to bool_and::@1 [phi:bool_and->bool_and::@1] + //SEG91 [48] phi (byte) bool_and::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:bool_and->bool_and::@1#0] -- vbuxx=vbuc1 ldx #0 - //SEG91 [47] phi from bool_and::@3 to bool_and::@1 [phi:bool_and::@3->bool_and::@1] - //SEG92 [47] phi (byte) bool_and::i#2 = (byte) bool_and::i#1 [phi:bool_and::@3->bool_and::@1#0] -- register_copy - //SEG93 bool_and::@1 + //SEG92 [48] phi from bool_and::@3 to bool_and::@1 [phi:bool_and::@3->bool_and::@1] + //SEG93 [48] phi (byte) bool_and::i#2 = (byte) bool_and::i#1 [phi:bool_and::@3->bool_and::@1#0] -- register_copy + //SEG94 bool_and::@1 b1: - //SEG94 [48] (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) -- vbuaa=vbuxx_band_vbuc1 + //SEG95 [49] (byte~) bool_and::$1 ← (byte) bool_and::i#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) -- vbuaa=vbuxx_band_vbuc1 txa and #1 - //SEG95 [49] if((byte) bool_and::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_and::@7 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) -- vbuxx_lt_vbuc1_then_la1 + //SEG96 [50] if((byte) bool_and::i#2<(byte/signed byte/word/signed word/dword/signed dword) 10) goto bool_and::@7 [ bool_and::i#2 bool_and::$1 ] ( main:2::bool_and:5 [ bool_and::i#2 bool_and::$1 ] ) -- vbuxx_lt_vbuc1_then_la1 cpx #$a bcc b7 - //SEG96 bool_and::@4 + //SEG97 bool_and::@4 b4: - //SEG97 [50] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) ' ' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + //SEG98 [51] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) ' ' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 lda #' ' sta screen,x - //SEG98 bool_and::@3 + //SEG99 bool_and::@3 b3: - //SEG99 [51] (byte) bool_and::i#1 ← ++ (byte) bool_and::i#2 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) -- vbuxx=_inc_vbuxx + //SEG100 [52] (byte) bool_and::i#1 ← ++ (byte) bool_and::i#2 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) -- vbuxx=_inc_vbuxx inx - //SEG100 [52] if((byte) bool_and::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_and::@1 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 + //SEG101 [53] if((byte) bool_and::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 21) goto bool_and::@1 [ bool_and::i#1 ] ( main:2::bool_and:5 [ bool_and::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 cpx #$15 bne b1 - //SEG101 bool_and::@return - //SEG102 [53] return [ ] ( main:2::bool_and:5 [ ] ) + //SEG102 bool_and::@return + //SEG103 [54] return [ ] ( main:2::bool_and:5 [ ] ) rts - //SEG103 bool_and::@7 + //SEG104 bool_and::@7 b7: - //SEG104 [54] if((byte~) bool_and::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_and::@2 [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- vbuaa_eq_0_then_la1 + //SEG105 [55] if((byte~) bool_and::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto bool_and::@2 [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- vbuaa_eq_0_then_la1 cmp #0 beq b2 jmp b4 - //SEG105 bool_and::@2 + //SEG106 bool_and::@2 b2: - //SEG106 [55] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) '*' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 + //SEG107 [56] *((const byte*) bool_and::screen#0 + (byte) bool_and::i#2) ← (byte) '*' [ bool_and::i#2 ] ( main:2::bool_and:5 [ bool_and::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuc2 lda #'*' sta screen,x jmp b3 diff --git a/src/test/java/dk/camelot64/kickc/test/ref/bool-vars.sym b/src/test/java/dk/camelot64/kickc/test/ref/bool-vars.sym index d92627d3e..7c5c50474 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/bool-vars.sym +++ b/src/test/java/dk/camelot64/kickc/test/ref/bool-vars.sym @@ -12,11 +12,13 @@ (byte) bool_and::i (byte) bool_and::i#1 reg byte x 16.5 (byte) bool_and::i#2 reg byte x 11.0 +(boolean) bool_and::o1 +(boolean) bool_and::o2 +(boolean) bool_and::o3 (byte*) bool_and::screen (const byte*) bool_and::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) 1024 (void()) bool_complex() -(byte~) bool_complex::$3 reg byte x 7.333333333333333 -(byte~) bool_complex::$7 reg byte a 5.5 +(byte~) bool_complex::$1 reg byte a 22.0 (label) bool_complex::@1 (label) bool_complex::@2 (label) bool_complex::@3 @@ -26,12 +28,19 @@ (label) bool_complex::@9 (label) bool_complex::@return (byte) bool_complex::i -(byte) bool_complex::i#1 reg byte y 16.5 -(byte) bool_complex::i#2 reg byte y 9.777777777777779 +(byte) bool_complex::i#1 reg byte x 16.5 +(byte) bool_complex::i#2 reg byte x 6.6 +(boolean) bool_complex::o1 +(boolean) bool_complex::o1#0 o1 zp ZP_BOOL:2 6.6000000000000005 +(boolean) bool_complex::o2 +(boolean) bool_complex::o2#0 o2 zp ZP_BOOL:3 8.25 +(boolean) bool_complex::o3 +(boolean) bool_complex::o4 +(boolean) bool_complex::o5 (byte*) bool_complex::screen (const byte*) bool_complex::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) 1144 (void()) bool_not() -(byte~) bool_not::$3 reg byte a 11.0 +(byte~) bool_not::$1 reg byte a 11.0 (label) bool_not::@1 (label) bool_not::@2 (label) bool_not::@3 @@ -41,6 +50,9 @@ (byte) bool_not::i (byte) bool_not::i#1 reg byte x 16.5 (byte) bool_not::i#2 reg byte x 11.0 +(boolean) bool_not::o1 +(boolean) bool_not::o2 +(boolean) bool_not::o3 (byte*) bool_not::screen (const byte*) bool_not::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) 1104 (void()) bool_or() @@ -54,6 +66,9 @@ (byte) bool_or::i (byte) bool_or::i#1 reg byte x 16.5 (byte) bool_or::i#2 reg byte x 11.0 +(boolean) bool_or::o1 +(boolean) bool_or::o2 +(boolean) bool_or::o3 (byte*) bool_or::screen (const byte*) bool_or::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) 1064 (void()) main() @@ -62,12 +77,13 @@ (label) main::@3 (label) main::@return -reg byte y [ bool_complex::i#2 bool_complex::i#1 ] +reg byte x [ bool_complex::i#2 bool_complex::i#1 ] reg byte x [ bool_not::i#2 bool_not::i#1 ] reg byte x [ bool_or::i#2 bool_or::i#1 ] reg byte x [ bool_and::i#2 bool_and::i#1 ] -reg byte x [ bool_complex::$3 ] -reg byte a [ bool_complex::$7 ] -reg byte a [ bool_not::$3 ] +zp ZP_BOOL:2 [ bool_complex::o1#0 ] +reg byte a [ bool_complex::$1 ] +zp ZP_BOOL:3 [ bool_complex::o2#0 ] +reg byte a [ bool_not::$1 ] reg byte a [ bool_or::$1 ] reg byte a [ bool_and::$1 ]