1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-12-19 15:29:48 +00:00

Declared constants only create a single version. Closes #34.

This commit is contained in:
jespergravgaard 2017-12-03 14:01:31 +01:00
parent 0323fb0a0d
commit ee5b113b3a
20 changed files with 2097 additions and 4775 deletions

View File

@ -118,6 +118,26 @@ public abstract class Scope implements Symbol {
return symbol;
}
/**
* Get all versions of an unversioned variable
* @param unversioned The unversioned variable
* @return All versions of the variable
*/
public Collection<VariableVersion> getVersions(VariableUnversioned unversioned) {
LinkedHashSet<VariableVersion> versions = new LinkedHashSet<>();
for (Symbol symbol : symbols.values()) {
if(symbol instanceof VariableVersion) {
if(((VariableVersion) symbol).isVersioned()) {
if(((VariableVersion) symbol).getVersionOf().equals(unversioned)) {
versions.add((VariableVersion) symbol);
}
}
}
}
return versions;
}
public String allocateIntermediateVariableName() {
return "$" + intermediateVarCount++;
}

View File

@ -2,6 +2,7 @@ package dk.camelot64.kickc.passes;
import dk.camelot64.kickc.model.*;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
@ -45,6 +46,9 @@ public class Pass1GenerateSingleStaticAssignmentForm extends Pass1Base {
// Assignment to a non-versioned non-intermediary variable
VariableUnversioned assignedSymbol = (VariableUnversioned) assignedVar;
VariableVersion version = assignedSymbol.createVersion();
if(assignedSymbol.isDeclaredConstant()) {
version.setDeclaredConstant(true);
}
statementLValue.setlValue(version.getRef());
}
}
@ -164,15 +168,26 @@ public class Pass1GenerateSingleStaticAssignmentForm extends Pass1Base {
if (rValueVar instanceof VariableUnversioned) {
// rValue needs versioning - look for version in statements
VariableUnversioned rSymbol = (VariableUnversioned) rValueVar;
version = blockVersions.get(rSymbol);
if (version == null) {
// look for version in new phi functions
version = blockNewPhis.get(rSymbol);
}
if (version == null) {
// create a new phi function
version = rSymbol.createVersion();
blockNewPhis.put(rSymbol, version);
if(rSymbol.isDeclaredConstant()) {
// A constant - find the single created version
Scope scope = rSymbol.getScope();
Collection<VariableVersion> versions = scope.getVersions(rSymbol);
if(versions.size()!=1) {
throw new RuntimeException("Error! Constants always must exactly one version "+rSymbol);
}
return versions.iterator().next();
} else {
// A proper variable - find or create version
version = blockVersions.get(rSymbol);
if (version == null) {
// look for version in new phi functions
version = blockNewPhis.get(rSymbol);
}
if (version == null) {
// create a new phi function
version = rSymbol.createVersion();
blockNewPhis.put(rSymbol, version);
}
}
}
}

View File

@ -24,6 +24,15 @@ public class TestPrograms extends TestCase {
helper = new ReferenceHelper("dk/camelot64/kickc/test/ref/");
}
public void testConstantAbsMin() throws IOException, URISyntaxException {
compileAndCompare("constabsmin");
}
public void testBasicFloats() throws IOException, URISyntaxException {
compileAndCompare("basic-floats");
}
public void testDoubleImport() throws IOException, URISyntaxException {
compileAndCompare("double-import");
}

View File

@ -0,0 +1,19 @@
void main() {
// Load word register Y,A into FAC (floating point accumulator)
asm {
lda #$55
ldy #$aa
jsr $b391
}
// Load FAC (floating point accumulator) integer part into word register Y,A
asm {
jsr $b1aa
sty $fe
sta $ff
}
}

View File

@ -0,0 +1,5 @@
const byte* SCREEN = $0400;
void main() {
*SCREEN = 1;
}

View File

@ -0,0 +1,13 @@
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
jsr main
main: {
lda #$55
ldy #$aa
jsr $b391
jsr $b1aa
sty $fe
sta $ff
rts
}

View File

@ -0,0 +1,16 @@
@begin: scope:[] from
[0] phi() [ ] ( )
to:@1
@1: scope:[] from @begin
[1] phi() [ ] ( )
[2] call main param-assignment [ ] ( )
to:@end
@end: scope:[] from @1
[3] phi() [ ] ( )
main: scope:[main] from @1
asm { lda#$55ldy#$aajsr$b391 }
asm { jsr$b1aasty$festa$ff }
to:main::@return
main::@return: scope:[main] from main
[6] return [ ] ( main:2 [ ] )
to:@return

View File

@ -0,0 +1,439 @@
void main() {
// Load word register Y,A into FAC (floating point accumulator)
asm {
lda #$55
ldy #$aa
jsr $b391
}
// Load FAC (floating point accumulator) integer part into word register Y,A
asm {
jsr $b1aa
sty $fe
sta $ff
}
}
PROGRAM
proc (void()) main()
asm { lda#$55ldy#$aajsr$b391 }
asm { jsr$b1aasty$festa$ff }
main::@return:
return
endproc // main()
call main
SYMBOLS
(void()) main()
(label) main::@return
INITIAL CONTROL FLOW GRAPH
@begin: scope:[] from
to:@1
main: scope:[main] from
asm { lda#$55ldy#$aajsr$b391 }
asm { jsr$b1aasty$festa$ff }
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
call main
to:@end
@end: scope:[] from @1
CONTROL FLOW GRAPH
@begin: scope:[] from
to:@1
main: scope:[main] from
asm { lda#$55ldy#$aajsr$b391 }
asm { jsr$b1aasty$festa$ff }
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
call main
to:@end
@end: scope:[] from @1
PROCEDURE MODIFY VARIABLE ANALYSIS
CONTROL FLOW GRAPH WITH ASSIGNMENT CALL
@begin: scope:[] from
to:@1
main: scope:[main] from @1
asm { lda#$55ldy#$aajsr$b391 }
asm { jsr$b1aasty$festa$ff }
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
call main param-assignment
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
Completing Phi functions...
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
to:@1
main: scope:[main] from @1
asm { lda#$55ldy#$aajsr$b391 }
asm { jsr$b1aasty$festa$ff }
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
call main param-assignment
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
CONTROL FLOW GRAPH WITH ASSIGNMENT CALL & RETURN
@begin: scope:[] from
to:@1
main: scope:[main] from @1
asm { lda#$55ldy#$aajsr$b391 }
asm { jsr$b1aasty$festa$ff }
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
call main param-assignment
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
INITIAL SSA SYMBOL TABLE
(label) @1
(label) @2
(label) @begin
(label) @end
(void()) main()
(label) main::@return
Culled Empty Block (label) @2
Succesful SSA optimization Pass2CullEmptyBlocks
CONTROL FLOW GRAPH
@begin: scope:[] from
to:@1
main: scope:[main] from @1
asm { lda#$55ldy#$aajsr$b391 }
asm { jsr$b1aasty$festa$ff }
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
call main param-assignment
to:@end
@end: scope:[] from @1
FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(void()) main()
(label) main::@return
Block Sequence Planned @begin @1 @end main main::@return
Block Sequence Planned @begin @1 @end main main::@return
CONTROL FLOW GRAPH - PHI LIFTED
@begin: scope:[] from
to:@1
@1: scope:[] from @begin
call main param-assignment
to:@end
@end: scope:[] from @1
main: scope:[main] from @1
asm { lda#$55ldy#$aajsr$b391 }
asm { jsr$b1aasty$festa$ff }
to:main::@return
main::@return: scope:[main] from main
return
to:@return
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
CALL GRAPH
Calls in [] to main:2
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES FOUND
@begin: scope:[] from
[0] phi() [ ]
to:@1
@1: scope:[] from @begin
[1] phi() [ ]
[2] call main param-assignment [ ]
to:@end
@end: scope:[] from @1
[3] phi() [ ]
main: scope:[main] from @1
asm { lda#$55ldy#$aajsr$b391 }
asm { jsr$b1aasty$festa$ff }
to:main::@return
main::@return: scope:[main] from main
[6] return [ ]
to:@return
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Block Sequence Planned @begin @1 @end main main::@return
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
Propagating live ranges...
CONTROL FLOW GRAPH - BEFORE EFFECTIVE LIVE RANGES
@begin: scope:[] from
[0] phi() [ ]
to:@1
@1: scope:[] from @begin
[1] phi() [ ]
[2] call main param-assignment [ ]
to:@end
@end: scope:[] from @1
[3] phi() [ ]
main: scope:[main] from @1
asm { lda#$55ldy#$aajsr$b391 }
asm { jsr$b1aasty$festa$ff }
to:main::@return
main::@return: scope:[main] from main
[6] return [ ]
to:@return
CONTROL FLOW GRAPH - PHI MEM COALESCED
@begin: scope:[] from
[0] phi() [ ] ( )
to:@1
@1: scope:[] from @begin
[1] phi() [ ] ( )
[2] call main param-assignment [ ] ( )
to:@end
@end: scope:[] from @1
[3] phi() [ ] ( )
main: scope:[main] from @1
asm { lda#$55ldy#$aajsr$b391 }
asm { jsr$b1aasty$festa$ff }
to:main::@return
main::@return: scope:[main] from main
[6] return [ ] ( main:2 [ ] )
to:@return
DOMINATORS
@begin dominated by @begin
@1 dominated by @1 @begin
@end dominated by @1 @begin @end
main dominated by @1 @begin main
main::@return dominated by main::@return @1 @begin main
NATURAL LOOPS
Found 0 loops in scope []
Found 0 loops in scope [main]
NATURAL LOOPS WITH DEPTH
VARIABLE REGISTER WEIGHTS
(void()) main()
Initial phi equivalence classes
Complete equivalence classes
INITIAL ASM
//SEG0 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
b1:
//SEG5 [2] call main param-assignment [ ] ( )
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
bend:
//SEG8 main
main: {
//SEG9 asm { lda#$55ldy#$aajsr$b391 }
lda #$55
ldy #$aa
jsr $b391
//SEG10 asm { jsr$b1aasty$festa$ff }
jsr $b1aa
sty $fe
sta $ff
jmp breturn
//SEG11 main::@return
breturn:
//SEG12 [6] return [ ] ( main:2 [ ] )
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
Statement asm { lda#$55ldy#$aajsr$b391 } always clobbers reg byte a reg byte y
REGISTER UPLIFT SCOPES
Uplift Scope [main]
Uplift Scope []
Uplifting [main] best 45 combination
Uplifting [] best 45 combination
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
ASSEMBLER
//SEG0 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
//SEG4 @1
b1:
//SEG5 [2] call main param-assignment [ ] ( )
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
//SEG7 @end
bend:
//SEG8 main
main: {
//SEG9 asm { lda#$55ldy#$aajsr$b391 }
lda #$55
ldy #$aa
jsr $b391
//SEG10 asm { jsr$b1aasty$festa$ff }
jsr $b1aa
sty $fe
sta $ff
//SEG11 main::@return
breturn:
//SEG12 [6] return [ ] ( main:2 [ ] )
rts
}
Removing instruction bbegin:
Removing instruction b1_from_bbegin:
Removing instruction bend_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
ASSEMBLER
//SEG0 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
b1:
//SEG5 [2] call main param-assignment [ ] ( )
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 @end
bend:
//SEG8 main
main: {
//SEG9 asm { lda#$55ldy#$aajsr$b391 }
lda #$55
ldy #$aa
jsr $b391
//SEG10 asm { jsr$b1aasty$festa$ff }
jsr $b1aa
sty $fe
sta $ff
//SEG11 main::@return
breturn:
//SEG12 [6] return [ ] ( main:2 [ ] )
rts
}
Removing instruction b1:
Removing instruction bend:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
ASSEMBLER
//SEG0 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main param-assignment [ ] ( )
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 @end
//SEG8 main
main: {
//SEG9 asm { lda#$55ldy#$aajsr$b391 }
lda #$55
ldy #$aa
jsr $b391
//SEG10 asm { jsr$b1aasty$festa$ff }
jsr $b1aa
sty $fe
sta $ff
//SEG11 main::@return
//SEG12 [6] return [ ] ( main:2 [ ] )
rts
}
FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(void()) main()
(label) main::@return
FINAL CODE
//SEG0 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main param-assignment [ ] ( )
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 @end
//SEG8 main
main: {
//SEG9 asm { lda#$55ldy#$aajsr$b391 }
lda #$55
ldy #$aa
jsr $b391
//SEG10 asm { jsr$b1aasty$festa$ff }
jsr $b1aa
sty $fe
sta $ff
//SEG11 main::@return
//SEG12 [6] return [ ] ( main:2 [ ] )
rts
}

View File

@ -0,0 +1,6 @@
(label) @1
(label) @begin
(label) @end
(void()) main()
(label) main::@return

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -314,8 +314,6 @@ plot::@return: scope:[plot] from plot
to:@end
@end: scope:[] from @4
Completing Phi functions...
Completing Phi functions...
Completing Phi functions...
Completing Phi functions...
Completing Phi functions...
@ -325,38 +323,28 @@ CONTROL FLOW GRAPH SSA
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
to:@3
main: scope:[main] from @3
(byte*) SCREEN#3 ← phi( @3/(byte*) SCREEN#6 )
(byte[]) plots#3 ← phi( @3/(byte[]) plots#6 )
(byte) main::i#0 ← (byte/signed byte/word/signed word) 0
to:main::@1
main::@1: scope:[main] from main main::@1
(byte*) SCREEN#1 ← phi( main/(byte*) SCREEN#3 main::@1/(byte*) SCREEN#1 )
(byte[]) plots#1 ← phi( main/(byte[]) plots#3 main::@1/(byte[]) plots#1 )
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
*((byte[]) plots#1 + (byte) main::i#2) ← (byte) main::i#2
*((byte*) SCREEN#1 + (byte) main::i#2) ← (byte/signed byte/word/signed word) 0
*((byte[]) plots#0 + (byte) main::i#2) ← (byte) main::i#2
*((byte*) SCREEN#0 + (byte) main::i#2) ← (byte/signed byte/word/signed word) 0
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$0 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 40
if((boolean~) main::$0) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1 main::@5
(byte*) SCREEN#10 ← phi( main::@1/(byte*) SCREEN#1 main::@5/(byte*) SCREEN#11 )
(byte[]) plots#10 ← phi( main::@1/(byte[]) plots#1 main::@5/(byte[]) plots#11 )
(byte) line::x0#0 ← (byte/signed byte/word/signed word) 0
(byte) line::x1#0 ← (byte/signed byte/word/signed word) 10
call line param-assignment
to:main::@5
main::@5: scope:[main] from main::@2
(byte*) SCREEN#11 ← phi( main::@2/(byte*) SCREEN#10 )
(byte[]) plots#11 ← phi( main::@2/(byte[]) plots#10 )
if(true) goto main::@2
to:main::@return
main::@return: scope:[main] from main::@5
return
to:@return
line: scope:[line] from main::@2
(byte*) SCREEN#7 ← phi( main::@2/(byte*) SCREEN#10 )
(byte[]) plots#7 ← phi( main::@2/(byte[]) plots#10 )
(byte) line::x1#1 ← phi( main::@2/(byte) line::x1#0 )
(byte) line::x0#1 ← phi( main::@2/(byte) line::x0#0 )
(boolean~) line::$0 ← (byte) line::x0#1 < (byte) line::x1#1
@ -364,8 +352,6 @@ line: scope:[line] from main::@2
if((boolean~) line::$1) goto line::@1
to:line::@4
line::@1: scope:[line] from line
(byte*) SCREEN#4 ← phi( line/(byte*) SCREEN#7 )
(byte[]) plots#4 ← phi( line/(byte[]) plots#7 )
(byte) line::x0#2 ← phi( line/(byte) line::x0#1 )
(byte) plot::x#0 ← (byte) line::x0#2
call plot param-assignment
@ -373,23 +359,17 @@ line::@1: scope:[line] from line
line::@7: scope:[line] from line::@1
to:line::@return
line::@4: scope:[line] from line
(byte*) SCREEN#8 ← phi( line/(byte*) SCREEN#7 )
(byte[]) plots#8 ← phi( line/(byte[]) plots#7 )
(byte) line::x1#4 ← phi( line/(byte) line::x1#1 )
(byte) line::x0#3 ← phi( line/(byte) line::x0#1 )
(byte) line::x#0 ← (byte) line::x0#3
to:line::@2
line::@2: scope:[line] from line::@4 line::@8
(byte*) SCREEN#5 ← phi( line::@4/(byte*) SCREEN#8 line::@8/(byte*) SCREEN#9 )
(byte[]) plots#5 ← phi( line::@4/(byte[]) plots#8 line::@8/(byte[]) plots#9 )
(byte) line::x1#3 ← phi( line::@4/(byte) line::x1#4 line::@8/(byte) line::x1#2 )
(byte) line::x#2 ← phi( line::@4/(byte) line::x#0 line::@8/(byte) line::x#1 )
(byte) plot::x#1 ← (byte) line::x#2
call plot param-assignment
to:line::@8
line::@8: scope:[line] from line::@2
(byte*) SCREEN#9 ← phi( line::@2/(byte*) SCREEN#5 )
(byte[]) plots#9 ← phi( line::@2/(byte[]) plots#5 )
(byte) line::x1#2 ← phi( line::@2/(byte) line::x1#3 )
(byte) line::x#3 ← phi( line::@2/(byte) line::x#2 )
(byte) line::x#1 ← ++ (byte) line::x#3
@ -400,21 +380,17 @@ line::@return: scope:[line] from line::@7 line::@8
return
to:@return
plot: scope:[plot] from line::@1 line::@2
(byte*) SCREEN#2 ← phi( line::@1/(byte*) SCREEN#4 line::@2/(byte*) SCREEN#5 )
(byte) plot::x#2 ← phi( line::@1/(byte) plot::x#0 line::@2/(byte) plot::x#1 )
(byte[]) plots#2 ← phi( line::@1/(byte[]) plots#4 line::@2/(byte[]) plots#5 )
(byte~) plot::$0 ← (byte[]) plots#2 *idx (byte) plot::x#2
(byte~) plot::$0 ← (byte[]) plots#0 *idx (byte) plot::x#2
(byte) plot::idx#0 ← (byte~) plot::$0
(byte~) plot::$1 ← (byte*) SCREEN#2 *idx (byte) plot::idx#0
(byte~) plot::$1 ← (byte*) SCREEN#0 *idx (byte) plot::idx#0
(byte~) plot::$2 ← (byte~) plot::$1 + (byte/signed byte/word/signed word) 1
*((byte*) SCREEN#2 + (byte) plot::idx#0) ← (byte~) plot::$2
*((byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte~) plot::$2
to:plot::@return
plot::@return: scope:[plot] from plot
return
to:@return
@3: scope:[] from @begin
(byte*) SCREEN#6 ← phi( @begin/(byte*) SCREEN#0 )
(byte[]) plots#6 ← phi( @begin/(byte[]) plots#0 )
call main param-assignment
to:@4
@4: scope:[] from @3
@ -427,38 +403,28 @@ CONTROL FLOW GRAPH WITH ASSIGNMENT CALL & RETURN
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
to:@3
main: scope:[main] from @3
(byte*) SCREEN#3 ← phi( @3/(byte*) SCREEN#6 )
(byte[]) plots#3 ← phi( @3/(byte[]) plots#6 )
(byte) main::i#0 ← (byte/signed byte/word/signed word) 0
to:main::@1
main::@1: scope:[main] from main main::@1
(byte*) SCREEN#1 ← phi( main/(byte*) SCREEN#3 main::@1/(byte*) SCREEN#1 )
(byte[]) plots#1 ← phi( main/(byte[]) plots#3 main::@1/(byte[]) plots#1 )
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
*((byte[]) plots#1 + (byte) main::i#2) ← (byte) main::i#2
*((byte*) SCREEN#1 + (byte) main::i#2) ← (byte/signed byte/word/signed word) 0
*((byte[]) plots#0 + (byte) main::i#2) ← (byte) main::i#2
*((byte*) SCREEN#0 + (byte) main::i#2) ← (byte/signed byte/word/signed word) 0
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$0 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 40
if((boolean~) main::$0) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1 main::@5
(byte*) SCREEN#10 ← phi( main::@1/(byte*) SCREEN#1 main::@5/(byte*) SCREEN#11 )
(byte[]) plots#10 ← phi( main::@1/(byte[]) plots#1 main::@5/(byte[]) plots#11 )
(byte) line::x0#0 ← (byte/signed byte/word/signed word) 0
(byte) line::x1#0 ← (byte/signed byte/word/signed word) 10
call line param-assignment
to:main::@5
main::@5: scope:[main] from main::@2
(byte*) SCREEN#11 ← phi( main::@2/(byte*) SCREEN#10 )
(byte[]) plots#11 ← phi( main::@2/(byte[]) plots#10 )
if(true) goto main::@2
to:main::@return
main::@return: scope:[main] from main::@5
return
to:@return
line: scope:[line] from main::@2
(byte*) SCREEN#7 ← phi( main::@2/(byte*) SCREEN#10 )
(byte[]) plots#7 ← phi( main::@2/(byte[]) plots#10 )
(byte) line::x1#1 ← phi( main::@2/(byte) line::x1#0 )
(byte) line::x0#1 ← phi( main::@2/(byte) line::x0#0 )
(boolean~) line::$0 ← (byte) line::x0#1 < (byte) line::x1#1
@ -466,8 +432,6 @@ line: scope:[line] from main::@2
if((boolean~) line::$1) goto line::@1
to:line::@4
line::@1: scope:[line] from line
(byte*) SCREEN#4 ← phi( line/(byte*) SCREEN#7 )
(byte[]) plots#4 ← phi( line/(byte[]) plots#7 )
(byte) line::x0#2 ← phi( line/(byte) line::x0#1 )
(byte) plot::x#0 ← (byte) line::x0#2
call plot param-assignment
@ -475,23 +439,17 @@ line::@1: scope:[line] from line
line::@7: scope:[line] from line::@1
to:line::@return
line::@4: scope:[line] from line
(byte*) SCREEN#8 ← phi( line/(byte*) SCREEN#7 )
(byte[]) plots#8 ← phi( line/(byte[]) plots#7 )
(byte) line::x1#4 ← phi( line/(byte) line::x1#1 )
(byte) line::x0#3 ← phi( line/(byte) line::x0#1 )
(byte) line::x#0 ← (byte) line::x0#3
to:line::@2
line::@2: scope:[line] from line::@4 line::@8
(byte*) SCREEN#5 ← phi( line::@4/(byte*) SCREEN#8 line::@8/(byte*) SCREEN#9 )
(byte[]) plots#5 ← phi( line::@4/(byte[]) plots#8 line::@8/(byte[]) plots#9 )
(byte) line::x1#3 ← phi( line::@4/(byte) line::x1#4 line::@8/(byte) line::x1#2 )
(byte) line::x#2 ← phi( line::@4/(byte) line::x#0 line::@8/(byte) line::x#1 )
(byte) plot::x#1 ← (byte) line::x#2
call plot param-assignment
to:line::@8
line::@8: scope:[line] from line::@2
(byte*) SCREEN#9 ← phi( line::@2/(byte*) SCREEN#5 )
(byte[]) plots#9 ← phi( line::@2/(byte[]) plots#5 )
(byte) line::x1#2 ← phi( line::@2/(byte) line::x1#3 )
(byte) line::x#3 ← phi( line::@2/(byte) line::x#2 )
(byte) line::x#1 ← ++ (byte) line::x#3
@ -502,21 +460,17 @@ line::@return: scope:[line] from line::@7 line::@8
return
to:@return
plot: scope:[plot] from line::@1 line::@2
(byte*) SCREEN#2 ← phi( line::@1/(byte*) SCREEN#4 line::@2/(byte*) SCREEN#5 )
(byte) plot::x#2 ← phi( line::@1/(byte) plot::x#0 line::@2/(byte) plot::x#1 )
(byte[]) plots#2 ← phi( line::@1/(byte[]) plots#4 line::@2/(byte[]) plots#5 )
(byte~) plot::$0 ← (byte[]) plots#2 *idx (byte) plot::x#2
(byte~) plot::$0 ← (byte[]) plots#0 *idx (byte) plot::x#2
(byte) plot::idx#0 ← (byte~) plot::$0
(byte~) plot::$1 ← (byte*) SCREEN#2 *idx (byte) plot::idx#0
(byte~) plot::$1 ← (byte*) SCREEN#0 *idx (byte) plot::idx#0
(byte~) plot::$2 ← (byte~) plot::$1 + (byte/signed byte/word/signed word) 1
*((byte*) SCREEN#2 + (byte) plot::idx#0) ← (byte~) plot::$2
*((byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte~) plot::$2
to:plot::@return
plot::@return: scope:[plot] from plot
return
to:@return
@3: scope:[] from @begin
(byte*) SCREEN#6 ← phi( @begin/(byte*) SCREEN#0 )
(byte[]) plots#6 ← phi( @begin/(byte[]) plots#0 )
call main param-assignment
to:@4
@4: scope:[] from @3
@ -530,17 +484,6 @@ INITIAL SSA SYMBOL TABLE
(label) @end
(byte*) SCREEN
(byte*) SCREEN#0
(byte*) SCREEN#1
(byte*) SCREEN#10
(byte*) SCREEN#11
(byte*) SCREEN#2
(byte*) SCREEN#3
(byte*) SCREEN#4
(byte*) SCREEN#5
(byte*) SCREEN#6
(byte*) SCREEN#7
(byte*) SCREEN#8
(byte*) SCREEN#9
(void()) line((byte) line::x0 , (byte) line::x1)
(boolean~) line::$0
(boolean~) line::$1
@ -590,437 +533,11 @@ INITIAL SSA SYMBOL TABLE
(byte) plot::x#2
(byte[]) plots
(byte[]) plots#0
(byte[]) plots#1
(byte[]) plots#10
(byte[]) plots#11
(byte[]) plots#2
(byte[]) plots#3
(byte[]) plots#4
(byte[]) plots#5
(byte[]) plots#6
(byte[]) plots#7
(byte[]) plots#8
(byte[]) plots#9
Culled Empty Block (label) line::@7
Culled Empty Block (label) @4
Succesful SSA optimization Pass2CullEmptyBlocks
CONTROL FLOW GRAPH
@begin: scope:[] from
(byte[]) plots#0 ← ((byte*)) (word/signed word) 4096
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
to:@3
main: scope:[main] from @3
(byte*) SCREEN#3 ← phi( @3/(byte*) SCREEN#6 )
(byte[]) plots#3 ← phi( @3/(byte[]) plots#6 )
(byte) main::i#0 ← (byte/signed byte/word/signed word) 0
to:main::@1
main::@1: scope:[main] from main main::@1
(byte*) SCREEN#1 ← phi( main/(byte*) SCREEN#3 main::@1/(byte*) SCREEN#1 )
(byte[]) plots#1 ← phi( main/(byte[]) plots#3 main::@1/(byte[]) plots#1 )
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
*((byte[]) plots#1 + (byte) main::i#2) ← (byte) main::i#2
*((byte*) SCREEN#1 + (byte) main::i#2) ← (byte/signed byte/word/signed word) 0
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$0 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 40
if((boolean~) main::$0) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1 main::@5
(byte*) SCREEN#10 ← phi( main::@1/(byte*) SCREEN#1 main::@5/(byte*) SCREEN#11 )
(byte[]) plots#10 ← phi( main::@1/(byte[]) plots#1 main::@5/(byte[]) plots#11 )
(byte) line::x0#0 ← (byte/signed byte/word/signed word) 0
(byte) line::x1#0 ← (byte/signed byte/word/signed word) 10
call line param-assignment
to:main::@5
main::@5: scope:[main] from main::@2
(byte*) SCREEN#11 ← phi( main::@2/(byte*) SCREEN#10 )
(byte[]) plots#11 ← phi( main::@2/(byte[]) plots#10 )
if(true) goto main::@2
to:main::@return
main::@return: scope:[main] from main::@5
return
to:@return
line: scope:[line] from main::@2
(byte*) SCREEN#7 ← phi( main::@2/(byte*) SCREEN#10 )
(byte[]) plots#7 ← phi( main::@2/(byte[]) plots#10 )
(byte) line::x1#1 ← phi( main::@2/(byte) line::x1#0 )
(byte) line::x0#1 ← phi( main::@2/(byte) line::x0#0 )
(boolean~) line::$0 ← (byte) line::x0#1 < (byte) line::x1#1
(boolean~) line::$1 ← ! (boolean~) line::$0
if((boolean~) line::$1) goto line::@1
to:line::@4
line::@1: scope:[line] from line
(byte*) SCREEN#4 ← phi( line/(byte*) SCREEN#7 )
(byte[]) plots#4 ← phi( line/(byte[]) plots#7 )
(byte) line::x0#2 ← phi( line/(byte) line::x0#1 )
(byte) plot::x#0 ← (byte) line::x0#2
call plot param-assignment
to:line::@return
line::@4: scope:[line] from line
(byte*) SCREEN#8 ← phi( line/(byte*) SCREEN#7 )
(byte[]) plots#8 ← phi( line/(byte[]) plots#7 )
(byte) line::x1#4 ← phi( line/(byte) line::x1#1 )
(byte) line::x0#3 ← phi( line/(byte) line::x0#1 )
(byte) line::x#0 ← (byte) line::x0#3
to:line::@2
line::@2: scope:[line] from line::@4 line::@8
(byte*) SCREEN#5 ← phi( line::@4/(byte*) SCREEN#8 line::@8/(byte*) SCREEN#9 )
(byte[]) plots#5 ← phi( line::@4/(byte[]) plots#8 line::@8/(byte[]) plots#9 )
(byte) line::x1#3 ← phi( line::@4/(byte) line::x1#4 line::@8/(byte) line::x1#2 )
(byte) line::x#2 ← phi( line::@4/(byte) line::x#0 line::@8/(byte) line::x#1 )
(byte) plot::x#1 ← (byte) line::x#2
call plot param-assignment
to:line::@8
line::@8: scope:[line] from line::@2
(byte*) SCREEN#9 ← phi( line::@2/(byte*) SCREEN#5 )
(byte[]) plots#9 ← phi( line::@2/(byte[]) plots#5 )
(byte) line::x1#2 ← phi( line::@2/(byte) line::x1#3 )
(byte) line::x#3 ← phi( line::@2/(byte) line::x#2 )
(byte) line::x#1 ← ++ (byte) line::x#3
(boolean~) line::$3 ← (byte) line::x#1 <= (byte) line::x1#2
if((boolean~) line::$3) goto line::@2
to:line::@return
line::@return: scope:[line] from line::@1 line::@8
return
to:@return
plot: scope:[plot] from line::@1 line::@2
(byte*) SCREEN#2 ← phi( line::@1/(byte*) SCREEN#4 line::@2/(byte*) SCREEN#5 )
(byte) plot::x#2 ← phi( line::@1/(byte) plot::x#0 line::@2/(byte) plot::x#1 )
(byte[]) plots#2 ← phi( line::@1/(byte[]) plots#4 line::@2/(byte[]) plots#5 )
(byte~) plot::$0 ← (byte[]) plots#2 *idx (byte) plot::x#2
(byte) plot::idx#0 ← (byte~) plot::$0
(byte~) plot::$1 ← (byte*) SCREEN#2 *idx (byte) plot::idx#0
(byte~) plot::$2 ← (byte~) plot::$1 + (byte/signed byte/word/signed word) 1
*((byte*) SCREEN#2 + (byte) plot::idx#0) ← (byte~) plot::$2
to:plot::@return
plot::@return: scope:[plot] from plot
return
to:@return
@3: scope:[] from @begin
(byte*) SCREEN#6 ← phi( @begin/(byte*) SCREEN#0 )
(byte[]) plots#6 ← phi( @begin/(byte[]) plots#0 )
call main param-assignment
to:@end
@end: scope:[] from @3
Inversing boolean not (boolean~) line::$1 ← (byte) line::x0#1 >= (byte) line::x1#1 from (boolean~) line::$0 ← (byte) line::x0#1 < (byte) line::x1#1
Succesful SSA optimization Pass2UnaryNotSimplification
CONTROL FLOW GRAPH
@begin: scope:[] from
(byte[]) plots#0 ← ((byte*)) (word/signed word) 4096
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
to:@3
main: scope:[main] from @3
(byte*) SCREEN#3 ← phi( @3/(byte*) SCREEN#6 )
(byte[]) plots#3 ← phi( @3/(byte[]) plots#6 )
(byte) main::i#0 ← (byte/signed byte/word/signed word) 0
to:main::@1
main::@1: scope:[main] from main main::@1
(byte*) SCREEN#1 ← phi( main/(byte*) SCREEN#3 main::@1/(byte*) SCREEN#1 )
(byte[]) plots#1 ← phi( main/(byte[]) plots#3 main::@1/(byte[]) plots#1 )
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
*((byte[]) plots#1 + (byte) main::i#2) ← (byte) main::i#2
*((byte*) SCREEN#1 + (byte) main::i#2) ← (byte/signed byte/word/signed word) 0
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$0 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 40
if((boolean~) main::$0) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1 main::@5
(byte*) SCREEN#10 ← phi( main::@1/(byte*) SCREEN#1 main::@5/(byte*) SCREEN#11 )
(byte[]) plots#10 ← phi( main::@1/(byte[]) plots#1 main::@5/(byte[]) plots#11 )
(byte) line::x0#0 ← (byte/signed byte/word/signed word) 0
(byte) line::x1#0 ← (byte/signed byte/word/signed word) 10
call line param-assignment
to:main::@5
main::@5: scope:[main] from main::@2
(byte*) SCREEN#11 ← phi( main::@2/(byte*) SCREEN#10 )
(byte[]) plots#11 ← phi( main::@2/(byte[]) plots#10 )
if(true) goto main::@2
to:main::@return
main::@return: scope:[main] from main::@5
return
to:@return
line: scope:[line] from main::@2
(byte*) SCREEN#7 ← phi( main::@2/(byte*) SCREEN#10 )
(byte[]) plots#7 ← phi( main::@2/(byte[]) plots#10 )
(byte) line::x1#1 ← phi( main::@2/(byte) line::x1#0 )
(byte) line::x0#1 ← phi( main::@2/(byte) line::x0#0 )
(boolean~) line::$1 ← (byte) line::x0#1 >= (byte) line::x1#1
if((boolean~) line::$1) goto line::@1
to:line::@4
line::@1: scope:[line] from line
(byte*) SCREEN#4 ← phi( line/(byte*) SCREEN#7 )
(byte[]) plots#4 ← phi( line/(byte[]) plots#7 )
(byte) line::x0#2 ← phi( line/(byte) line::x0#1 )
(byte) plot::x#0 ← (byte) line::x0#2
call plot param-assignment
to:line::@return
line::@4: scope:[line] from line
(byte*) SCREEN#8 ← phi( line/(byte*) SCREEN#7 )
(byte[]) plots#8 ← phi( line/(byte[]) plots#7 )
(byte) line::x1#4 ← phi( line/(byte) line::x1#1 )
(byte) line::x0#3 ← phi( line/(byte) line::x0#1 )
(byte) line::x#0 ← (byte) line::x0#3
to:line::@2
line::@2: scope:[line] from line::@4 line::@8
(byte*) SCREEN#5 ← phi( line::@4/(byte*) SCREEN#8 line::@8/(byte*) SCREEN#9 )
(byte[]) plots#5 ← phi( line::@4/(byte[]) plots#8 line::@8/(byte[]) plots#9 )
(byte) line::x1#3 ← phi( line::@4/(byte) line::x1#4 line::@8/(byte) line::x1#2 )
(byte) line::x#2 ← phi( line::@4/(byte) line::x#0 line::@8/(byte) line::x#1 )
(byte) plot::x#1 ← (byte) line::x#2
call plot param-assignment
to:line::@8
line::@8: scope:[line] from line::@2
(byte*) SCREEN#9 ← phi( line::@2/(byte*) SCREEN#5 )
(byte[]) plots#9 ← phi( line::@2/(byte[]) plots#5 )
(byte) line::x1#2 ← phi( line::@2/(byte) line::x1#3 )
(byte) line::x#3 ← phi( line::@2/(byte) line::x#2 )
(byte) line::x#1 ← ++ (byte) line::x#3
(boolean~) line::$3 ← (byte) line::x#1 <= (byte) line::x1#2
if((boolean~) line::$3) goto line::@2
to:line::@return
line::@return: scope:[line] from line::@1 line::@8
return
to:@return
plot: scope:[plot] from line::@1 line::@2
(byte*) SCREEN#2 ← phi( line::@1/(byte*) SCREEN#4 line::@2/(byte*) SCREEN#5 )
(byte) plot::x#2 ← phi( line::@1/(byte) plot::x#0 line::@2/(byte) plot::x#1 )
(byte[]) plots#2 ← phi( line::@1/(byte[]) plots#4 line::@2/(byte[]) plots#5 )
(byte~) plot::$0 ← (byte[]) plots#2 *idx (byte) plot::x#2
(byte) plot::idx#0 ← (byte~) plot::$0
(byte~) plot::$1 ← (byte*) SCREEN#2 *idx (byte) plot::idx#0
(byte~) plot::$2 ← (byte~) plot::$1 + (byte/signed byte/word/signed word) 1
*((byte*) SCREEN#2 + (byte) plot::idx#0) ← (byte~) plot::$2
to:plot::@return
plot::@return: scope:[plot] from plot
return
to:@return
@3: scope:[] from @begin
(byte*) SCREEN#6 ← phi( @begin/(byte*) SCREEN#0 )
(byte[]) plots#6 ← phi( @begin/(byte[]) plots#0 )
call main param-assignment
to:@end
@end: scope:[] from @3
Not aliassing across scopes: plots#3 plots#6
Not aliassing across scopes: SCREEN#3 SCREEN#6
Not aliassing across scopes: line::x0#1 line::x0#0
Not aliassing across scopes: line::x1#1 line::x1#0
Not aliassing across scopes: plots#7 plots#10
Not aliassing across scopes: SCREEN#7 SCREEN#10
Not aliassing across scopes: plot::x#0 line::x0#2
Not aliassing across scopes: plot::x#1 line::x#2
Not aliassing across scopes: plots#2 plots#4
Not aliassing across scopes: plot::x#2 plot::x#0
Not aliassing across scopes: SCREEN#2 SCREEN#4
Alias (byte[]) plots#10 = (byte[]) plots#11
Alias (byte*) SCREEN#10 = (byte*) SCREEN#11
Alias (byte) line::x#0 = (byte) line::x0#2 (byte) line::x0#1 (byte) line::x0#3
Alias (byte[]) plots#4 = (byte[]) plots#7 (byte[]) plots#8
Alias (byte*) SCREEN#4 = (byte*) SCREEN#7 (byte*) SCREEN#8
Alias (byte) line::x1#1 = (byte) line::x1#4
Alias (byte) line::x#2 = (byte) line::x#3
Alias (byte) line::x1#2 = (byte) line::x1#3
Alias (byte[]) plots#5 = (byte[]) plots#9
Alias (byte*) SCREEN#5 = (byte*) SCREEN#9
Alias (byte) plot::idx#0 = (byte~) plot::$0
Alias (byte[]) plots#0 = (byte[]) plots#6
Alias (byte*) SCREEN#0 = (byte*) SCREEN#6
Succesful SSA optimization Pass2AliasElimination
CONTROL FLOW GRAPH
@begin: scope:[] from
(byte[]) plots#0 ← ((byte*)) (word/signed word) 4096
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
to:@3
main: scope:[main] from @3
(byte*) SCREEN#3 ← phi( @3/(byte*) SCREEN#0 )
(byte[]) plots#3 ← phi( @3/(byte[]) plots#0 )
(byte) main::i#0 ← (byte/signed byte/word/signed word) 0
to:main::@1
main::@1: scope:[main] from main main::@1
(byte*) SCREEN#1 ← phi( main/(byte*) SCREEN#3 main::@1/(byte*) SCREEN#1 )
(byte[]) plots#1 ← phi( main/(byte[]) plots#3 main::@1/(byte[]) plots#1 )
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
*((byte[]) plots#1 + (byte) main::i#2) ← (byte) main::i#2
*((byte*) SCREEN#1 + (byte) main::i#2) ← (byte/signed byte/word/signed word) 0
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$0 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 40
if((boolean~) main::$0) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1 main::@5
(byte*) SCREEN#10 ← phi( main::@1/(byte*) SCREEN#1 main::@5/(byte*) SCREEN#10 )
(byte[]) plots#10 ← phi( main::@1/(byte[]) plots#1 main::@5/(byte[]) plots#10 )
(byte) line::x0#0 ← (byte/signed byte/word/signed word) 0
(byte) line::x1#0 ← (byte/signed byte/word/signed word) 10
call line param-assignment
to:main::@5
main::@5: scope:[main] from main::@2
if(true) goto main::@2
to:main::@return
main::@return: scope:[main] from main::@5
return
to:@return
line: scope:[line] from main::@2
(byte*) SCREEN#4 ← phi( main::@2/(byte*) SCREEN#10 )
(byte[]) plots#4 ← phi( main::@2/(byte[]) plots#10 )
(byte) line::x1#1 ← phi( main::@2/(byte) line::x1#0 )
(byte) line::x#0 ← phi( main::@2/(byte) line::x0#0 )
(boolean~) line::$1 ← (byte) line::x#0 >= (byte) line::x1#1
if((boolean~) line::$1) goto line::@1
to:line::@4
line::@1: scope:[line] from line
(byte) plot::x#0 ← (byte) line::x#0
call plot param-assignment
to:line::@return
line::@4: scope:[line] from line
to:line::@2
line::@2: scope:[line] from line::@4 line::@8
(byte*) SCREEN#5 ← phi( line::@4/(byte*) SCREEN#4 line::@8/(byte*) SCREEN#5 )
(byte[]) plots#5 ← phi( line::@4/(byte[]) plots#4 line::@8/(byte[]) plots#5 )
(byte) line::x1#2 ← phi( line::@4/(byte) line::x1#1 line::@8/(byte) line::x1#2 )
(byte) line::x#2 ← phi( line::@4/(byte) line::x#0 line::@8/(byte) line::x#1 )
(byte) plot::x#1 ← (byte) line::x#2
call plot param-assignment
to:line::@8
line::@8: scope:[line] from line::@2
(byte) line::x#1 ← ++ (byte) line::x#2
(boolean~) line::$3 ← (byte) line::x#1 <= (byte) line::x1#2
if((boolean~) line::$3) goto line::@2
to:line::@return
line::@return: scope:[line] from line::@1 line::@8
return
to:@return
plot: scope:[plot] from line::@1 line::@2
(byte*) SCREEN#2 ← phi( line::@1/(byte*) SCREEN#4 line::@2/(byte*) SCREEN#5 )
(byte) plot::x#2 ← phi( line::@1/(byte) plot::x#0 line::@2/(byte) plot::x#1 )
(byte[]) plots#2 ← phi( line::@1/(byte[]) plots#4 line::@2/(byte[]) plots#5 )
(byte) plot::idx#0 ← (byte[]) plots#2 *idx (byte) plot::x#2
(byte~) plot::$1 ← (byte*) SCREEN#2 *idx (byte) plot::idx#0
(byte~) plot::$2 ← (byte~) plot::$1 + (byte/signed byte/word/signed word) 1
*((byte*) SCREEN#2 + (byte) plot::idx#0) ← (byte~) plot::$2
to:plot::@return
plot::@return: scope:[plot] from plot
return
to:@return
@3: scope:[] from @begin
call main param-assignment
to:@end
@end: scope:[] from @3
Not aliassing across scopes: plots#3 plots#0
Not aliassing across scopes: SCREEN#3 SCREEN#0
Not aliassing across scopes: line::x#0 line::x0#0
Not aliassing across scopes: line::x1#1 line::x1#0
Not aliassing across scopes: plots#4 plots#10
Not aliassing across scopes: SCREEN#4 SCREEN#10
Not aliassing across scopes: plot::x#0 line::x#0
Not aliassing across scopes: plot::x#1 line::x#2
Not aliassing across scopes: plots#2 plots#4
Not aliassing across scopes: plot::x#2 plot::x#0
Not aliassing across scopes: SCREEN#2 SCREEN#4
Self Phi Eliminated (byte[]) plots#1
Self Phi Eliminated (byte*) SCREEN#1
Self Phi Eliminated (byte[]) plots#10
Self Phi Eliminated (byte*) SCREEN#10
Self Phi Eliminated (byte) line::x1#2
Self Phi Eliminated (byte[]) plots#5
Self Phi Eliminated (byte*) SCREEN#5
Succesful SSA optimization Pass2SelfPhiElimination
CONTROL FLOW GRAPH
@begin: scope:[] from
(byte[]) plots#0 ← ((byte*)) (word/signed word) 4096
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
to:@3
main: scope:[main] from @3
(byte*) SCREEN#3 ← phi( @3/(byte*) SCREEN#0 )
(byte[]) plots#3 ← phi( @3/(byte[]) plots#0 )
(byte) main::i#0 ← (byte/signed byte/word/signed word) 0
to:main::@1
main::@1: scope:[main] from main main::@1
(byte*) SCREEN#1 ← phi( main/(byte*) SCREEN#3 )
(byte[]) plots#1 ← phi( main/(byte[]) plots#3 )
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
*((byte[]) plots#1 + (byte) main::i#2) ← (byte) main::i#2
*((byte*) SCREEN#1 + (byte) main::i#2) ← (byte/signed byte/word/signed word) 0
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$0 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 40
if((boolean~) main::$0) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1 main::@5
(byte*) SCREEN#10 ← phi( main::@1/(byte*) SCREEN#1 )
(byte[]) plots#10 ← phi( main::@1/(byte[]) plots#1 )
(byte) line::x0#0 ← (byte/signed byte/word/signed word) 0
(byte) line::x1#0 ← (byte/signed byte/word/signed word) 10
call line param-assignment
to:main::@5
main::@5: scope:[main] from main::@2
if(true) goto main::@2
to:main::@return
main::@return: scope:[main] from main::@5
return
to:@return
line: scope:[line] from main::@2
(byte*) SCREEN#4 ← phi( main::@2/(byte*) SCREEN#10 )
(byte[]) plots#4 ← phi( main::@2/(byte[]) plots#10 )
(byte) line::x1#1 ← phi( main::@2/(byte) line::x1#0 )
(byte) line::x#0 ← phi( main::@2/(byte) line::x0#0 )
(boolean~) line::$1 ← (byte) line::x#0 >= (byte) line::x1#1
if((boolean~) line::$1) goto line::@1
to:line::@4
line::@1: scope:[line] from line
(byte) plot::x#0 ← (byte) line::x#0
call plot param-assignment
to:line::@return
line::@4: scope:[line] from line
to:line::@2
line::@2: scope:[line] from line::@4 line::@8
(byte*) SCREEN#5 ← phi( line::@4/(byte*) SCREEN#4 )
(byte[]) plots#5 ← phi( line::@4/(byte[]) plots#4 )
(byte) line::x1#2 ← phi( line::@4/(byte) line::x1#1 )
(byte) line::x#2 ← phi( line::@4/(byte) line::x#0 line::@8/(byte) line::x#1 )
(byte) plot::x#1 ← (byte) line::x#2
call plot param-assignment
to:line::@8
line::@8: scope:[line] from line::@2
(byte) line::x#1 ← ++ (byte) line::x#2
(boolean~) line::$3 ← (byte) line::x#1 <= (byte) line::x1#2
if((boolean~) line::$3) goto line::@2
to:line::@return
line::@return: scope:[line] from line::@1 line::@8
return
to:@return
plot: scope:[plot] from line::@1 line::@2
(byte*) SCREEN#2 ← phi( line::@1/(byte*) SCREEN#4 line::@2/(byte*) SCREEN#5 )
(byte) plot::x#2 ← phi( line::@1/(byte) plot::x#0 line::@2/(byte) plot::x#1 )
(byte[]) plots#2 ← phi( line::@1/(byte[]) plots#4 line::@2/(byte[]) plots#5 )
(byte) plot::idx#0 ← (byte[]) plots#2 *idx (byte) plot::x#2
(byte~) plot::$1 ← (byte*) SCREEN#2 *idx (byte) plot::idx#0
(byte~) plot::$2 ← (byte~) plot::$1 + (byte/signed byte/word/signed word) 1
*((byte*) SCREEN#2 + (byte) plot::idx#0) ← (byte~) plot::$2
to:plot::@return
plot::@return: scope:[plot] from plot
return
to:@return
@3: scope:[] from @begin
call main param-assignment
to:@end
@end: scope:[] from @3
Redundant Phi (byte[]) plots#3 (byte[]) plots#0
Redundant Phi (byte*) SCREEN#3 (byte*) SCREEN#0
Redundant Phi (byte[]) plots#1 (byte[]) plots#3
Redundant Phi (byte*) SCREEN#1 (byte*) SCREEN#3
Redundant Phi (byte[]) plots#10 (byte[]) plots#1
Redundant Phi (byte*) SCREEN#10 (byte*) SCREEN#1
Redundant Phi (byte) line::x#0 (byte) line::x0#0
Redundant Phi (byte) line::x1#1 (byte) line::x1#0
Redundant Phi (byte[]) plots#4 (byte[]) plots#10
Redundant Phi (byte*) SCREEN#4 (byte*) SCREEN#10
Redundant Phi (byte) line::x1#2 (byte) line::x1#1
Redundant Phi (byte[]) plots#5 (byte[]) plots#4
Redundant Phi (byte*) SCREEN#5 (byte*) SCREEN#4
Succesful SSA optimization Pass2RedundantPhiElimination
CONTROL FLOW GRAPH
@begin: scope:[] from
(byte[]) plots#0 ← ((byte*)) (word/signed word) 4096
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
@ -1048,36 +565,45 @@ main::@return: scope:[main] from main::@5
return
to:@return
line: scope:[line] from main::@2
(boolean~) line::$1 ← (byte) line::x0#0 >= (byte) line::x1#0
(byte) line::x1#1 ← phi( main::@2/(byte) line::x1#0 )
(byte) line::x0#1 ← phi( main::@2/(byte) line::x0#0 )
(boolean~) line::$0 ← (byte) line::x0#1 < (byte) line::x1#1
(boolean~) line::$1 ← ! (boolean~) line::$0
if((boolean~) line::$1) goto line::@1
to:line::@4
line::@1: scope:[line] from line
(byte) plot::x#0 ← (byte) line::x0#0
(byte) line::x0#2 ← phi( line/(byte) line::x0#1 )
(byte) plot::x#0 ← (byte) line::x0#2
call plot param-assignment
to:line::@return
line::@4: scope:[line] from line
(byte) line::x1#4 ← phi( line/(byte) line::x1#1 )
(byte) line::x0#3 ← phi( line/(byte) line::x0#1 )
(byte) line::x#0 ← (byte) line::x0#3
to:line::@2
line::@2: scope:[line] from line::@4 line::@8
(byte) line::x#2 ← phi( line::@4/(byte) line::x0#0 line::@8/(byte) line::x#1 )
(byte) line::x1#3 ← phi( line::@4/(byte) line::x1#4 line::@8/(byte) line::x1#2 )
(byte) line::x#2 ← phi( line::@4/(byte) line::x#0 line::@8/(byte) line::x#1 )
(byte) plot::x#1 ← (byte) line::x#2
call plot param-assignment
to:line::@8
line::@8: scope:[line] from line::@2
(byte) line::x#1 ← ++ (byte) line::x#2
(boolean~) line::$3 ← (byte) line::x#1 <= (byte) line::x1#0
(byte) line::x1#2 ← phi( line::@2/(byte) line::x1#3 )
(byte) line::x#3 ← phi( line::@2/(byte) line::x#2 )
(byte) line::x#1 ← ++ (byte) line::x#3
(boolean~) line::$3 ← (byte) line::x#1 <= (byte) line::x1#2
if((boolean~) line::$3) goto line::@2
to:line::@return
line::@return: scope:[line] from line::@1 line::@8
return
to:@return
plot: scope:[plot] from line::@1 line::@2
(byte*) SCREEN#2 ← phi( line::@1/(byte*) SCREEN#0 line::@2/(byte*) SCREEN#0 )
(byte) plot::x#2 ← phi( line::@1/(byte) plot::x#0 line::@2/(byte) plot::x#1 )
(byte[]) plots#2 ← phi( line::@1/(byte[]) plots#0 line::@2/(byte[]) plots#0 )
(byte) plot::idx#0 ← (byte[]) plots#2 *idx (byte) plot::x#2
(byte~) plot::$1 ← (byte*) SCREEN#2 *idx (byte) plot::idx#0
(byte~) plot::$0 ← (byte[]) plots#0 *idx (byte) plot::x#2
(byte) plot::idx#0 ← (byte~) plot::$0
(byte~) plot::$1 ← (byte*) SCREEN#0 *idx (byte) plot::idx#0
(byte~) plot::$2 ← (byte~) plot::$1 + (byte/signed byte/word/signed word) 1
*((byte*) SCREEN#2 + (byte) plot::idx#0) ← (byte~) plot::$2
*((byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte~) plot::$2
to:plot::@return
plot::@return: scope:[plot] from plot
return
@ -1087,8 +613,240 @@ plot::@return: scope:[plot] from plot
to:@end
@end: scope:[] from @3
Redundant Phi (byte[]) plots#2 (byte[]) plots#0
Redundant Phi (byte*) SCREEN#2 (byte*) SCREEN#0
Inversing boolean not (boolean~) line::$1 ← (byte) line::x0#1 >= (byte) line::x1#1 from (boolean~) line::$0 ← (byte) line::x0#1 < (byte) line::x1#1
Succesful SSA optimization Pass2UnaryNotSimplification
CONTROL FLOW GRAPH
@begin: scope:[] from
(byte[]) plots#0 ← ((byte*)) (word/signed word) 4096
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
to:@3
main: scope:[main] from @3
(byte) main::i#0 ← (byte/signed byte/word/signed word) 0
to:main::@1
main::@1: scope:[main] from main main::@1
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
*((byte[]) plots#0 + (byte) main::i#2) ← (byte) main::i#2
*((byte*) SCREEN#0 + (byte) main::i#2) ← (byte/signed byte/word/signed word) 0
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$0 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 40
if((boolean~) main::$0) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1 main::@5
(byte) line::x0#0 ← (byte/signed byte/word/signed word) 0
(byte) line::x1#0 ← (byte/signed byte/word/signed word) 10
call line param-assignment
to:main::@5
main::@5: scope:[main] from main::@2
if(true) goto main::@2
to:main::@return
main::@return: scope:[main] from main::@5
return
to:@return
line: scope:[line] from main::@2
(byte) line::x1#1 ← phi( main::@2/(byte) line::x1#0 )
(byte) line::x0#1 ← phi( main::@2/(byte) line::x0#0 )
(boolean~) line::$1 ← (byte) line::x0#1 >= (byte) line::x1#1
if((boolean~) line::$1) goto line::@1
to:line::@4
line::@1: scope:[line] from line
(byte) line::x0#2 ← phi( line/(byte) line::x0#1 )
(byte) plot::x#0 ← (byte) line::x0#2
call plot param-assignment
to:line::@return
line::@4: scope:[line] from line
(byte) line::x1#4 ← phi( line/(byte) line::x1#1 )
(byte) line::x0#3 ← phi( line/(byte) line::x0#1 )
(byte) line::x#0 ← (byte) line::x0#3
to:line::@2
line::@2: scope:[line] from line::@4 line::@8
(byte) line::x1#3 ← phi( line::@4/(byte) line::x1#4 line::@8/(byte) line::x1#2 )
(byte) line::x#2 ← phi( line::@4/(byte) line::x#0 line::@8/(byte) line::x#1 )
(byte) plot::x#1 ← (byte) line::x#2
call plot param-assignment
to:line::@8
line::@8: scope:[line] from line::@2
(byte) line::x1#2 ← phi( line::@2/(byte) line::x1#3 )
(byte) line::x#3 ← phi( line::@2/(byte) line::x#2 )
(byte) line::x#1 ← ++ (byte) line::x#3
(boolean~) line::$3 ← (byte) line::x#1 <= (byte) line::x1#2
if((boolean~) line::$3) goto line::@2
to:line::@return
line::@return: scope:[line] from line::@1 line::@8
return
to:@return
plot: scope:[plot] from line::@1 line::@2
(byte) plot::x#2 ← phi( line::@1/(byte) plot::x#0 line::@2/(byte) plot::x#1 )
(byte~) plot::$0 ← (byte[]) plots#0 *idx (byte) plot::x#2
(byte) plot::idx#0 ← (byte~) plot::$0
(byte~) plot::$1 ← (byte*) SCREEN#0 *idx (byte) plot::idx#0
(byte~) plot::$2 ← (byte~) plot::$1 + (byte/signed byte/word/signed word) 1
*((byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte~) plot::$2
to:plot::@return
plot::@return: scope:[plot] from plot
return
to:@return
@3: scope:[] from @begin
call main param-assignment
to:@end
@end: scope:[] from @3
Not aliassing across scopes: line::x0#1 line::x0#0
Not aliassing across scopes: line::x1#1 line::x1#0
Not aliassing across scopes: plot::x#0 line::x0#2
Not aliassing across scopes: plot::x#1 line::x#2
Not aliassing across scopes: plot::x#2 plot::x#0
Alias (byte) line::x#0 = (byte) line::x0#2 (byte) line::x0#1 (byte) line::x0#3
Alias (byte) line::x1#1 = (byte) line::x1#4
Alias (byte) line::x#2 = (byte) line::x#3
Alias (byte) line::x1#2 = (byte) line::x1#3
Alias (byte) plot::idx#0 = (byte~) plot::$0
Succesful SSA optimization Pass2AliasElimination
CONTROL FLOW GRAPH
@begin: scope:[] from
(byte[]) plots#0 ← ((byte*)) (word/signed word) 4096
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
to:@3
main: scope:[main] from @3
(byte) main::i#0 ← (byte/signed byte/word/signed word) 0
to:main::@1
main::@1: scope:[main] from main main::@1
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
*((byte[]) plots#0 + (byte) main::i#2) ← (byte) main::i#2
*((byte*) SCREEN#0 + (byte) main::i#2) ← (byte/signed byte/word/signed word) 0
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$0 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 40
if((boolean~) main::$0) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1 main::@5
(byte) line::x0#0 ← (byte/signed byte/word/signed word) 0
(byte) line::x1#0 ← (byte/signed byte/word/signed word) 10
call line param-assignment
to:main::@5
main::@5: scope:[main] from main::@2
if(true) goto main::@2
to:main::@return
main::@return: scope:[main] from main::@5
return
to:@return
line: scope:[line] from main::@2
(byte) line::x1#1 ← phi( main::@2/(byte) line::x1#0 )
(byte) line::x#0 ← phi( main::@2/(byte) line::x0#0 )
(boolean~) line::$1 ← (byte) line::x#0 >= (byte) line::x1#1
if((boolean~) line::$1) goto line::@1
to:line::@4
line::@1: scope:[line] from line
(byte) plot::x#0 ← (byte) line::x#0
call plot param-assignment
to:line::@return
line::@4: scope:[line] from line
to:line::@2
line::@2: scope:[line] from line::@4 line::@8
(byte) line::x1#2 ← phi( line::@4/(byte) line::x1#1 line::@8/(byte) line::x1#2 )
(byte) line::x#2 ← phi( line::@4/(byte) line::x#0 line::@8/(byte) line::x#1 )
(byte) plot::x#1 ← (byte) line::x#2
call plot param-assignment
to:line::@8
line::@8: scope:[line] from line::@2
(byte) line::x#1 ← ++ (byte) line::x#2
(boolean~) line::$3 ← (byte) line::x#1 <= (byte) line::x1#2
if((boolean~) line::$3) goto line::@2
to:line::@return
line::@return: scope:[line] from line::@1 line::@8
return
to:@return
plot: scope:[plot] from line::@1 line::@2
(byte) plot::x#2 ← phi( line::@1/(byte) plot::x#0 line::@2/(byte) plot::x#1 )
(byte) plot::idx#0 ← (byte[]) plots#0 *idx (byte) plot::x#2
(byte~) plot::$1 ← (byte*) SCREEN#0 *idx (byte) plot::idx#0
(byte~) plot::$2 ← (byte~) plot::$1 + (byte/signed byte/word/signed word) 1
*((byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte~) plot::$2
to:plot::@return
plot::@return: scope:[plot] from plot
return
to:@return
@3: scope:[] from @begin
call main param-assignment
to:@end
@end: scope:[] from @3
Not aliassing across scopes: line::x#0 line::x0#0
Not aliassing across scopes: line::x1#1 line::x1#0
Not aliassing across scopes: plot::x#0 line::x#0
Not aliassing across scopes: plot::x#1 line::x#2
Not aliassing across scopes: plot::x#2 plot::x#0
Self Phi Eliminated (byte) line::x1#2
Succesful SSA optimization Pass2SelfPhiElimination
CONTROL FLOW GRAPH
@begin: scope:[] from
(byte[]) plots#0 ← ((byte*)) (word/signed word) 4096
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
to:@3
main: scope:[main] from @3
(byte) main::i#0 ← (byte/signed byte/word/signed word) 0
to:main::@1
main::@1: scope:[main] from main main::@1
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
*((byte[]) plots#0 + (byte) main::i#2) ← (byte) main::i#2
*((byte*) SCREEN#0 + (byte) main::i#2) ← (byte/signed byte/word/signed word) 0
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$0 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 40
if((boolean~) main::$0) goto main::@1
to:main::@2
main::@2: scope:[main] from main::@1 main::@5
(byte) line::x0#0 ← (byte/signed byte/word/signed word) 0
(byte) line::x1#0 ← (byte/signed byte/word/signed word) 10
call line param-assignment
to:main::@5
main::@5: scope:[main] from main::@2
if(true) goto main::@2
to:main::@return
main::@return: scope:[main] from main::@5
return
to:@return
line: scope:[line] from main::@2
(byte) line::x1#1 ← phi( main::@2/(byte) line::x1#0 )
(byte) line::x#0 ← phi( main::@2/(byte) line::x0#0 )
(boolean~) line::$1 ← (byte) line::x#0 >= (byte) line::x1#1
if((boolean~) line::$1) goto line::@1
to:line::@4
line::@1: scope:[line] from line
(byte) plot::x#0 ← (byte) line::x#0
call plot param-assignment
to:line::@return
line::@4: scope:[line] from line
to:line::@2
line::@2: scope:[line] from line::@4 line::@8
(byte) line::x1#2 ← phi( line::@4/(byte) line::x1#1 )
(byte) line::x#2 ← phi( line::@4/(byte) line::x#0 line::@8/(byte) line::x#1 )
(byte) plot::x#1 ← (byte) line::x#2
call plot param-assignment
to:line::@8
line::@8: scope:[line] from line::@2
(byte) line::x#1 ← ++ (byte) line::x#2
(boolean~) line::$3 ← (byte) line::x#1 <= (byte) line::x1#2
if((boolean~) line::$3) goto line::@2
to:line::@return
line::@return: scope:[line] from line::@1 line::@8
return
to:@return
plot: scope:[plot] from line::@1 line::@2
(byte) plot::x#2 ← phi( line::@1/(byte) plot::x#0 line::@2/(byte) plot::x#1 )
(byte) plot::idx#0 ← (byte[]) plots#0 *idx (byte) plot::x#2
(byte~) plot::$1 ← (byte*) SCREEN#0 *idx (byte) plot::idx#0
(byte~) plot::$2 ← (byte~) plot::$1 + (byte/signed byte/word/signed word) 1
*((byte*) SCREEN#0 + (byte) plot::idx#0) ← (byte~) plot::$2
to:plot::@return
plot::@return: scope:[plot] from plot
return
to:@return
@3: scope:[] from @begin
call main param-assignment
to:@end
@end: scope:[] from @3
Redundant Phi (byte) line::x#0 (byte) line::x0#0
Redundant Phi (byte) line::x1#1 (byte) line::x1#0
Redundant Phi (byte) line::x1#2 (byte) line::x1#1
Succesful SSA optimization Pass2RedundantPhiElimination
CONTROL FLOW GRAPH
@begin: scope:[] from

View File

@ -0,0 +1,10 @@
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.const SCREEN = $400
jsr main
main: {
lda #1
sta SCREEN
rts
}

View File

@ -0,0 +1,15 @@
@begin: scope:[] from
[0] phi() [ ] ( )
to:@1
@1: scope:[] from @begin
[1] phi() [ ] ( )
[2] call main param-assignment [ ] ( )
to:@end
@end: scope:[] from @1
[3] phi() [ ] ( )
main: scope:[main] from @1
[4] *((const byte*) SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2 [ ] )
to:main::@return
main::@return: scope:[main] from main
[5] return [ ] ( main:2 [ ] )
to:@return

View File

@ -0,0 +1,426 @@
const byte* SCREEN = $0400;
void main() {
*SCREEN = 1;
}
PROGRAM
(byte*) SCREEN ← (word/signed word) 1024
proc (void()) main()
*((byte*) SCREEN) ← (byte/signed byte/word/signed word) 1
main::@return:
return
endproc // main()
call main
SYMBOLS
(byte*) SCREEN
(void()) main()
(label) main::@return
Promoting word/signed word to byte* in SCREEN ← ((byte*)) 1024
INITIAL CONTROL FLOW GRAPH
@begin: scope:[] from
(byte*) SCREEN ← ((byte*)) (word/signed word) 1024
to:@1
main: scope:[main] from
*((byte*) SCREEN) ← (byte/signed byte/word/signed word) 1
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
call main
to:@end
@end: scope:[] from @1
CONTROL FLOW GRAPH
@begin: scope:[] from
(byte*) SCREEN ← ((byte*)) (word/signed word) 1024
to:@1
main: scope:[main] from
*((byte*) SCREEN) ← (byte/signed byte/word/signed word) 1
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
call main
to:@end
@end: scope:[] from @1
PROCEDURE MODIFY VARIABLE ANALYSIS
CONTROL FLOW GRAPH WITH ASSIGNMENT CALL
@begin: scope:[] from
(byte*) SCREEN ← ((byte*)) (word/signed word) 1024
to:@1
main: scope:[main] from @1
*((byte*) SCREEN) ← (byte/signed byte/word/signed word) 1
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
call main param-assignment
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
Completing Phi functions...
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
to:@1
main: scope:[main] from @1
*((byte*) SCREEN#0) ← (byte/signed byte/word/signed word) 1
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
call main param-assignment
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
CONTROL FLOW GRAPH WITH ASSIGNMENT CALL & RETURN
@begin: scope:[] from
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
to:@1
main: scope:[main] from @1
*((byte*) SCREEN#0) ← (byte/signed byte/word/signed word) 1
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
call main param-assignment
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
INITIAL SSA SYMBOL TABLE
(label) @1
(label) @2
(label) @begin
(label) @end
(byte*) SCREEN
(byte*) SCREEN#0
(void()) main()
(label) main::@return
Culled Empty Block (label) @2
Succesful SSA optimization Pass2CullEmptyBlocks
CONTROL FLOW GRAPH
@begin: scope:[] from
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
to:@1
main: scope:[main] from @1
*((byte*) SCREEN#0) ← (byte/signed byte/word/signed word) 1
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
call main param-assignment
to:@end
@end: scope:[] from @1
Constant (const byte*) SCREEN#0 = ((byte*))1024
Succesful SSA optimization Pass2ConstantIdentification
CONTROL FLOW GRAPH
@begin: scope:[] from
to:@1
main: scope:[main] from @1
*((const byte*) SCREEN#0) ← (byte/signed byte/word/signed word) 1
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
call main param-assignment
to:@end
@end: scope:[] from @1
FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(byte*) SCREEN
(const byte*) SCREEN#0 = ((byte*))(word/signed word) 1024
(void()) main()
(label) main::@return
Block Sequence Planned @begin @1 @end main main::@return
Block Sequence Planned @begin @1 @end main main::@return
CONTROL FLOW GRAPH - PHI LIFTED
@begin: scope:[] from
to:@1
@1: scope:[] from @begin
call main param-assignment
to:@end
@end: scope:[] from @1
main: scope:[main] from @1
*((const byte*) SCREEN#0) ← (byte/signed byte/word/signed word) 1
to:main::@return
main::@return: scope:[main] from main
return
to:@return
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
CALL GRAPH
Calls in [] to main:2
Propagating live ranges...
CONTROL FLOW GRAPH - LIVE RANGES FOUND
@begin: scope:[] from
[0] phi() [ ]
to:@1
@1: scope:[] from @begin
[1] phi() [ ]
[2] call main param-assignment [ ]
to:@end
@end: scope:[] from @1
[3] phi() [ ]
main: scope:[main] from @1
[4] *((const byte*) SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ]
to:main::@return
main::@return: scope:[main] from main
[5] return [ ]
to:@return
Created 0 initial phi equivalence classes
Coalesced down to 0 phi equivalence classes
Block Sequence Planned @begin @1 @end main main::@return
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
Propagating live ranges...
CONTROL FLOW GRAPH - BEFORE EFFECTIVE LIVE RANGES
@begin: scope:[] from
[0] phi() [ ]
to:@1
@1: scope:[] from @begin
[1] phi() [ ]
[2] call main param-assignment [ ]
to:@end
@end: scope:[] from @1
[3] phi() [ ]
main: scope:[main] from @1
[4] *((const byte*) SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ]
to:main::@return
main::@return: scope:[main] from main
[5] return [ ]
to:@return
CONTROL FLOW GRAPH - PHI MEM COALESCED
@begin: scope:[] from
[0] phi() [ ] ( )
to:@1
@1: scope:[] from @begin
[1] phi() [ ] ( )
[2] call main param-assignment [ ] ( )
to:@end
@end: scope:[] from @1
[3] phi() [ ] ( )
main: scope:[main] from @1
[4] *((const byte*) SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2 [ ] )
to:main::@return
main::@return: scope:[main] from main
[5] return [ ] ( main:2 [ ] )
to:@return
DOMINATORS
@begin dominated by @begin
@1 dominated by @1 @begin
@end dominated by @1 @begin @end
main dominated by @1 @begin main
main::@return dominated by main::@return @1 @begin main
NATURAL LOOPS
Found 0 loops in scope []
Found 0 loops in scope [main]
NATURAL LOOPS WITH DEPTH
VARIABLE REGISTER WEIGHTS
(byte*) SCREEN
(void()) main()
Initial phi equivalence classes
Complete equivalence classes
INITIAL ASM
//SEG0 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
.const SCREEN = $400
//SEG2 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
jmp b1
//SEG4 @1
b1:
//SEG5 [2] call main param-assignment [ ] ( )
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
jmp bend
//SEG7 @end
bend:
//SEG8 main
main: {
//SEG9 [4] *((const byte*) SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2 [ ] ) -- _deref_cowo1=coby2
lda #1
sta SCREEN
jmp breturn
//SEG10 main::@return
breturn:
//SEG11 [5] return [ ] ( main:2 [ ] )
rts
}
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [4] *((const byte*) SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2 [ ] ) always clobbers reg byte a
REGISTER UPLIFT SCOPES
Uplift Scope [main]
Uplift Scope []
Uplifting [main] best 27 combination
Uplifting [] best 27 combination
Removing instruction jmp b1
Removing instruction jmp bend
Removing instruction jmp breturn
Succesful ASM optimization Pass5NextJumpElimination
ASSEMBLER
//SEG0 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
.const SCREEN = $400
//SEG2 @begin
bbegin:
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
b1_from_bbegin:
//SEG4 @1
b1:
//SEG5 [2] call main param-assignment [ ] ( )
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
bend_from_b1:
//SEG7 @end
bend:
//SEG8 main
main: {
//SEG9 [4] *((const byte*) SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2 [ ] ) -- _deref_cowo1=coby2
lda #1
sta SCREEN
//SEG10 main::@return
breturn:
//SEG11 [5] return [ ] ( main:2 [ ] )
rts
}
Removing instruction bbegin:
Removing instruction b1_from_bbegin:
Removing instruction bend_from_b1:
Succesful ASM optimization Pass5RedundantLabelElimination
ASSEMBLER
//SEG0 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
.const SCREEN = $400
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
b1:
//SEG5 [2] call main param-assignment [ ] ( )
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 @end
bend:
//SEG8 main
main: {
//SEG9 [4] *((const byte*) SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2 [ ] ) -- _deref_cowo1=coby2
lda #1
sta SCREEN
//SEG10 main::@return
breturn:
//SEG11 [5] return [ ] ( main:2 [ ] )
rts
}
Removing instruction b1:
Removing instruction bend:
Removing instruction breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
ASSEMBLER
//SEG0 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
.const SCREEN = $400
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main param-assignment [ ] ( )
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 @end
//SEG8 main
main: {
//SEG9 [4] *((const byte*) SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2 [ ] ) -- _deref_cowo1=coby2
lda #1
sta SCREEN
//SEG10 main::@return
//SEG11 [5] return [ ] ( main:2 [ ] )
rts
}
FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word) 1024
(void()) main()
(label) main::@return
FINAL CODE
//SEG0 Basic Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
//SEG1 Global Constants & labels
.const SCREEN = $400
//SEG2 @begin
//SEG3 [1] phi from @begin to @1 [phi:@begin->@1]
//SEG4 @1
//SEG5 [2] call main param-assignment [ ] ( )
jsr main
//SEG6 [3] phi from @1 to @end [phi:@1->@end]
//SEG7 @end
//SEG8 main
main: {
//SEG9 [4] *((const byte*) SCREEN#0) ← (byte/signed byte/word/signed word) 1 [ ] ( main:2 [ ] ) -- _deref_cowo1=coby2
lda #1
sta SCREEN
//SEG10 main::@return
//SEG11 [5] return [ ] ( main:2 [ ] )
rts
}

View File

@ -0,0 +1,8 @@
(label) @1
(label) @begin
(label) @end
(byte*) SCREEN
(const byte*) SCREEN#0 SCREEN = ((byte*))(word/signed word) 1024
(void()) main()
(label) main::@return

View File

@ -170,18 +170,14 @@ CONTROL FLOW GRAPH SSA
main: scope:[main] from @1
(byte*) BGCOL#1 ← phi( @1/(byte*) BGCOL#2 )
(byte) RED#1 ← phi( @1/(byte) RED#2 )
(byte*) SCREEN#1 ← phi( @1/(byte*) SCREEN#3 )
(byte) STAR#1 ← phi( @1/(byte) STAR#3 )
*((byte*) SCREEN#1) ← (byte) STAR#1
*((byte*) SCREEN#0) ← (byte) STAR#0
*((byte*) BGCOL#1) ← (byte) RED#1
(byte) main::i#0 ← (byte/signed byte/word/signed word) 40
to:main::@1
main::@1: scope:[main] from main main::@1
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
(byte*) SCREEN#2 ← phi( main/(byte*) SCREEN#1 main::@1/(byte*) SCREEN#2 )
(byte) STAR#2 ← phi( main/(byte) STAR#1 main::@1/(byte) STAR#2 )
(byte~) main::$0 ← (byte) STAR#2 + (byte/signed byte/word/signed word) 1
*((byte*) SCREEN#2 + (byte) main::i#2) ← (byte~) main::$0
(byte~) main::$0 ← (byte) STAR#0 + (byte/signed byte/word/signed word) 1
*((byte*) SCREEN#0 + (byte) main::i#2) ← (byte~) main::$0
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$1 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 80
if((boolean~) main::$1) goto main::@1
@ -192,8 +188,6 @@ main::@return: scope:[main] from main::@1
@1: scope:[] from @begin
(byte*) BGCOL#2 ← phi( @begin/(byte*) BGCOL#0 )
(byte) RED#2 ← phi( @begin/(byte) RED#0 )
(byte*) SCREEN#3 ← phi( @begin/(byte*) SCREEN#0 )
(byte) STAR#3 ← phi( @begin/(byte) STAR#0 )
call main param-assignment
to:@2
@2: scope:[] from @1
@ -214,18 +208,14 @@ CONTROL FLOW GRAPH WITH ASSIGNMENT CALL & RETURN
main: scope:[main] from @1
(byte*) BGCOL#1 ← phi( @1/(byte*) BGCOL#2 )
(byte) RED#1 ← phi( @1/(byte) RED#2 )
(byte*) SCREEN#1 ← phi( @1/(byte*) SCREEN#3 )
(byte) STAR#1 ← phi( @1/(byte) STAR#3 )
*((byte*) SCREEN#1) ← (byte) STAR#1
*((byte*) SCREEN#0) ← (byte) STAR#0
*((byte*) BGCOL#1) ← (byte) RED#1
(byte) main::i#0 ← (byte/signed byte/word/signed word) 40
to:main::@1
main::@1: scope:[main] from main main::@1
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
(byte*) SCREEN#2 ← phi( main/(byte*) SCREEN#1 main::@1/(byte*) SCREEN#2 )
(byte) STAR#2 ← phi( main/(byte) STAR#1 main::@1/(byte) STAR#2 )
(byte~) main::$0 ← (byte) STAR#2 + (byte/signed byte/word/signed word) 1
*((byte*) SCREEN#2 + (byte) main::i#2) ← (byte~) main::$0
(byte~) main::$0 ← (byte) STAR#0 + (byte/signed byte/word/signed word) 1
*((byte*) SCREEN#0 + (byte) main::i#2) ← (byte~) main::$0
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$1 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 80
if((boolean~) main::$1) goto main::@1
@ -236,8 +226,6 @@ main::@return: scope:[main] from main::@1
@1: scope:[] from @begin
(byte*) BGCOL#2 ← phi( @begin/(byte*) BGCOL#0 )
(byte) RED#2 ← phi( @begin/(byte) RED#0 )
(byte*) SCREEN#3 ← phi( @begin/(byte*) SCREEN#0 )
(byte) STAR#3 ← phi( @begin/(byte) STAR#0 )
call main param-assignment
to:@2
@2: scope:[] from @1
@ -262,14 +250,8 @@ INITIAL SSA SYMBOL TABLE
(byte) RED#2
(byte*) SCREEN
(byte*) SCREEN#0
(byte*) SCREEN#1
(byte*) SCREEN#2
(byte*) SCREEN#3
(byte) STAR
(byte) STAR#0
(byte) STAR#1
(byte) STAR#2
(byte) STAR#3
(byte*) VIC
(byte*) VIC#0
(void()) main()
@ -298,18 +280,14 @@ CONTROL FLOW GRAPH
main: scope:[main] from @1
(byte*) BGCOL#1 ← phi( @1/(byte*) BGCOL#2 )
(byte) RED#1 ← phi( @1/(byte) RED#2 )
(byte*) SCREEN#1 ← phi( @1/(byte*) SCREEN#3 )
(byte) STAR#1 ← phi( @1/(byte) STAR#3 )
*((byte*) SCREEN#1) ← (byte) STAR#1
*((byte*) SCREEN#0) ← (byte) STAR#0
*((byte*) BGCOL#1) ← (byte) RED#1
(byte) main::i#0 ← (byte/signed byte/word/signed word) 40
to:main::@1
main::@1: scope:[main] from main main::@1
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
(byte*) SCREEN#2 ← phi( main/(byte*) SCREEN#1 main::@1/(byte*) SCREEN#2 )
(byte) STAR#2 ← phi( main/(byte) STAR#1 main::@1/(byte) STAR#2 )
(byte~) main::$0 ← (byte) STAR#2 + (byte/signed byte/word/signed word) 1
*((byte*) SCREEN#2 + (byte) main::i#2) ← (byte~) main::$0
(byte~) main::$0 ← (byte) STAR#0 + (byte/signed byte/word/signed word) 1
*((byte*) SCREEN#0 + (byte) main::i#2) ← (byte~) main::$0
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$1 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 80
if((boolean~) main::$1) goto main::@1
@ -320,19 +298,13 @@ main::@return: scope:[main] from main::@1
@1: scope:[] from @begin
(byte*) BGCOL#2 ← phi( @begin/(byte*) BGCOL#0 )
(byte) RED#2 ← phi( @begin/(byte) RED#0 )
(byte*) SCREEN#3 ← phi( @begin/(byte*) SCREEN#0 )
(byte) STAR#3 ← phi( @begin/(byte) STAR#0 )
call main param-assignment
to:@end
@end: scope:[] from @1
Not aliassing across scopes: STAR#1 STAR#3
Not aliassing across scopes: SCREEN#1 SCREEN#3
Not aliassing across scopes: RED#1 RED#2
Not aliassing across scopes: BGCOL#1 BGCOL#2
Alias (byte*) BGCOL#0 = (byte*~) $2 (byte*) BGCOL#2
Alias (byte) STAR#0 = (byte) STAR#3
Alias (byte*) SCREEN#0 = (byte*) SCREEN#3
Alias (byte) RED#0 = (byte) RED#2
Succesful SSA optimization Pass2AliasElimination
CONTROL FLOW GRAPH
@ -348,18 +320,14 @@ CONTROL FLOW GRAPH
main: scope:[main] from @1
(byte*) BGCOL#1 ← phi( @1/(byte*) BGCOL#0 )
(byte) RED#1 ← phi( @1/(byte) RED#0 )
(byte*) SCREEN#1 ← phi( @1/(byte*) SCREEN#0 )
(byte) STAR#1 ← phi( @1/(byte) STAR#0 )
*((byte*) SCREEN#1) ← (byte) STAR#1
*((byte*) SCREEN#0) ← (byte) STAR#0
*((byte*) BGCOL#1) ← (byte) RED#1
(byte) main::i#0 ← (byte/signed byte/word/signed word) 40
to:main::@1
main::@1: scope:[main] from main main::@1
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
(byte*) SCREEN#2 ← phi( main/(byte*) SCREEN#1 main::@1/(byte*) SCREEN#2 )
(byte) STAR#2 ← phi( main/(byte) STAR#1 main::@1/(byte) STAR#2 )
(byte~) main::$0 ← (byte) STAR#2 + (byte/signed byte/word/signed word) 1
*((byte*) SCREEN#2 + (byte) main::i#2) ← (byte~) main::$0
(byte~) main::$0 ← (byte) STAR#0 + (byte/signed byte/word/signed word) 1
*((byte*) SCREEN#0 + (byte) main::i#2) ← (byte~) main::$0
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$1 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 80
if((boolean~) main::$1) goto main::@1
@ -372,56 +340,10 @@ main::@return: scope:[main] from main::@1
to:@end
@end: scope:[] from @1
Not aliassing across scopes: STAR#1 STAR#0
Not aliassing across scopes: SCREEN#1 SCREEN#0
Not aliassing across scopes: RED#1 RED#0
Not aliassing across scopes: BGCOL#1 BGCOL#0
Self Phi Eliminated (byte) STAR#2
Self Phi Eliminated (byte*) SCREEN#2
Succesful SSA optimization Pass2SelfPhiElimination
CONTROL FLOW GRAPH
@begin: scope:[] from
(byte*) SCREEN#0 ← ((byte*)) (word/signed word) 1024
(byte) STAR#0 ← (byte/signed byte/word/signed word) 81
(byte*) VIC#0 ← ((byte*)) (word) 53248
(byte/signed byte/word/signed word~) $0 ← (byte/signed byte/word/signed word) 16 * (byte/signed byte/word/signed word) 2
(byte*~) $1 ← (byte*) VIC#0 + (byte/signed byte/word/signed word~) $0
(byte*) BGCOL#0 ← (byte*~) $1 + (byte/signed byte/word/signed word) 1
(byte) RED#0 ← (byte/signed byte/word/signed word) 2
to:@1
main: scope:[main] from @1
(byte*) BGCOL#1 ← phi( @1/(byte*) BGCOL#0 )
(byte) RED#1 ← phi( @1/(byte) RED#0 )
(byte*) SCREEN#1 ← phi( @1/(byte*) SCREEN#0 )
(byte) STAR#1 ← phi( @1/(byte) STAR#0 )
*((byte*) SCREEN#1) ← (byte) STAR#1
*((byte*) BGCOL#1) ← (byte) RED#1
(byte) main::i#0 ← (byte/signed byte/word/signed word) 40
to:main::@1
main::@1: scope:[main] from main main::@1
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
(byte*) SCREEN#2 ← phi( main/(byte*) SCREEN#1 )
(byte) STAR#2 ← phi( main/(byte) STAR#1 )
(byte~) main::$0 ← (byte) STAR#2 + (byte/signed byte/word/signed word) 1
*((byte*) SCREEN#2 + (byte) main::i#2) ← (byte~) main::$0
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$1 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 80
if((boolean~) main::$1) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
return
to:@return
@1: scope:[] from @begin
call main param-assignment
to:@end
@end: scope:[] from @1
Redundant Phi (byte) STAR#1 (byte) STAR#0
Redundant Phi (byte*) SCREEN#1 (byte*) SCREEN#0
Redundant Phi (byte) RED#1 (byte) RED#0
Redundant Phi (byte*) BGCOL#1 (byte*) BGCOL#0
Redundant Phi (byte) STAR#2 (byte) STAR#1
Redundant Phi (byte*) SCREEN#2 (byte*) SCREEN#1
Succesful SSA optimization Pass2RedundantPhiElimination
CONTROL FLOW GRAPH
@begin: scope:[] from

View File

@ -78,7 +78,6 @@ main::@return: scope:[main] from main
to:@end
@end: scope:[] from @2
Completing Phi functions...
Completing Phi functions...
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
@ -86,16 +85,12 @@ CONTROL FLOW GRAPH SSA
(byte) RED#0 ← (byte/signed byte/word/signed word) 2
to:@1
main: scope:[main] from @1
(byte*) BGCOL#1 ← phi( @1/(byte*) BGCOL#2 )
(byte) RED#1 ← phi( @1/(byte) RED#2 )
*((byte*) BGCOL#1) ← (byte) RED#1
*((byte*) BGCOL#0) ← (byte) RED#0
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
(byte*) BGCOL#2 ← phi( @begin/(byte*) BGCOL#0 )
(byte) RED#2 ← phi( @begin/(byte) RED#0 )
call main param-assignment
to:@2
@2: scope:[] from @1
@ -108,16 +103,12 @@ CONTROL FLOW GRAPH WITH ASSIGNMENT CALL & RETURN
(byte) RED#0 ← (byte/signed byte/word/signed word) 2
to:@1
main: scope:[main] from @1
(byte*) BGCOL#1 ← phi( @1/(byte*) BGCOL#2 )
(byte) RED#1 ← phi( @1/(byte) RED#2 )
*((byte*) BGCOL#1) ← (byte) RED#1
*((byte*) BGCOL#0) ← (byte) RED#0
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
(byte*) BGCOL#2 ← phi( @begin/(byte*) BGCOL#0 )
(byte) RED#2 ← phi( @begin/(byte) RED#0 )
call main param-assignment
to:@2
@2: scope:[] from @1
@ -131,66 +122,14 @@ INITIAL SSA SYMBOL TABLE
(label) @end
(byte*) BGCOL
(byte*) BGCOL#0
(byte*) BGCOL#1
(byte*) BGCOL#2
(byte) RED
(byte) RED#0
(byte) RED#1
(byte) RED#2
(void()) main()
(label) main::@return
Culled Empty Block (label) @2
Succesful SSA optimization Pass2CullEmptyBlocks
CONTROL FLOW GRAPH
@begin: scope:[] from
(byte*) BGCOL#0 ← ((byte*)) (word) 53281
(byte) RED#0 ← (byte/signed byte/word/signed word) 2
to:@1
main: scope:[main] from @1
(byte*) BGCOL#1 ← phi( @1/(byte*) BGCOL#2 )
(byte) RED#1 ← phi( @1/(byte) RED#2 )
*((byte*) BGCOL#1) ← (byte) RED#1
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
(byte*) BGCOL#2 ← phi( @begin/(byte*) BGCOL#0 )
(byte) RED#2 ← phi( @begin/(byte) RED#0 )
call main param-assignment
to:@end
@end: scope:[] from @1
Not aliassing across scopes: RED#1 RED#2
Not aliassing across scopes: BGCOL#1 BGCOL#2
Alias (byte) RED#0 = (byte) RED#2
Alias (byte*) BGCOL#0 = (byte*) BGCOL#2
Succesful SSA optimization Pass2AliasElimination
CONTROL FLOW GRAPH
@begin: scope:[] from
(byte*) BGCOL#0 ← ((byte*)) (word) 53281
(byte) RED#0 ← (byte/signed byte/word/signed word) 2
to:@1
main: scope:[main] from @1
(byte*) BGCOL#1 ← phi( @1/(byte*) BGCOL#0 )
(byte) RED#1 ← phi( @1/(byte) RED#0 )
*((byte*) BGCOL#1) ← (byte) RED#1
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
call main param-assignment
to:@end
@end: scope:[] from @1
Not aliassing across scopes: RED#1 RED#0
Not aliassing across scopes: BGCOL#1 BGCOL#0
Redundant Phi (byte) RED#1 (byte) RED#0
Redundant Phi (byte*) BGCOL#1 (byte*) BGCOL#0
Succesful SSA optimization Pass2RedundantPhiElimination
CONTROL FLOW GRAPH
@begin: scope:[] from
(byte*) BGCOL#0 ← ((byte*)) (word) 53281
(byte) RED#0 ← (byte/signed byte/word/signed word) 2

View File

@ -88,7 +88,6 @@ main::@return: scope:[main] from main
to:@end
@end: scope:[] from @2
Completing Phi functions...
Completing Phi functions...
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
@ -96,18 +95,14 @@ CONTROL FLOW GRAPH SSA
(byte) RED#0 ← (byte/signed byte/word/signed word) 2
to:@1
main: scope:[main] from @1
(byte*) BGCOL#1 ← phi( @1/(byte*) BGCOL#2 )
(byte) RED#1 ← phi( @1/(byte) RED#2 )
(byte*) main::screen#0 ← ((byte*)) (word/signed word) 1024
*((byte*) main::screen#0) ← (byte/signed byte/word/signed word) 1
*((byte*) BGCOL#1) ← (byte) RED#1
*((byte*) BGCOL#0) ← (byte) RED#0
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
(byte*) BGCOL#2 ← phi( @begin/(byte*) BGCOL#0 )
(byte) RED#2 ← phi( @begin/(byte) RED#0 )
call main param-assignment
to:@2
@2: scope:[] from @1
@ -120,18 +115,14 @@ CONTROL FLOW GRAPH WITH ASSIGNMENT CALL & RETURN
(byte) RED#0 ← (byte/signed byte/word/signed word) 2
to:@1
main: scope:[main] from @1
(byte*) BGCOL#1 ← phi( @1/(byte*) BGCOL#2 )
(byte) RED#1 ← phi( @1/(byte) RED#2 )
(byte*) main::screen#0 ← ((byte*)) (word/signed word) 1024
*((byte*) main::screen#0) ← (byte/signed byte/word/signed word) 1
*((byte*) BGCOL#1) ← (byte) RED#1
*((byte*) BGCOL#0) ← (byte) RED#0
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
(byte*) BGCOL#2 ← phi( @begin/(byte*) BGCOL#0 )
(byte) RED#2 ← phi( @begin/(byte) RED#0 )
call main param-assignment
to:@2
@2: scope:[] from @1
@ -145,12 +136,8 @@ INITIAL SSA SYMBOL TABLE
(label) @end
(byte*) BGCOL
(byte*) BGCOL#0
(byte*) BGCOL#1
(byte*) BGCOL#2
(byte) RED
(byte) RED#0
(byte) RED#1
(byte) RED#2
(void()) main()
(label) main::@return
(byte*) main::screen
@ -159,58 +146,6 @@ INITIAL SSA SYMBOL TABLE
Culled Empty Block (label) @2
Succesful SSA optimization Pass2CullEmptyBlocks
CONTROL FLOW GRAPH
@begin: scope:[] from
(byte*) BGCOL#0 ← ((byte*)) (word) 53281
(byte) RED#0 ← (byte/signed byte/word/signed word) 2
to:@1
main: scope:[main] from @1
(byte*) BGCOL#1 ← phi( @1/(byte*) BGCOL#2 )
(byte) RED#1 ← phi( @1/(byte) RED#2 )
(byte*) main::screen#0 ← ((byte*)) (word/signed word) 1024
*((byte*) main::screen#0) ← (byte/signed byte/word/signed word) 1
*((byte*) BGCOL#1) ← (byte) RED#1
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
(byte*) BGCOL#2 ← phi( @begin/(byte*) BGCOL#0 )
(byte) RED#2 ← phi( @begin/(byte) RED#0 )
call main param-assignment
to:@end
@end: scope:[] from @1
Not aliassing across scopes: RED#1 RED#2
Not aliassing across scopes: BGCOL#1 BGCOL#2
Alias (byte) RED#0 = (byte) RED#2
Alias (byte*) BGCOL#0 = (byte*) BGCOL#2
Succesful SSA optimization Pass2AliasElimination
CONTROL FLOW GRAPH
@begin: scope:[] from
(byte*) BGCOL#0 ← ((byte*)) (word) 53281
(byte) RED#0 ← (byte/signed byte/word/signed word) 2
to:@1
main: scope:[main] from @1
(byte*) BGCOL#1 ← phi( @1/(byte*) BGCOL#0 )
(byte) RED#1 ← phi( @1/(byte) RED#0 )
(byte*) main::screen#0 ← ((byte*)) (word/signed word) 1024
*((byte*) main::screen#0) ← (byte/signed byte/word/signed word) 1
*((byte*) BGCOL#1) ← (byte) RED#1
to:main::@return
main::@return: scope:[main] from main
return
to:@return
@1: scope:[] from @begin
call main param-assignment
to:@end
@end: scope:[] from @1
Not aliassing across scopes: RED#1 RED#0
Not aliassing across scopes: BGCOL#1 BGCOL#0
Redundant Phi (byte) RED#1 (byte) RED#0
Redundant Phi (byte*) BGCOL#1 (byte*) BGCOL#0
Succesful SSA optimization Pass2RedundantPhiElimination
CONTROL FLOW GRAPH
@begin: scope:[] from
(byte*) BGCOL#0 ← ((byte*)) (word) 53281
(byte) RED#0 ← (byte/signed byte/word/signed word) 2

View File

@ -284,8 +284,6 @@ s::@return: scope:[s] from s
to:@end
@end: scope:[] from @3
Completing Phi functions...
Completing Phi functions...
Completing Phi functions...
Completing Phi functions...
CONTROL FLOW GRAPH SSA
@ -295,14 +293,12 @@ CONTROL FLOW GRAPH SSA
(byte) b#0 ← (byte~) $0
to:@2
main: scope:[main] from @2
(byte*) SCREEN#3 ← phi( @2/(byte*) SCREEN#4 )
(byte) b#13 ← phi( @2/(byte) b#14 )
(byte) main::col#0 ← (byte/signed byte/word/signed word) 2
(byte*) main::COLS#0 ← ((byte*)) (word) 55296
(byte) s::return#0 ← call s param-assignment
to:main::@3
main::@3: scope:[main] from main
(byte*) SCREEN#2 ← phi( main/(byte*) SCREEN#3 )
(byte*) main::COLS#2 ← phi( main/(byte*) main::COLS#0 )
(byte) main::col#2 ← phi( main/(byte) main::col#0 )
(byte) b#7 ← phi( main/(byte) b#13 )
@ -311,13 +307,12 @@ main::@3: scope:[main] from main
(byte) main::i#0 ← (byte/signed byte/word/signed word) 0
to:main::@1
main::@1: scope:[main] from main::@1 main::@3
(byte*) SCREEN#1 ← phi( main::@1/(byte*) SCREEN#1 main::@3/(byte*) SCREEN#2 )
(byte) b#8 ← phi( main::@1/(byte) b#8 main::@3/(byte) b#2 )
(byte) main::i#2 ← phi( main::@1/(byte) main::i#1 main::@3/(byte) main::i#0 )
(byte*) main::COLS#1 ← phi( main::@1/(byte*) main::COLS#1 main::@3/(byte*) main::COLS#2 )
(byte) main::col#1 ← phi( main::@1/(byte) main::col#1 main::@3/(byte) main::col#2 )
*((byte*) main::COLS#1 + (byte) main::i#2) ← (byte) main::col#1
*((byte*) SCREEN#1 + (byte) main::i#2) ← (byte) b#8
*((byte*) SCREEN#0 + (byte) main::i#2) ← (byte) b#8
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$8 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 101
if((boolean~) main::$8) goto main::@1
@ -340,7 +335,6 @@ s::@return: scope:[s] from s
return (byte) s::return#2
to:@return
@2: scope:[] from @begin
(byte*) SCREEN#4 ← phi( @begin/(byte*) SCREEN#0 )
(byte) b#14 ← phi( @begin/(byte) b#0 )
call main param-assignment
to:@3
@ -357,7 +351,6 @@ CONTROL FLOW GRAPH WITH ASSIGNMENT CALL & RETURN
(byte) b#0 ← (byte~) $0
to:@2
main: scope:[main] from @2
(byte*) SCREEN#3 ← phi( @2/(byte*) SCREEN#4 )
(byte) b#13 ← phi( @2/(byte) b#14 )
(byte) main::col#0 ← (byte/signed byte/word/signed word) 2
(byte*) main::COLS#0 ← ((byte*)) (word) 55296
@ -365,7 +358,6 @@ main: scope:[main] from @2
(byte) s::return#0 ← (byte) s::return#2
to:main::@3
main::@3: scope:[main] from main
(byte*) SCREEN#2 ← phi( main/(byte*) SCREEN#3 )
(byte*) main::COLS#2 ← phi( main/(byte*) main::COLS#0 )
(byte) main::col#2 ← phi( main/(byte) main::col#0 )
(byte) b#7 ← phi( main/(byte) b#5 )
@ -374,13 +366,12 @@ main::@3: scope:[main] from main
(byte) main::i#0 ← (byte/signed byte/word/signed word) 0
to:main::@1
main::@1: scope:[main] from main::@1 main::@3
(byte*) SCREEN#1 ← phi( main::@1/(byte*) SCREEN#1 main::@3/(byte*) SCREEN#2 )
(byte) b#8 ← phi( main::@1/(byte) b#8 main::@3/(byte) b#2 )
(byte) main::i#2 ← phi( main::@1/(byte) main::i#1 main::@3/(byte) main::i#0 )
(byte*) main::COLS#1 ← phi( main::@1/(byte*) main::COLS#1 main::@3/(byte*) main::COLS#2 )
(byte) main::col#1 ← phi( main::@1/(byte) main::col#1 main::@3/(byte) main::col#2 )
*((byte*) main::COLS#1 + (byte) main::i#2) ← (byte) main::col#1
*((byte*) SCREEN#1 + (byte) main::i#2) ← (byte) b#8
*((byte*) SCREEN#0 + (byte) main::i#2) ← (byte) b#8
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$8 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 101
if((boolean~) main::$8) goto main::@1
@ -403,7 +394,6 @@ s::@return: scope:[s] from s
return
to:@return
@2: scope:[] from @begin
(byte*) SCREEN#4 ← phi( @begin/(byte*) SCREEN#0 )
(byte) b#14 ← phi( @begin/(byte) b#0 )
call main param-assignment
to:@3
@ -421,10 +411,6 @@ INITIAL SSA SYMBOL TABLE
(label) @end
(byte*) SCREEN
(byte*) SCREEN#0
(byte*) SCREEN#1
(byte*) SCREEN#2
(byte*) SCREEN#3
(byte*) SCREEN#4
(byte) b
(byte) b#0
(byte) b#1
@ -467,24 +453,20 @@ INITIAL SSA SYMBOL TABLE
(byte) s::return#3
Not aliassing across scopes: b#13 b#14
Not aliassing across scopes: SCREEN#3 SCREEN#4
Not aliassing across scopes: s::return#0 s::return#2
Not aliassing across scopes: b#7 b#5
Not aliassing identity: main::col#1 main::col#1
Not aliassing identity: main::COLS#1 main::COLS#1
Not aliassing identity: b#8 b#8
Not aliassing identity: SCREEN#1 SCREEN#1
Not aliassing across scopes: b#10 b#13
Not aliassing across scopes: b#12 b#3
Alias (byte) b#0 = (byte~) $0 (byte) b#14
Alias (byte) main::col#0 = (byte) main::col#2
Alias (byte*) main::COLS#0 = (byte*) main::COLS#2
Alias (byte*) SCREEN#2 = (byte*) SCREEN#3
Alias (byte) b#1 = (byte) b#7
Alias (byte) b#3 = (byte) b#9 (byte) b#8
Alias (byte) s::return#1 = (byte) s::return#3 (byte) s::return#2
Alias (byte) b#11 = (byte) b#4 (byte) b#5
Alias (byte*) SCREEN#0 = (byte*) SCREEN#4
Alias (byte) b#12 = (byte) b#6
Succesful SSA optimization Pass2AliasElimination
CONTROL FLOW GRAPH
@ -493,7 +475,6 @@ CONTROL FLOW GRAPH
(byte) b#0 ← (byte/signed byte/word/signed word) 2 >> (byte/signed byte/word/signed word) 1
to:@2
main: scope:[main] from @2
(byte*) SCREEN#2 ← phi( @2/(byte*) SCREEN#0 )
(byte) b#13 ← phi( @2/(byte) b#0 )
(byte) main::col#0 ← (byte/signed byte/word/signed word) 2
(byte*) main::COLS#0 ← ((byte*)) (word) 55296
@ -506,13 +487,12 @@ main::@3: scope:[main] from main
(byte) main::i#0 ← (byte/signed byte/word/signed word) 0
to:main::@1
main::@1: scope:[main] from main::@1 main::@3
(byte*) SCREEN#1 ← phi( main::@1/(byte*) SCREEN#1 main::@3/(byte*) SCREEN#2 )
(byte) b#3 ← phi( main::@1/(byte) b#3 main::@3/(byte) b#2 )
(byte) main::i#2 ← phi( main::@1/(byte) main::i#1 main::@3/(byte) main::i#0 )
(byte*) main::COLS#1 ← phi( main::@1/(byte*) main::COLS#1 main::@3/(byte*) main::COLS#0 )
(byte) main::col#1 ← phi( main::@1/(byte) main::col#1 main::@3/(byte) main::col#0 )
*((byte*) main::COLS#1 + (byte) main::i#2) ← (byte) main::col#1
*((byte*) SCREEN#1 + (byte) main::i#2) ← (byte) b#3
*((byte*) SCREEN#0 + (byte) main::i#2) ← (byte) b#3
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$8 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 101
if((boolean~) main::$8) goto main::@1
@ -537,19 +517,16 @@ s::@return: scope:[s] from s
@end: scope:[] from @3
Not aliassing across scopes: b#13 b#0
Not aliassing across scopes: SCREEN#2 SCREEN#0
Not aliassing across scopes: s::return#0 s::return#1
Not aliassing across scopes: b#1 b#11
Not aliassing identity: main::col#1 main::col#1
Not aliassing identity: main::COLS#1 main::COLS#1
Not aliassing identity: b#3 b#3
Not aliassing identity: SCREEN#1 SCREEN#1
Not aliassing across scopes: b#10 b#13
Not aliassing across scopes: b#12 b#3
Self Phi Eliminated (byte) main::col#1
Self Phi Eliminated (byte*) main::COLS#1
Self Phi Eliminated (byte) b#3
Self Phi Eliminated (byte*) SCREEN#1
Succesful SSA optimization Pass2SelfPhiElimination
CONTROL FLOW GRAPH
@begin: scope:[] from
@ -557,7 +534,6 @@ CONTROL FLOW GRAPH
(byte) b#0 ← (byte/signed byte/word/signed word) 2 >> (byte/signed byte/word/signed word) 1
to:@2
main: scope:[main] from @2
(byte*) SCREEN#2 ← phi( @2/(byte*) SCREEN#0 )
(byte) b#13 ← phi( @2/(byte) b#0 )
(byte) main::col#0 ← (byte/signed byte/word/signed word) 2
(byte*) main::COLS#0 ← ((byte*)) (word) 55296
@ -570,13 +546,12 @@ main::@3: scope:[main] from main
(byte) main::i#0 ← (byte/signed byte/word/signed word) 0
to:main::@1
main::@1: scope:[main] from main::@1 main::@3
(byte*) SCREEN#1 ← phi( main::@3/(byte*) SCREEN#2 )
(byte) b#3 ← phi( main::@3/(byte) b#2 )
(byte) main::i#2 ← phi( main::@1/(byte) main::i#1 main::@3/(byte) main::i#0 )
(byte*) main::COLS#1 ← phi( main::@3/(byte*) main::COLS#0 )
(byte) main::col#1 ← phi( main::@3/(byte) main::col#0 )
*((byte*) main::COLS#1 + (byte) main::i#2) ← (byte) main::col#1
*((byte*) SCREEN#1 + (byte) main::i#2) ← (byte) b#3
*((byte*) SCREEN#0 + (byte) main::i#2) ← (byte) b#3
(byte) main::i#1 ← ++ (byte) main::i#2
(boolean~) main::$8 ← (byte) main::i#1 != (byte/signed byte/word/signed word) 101
if((boolean~) main::$8) goto main::@1
@ -601,12 +576,10 @@ s::@return: scope:[s] from s
@end: scope:[] from @3
Redundant Phi (byte) b#13 (byte) b#0
Redundant Phi (byte*) SCREEN#2 (byte*) SCREEN#0
Redundant Phi (byte) b#1 (byte) b#11
Redundant Phi (byte) main::col#1 (byte) main::col#0
Redundant Phi (byte*) main::COLS#1 (byte*) main::COLS#0
Redundant Phi (byte) b#3 (byte) b#2
Redundant Phi (byte*) SCREEN#1 (byte*) SCREEN#2
Redundant Phi (byte) b#10 (byte) b#13
Redundant Phi (byte) b#12 (byte) b#3
Succesful SSA optimization Pass2RedundantPhiElimination