mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-09-08 17:54:40 +00:00
Added pass1 optimization removing empty blocks.
This commit is contained in:
parent
524252105a
commit
2819d3c58a
@ -12,7 +12,7 @@ public class CompileLog {
|
||||
public void append(String msg) {
|
||||
log.append(msg);
|
||||
log.append("\n");
|
||||
//System.out.printf(msg+"\n");
|
||||
System.out.printf(msg+"\n");
|
||||
}
|
||||
|
||||
public StringBuilder getLog() {
|
||||
|
@ -150,6 +150,12 @@ public class Compiler {
|
||||
log.append("INITIAL CONTROL FLOW GRAPH");
|
||||
log.append(program.getGraph().toString(program.getScope()));
|
||||
|
||||
Pass1EliminateEmptyBlocks pass1EliminateEmptyBlocks = new Pass1EliminateEmptyBlocks(program, log);
|
||||
boolean blockEliminated = pass1EliminateEmptyBlocks.eliminate();
|
||||
if(blockEliminated) {
|
||||
log.append(program.getGraph().toString(program.getScope()));
|
||||
}
|
||||
|
||||
Pass1ProcedureCallParameters pass1ProcedureCallParameters =
|
||||
new Pass1ProcedureCallParameters(program);
|
||||
program.setGraph(pass1ProcedureCallParameters.generate());
|
||||
|
@ -43,6 +43,10 @@ public class ControlFlowGraph {
|
||||
return blocks.values();
|
||||
}
|
||||
|
||||
public void remove(LabelRef label) {
|
||||
blocks.remove(label);
|
||||
}
|
||||
|
||||
/** Get the assignment of the passed variable.
|
||||
*
|
||||
* @param variable The variable to find the assignment for
|
||||
|
55
src/dk/camelot64/kickc/passes/Pass1EliminateEmptyBlocks.java
Normal file
55
src/dk/camelot64/kickc/passes/Pass1EliminateEmptyBlocks.java
Normal file
@ -0,0 +1,55 @@
|
||||
package dk.camelot64.kickc.passes;
|
||||
|
||||
import dk.camelot64.kickc.CompileLog;
|
||||
import dk.camelot64.kickc.icl.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Eliminate empty blocks in pass 1 (before creating SSA)
|
||||
*/
|
||||
public class Pass1EliminateEmptyBlocks {
|
||||
|
||||
private Program program;
|
||||
private CompileLog log;
|
||||
|
||||
public Pass1EliminateEmptyBlocks(Program program, CompileLog log) {
|
||||
this.program = program;
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
public boolean eliminate() {
|
||||
ControlFlowGraph graph = program.getGraph();
|
||||
Collection<ControlFlowBlock> blocks = graph.getAllBlocks();
|
||||
List<LabelRef> removeList = new ArrayList<>();
|
||||
for (ControlFlowBlock block : blocks) {
|
||||
if(block.getLabel().getFullName().equals("@END")) {
|
||||
continue;
|
||||
}
|
||||
if (block.getStatements().isEmpty()) {
|
||||
List<ControlFlowBlock> predecessors = graph.getPredecessors(block);
|
||||
boolean remove = true;
|
||||
for (ControlFlowBlock predecessor : predecessors) {
|
||||
if(predecessor.getDefaultSuccessor().equals(block.getLabel())) {
|
||||
predecessor.setDefaultSuccessor(block.getDefaultSuccessor());
|
||||
} else {
|
||||
remove = false;
|
||||
}
|
||||
}
|
||||
if (remove) {
|
||||
removeList.add(block.getLabel());
|
||||
}
|
||||
}
|
||||
}
|
||||
for (LabelRef labelRef : removeList) {
|
||||
graph.remove(labelRef);
|
||||
Label label = program.getScope().getLabel(labelRef);
|
||||
label.getScope().remove(label);
|
||||
log.append("Removing empty block "+labelRef);
|
||||
}
|
||||
return removeList.size()>0;
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
||||
@BEGIN: from
|
||||
to:@1
|
||||
@1: from @3 @BEGIN
|
||||
(byte) y#2 ← phi( @3/(byte) y#5 @BEGIN/(byte) 0 )
|
||||
(byte) y#2 ← phi( @3/(byte) y#4 @BEGIN/(byte) 0 )
|
||||
(byte) e#3 ← phi( @3/(byte) e#5 @BEGIN/(byte) 12 )
|
||||
(byte) x#2 ← phi( @3/(byte) x#1 @BEGIN/(byte) 0 )
|
||||
(byte*) cursor#3 ← phi( @3/(byte*) cursor#5 @BEGIN/(word) 1024 )
|
||||
@ -17,7 +17,7 @@
|
||||
(byte) e#2 ← (byte) e#1 - (byte) 39
|
||||
to:@3
|
||||
@3: from @1 @2
|
||||
(byte) y#5 ← phi( @1/(byte) y#2 @2/(byte) y#1 )
|
||||
(byte) y#4 ← phi( @1/(byte) y#2 @2/(byte) y#1 )
|
||||
(byte) e#5 ← phi( @1/(byte) e#1 @2/(byte) e#2 )
|
||||
(byte*) cursor#5 ← phi( @1/(byte*) cursor#1 @2/(byte*) cursor#2 )
|
||||
if((byte) x#1<(byte) 40) goto @1
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -24,7 +24,7 @@
|
||||
(byte) y
|
||||
(byte) y#1 zp byte:6
|
||||
(byte) y#2 zp byte:14
|
||||
(byte) y#5 zp byte:18
|
||||
(byte) y#4 zp byte:18
|
||||
(byte) y0
|
||||
(byte) y1
|
||||
(byte) yd
|
||||
|
@ -3,17 +3,17 @@ BBEGIN:
|
||||
BEND:
|
||||
main:
|
||||
jsr prepare
|
||||
main__B2_from_main:
|
||||
main__B3_from_main:
|
||||
ldx #25
|
||||
jmp main__B2
|
||||
main__B2_from_B11:
|
||||
jmp main__B3
|
||||
main__B3_from_B11:
|
||||
ldx #25
|
||||
main__B2_from_B6:
|
||||
main__B2:
|
||||
main__B3_from_B3:
|
||||
main__B3_from_B6:
|
||||
main__B3:
|
||||
lda 53266
|
||||
cmp #254
|
||||
bne main__main__B3
|
||||
bne main__B3_from_B3
|
||||
main__B4:
|
||||
lda 53266
|
||||
cmp #255
|
||||
@ -21,13 +21,13 @@ main__B4:
|
||||
main__B6:
|
||||
dex
|
||||
cpx #0
|
||||
bne main__B2_from_B6
|
||||
bne main__B3_from_B6
|
||||
main__B7:
|
||||
jsr flip
|
||||
main__B10:
|
||||
jsr plot
|
||||
main__B11:
|
||||
jmp main__B2_from_B11
|
||||
jmp main__B3_from_B11
|
||||
main__Breturn:
|
||||
rts
|
||||
plot:
|
||||
|
@ -3,11 +3,9 @@
|
||||
to:@END
|
||||
main: from @BEGIN
|
||||
call prepare param-assignment
|
||||
to:main::@2
|
||||
main::@2: from main main::@11 main::@6
|
||||
(byte) main::c#2 ← phi( main/(byte) 25 main::@11/(byte) 25 main::@6/(byte) main::c#1 )
|
||||
to:main::@3
|
||||
main::@3: from main::@2 main::@3
|
||||
main::@3: from main main::@11 main::@3 main::@6
|
||||
(byte) main::c#2 ← phi( main/(byte) 25 main::@11/(byte) 25 main::@6/(byte) main::c#1 )
|
||||
(byte~) main::$1 ← * (word) 53266
|
||||
if((byte~) main::$1!=(byte) 254) goto main::@3
|
||||
to:main::@4
|
||||
@ -17,7 +15,7 @@ main::@4: from main::@3 main::@4
|
||||
to:main::@6
|
||||
main::@6: from main::@4
|
||||
(byte) main::c#1 ← -- (byte) main::c#2
|
||||
if((byte) main::c#1!=(byte) 0) goto main::@2
|
||||
if((byte) main::c#1!=(byte) 0) goto main::@3
|
||||
to:main::@7
|
||||
main::@7: from main::@6
|
||||
call flip param-assignment
|
||||
@ -26,7 +24,7 @@ main::@10: from main::@7
|
||||
call plot param-assignment
|
||||
to:main::@11
|
||||
main::@11: from main::@10
|
||||
if(true) goto main::@2
|
||||
if(true) goto main::@3
|
||||
to:main::@return
|
||||
main::@return: from main::@11
|
||||
return
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -36,7 +36,6 @@
|
||||
(byte~) main::$3 reg byte a
|
||||
(label) main::@10
|
||||
(label) main::@11
|
||||
(label) main::@2
|
||||
(label) main::@3
|
||||
(label) main::@4
|
||||
(label) main::@6
|
||||
|
@ -1,7 +1,7 @@
|
||||
@BEGIN: from
|
||||
to:@1
|
||||
@1: from @3 @BEGIN
|
||||
(byte) s#2 ← phi( @3/(byte) s#5 @BEGIN/(byte) 0 )
|
||||
(byte) s#2 ← phi( @3/(byte) s#4 @BEGIN/(byte) 0 )
|
||||
(byte) i#2 ← phi( @3/(byte) i#1 @BEGIN/(byte) 10 )
|
||||
if((byte) i#2>(byte) 5) goto @2
|
||||
to:@3
|
||||
@ -9,7 +9,7 @@
|
||||
(byte) s#1 ← (byte) s#2 + (byte) i#2
|
||||
to:@3
|
||||
@3: from @1 @2
|
||||
(byte) s#5 ← phi( @1/(byte) s#2 @2/(byte) s#1 )
|
||||
(byte) s#4 ← phi( @1/(byte) s#2 @2/(byte) s#1 )
|
||||
(byte) i#1 ← -- (byte) i#2
|
||||
if((byte) i#1>(byte) 0) goto @1
|
||||
to:@END
|
||||
|
@ -58,6 +58,28 @@ INITIAL CONTROL FLOW GRAPH
|
||||
to:@END
|
||||
@END: from @6
|
||||
|
||||
Removing empty block @4
|
||||
Removing empty block @5
|
||||
Removing empty block @6
|
||||
@BEGIN: from
|
||||
(byte) i ← (byte) 10
|
||||
(byte) s ← (byte) 0
|
||||
to:@1
|
||||
@1: from @3 @BEGIN
|
||||
(boolean~) $0 ← (byte) i > (byte) 5
|
||||
if((boolean~) $0) goto @2
|
||||
to:@3
|
||||
@2: from @1
|
||||
(byte~) $1 ← (byte) s + (byte) i
|
||||
(byte) s ← (byte~) $1
|
||||
to:@3
|
||||
@3: from @1 @2
|
||||
(byte) i ← -- (byte) i
|
||||
(boolean~) $2 ← (byte) i > (byte) 0
|
||||
if((boolean~) $2) goto @1
|
||||
to:@END
|
||||
@END: from @3
|
||||
|
||||
CONTROL FLOW GRAPH WITH ASSIGNMENT CALL
|
||||
@BEGIN: from
|
||||
(byte) i ← (byte) 10
|
||||
@ -66,63 +88,46 @@ CONTROL FLOW GRAPH WITH ASSIGNMENT CALL
|
||||
@1: from @3 @BEGIN
|
||||
(boolean~) $0 ← (byte) i > (byte) 5
|
||||
if((boolean~) $0) goto @2
|
||||
to:@4
|
||||
@2: from @1 @5
|
||||
to:@3
|
||||
@2: from @1
|
||||
(byte~) $1 ← (byte) s + (byte) i
|
||||
(byte) s ← (byte~) $1
|
||||
to:@3
|
||||
@4: from @1
|
||||
to:@3
|
||||
@3: from @2 @4
|
||||
@3: from @1 @2
|
||||
(byte) i ← -- (byte) i
|
||||
(boolean~) $2 ← (byte) i > (byte) 0
|
||||
if((boolean~) $2) goto @1
|
||||
to:@6
|
||||
@5: from
|
||||
to:@2
|
||||
@6: from @3
|
||||
to:@END
|
||||
@END: from @6
|
||||
@END: from @3
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@BEGIN: from
|
||||
(byte) i#0 ← (byte) 10
|
||||
(byte) s#0 ← (byte) 0
|
||||
to:@1
|
||||
@1: from @3 @BEGIN
|
||||
(byte) s#3 ← phi( @3/(byte) s#5 @BEGIN/(byte) s#0 )
|
||||
(byte) s#3 ← phi( @3/(byte) s#4 @BEGIN/(byte) s#0 )
|
||||
(byte) i#2 ← phi( @3/(byte) i#1 @BEGIN/(byte) i#0 )
|
||||
(boolean~) $0 ← (byte) i#2 > (byte) 5
|
||||
if((boolean~) $0) goto @2
|
||||
to:@4
|
||||
@2: from @1 @5
|
||||
(byte) i#3 ← phi( @1/(byte) i#2 @5/(byte) i#5 )
|
||||
(byte) s#2 ← phi( @1/(byte) s#3 @5/(byte) s#4 )
|
||||
to:@3
|
||||
@2: from @1
|
||||
(byte) i#3 ← phi( @1/(byte) i#2 )
|
||||
(byte) s#2 ← phi( @1/(byte) s#3 )
|
||||
(byte~) $1 ← (byte) s#2 + (byte) i#3
|
||||
(byte) s#1 ← (byte~) $1
|
||||
to:@3
|
||||
@4: from @1
|
||||
(byte) s#6 ← phi( @1/(byte) s#3 )
|
||||
(byte) i#6 ← phi( @1/(byte) i#2 )
|
||||
to:@3
|
||||
@3: from @2 @4
|
||||
(byte) s#5 ← phi( @2/(byte) s#1 @4/(byte) s#6 )
|
||||
(byte) i#4 ← phi( @2/(byte) i#3 @4/(byte) i#6 )
|
||||
@3: from @1 @2
|
||||
(byte) s#4 ← phi( @1/(byte) s#3 @2/(byte) s#1 )
|
||||
(byte) i#4 ← phi( @1/(byte) i#2 @2/(byte) i#3 )
|
||||
(byte) i#1 ← -- (byte) i#4
|
||||
(boolean~) $2 ← (byte) i#1 > (byte) 0
|
||||
if((boolean~) $2) goto @1
|
||||
to:@6
|
||||
@5: from
|
||||
(byte) i#5 ← phi( )
|
||||
(byte) s#4 ← phi( )
|
||||
to:@2
|
||||
@6: from @3
|
||||
to:@END
|
||||
@END: from @6
|
||||
@END: from @3
|
||||
|
||||
CONTROL FLOW GRAPH WITH ASSIGNMENT CALL & RETURN
|
||||
@BEGIN: from
|
||||
@ -130,70 +135,24 @@ CONTROL FLOW GRAPH WITH ASSIGNMENT CALL & RETURN
|
||||
(byte) s#0 ← (byte) 0
|
||||
to:@1
|
||||
@1: from @3 @BEGIN
|
||||
(byte) s#3 ← phi( @3/(byte) s#5 @BEGIN/(byte) s#0 )
|
||||
(byte) s#3 ← phi( @3/(byte) s#4 @BEGIN/(byte) s#0 )
|
||||
(byte) i#2 ← phi( @3/(byte) i#1 @BEGIN/(byte) i#0 )
|
||||
(boolean~) $0 ← (byte) i#2 > (byte) 5
|
||||
if((boolean~) $0) goto @2
|
||||
to:@4
|
||||
@2: from @1 @5
|
||||
(byte) i#3 ← phi( @1/(byte) i#2 @5/(byte) i#5 )
|
||||
(byte) s#2 ← phi( @1/(byte) s#3 @5/(byte) s#4 )
|
||||
to:@3
|
||||
@2: from @1
|
||||
(byte) i#3 ← phi( @1/(byte) i#2 )
|
||||
(byte) s#2 ← phi( @1/(byte) s#3 )
|
||||
(byte~) $1 ← (byte) s#2 + (byte) i#3
|
||||
(byte) s#1 ← (byte~) $1
|
||||
to:@3
|
||||
@4: from @1
|
||||
(byte) s#6 ← phi( @1/(byte) s#3 )
|
||||
(byte) i#6 ← phi( @1/(byte) i#2 )
|
||||
to:@3
|
||||
@3: from @2 @4
|
||||
(byte) s#5 ← phi( @2/(byte) s#1 @4/(byte) s#6 )
|
||||
(byte) i#4 ← phi( @2/(byte) i#3 @4/(byte) i#6 )
|
||||
(byte) i#1 ← -- (byte) i#4
|
||||
(boolean~) $2 ← (byte) i#1 > (byte) 0
|
||||
if((boolean~) $2) goto @1
|
||||
to:@6
|
||||
@5: from
|
||||
(byte) i#5 ← phi( )
|
||||
(byte) s#4 ← phi( )
|
||||
to:@2
|
||||
@6: from @3
|
||||
to:@END
|
||||
@END: from @6
|
||||
|
||||
Culled Empty Block (label) @6
|
||||
Succesful SSA optimization Pass2CullEmptyBlocks
|
||||
CONTROL FLOW GRAPH
|
||||
@BEGIN: from
|
||||
(byte) i#0 ← (byte) 10
|
||||
(byte) s#0 ← (byte) 0
|
||||
to:@1
|
||||
@1: from @3 @BEGIN
|
||||
(byte) s#3 ← phi( @3/(byte) s#5 @BEGIN/(byte) s#0 )
|
||||
(byte) i#2 ← phi( @3/(byte) i#1 @BEGIN/(byte) i#0 )
|
||||
(boolean~) $0 ← (byte) i#2 > (byte) 5
|
||||
if((boolean~) $0) goto @2
|
||||
to:@4
|
||||
@2: from @1 @5
|
||||
(byte) i#3 ← phi( @1/(byte) i#2 @5/(byte) i#5 )
|
||||
(byte) s#2 ← phi( @1/(byte) s#3 @5/(byte) s#4 )
|
||||
(byte~) $1 ← (byte) s#2 + (byte) i#3
|
||||
(byte) s#1 ← (byte~) $1
|
||||
to:@3
|
||||
@4: from @1
|
||||
(byte) s#6 ← phi( @1/(byte) s#3 )
|
||||
(byte) i#6 ← phi( @1/(byte) i#2 )
|
||||
to:@3
|
||||
@3: from @2 @4
|
||||
(byte) s#5 ← phi( @2/(byte) s#1 @4/(byte) s#6 )
|
||||
(byte) i#4 ← phi( @2/(byte) i#3 @4/(byte) i#6 )
|
||||
@3: from @1 @2
|
||||
(byte) s#4 ← phi( @1/(byte) s#3 @2/(byte) s#1 )
|
||||
(byte) i#4 ← phi( @1/(byte) i#2 @2/(byte) i#3 )
|
||||
(byte) i#1 ← -- (byte) i#4
|
||||
(boolean~) $2 ← (byte) i#1 > (byte) 0
|
||||
if((boolean~) $2) goto @1
|
||||
to:@END
|
||||
@5: from
|
||||
(byte) i#5 ← phi( )
|
||||
(byte) s#4 ← phi( )
|
||||
to:@2
|
||||
@END: from @3
|
||||
|
||||
Constant (byte) i#0 (byte) 10
|
||||
@ -203,168 +162,48 @@ CONTROL FLOW GRAPH
|
||||
@BEGIN: from
|
||||
to:@1
|
||||
@1: from @3 @BEGIN
|
||||
(byte) s#3 ← phi( @3/(byte) s#5 @BEGIN/(byte) 0 )
|
||||
(byte) s#3 ← phi( @3/(byte) s#4 @BEGIN/(byte) 0 )
|
||||
(byte) i#2 ← phi( @3/(byte) i#1 @BEGIN/(byte) 10 )
|
||||
(boolean~) $0 ← (byte) i#2 > (byte) 5
|
||||
if((boolean~) $0) goto @2
|
||||
to:@4
|
||||
@2: from @1 @5
|
||||
(byte) i#3 ← phi( @1/(byte) i#2 @5/(byte) i#5 )
|
||||
(byte) s#2 ← phi( @1/(byte) s#3 @5/(byte) s#4 )
|
||||
(byte~) $1 ← (byte) s#2 + (byte) i#3
|
||||
(byte) s#1 ← (byte~) $1
|
||||
to:@3
|
||||
@4: from @1
|
||||
(byte) s#6 ← phi( @1/(byte) s#3 )
|
||||
(byte) i#6 ← phi( @1/(byte) i#2 )
|
||||
to:@3
|
||||
@3: from @2 @4
|
||||
(byte) s#5 ← phi( @2/(byte) s#1 @4/(byte) s#6 )
|
||||
(byte) i#4 ← phi( @2/(byte) i#3 @4/(byte) i#6 )
|
||||
(byte) i#1 ← -- (byte) i#4
|
||||
(boolean~) $2 ← (byte) i#1 > (byte) 0
|
||||
if((boolean~) $2) goto @1
|
||||
to:@END
|
||||
@5: from
|
||||
(byte) i#5 ← phi( )
|
||||
(byte) s#4 ← phi( )
|
||||
to:@2
|
||||
@END: from @3
|
||||
|
||||
Alias (byte) s#1 = (byte~) $1
|
||||
Alias (byte) i#2 = (byte) i#6
|
||||
Alias (byte) s#3 = (byte) s#6
|
||||
Succesful SSA optimization Pass2AliasElimination
|
||||
CONTROL FLOW GRAPH
|
||||
@BEGIN: from
|
||||
to:@1
|
||||
@1: from @3 @BEGIN
|
||||
(byte) s#3 ← phi( @3/(byte) s#5 @BEGIN/(byte) 0 )
|
||||
(byte) i#2 ← phi( @3/(byte) i#1 @BEGIN/(byte) 10 )
|
||||
(boolean~) $0 ← (byte) i#2 > (byte) 5
|
||||
if((boolean~) $0) goto @2
|
||||
to:@4
|
||||
@2: from @1 @5
|
||||
(byte) i#3 ← phi( @1/(byte) i#2 @5/(byte) i#5 )
|
||||
(byte) s#2 ← phi( @1/(byte) s#3 @5/(byte) s#4 )
|
||||
(byte) s#1 ← (byte) s#2 + (byte) i#3
|
||||
to:@3
|
||||
@4: from @1
|
||||
to:@3
|
||||
@3: from @2 @4
|
||||
(byte) s#5 ← phi( @2/(byte) s#1 @4/(byte) s#3 )
|
||||
(byte) i#4 ← phi( @2/(byte) i#3 @4/(byte) i#2 )
|
||||
(byte) i#1 ← -- (byte) i#4
|
||||
(boolean~) $2 ← (byte) i#1 > (byte) 0
|
||||
if((boolean~) $2) goto @1
|
||||
to:@END
|
||||
@5: from
|
||||
(byte) i#5 ← phi( )
|
||||
(byte) s#4 ← phi( )
|
||||
to:@2
|
||||
@END: from @3
|
||||
|
||||
Redundant Phi (byte) s#4 VOID
|
||||
Redundant Phi (byte) i#5 VOID
|
||||
Succesful SSA optimization Pass2RedundantPhiElimination
|
||||
CONTROL FLOW GRAPH
|
||||
@BEGIN: from
|
||||
to:@1
|
||||
@1: from @3 @BEGIN
|
||||
(byte) s#3 ← phi( @3/(byte) s#5 @BEGIN/(byte) 0 )
|
||||
(byte) i#2 ← phi( @3/(byte) i#1 @BEGIN/(byte) 10 )
|
||||
(boolean~) $0 ← (byte) i#2 > (byte) 5
|
||||
if((boolean~) $0) goto @2
|
||||
to:@4
|
||||
@2: from @1 @5
|
||||
(byte) i#3 ← phi( @1/(byte) i#2 )
|
||||
(byte) s#2 ← phi( @1/(byte) s#3 )
|
||||
(byte) s#1 ← (byte) s#2 + (byte) i#3
|
||||
to:@3
|
||||
@4: from @1
|
||||
to:@3
|
||||
@3: from @2 @4
|
||||
(byte) s#5 ← phi( @2/(byte) s#1 @4/(byte) s#3 )
|
||||
(byte) i#4 ← phi( @2/(byte) i#3 @4/(byte) i#2 )
|
||||
(byte) i#1 ← -- (byte) i#4
|
||||
(boolean~) $2 ← (byte) i#1 > (byte) 0
|
||||
if((boolean~) $2) goto @1
|
||||
to:@END
|
||||
@5: from
|
||||
to:@2
|
||||
@END: from @3
|
||||
|
||||
Simple Condition (boolean~) $0 if((byte) i#2>(byte) 5) goto @2
|
||||
Simple Condition (boolean~) $2 if((byte) i#1>(byte) 0) goto @1
|
||||
Succesful SSA optimization Pass2ConditionalJumpSimplification
|
||||
CONTROL FLOW GRAPH
|
||||
@BEGIN: from
|
||||
to:@1
|
||||
@1: from @3 @BEGIN
|
||||
(byte) s#3 ← phi( @3/(byte) s#5 @BEGIN/(byte) 0 )
|
||||
(byte) i#2 ← phi( @3/(byte) i#1 @BEGIN/(byte) 10 )
|
||||
if((byte) i#2>(byte) 5) goto @2
|
||||
to:@4
|
||||
@2: from @1 @5
|
||||
(byte) i#3 ← phi( @1/(byte) i#2 )
|
||||
(byte) s#2 ← phi( @1/(byte) s#3 )
|
||||
(byte) s#1 ← (byte) s#2 + (byte) i#3
|
||||
to:@3
|
||||
@4: from @1
|
||||
to:@3
|
||||
@3: from @2 @4
|
||||
(byte) s#5 ← phi( @2/(byte) s#1 @4/(byte) s#3 )
|
||||
(byte) i#4 ← phi( @2/(byte) i#3 @4/(byte) i#2 )
|
||||
(byte) i#1 ← -- (byte) i#4
|
||||
if((byte) i#1>(byte) 0) goto @1
|
||||
to:@END
|
||||
@5: from
|
||||
to:@2
|
||||
@END: from @3
|
||||
|
||||
Culled Empty Block (label) @4
|
||||
Culled Empty Block (label) @5
|
||||
Succesful SSA optimization Pass2CullEmptyBlocks
|
||||
CONTROL FLOW GRAPH
|
||||
@BEGIN: from
|
||||
to:@1
|
||||
@1: from @3 @BEGIN
|
||||
(byte) s#3 ← phi( @3/(byte) s#5 @BEGIN/(byte) 0 )
|
||||
(byte) i#2 ← phi( @3/(byte) i#1 @BEGIN/(byte) 10 )
|
||||
if((byte) i#2>(byte) 5) goto @2
|
||||
to:@3
|
||||
@2: from @1
|
||||
(byte) i#3 ← phi( @1/(byte) i#2 )
|
||||
(byte) s#2 ← phi( @1/(byte) s#3 )
|
||||
(byte) s#1 ← (byte) s#2 + (byte) i#3
|
||||
(byte~) $1 ← (byte) s#2 + (byte) i#3
|
||||
(byte) s#1 ← (byte~) $1
|
||||
to:@3
|
||||
@3: from @1 @2
|
||||
(byte) s#5 ← phi( @2/(byte) s#1 @1/(byte) s#3 )
|
||||
(byte) i#4 ← phi( @2/(byte) i#3 @1/(byte) i#2 )
|
||||
(byte) s#4 ← phi( @1/(byte) s#3 @2/(byte) s#1 )
|
||||
(byte) i#4 ← phi( @1/(byte) i#2 @2/(byte) i#3 )
|
||||
(byte) i#1 ← -- (byte) i#4
|
||||
if((byte) i#1>(byte) 0) goto @1
|
||||
(boolean~) $2 ← (byte) i#1 > (byte) 0
|
||||
if((boolean~) $2) goto @1
|
||||
to:@END
|
||||
@END: from @3
|
||||
|
||||
Alias (byte) s#2 = (byte) s#3
|
||||
Alias (byte) i#2 = (byte) i#3
|
||||
Alias (byte) s#1 = (byte~) $1
|
||||
Succesful SSA optimization Pass2AliasElimination
|
||||
CONTROL FLOW GRAPH
|
||||
@BEGIN: from
|
||||
to:@1
|
||||
@1: from @3 @BEGIN
|
||||
(byte) s#2 ← phi( @3/(byte) s#5 @BEGIN/(byte) 0 )
|
||||
(byte) s#2 ← phi( @3/(byte) s#4 @BEGIN/(byte) 0 )
|
||||
(byte) i#2 ← phi( @3/(byte) i#1 @BEGIN/(byte) 10 )
|
||||
if((byte) i#2>(byte) 5) goto @2
|
||||
(boolean~) $0 ← (byte) i#2 > (byte) 5
|
||||
if((boolean~) $0) goto @2
|
||||
to:@3
|
||||
@2: from @1
|
||||
(byte) s#1 ← (byte) s#2 + (byte) i#2
|
||||
to:@3
|
||||
@3: from @1 @2
|
||||
(byte) s#5 ← phi( @2/(byte) s#1 @1/(byte) s#2 )
|
||||
(byte) i#4 ← phi( @2/(byte) i#2 @1/(byte) i#2 )
|
||||
(byte) s#4 ← phi( @1/(byte) s#2 @2/(byte) s#1 )
|
||||
(byte) i#4 ← phi( @1/(byte) i#2 @2/(byte) i#2 )
|
||||
(byte) i#1 ← -- (byte) i#4
|
||||
if((byte) i#1>(byte) 0) goto @1
|
||||
(boolean~) $2 ← (byte) i#1 > (byte) 0
|
||||
if((boolean~) $2) goto @1
|
||||
to:@END
|
||||
@END: from @3
|
||||
|
||||
@ -374,7 +213,30 @@ CONTROL FLOW GRAPH
|
||||
@BEGIN: from
|
||||
to:@1
|
||||
@1: from @3 @BEGIN
|
||||
(byte) s#2 ← phi( @3/(byte) s#5 @BEGIN/(byte) 0 )
|
||||
(byte) s#2 ← phi( @3/(byte) s#4 @BEGIN/(byte) 0 )
|
||||
(byte) i#2 ← phi( @3/(byte) i#1 @BEGIN/(byte) 10 )
|
||||
(boolean~) $0 ← (byte) i#2 > (byte) 5
|
||||
if((boolean~) $0) goto @2
|
||||
to:@3
|
||||
@2: from @1
|
||||
(byte) s#1 ← (byte) s#2 + (byte) i#2
|
||||
to:@3
|
||||
@3: from @1 @2
|
||||
(byte) s#4 ← phi( @1/(byte) s#2 @2/(byte) s#1 )
|
||||
(byte) i#1 ← -- (byte) i#2
|
||||
(boolean~) $2 ← (byte) i#1 > (byte) 0
|
||||
if((boolean~) $2) goto @1
|
||||
to:@END
|
||||
@END: from @3
|
||||
|
||||
Simple Condition (boolean~) $0 if((byte) i#2>(byte) 5) goto @2
|
||||
Simple Condition (boolean~) $2 if((byte) i#1>(byte) 0) goto @1
|
||||
Succesful SSA optimization Pass2ConditionalJumpSimplification
|
||||
CONTROL FLOW GRAPH
|
||||
@BEGIN: from
|
||||
to:@1
|
||||
@1: from @3 @BEGIN
|
||||
(byte) s#2 ← phi( @3/(byte) s#4 @BEGIN/(byte) 0 )
|
||||
(byte) i#2 ← phi( @3/(byte) i#1 @BEGIN/(byte) 10 )
|
||||
if((byte) i#2>(byte) 5) goto @2
|
||||
to:@3
|
||||
@ -382,7 +244,7 @@ CONTROL FLOW GRAPH
|
||||
(byte) s#1 ← (byte) s#2 + (byte) i#2
|
||||
to:@3
|
||||
@3: from @1 @2
|
||||
(byte) s#5 ← phi( @2/(byte) s#1 @1/(byte) s#2 )
|
||||
(byte) s#4 ← phi( @1/(byte) s#2 @2/(byte) s#1 )
|
||||
(byte) i#1 ← -- (byte) i#2
|
||||
if((byte) i#1>(byte) 0) goto @1
|
||||
to:@END
|
||||
@ -399,7 +261,7 @@ B1_from_BBEGIN:
|
||||
sta 4
|
||||
jmp B1
|
||||
B1_from_B3:
|
||||
// (byte) s#2 = (byte) s#5 // zpby1=zpby2
|
||||
// (byte) s#2 = (byte) s#4 // zpby1=zpby2
|
||||
lda 6
|
||||
sta 5
|
||||
// (byte) i#2 = (byte) i#1 // zpby1=zpby2
|
||||
@ -414,7 +276,7 @@ B1:
|
||||
bcs B2
|
||||
!:
|
||||
B3_from_B1:
|
||||
// (byte) s#5 = (byte) s#2 // zpby1=zpby2
|
||||
// (byte) s#4 = (byte) s#2 // zpby1=zpby2
|
||||
lda 5
|
||||
sta 6
|
||||
jmp B3
|
||||
@ -435,7 +297,7 @@ B2:
|
||||
adc 4
|
||||
sta 2
|
||||
B3_from_B2:
|
||||
// (byte) s#5 = (byte) s#1 // zpby1=zpby2
|
||||
// (byte) s#4 = (byte) s#1 // zpby1=zpby2
|
||||
lda 2
|
||||
sta 6
|
||||
jmp B3
|
||||
@ -455,7 +317,7 @@ B1_from_BBEGIN:
|
||||
sta 4
|
||||
jmp B1
|
||||
B1_from_B3:
|
||||
// (byte) s#2 = (byte) s#5 // zpby1=zpby2
|
||||
// (byte) s#2 = (byte) s#4 // zpby1=zpby2
|
||||
lda 6
|
||||
sta 5
|
||||
// (byte) i#2 = (byte) i#1 // zpby1=zpby2
|
||||
@ -469,7 +331,7 @@ B1:
|
||||
bcs B2
|
||||
!:
|
||||
B3_from_B1:
|
||||
// (byte) s#5 = (byte) s#2 // zpby1=zpby2
|
||||
// (byte) s#4 = (byte) s#2 // zpby1=zpby2
|
||||
lda 5
|
||||
sta 6
|
||||
B3:
|
||||
@ -488,7 +350,7 @@ B2:
|
||||
adc 4
|
||||
sta 2
|
||||
B3_from_B2:
|
||||
// (byte) s#5 = (byte) s#1 // zpby1=zpby2
|
||||
// (byte) s#4 = (byte) s#1 // zpby1=zpby2
|
||||
lda 2
|
||||
sta 6
|
||||
jmp B3
|
||||
@ -505,7 +367,7 @@ FINAL SYMBOL TABLE
|
||||
(byte) s
|
||||
(byte) s#1 zp byte:2
|
||||
(byte) s#2 zp byte:5
|
||||
(byte) s#5 zp byte:6
|
||||
(byte) s#4 zp byte:6
|
||||
|
||||
FINAL CODE
|
||||
BBEGIN:
|
||||
@ -518,7 +380,7 @@ B1_from_BBEGIN:
|
||||
sta 4
|
||||
jmp B1
|
||||
B1_from_B3:
|
||||
// (byte) s#2 = (byte) s#5 // zpby1=zpby2
|
||||
// (byte) s#2 = (byte) s#4 // zpby1=zpby2
|
||||
lda 6
|
||||
sta 5
|
||||
// (byte) i#2 = (byte) i#1 // zpby1=zpby2
|
||||
@ -532,7 +394,7 @@ B1:
|
||||
bcs B2
|
||||
!:
|
||||
B3_from_B1:
|
||||
// (byte) s#5 = (byte) s#2 // zpby1=zpby2
|
||||
// (byte) s#4 = (byte) s#2 // zpby1=zpby2
|
||||
lda 5
|
||||
sta 6
|
||||
B3:
|
||||
@ -551,7 +413,7 @@ B2:
|
||||
adc 4
|
||||
sta 2
|
||||
B3_from_B2:
|
||||
// (byte) s#5 = (byte) s#1 // zpby1=zpby2
|
||||
// (byte) s#4 = (byte) s#1 // zpby1=zpby2
|
||||
lda 2
|
||||
sta 6
|
||||
jmp B3
|
||||
|
@ -9,4 +9,4 @@
|
||||
(byte) s
|
||||
(byte) s#1 zp byte:2
|
||||
(byte) s#2 zp byte:5
|
||||
(byte) s#5 zp byte:6
|
||||
(byte) s#4 zp byte:6
|
||||
|
@ -44,6 +44,22 @@ INITIAL CONTROL FLOW GRAPH
|
||||
to:@END
|
||||
@END: from @2
|
||||
|
||||
Removing empty block @2
|
||||
@BEGIN: from
|
||||
(byte[16]) p ← (word) 4352
|
||||
(byte) i ← (byte) 5
|
||||
to:@1
|
||||
@1: from @1 @BEGIN
|
||||
(byte~) $0 ← (byte) 2 + (byte) i
|
||||
(byte~) $1 ← (byte~) $0 + (byte) 2
|
||||
*((byte[16]) p + (byte) i) ← (byte~) $1
|
||||
(byte~) $2 ← (byte) i + (byte) 1
|
||||
(byte) i ← (byte~) $2
|
||||
(boolean~) $3 ← (byte) i < (byte) 10
|
||||
if((boolean~) $3) goto @1
|
||||
to:@END
|
||||
@END: from @1
|
||||
|
||||
CONTROL FLOW GRAPH WITH ASSIGNMENT CALL
|
||||
@BEGIN: from
|
||||
(byte[16]) p ← (word) 4352
|
||||
@ -57,10 +73,8 @@ CONTROL FLOW GRAPH WITH ASSIGNMENT CALL
|
||||
(byte) i ← (byte~) $2
|
||||
(boolean~) $3 ← (byte) i < (byte) 10
|
||||
if((boolean~) $3) goto @1
|
||||
to:@2
|
||||
@2: from @1
|
||||
to:@END
|
||||
@END: from @2
|
||||
@END: from @1
|
||||
|
||||
Completing Phi functions...
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@ -78,34 +92,10 @@ CONTROL FLOW GRAPH SSA
|
||||
(byte) i#1 ← (byte~) $2
|
||||
(boolean~) $3 ← (byte) i#1 < (byte) 10
|
||||
if((boolean~) $3) goto @1
|
||||
to:@2
|
||||
@2: from @1
|
||||
to:@END
|
||||
@END: from @2
|
||||
@END: from @1
|
||||
|
||||
CONTROL FLOW GRAPH WITH ASSIGNMENT CALL & RETURN
|
||||
@BEGIN: from
|
||||
(byte[16]) p#0 ← (word) 4352
|
||||
(byte) i#0 ← (byte) 5
|
||||
to:@1
|
||||
@1: from @1 @BEGIN
|
||||
(byte[16]) p#1 ← phi( @1/(byte[16]) p#1 @BEGIN/(byte[16]) p#0 )
|
||||
(byte) i#2 ← phi( @1/(byte) i#1 @BEGIN/(byte) i#0 )
|
||||
(byte~) $0 ← (byte) 2 + (byte) i#2
|
||||
(byte~) $1 ← (byte~) $0 + (byte) 2
|
||||
*((byte[16]) p#1 + (byte) i#2) ← (byte~) $1
|
||||
(byte~) $2 ← (byte) i#2 + (byte) 1
|
||||
(byte) i#1 ← (byte~) $2
|
||||
(boolean~) $3 ← (byte) i#1 < (byte) 10
|
||||
if((boolean~) $3) goto @1
|
||||
to:@2
|
||||
@2: from @1
|
||||
to:@END
|
||||
@END: from @2
|
||||
|
||||
Culled Empty Block (label) @2
|
||||
Succesful SSA optimization Pass2CullEmptyBlocks
|
||||
CONTROL FLOW GRAPH
|
||||
@BEGIN: from
|
||||
(byte[16]) p#0 ← (word) 4352
|
||||
(byte) i#0 ← (byte) 5
|
||||
|
@ -52,6 +52,24 @@ sum::@1: from
|
||||
to:@END
|
||||
@END: from @1
|
||||
|
||||
Removing empty block sum::@1
|
||||
Removing empty block @1
|
||||
@BEGIN: from
|
||||
(byte~) $0 ← call sum (byte) 1 (byte) 2
|
||||
(byte) s1 ← (byte~) $0
|
||||
(byte~) $1 ← call sum (byte) 9 (byte) 13
|
||||
(byte) s2 ← (byte~) $1
|
||||
to:@END
|
||||
sum: from
|
||||
(byte~) sum::$0 ← (byte) sum::a + (byte) sum::b
|
||||
(byte) sum::return ← (byte~) sum::$0
|
||||
to:sum::@return
|
||||
sum::@return: from sum
|
||||
(byte) sum::return ← (byte) sum::return
|
||||
return (byte) sum::return
|
||||
to:@RETURN
|
||||
@END: from @BEGIN
|
||||
|
||||
CONTROL FLOW GRAPH WITH ASSIGNMENT CALL
|
||||
@BEGIN: from
|
||||
(byte) sum::a ← (byte) 1
|
||||
@ -68,22 +86,17 @@ CONTROL FLOW GRAPH WITH ASSIGNMENT CALL
|
||||
@3: from @2
|
||||
(byte~) $1 ← (byte) sum::return
|
||||
(byte) s2 ← (byte~) $1
|
||||
to:@1
|
||||
to:@END
|
||||
sum: from @2 @BEGIN
|
||||
(byte~) sum::$0 ← (byte) sum::a + (byte) sum::b
|
||||
(byte) sum::return ← (byte~) sum::$0
|
||||
to:sum::@return
|
||||
sum::@return: from sum sum::@1
|
||||
sum::@return: from sum
|
||||
(byte) sum::return ← (byte) sum::return
|
||||
return (byte) sum::return
|
||||
to:@RETURN
|
||||
sum::@1: from
|
||||
to:sum::@return
|
||||
@1: from @3
|
||||
to:@END
|
||||
@END: from @1
|
||||
@END: from @3
|
||||
|
||||
Completing Phi functions...
|
||||
Completing Phi functions...
|
||||
CONTROL FLOW GRAPH SSA
|
||||
@BEGIN: from
|
||||
@ -103,67 +116,21 @@ CONTROL FLOW GRAPH SSA
|
||||
(byte) sum::return#5 ← phi( @2/(byte) sum::return#1 )
|
||||
(byte~) $1 ← (byte) sum::return#5
|
||||
(byte) s2#0 ← (byte~) $1
|
||||
to:@1
|
||||
to:@END
|
||||
sum: from @2 @BEGIN
|
||||
(byte) sum::b#2 ← phi( @2/(byte) sum::b#1 @BEGIN/(byte) sum::b#0 )
|
||||
(byte) sum::a#2 ← phi( @2/(byte) sum::a#1 @BEGIN/(byte) sum::a#0 )
|
||||
(byte~) sum::$0 ← (byte) sum::a#2 + (byte) sum::b#2
|
||||
(byte) sum::return#2 ← (byte~) sum::$0
|
||||
to:sum::@return
|
||||
sum::@return: from sum sum::@1
|
||||
(byte) sum::return#6 ← phi( sum/(byte) sum::return#2 sum::@1/(byte) sum::return#7 )
|
||||
sum::@return: from sum
|
||||
(byte) sum::return#6 ← phi( sum/(byte) sum::return#2 )
|
||||
(byte) sum::return#3 ← (byte) sum::return#6
|
||||
return (byte) sum::return#3
|
||||
to:@RETURN
|
||||
sum::@1: from
|
||||
(byte) sum::return#7 ← phi( )
|
||||
to:sum::@return
|
||||
@1: from @3
|
||||
to:@END
|
||||
@END: from @1
|
||||
@END: from @3
|
||||
|
||||
CONTROL FLOW GRAPH WITH ASSIGNMENT CALL & RETURN
|
||||
@BEGIN: from
|
||||
(byte) sum::a#0 ← (byte) 1
|
||||
(byte) sum::b#0 ← (byte) 2
|
||||
call sum param-assignment
|
||||
(byte) sum::return#0 ← (byte) sum::return#3
|
||||
to:@2
|
||||
@2: from @BEGIN
|
||||
(byte) sum::return#4 ← phi( @BEGIN/(byte) sum::return#0 )
|
||||
(byte~) $0 ← (byte) sum::return#4
|
||||
(byte) s1#0 ← (byte~) $0
|
||||
(byte) sum::a#1 ← (byte) 9
|
||||
(byte) sum::b#1 ← (byte) 13
|
||||
call sum param-assignment
|
||||
(byte) sum::return#1 ← (byte) sum::return#3
|
||||
to:@3
|
||||
@3: from @2
|
||||
(byte) sum::return#5 ← phi( @2/(byte) sum::return#1 )
|
||||
(byte~) $1 ← (byte) sum::return#5
|
||||
(byte) s2#0 ← (byte~) $1
|
||||
to:@1
|
||||
sum: from @2 @BEGIN
|
||||
(byte) sum::b#2 ← phi( @2/(byte) sum::b#1 @BEGIN/(byte) sum::b#0 )
|
||||
(byte) sum::a#2 ← phi( @2/(byte) sum::a#1 @BEGIN/(byte) sum::a#0 )
|
||||
(byte~) sum::$0 ← (byte) sum::a#2 + (byte) sum::b#2
|
||||
(byte) sum::return#2 ← (byte~) sum::$0
|
||||
to:sum::@return
|
||||
sum::@return: from sum sum::@1
|
||||
(byte) sum::return#6 ← phi( sum/(byte) sum::return#2 sum::@1/(byte) sum::return#7 )
|
||||
(byte) sum::return#3 ← (byte) sum::return#6
|
||||
return (byte) sum::return#3
|
||||
to:@RETURN
|
||||
sum::@1: from
|
||||
(byte) sum::return#7 ← phi( )
|
||||
to:sum::@return
|
||||
@1: from @3
|
||||
to:@END
|
||||
@END: from @1
|
||||
|
||||
Culled Empty Block (label) @1
|
||||
Succesful SSA optimization Pass2CullEmptyBlocks
|
||||
CONTROL FLOW GRAPH
|
||||
@BEGIN: from
|
||||
(byte) sum::a#0 ← (byte) 1
|
||||
(byte) sum::b#0 ← (byte) 2
|
||||
@ -190,14 +157,11 @@ sum: from @2 @BEGIN
|
||||
(byte~) sum::$0 ← (byte) sum::a#2 + (byte) sum::b#2
|
||||
(byte) sum::return#2 ← (byte~) sum::$0
|
||||
to:sum::@return
|
||||
sum::@return: from sum sum::@1
|
||||
(byte) sum::return#6 ← phi( sum/(byte) sum::return#2 sum::@1/(byte) sum::return#7 )
|
||||
sum::@return: from sum
|
||||
(byte) sum::return#6 ← phi( sum/(byte) sum::return#2 )
|
||||
(byte) sum::return#3 ← (byte) sum::return#6
|
||||
return (byte) sum::return#3
|
||||
to:@RETURN
|
||||
sum::@1: from
|
||||
(byte) sum::return#7 ← phi( )
|
||||
to:sum::@return
|
||||
@END: from @3
|
||||
|
||||
Constant (byte) sum::a#0 (byte) 1
|
||||
@ -228,18 +192,14 @@ sum: from @2 @BEGIN
|
||||
(byte~) sum::$0 ← (byte) sum::a#2 + (byte) sum::b#2
|
||||
(byte) sum::return#2 ← (byte~) sum::$0
|
||||
to:sum::@return
|
||||
sum::@return: from sum sum::@1
|
||||
(byte) sum::return#6 ← phi( sum/(byte) sum::return#2 sum::@1/(byte) sum::return#7 )
|
||||
sum::@return: from sum
|
||||
(byte) sum::return#6 ← phi( sum/(byte) sum::return#2 )
|
||||
(byte) sum::return#3 ← (byte) sum::return#6
|
||||
return (byte) sum::return#3
|
||||
to:@RETURN
|
||||
sum::@1: from
|
||||
(byte) sum::return#7 ← phi( )
|
||||
to:sum::@return
|
||||
@END: from @3
|
||||
|
||||
Alias (byte) s1#0 = (byte) sum::return#0 (byte) sum::return#3 (byte) sum::return#4 (byte~) $0 (byte) sum::return#1 (byte) sum::return#5 (byte~) $1 (byte) s2#0 (byte) sum::return#6
|
||||
Alias (byte) sum::return#2 = (byte~) sum::$0
|
||||
Alias (byte) s1#0 = (byte) sum::return#0 (byte) sum::return#3 (byte) sum::return#4 (byte~) $0 (byte) sum::return#1 (byte) sum::return#5 (byte~) $1 (byte) s2#0 (byte) sum::return#2 (byte~) sum::$0 (byte) sum::return#6
|
||||
Succesful SSA optimization Pass2AliasElimination
|
||||
CONTROL FLOW GRAPH
|
||||
@BEGIN: from
|
||||
@ -253,65 +213,16 @@ CONTROL FLOW GRAPH
|
||||
sum: from @2 @BEGIN
|
||||
(byte) sum::b#2 ← phi( @2/(byte) 13 @BEGIN/(byte) 2 )
|
||||
(byte) sum::a#2 ← phi( @2/(byte) 9 @BEGIN/(byte) 1 )
|
||||
(byte) sum::return#2 ← (byte) sum::a#2 + (byte) sum::b#2
|
||||
(byte) s1#0 ← (byte) sum::a#2 + (byte) sum::b#2
|
||||
to:sum::@return
|
||||
sum::@return: from sum sum::@1
|
||||
(byte) s1#0 ← phi( sum/(byte) sum::return#2 sum::@1/(byte) sum::return#7 )
|
||||
sum::@return: from sum
|
||||
return (byte) s1#0
|
||||
to:@RETURN
|
||||
sum::@1: from
|
||||
(byte) sum::return#7 ← phi( )
|
||||
to:sum::@return
|
||||
@END: from @3
|
||||
|
||||
Redundant Phi (byte) sum::return#7 VOID
|
||||
Succesful SSA optimization Pass2RedundantPhiElimination
|
||||
CONTROL FLOW GRAPH
|
||||
@BEGIN: from
|
||||
call sum param-assignment
|
||||
to:@2
|
||||
@2: from @BEGIN
|
||||
call sum param-assignment
|
||||
to:@3
|
||||
@3: from @2
|
||||
to:@END
|
||||
sum: from @2 @BEGIN
|
||||
(byte) sum::b#2 ← phi( @2/(byte) 13 @BEGIN/(byte) 2 )
|
||||
(byte) sum::a#2 ← phi( @2/(byte) 9 @BEGIN/(byte) 1 )
|
||||
(byte) sum::return#2 ← (byte) sum::a#2 + (byte) sum::b#2
|
||||
to:sum::@return
|
||||
sum::@return: from sum sum::@1
|
||||
(byte) s1#0 ← phi( sum/(byte) sum::return#2 )
|
||||
return (byte) s1#0
|
||||
to:@RETURN
|
||||
sum::@1: from
|
||||
to:sum::@return
|
||||
@END: from @3
|
||||
|
||||
Culled Empty Block (label) @3
|
||||
Culled Empty Block (label) sum::@1
|
||||
Succesful SSA optimization Pass2CullEmptyBlocks
|
||||
CONTROL FLOW GRAPH
|
||||
@BEGIN: from
|
||||
call sum param-assignment
|
||||
to:@2
|
||||
@2: from @BEGIN
|
||||
call sum param-assignment
|
||||
to:@END
|
||||
sum: from @2 @BEGIN
|
||||
(byte) sum::b#2 ← phi( @2/(byte) 13 @BEGIN/(byte) 2 )
|
||||
(byte) sum::a#2 ← phi( @2/(byte) 9 @BEGIN/(byte) 1 )
|
||||
(byte) sum::return#2 ← (byte) sum::a#2 + (byte) sum::b#2
|
||||
to:sum::@return
|
||||
sum::@return: from sum
|
||||
(byte) s1#0 ← phi( sum/(byte) sum::return#2 )
|
||||
return (byte) s1#0
|
||||
to:@RETURN
|
||||
@END: from @2
|
||||
|
||||
Alias (byte) s1#0 = (byte) sum::return#2
|
||||
Succesful SSA optimization Pass2AliasElimination
|
||||
CONTROL FLOW GRAPH
|
||||
@BEGIN: from
|
||||
call sum param-assignment
|
||||
to:@2
|
||||
|
Loading…
Reference in New Issue
Block a user