1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-04-07 06:37:31 +00:00

Centralized getting all entry point blocks in the program into ControlFlowGraph

This commit is contained in:
jespergravgaard 2018-08-12 01:03:44 +02:00
parent 75a8749db4
commit a87da922f8
16 changed files with 145 additions and 165 deletions

View File

@ -1,11 +1,14 @@
package dk.camelot64.kickc.model;
import dk.camelot64.kickc.model.values.LabelRef;
import dk.camelot64.kickc.model.values.ScopeRef;
import dk.camelot64.kickc.model.values.VariableRef;
import dk.camelot64.kickc.model.statements.Statement;
import dk.camelot64.kickc.model.statements.StatementAssignment;
import dk.camelot64.kickc.model.statements.StatementPhiBlock;
import dk.camelot64.kickc.model.symbols.Label;
import dk.camelot64.kickc.model.symbols.Procedure;
import dk.camelot64.kickc.model.values.LabelRef;
import dk.camelot64.kickc.model.values.ScopeRef;
import dk.camelot64.kickc.model.values.VariableRef;
import dk.camelot64.kickc.passes.Pass2ConstantIdentification;
import java.util.*;
@ -175,6 +178,32 @@ public class ControlFlowGraph {
return null;
}
/**
* Get all blocks that are program entry points. This is the main-block and any blocks referenced by the address-off operator (&)
* @param program The program
* @return All entry-point blocks
*/
public List<ControlFlowBlock> getEntryPointBlocks(Program program) {
List<ControlFlowBlock> entryPointBlocks = new ArrayList<>();
for(Procedure procedure : program.getScope().getAllProcedures(true)) {
if(Pass2ConstantIdentification.isAddressOfUsed(procedure.getRef(), program)) {
// Address-of is used on the procedure
Label procedureLabel = procedure.getLabel();
ControlFlowBlock procedureBlock = getBlock(procedureLabel.getRef());
entryPointBlocks.add(procedureBlock);
}
}
ControlFlowBlock mainBlock = getMainBlock();
if(mainBlock != null) {
entryPointBlocks.add(mainBlock);
}
entryPointBlocks.add(getFirstBlock());
return entryPointBlocks;
}
@Override
public String toString() {
return toString(null);

View File

@ -7,7 +7,6 @@ import dk.camelot64.kickc.model.statements.Statement;
import dk.camelot64.kickc.model.statements.StatementAssignment;
import dk.camelot64.kickc.model.statements.StatementPhiBlock;
import dk.camelot64.kickc.model.symbols.Label;
import dk.camelot64.kickc.model.symbols.Procedure;
import dk.camelot64.kickc.model.symbols.Variable;
import dk.camelot64.kickc.model.values.LValue;
import dk.camelot64.kickc.model.values.LabelRef;
@ -15,6 +14,7 @@ import dk.camelot64.kickc.model.values.SymbolRef;
import dk.camelot64.kickc.model.values.VariableRef;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.ListIterator;
import java.util.Set;
@ -56,19 +56,14 @@ public class Pass2EliminateUnusedBlocks extends Pass2SsaOptimization {
}
/**
* Get all referenced blocks en the entire program
* Get all referenced blocks in the entire program
* @return All blocks referenced
*/
private Set<LabelRef> getReferencedBlocks() {
Set<LabelRef> referencedBlocks = new LinkedHashSet<>();
findReferencedBlocks(getGraph().getFirstBlock(), referencedBlocks);
for(Procedure procedure : getScope().getAllProcedures(true)) {
if(Pass2ConstantIdentification.isAddressOfUsed(procedure.getRef(), getProgram())) {
// Address-of is used on the procedure
Label procedureLabel = procedure.getLabel();
ControlFlowBlock procedureBlock = getGraph().getBlock(procedureLabel.getRef());
findReferencedBlocks(procedureBlock, referencedBlocks);
}
List<ControlFlowBlock> entryPointBlocks = getGraph().getEntryPointBlocks(getProgram());
for(ControlFlowBlock entryPointBlock : entryPointBlocks) {
findReferencedBlocks(entryPointBlock, referencedBlocks);
}
return referencedBlocks;
}

View File

@ -21,21 +21,11 @@ public class Pass3BlockSequencePlanner extends Pass2Base {
public void plan() {
for(Procedure procedure : getProgram().getScope().getAllProcedures(true)) {
if(Pass2ConstantIdentification.isAddressOfUsed(procedure.getRef(), getProgram())) {
// Address-of is used on the procedure
Label procedureLabel = procedure.getLabel();
ControlFlowBlock procedureBlock = getGraph().getBlock(procedureLabel.getRef());
pushTodo(procedureBlock);
}
}
List<ControlFlowBlock> entryPointBlocks = getGraph().getEntryPointBlocks(getProgram());
ControlFlowBlock mainBlock = getGraph().getMainBlock();
if(mainBlock != null) {
pushTodo(mainBlock);
for(ControlFlowBlock entryPointBlock : entryPointBlocks) {
pushTodo(entryPointBlock);
}
pushTodo(getGraph().getFirstBlock());
List<LabelRef> sequence = new ArrayList<>();
while(hasTodo()) {

View File

@ -26,15 +26,24 @@ public class Pass3DominatorsAnalysis extends Pass2Base {
DominatorsGraph dominatorsGraph = new DominatorsGraph();
// Initialize dominators: Dom[first]={first}, Dom[block]={all}
LabelRef firstBlock = getGraph().getFirstBlock().getLabel();
DominatorsBlock firstDominators = dominatorsGraph.addDominators(firstBlock);
firstDominators.add(firstBlock);
List<LabelRef> firstBlocks = new ArrayList<>();
List<ControlFlowBlock> entryPointBlocks = getGraph().getEntryPointBlocks(getProgram());
for(ControlFlowBlock entryPointBlock : entryPointBlocks) {
LabelRef firstBlock = entryPointBlock.getLabel();
// Skip main-block, as it will be called by @begin anyways
if(firstBlock.getFullName().equals("main")) continue;
DominatorsBlock firstDominators = dominatorsGraph.addDominators(firstBlock);
firstDominators.add(firstBlock);
firstBlocks.add(firstBlock);
}
List<LabelRef> allBlocks = new ArrayList<>();
for(ControlFlowBlock block : getGraph().getAllBlocks()) {
allBlocks.add(block.getLabel());
}
for(ControlFlowBlock block : getGraph().getAllBlocks()) {
if(!block.getLabel().equals(firstBlock)) {
if(!firstBlocks.contains(block.getLabel())) {
DominatorsBlock dominatorsBlock = dominatorsGraph.addDominators(block.getLabel());
dominatorsBlock.addAll(allBlocks);
}
@ -47,7 +56,7 @@ public class Pass3DominatorsAnalysis extends Pass2Base {
do {
change = false;
for(ControlFlowBlock block : getGraph().getAllBlocks()) {
if(!block.getLabel().equals(firstBlock)) {
if(!firstBlocks.contains(block.getLabel())) {
List<ControlFlowBlock> predecessors = getGraph().getPredecessors(block);
DominatorsBlock newDominators = new DominatorsBlock();
newDominators.addAll(allBlocks);

View File

@ -29,15 +29,14 @@ public class Pass3LoopDepthAnalysis extends Pass2Base {
public void findLoopDepths() {
Deque<LabelRef> todo = new ArrayDeque<>();
Set<LabelRef> done = new LinkedHashSet<>();
// Add the main block block
todo.push(callGraph.getFirstCallBlock());
// Also add all address-of referenced blocks
for(Procedure procedure : getProgram().getScope().getAllProcedures(true)) {
if(Pass2ConstantIdentification.isAddressOfUsed(procedure.getRef(), getProgram())) {
// Address-of is used on the procedure
Label procedureLabel = procedure.getLabel();
todo.push(procedureLabel.getRef());
List<ControlFlowBlock> entryPointBlocks = getGraph().getEntryPointBlocks(getProgram());
for(ControlFlowBlock entryPointBlock : entryPointBlocks) {
LabelRef label = entryPointBlock.getLabel();
if(label.getFullName().equals(LabelRef.BEGIN_BLOCK_NAME)) {
label = callGraph.getFirstCallBlock();
}
todo.push(label);
}
while(!todo.isEmpty()) {

View File

@ -46,6 +46,11 @@ public class TestPrograms {
AsmFragmentTemplateUsages.logUsages(log, false, false, false, false, false, false);
}
// @Test
// public void testUnrollScreenFill() throws IOException, URISyntaxException {
// compileAndCompare("unroll-screenfill");
// }
@Test
public void testIrqHardwareClobberJsr() throws IOException, URISyntaxException {
compileAndCompare("irq-hardware-clobber-jsr");

View File

@ -0,0 +1,10 @@
// Fills the screen using an unrolled inner loop
void main() {
byte* SCREEN = $400;
for(byte x: 0..39) {
inline for(byte line: 0..24) {
(SCREEN+line*40)[x] = x;
}
}
}

View File

@ -795,45 +795,28 @@ do_irq::@return: scope:[do_irq] from do_irq
to:@return
DOMINATORS
irq dominated by irq
@begin dominated by @begin
@6 dominated by @begin @6
@end dominated by @begin @end @6
main dominated by @begin @6 main
main::@2 dominated by @begin @6 main::@2 main
irq dominated by @begin @end @6 main::@2 irq irq::@return do_irq main do_irq::@return
irq::@return dominated by @begin @end @6 main::@2 irq irq::@return do_irq main do_irq::@return
do_irq dominated by @begin @end @6 main::@2 irq irq::@return do_irq main do_irq::@return
do_irq::@return dominated by @begin @end @6 main::@2 irq irq::@return do_irq main do_irq::@return
irq::@return dominated by irq irq::@return
do_irq dominated by irq do_irq
do_irq::@return dominated by irq do_irq do_irq::@return
NATURAL LOOPS
Found back edge: Loop head: main::@2 tails: main::@2 blocks: null
Found back edge: Loop head: irq::@return tails: irq blocks: null
Found back edge: Loop head: do_irq tails: irq blocks: null
Found back edge: Loop head: do_irq::@return tails: do_irq blocks: null
Populated: Loop head: main::@2 tails: main::@2 blocks: main::@2
Populated: Loop head: irq::@return tails: irq blocks: irq
Populated: Loop head: do_irq tails: irq blocks: irq
Populated: Loop head: do_irq::@return tails: do_irq blocks: do_irq irq
Loop head: main::@2 tails: main::@2 blocks: main::@2
Loop head: irq::@return tails: irq blocks: irq
Loop head: do_irq tails: irq blocks: irq
Loop head: do_irq::@return tails: do_irq blocks: do_irq irq
NATURAL LOOPS WITH DEPTH
Found 1 loops in scope [irq]
Loop head: irq::@return tails: irq blocks: irq
Found 0 loops in scope []
null depth in calling loop Loop head: do_irq tails: irq blocks: irq in scope do_irq
null depth in calling loop Loop head: do_irq::@return tails: do_irq blocks: do_irq irq in scope do_irq
Found 2 loops in scope [do_irq]
Loop head: do_irq tails: irq blocks: irq
Loop head: do_irq::@return tails: do_irq blocks: do_irq irq
Found 1 loops in scope [main]
Loop head: main::@2 tails: main::@2 blocks: main::@2
Found 0 loops in scope [irq]
Found 0 loops in scope [do_irq]
Loop head: main::@2 tails: main::@2 blocks: main::@2 depth: 1
Loop head: irq::@return tails: irq blocks: irq depth: 1
Loop head: do_irq tails: irq blocks: irq depth: 3
Loop head: do_irq::@return tails: do_irq blocks: do_irq irq depth: 2
VARIABLE REGISTER WEIGHTS
@ -990,10 +973,10 @@ Uplift Scope [irq]
Uplift Scope [do_irq]
Uplift Scope []
Uplifting [main] best 11399 combination
Uplifting [irq] best 11399 combination
Uplifting [do_irq] best 11399 combination
Uplifting [] best 11399 combination
Uplifting [main] best 329 combination
Uplifting [irq] best 329 combination
Uplifting [do_irq] best 329 combination
Uplifting [] best 329 combination
Interrupt procedure irq clobbers ANZ
Removing interrupt register storage stx regx+1 in SEG21 entry interrupt(HARDWARE_CLOBBER)
Removing interrupt register storage sty regy+1 in SEG21 entry interrupt(HARDWARE_CLOBBER)
@ -1170,7 +1153,7 @@ interrupt(HARDWARE_CLOBBER)(void()) irq()
FINAL ASSEMBLER
Score: 8006
Score: 230
//SEG0 Basic Upstart
.pc = $801 "Basic"

View File

@ -368,30 +368,25 @@ irq::@return: scope:[irq] from irq
to:@return
DOMINATORS
irq dominated by irq
@begin dominated by @begin
@2 dominated by @2 @begin
@end dominated by @2 @begin @end
main dominated by @2 @begin main
main::@2 dominated by @2 @begin main::@2 main
irq dominated by @2 @begin @end main::@2 irq irq::@return main
irq::@return dominated by @2 @begin @end main::@2 irq irq::@return main
irq::@return dominated by irq irq::@return
NATURAL LOOPS
Found back edge: Loop head: main::@2 tails: main::@2 blocks: null
Found back edge: Loop head: irq::@return tails: irq blocks: null
Populated: Loop head: main::@2 tails: main::@2 blocks: main::@2
Populated: Loop head: irq::@return tails: irq blocks: irq
Loop head: main::@2 tails: main::@2 blocks: main::@2
Loop head: irq::@return tails: irq blocks: irq
NATURAL LOOPS WITH DEPTH
Found 1 loops in scope [irq]
Loop head: irq::@return tails: irq blocks: irq
Found 0 loops in scope []
Found 1 loops in scope [main]
Loop head: main::@2 tails: main::@2 blocks: main::@2
Found 0 loops in scope [irq]
Loop head: main::@2 tails: main::@2 blocks: main::@2 depth: 1
Loop head: irq::@return tails: irq blocks: irq depth: 1
VARIABLE REGISTER WEIGHTS
@ -536,9 +531,9 @@ Uplift Scope [main]
Uplift Scope [irq]
Uplift Scope []
Uplifting [main] best 503 combination
Uplifting [irq] best 503 combination
Uplifting [] best 503 combination
Uplifting [main] best 314 combination
Uplifting [irq] best 314 combination
Uplifting [] best 314 combination
Interrupt procedure irq clobbers ANZ
Removing interrupt register storage stx regx+1 in SEG21 entry interrupt(HARDWARE_CLOBBER)
Removing interrupt register storage sty regy+1 in SEG21 entry interrupt(HARDWARE_CLOBBER)
@ -701,7 +696,7 @@ interrupt(HARDWARE_CLOBBER)(void()) irq()
FINAL ASSEMBLER
Score: 380
Score: 218
//SEG0 Basic Upstart
.pc = $801 "Basic"

View File

@ -368,30 +368,25 @@ irq::@return: scope:[irq] from irq
to:@return
DOMINATORS
irq dominated by irq
@begin dominated by @begin
@2 dominated by @2 @begin
@end dominated by @2 @begin @end
main dominated by @2 @begin main
main::@2 dominated by @2 @begin main::@2 main
irq dominated by @2 @begin @end main::@2 irq irq::@return main
irq::@return dominated by @2 @begin @end main::@2 irq irq::@return main
irq::@return dominated by irq irq::@return
NATURAL LOOPS
Found back edge: Loop head: main::@2 tails: main::@2 blocks: null
Found back edge: Loop head: irq::@return tails: irq blocks: null
Populated: Loop head: main::@2 tails: main::@2 blocks: main::@2
Populated: Loop head: irq::@return tails: irq blocks: irq
Loop head: main::@2 tails: main::@2 blocks: main::@2
Loop head: irq::@return tails: irq blocks: irq
NATURAL LOOPS WITH DEPTH
Found 1 loops in scope [irq]
Loop head: irq::@return tails: irq blocks: irq
Found 0 loops in scope []
Found 1 loops in scope [main]
Loop head: main::@2 tails: main::@2 blocks: main::@2
Found 0 loops in scope [irq]
Loop head: main::@2 tails: main::@2 blocks: main::@2 depth: 1
Loop head: irq::@return tails: irq blocks: irq depth: 1
VARIABLE REGISTER WEIGHTS
@ -536,9 +531,9 @@ Uplift Scope [main]
Uplift Scope [irq]
Uplift Scope []
Uplifting [main] best 503 combination
Uplifting [irq] best 503 combination
Uplifting [] best 503 combination
Uplifting [main] best 314 combination
Uplifting [irq] best 314 combination
Uplifting [] best 314 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
@ -700,7 +695,7 @@ interrupt(HARDWARE_ALL)(void()) irq()
FINAL ASSEMBLER
Score: 464
Score: 302
//SEG0 Basic Upstart
.pc = $801 "Basic"

View File

@ -380,33 +380,23 @@ irq_bottom_1::@return: scope:[irq_bottom_1] from irq_bottom_1
to:@return
DOMINATORS
irq_bottom_1 dominated by irq_bottom_1
irq_bottom_2 dominated by irq_bottom_2
@begin dominated by @begin
@3 dominated by @begin @3
@end dominated by @begin @3 @end
main dominated by @begin @3 main
main::@return dominated by main::@return @begin @3 main
irq_bottom_2 dominated by main::@return irq_bottom_1 irq_bottom_2 @begin @3 @end irq_bottom_1::@return irq_bottom_2::@return main
irq_bottom_2::@return dominated by main::@return irq_bottom_1 irq_bottom_2 @begin @3 @end irq_bottom_1::@return irq_bottom_2::@return main
irq_bottom_1 dominated by main::@return irq_bottom_1 irq_bottom_2 @begin @3 @end irq_bottom_1::@return irq_bottom_2::@return main
irq_bottom_1::@return dominated by main::@return irq_bottom_1 irq_bottom_2 @begin @3 @end irq_bottom_1::@return irq_bottom_2::@return main
irq_bottom_2::@return dominated by irq_bottom_2 irq_bottom_2::@return
irq_bottom_1::@return dominated by irq_bottom_1 irq_bottom_1::@return
NATURAL LOOPS
Found back edge: Loop head: irq_bottom_2::@return tails: irq_bottom_2 blocks: null
Found back edge: Loop head: irq_bottom_1::@return tails: irq_bottom_1 blocks: null
Populated: Loop head: irq_bottom_2::@return tails: irq_bottom_2 blocks: irq_bottom_2
Populated: Loop head: irq_bottom_1::@return tails: irq_bottom_1 blocks: irq_bottom_1
Loop head: irq_bottom_2::@return tails: irq_bottom_2 blocks: irq_bottom_2
Loop head: irq_bottom_1::@return tails: irq_bottom_1 blocks: irq_bottom_1
NATURAL LOOPS WITH DEPTH
Found 1 loops in scope [irq_bottom_2]
Loop head: irq_bottom_2::@return tails: irq_bottom_2 blocks: irq_bottom_2
Found 1 loops in scope [irq_bottom_1]
Loop head: irq_bottom_1::@return tails: irq_bottom_1 blocks: irq_bottom_1
Found 0 loops in scope []
Found 0 loops in scope [main]
Loop head: irq_bottom_2::@return tails: irq_bottom_2 blocks: irq_bottom_2 depth: 1
Loop head: irq_bottom_1::@return tails: irq_bottom_1 blocks: irq_bottom_1 depth: 1
Found 0 loops in scope [irq_bottom_2]
Found 0 loops in scope [irq_bottom_1]
VARIABLE REGISTER WEIGHTS
@ -583,10 +573,10 @@ Uplift Scope [irq_bottom_1]
Uplift Scope [irq_bottom_2]
Uplift Scope []
Uplifting [main] best 1057 combination
Uplifting [irq_bottom_1] best 1057 combination
Uplifting [irq_bottom_2] best 1057 combination
Uplifting [] best 1057 combination
Uplifting [main] best 175 combination
Uplifting [irq_bottom_1] best 175 combination
Uplifting [irq_bottom_2] best 175 combination
Uplifting [] best 175 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
@ -773,7 +763,7 @@ interrupt(KERNEL_KEYBOARD)(void()) irq_bottom_2()
FINAL ASSEMBLER
Score: 988
Score: 160
//SEG0 Basic Upstart
.pc = $801 "Basic"

View File

@ -267,25 +267,20 @@ irq::@return: scope:[irq] from irq
to:@return
DOMINATORS
irq dominated by irq
@begin dominated by @begin
@2 dominated by @2 @begin
@end dominated by @2 @begin @end
main dominated by @2 @begin main
main::@return dominated by main::@return @2 @begin main
irq dominated by main::@return @2 @begin @end irq irq::@return main
irq::@return dominated by main::@return @2 @begin @end irq irq::@return main
irq::@return dominated by irq irq::@return
NATURAL LOOPS
Found back edge: Loop head: irq::@return tails: irq blocks: null
Populated: Loop head: irq::@return tails: irq blocks: irq
Loop head: irq::@return tails: irq blocks: irq
NATURAL LOOPS WITH DEPTH
Found 1 loops in scope [irq]
Loop head: irq::@return tails: irq blocks: irq
Found 0 loops in scope []
Found 0 loops in scope [main]
Loop head: irq::@return tails: irq blocks: irq depth: 1
Found 0 loops in scope [irq]
VARIABLE REGISTER WEIGHTS
@ -401,9 +396,9 @@ Uplift Scope [main]
Uplift Scope [irq]
Uplift Scope []
Uplifting [main] best 278 combination
Uplifting [irq] best 278 combination
Uplifting [] best 278 combination
Uplifting [main] best 89 combination
Uplifting [irq] best 89 combination
Uplifting [] best 89 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
@ -535,7 +530,7 @@ interrupt(KERNEL_KEYBOARD)(void()) irq()
FINAL ASSEMBLER
Score: 239
Score: 77
//SEG0 Basic Upstart
.pc = $801 "Basic"

View File

@ -267,25 +267,20 @@ irq::@return: scope:[irq] from irq
to:@return
DOMINATORS
irq dominated by irq
@begin dominated by @begin
@2 dominated by @2 @begin
@end dominated by @2 @begin @end
main dominated by @2 @begin main
main::@return dominated by main::@return @2 @begin main
irq dominated by main::@return @2 @begin @end irq irq::@return main
irq::@return dominated by main::@return @2 @begin @end irq irq::@return main
irq::@return dominated by irq irq::@return
NATURAL LOOPS
Found back edge: Loop head: irq::@return tails: irq blocks: null
Populated: Loop head: irq::@return tails: irq blocks: irq
Loop head: irq::@return tails: irq blocks: irq
NATURAL LOOPS WITH DEPTH
Found 1 loops in scope [irq]
Loop head: irq::@return tails: irq blocks: irq
Found 0 loops in scope []
Found 0 loops in scope [main]
Loop head: irq::@return tails: irq blocks: irq depth: 1
Found 0 loops in scope [irq]
VARIABLE REGISTER WEIGHTS
@ -401,9 +396,9 @@ Uplift Scope [main]
Uplift Scope [irq]
Uplift Scope []
Uplifting [main] best 278 combination
Uplifting [irq] best 278 combination
Uplifting [] best 278 combination
Uplifting [main] best 89 combination
Uplifting [irq] best 89 combination
Uplifting [] best 89 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
@ -535,7 +530,7 @@ interrupt(KERNEL_MIN)(void()) irq()
FINAL ASSEMBLER
Score: 239
Score: 77
//SEG0 Basic Upstart
.pc = $801 "Basic"

View File

@ -246,38 +246,33 @@ irq::@return: scope:[irq] from irq
to:@return
DOMINATORS
irq dominated by irq
@begin dominated by @begin
@2 dominated by @2 @begin
@end dominated by @2 @begin @end
main dominated by @2 @begin main
main::@1 dominated by @2 @begin main::@1 main
main::@2 dominated by @2 @begin main::@1 main::@2 main
irq dominated by @2 @begin @end main::@1 main::@2 irq irq::@return main
irq::@return dominated by @2 @begin @end main::@1 main::@2 irq irq::@return main
irq::@return dominated by irq irq::@return
NATURAL LOOPS
Found back edge: Loop head: main::@1 tails: main::@2 blocks: null
Found back edge: Loop head: irq::@return tails: irq blocks: null
Populated: Loop head: main::@1 tails: main::@2 blocks: main::@2 main::@1
Populated: Loop head: irq::@return tails: irq blocks: irq
Loop head: main::@1 tails: main::@2 blocks: main::@2 main::@1
Loop head: irq::@return tails: irq blocks: irq
NATURAL LOOPS WITH DEPTH
Found 1 loops in scope [irq]
Loop head: irq::@return tails: irq blocks: irq
Found 0 loops in scope []
Found 1 loops in scope [main]
Loop head: main::@1 tails: main::@2 blocks: main::@2 main::@1
Found 0 loops in scope [irq]
Loop head: main::@1 tails: main::@2 blocks: main::@2 main::@1 depth: 1
Loop head: irq::@return tails: irq blocks: irq depth: 1
VARIABLE REGISTER WEIGHTS
(byte*) BGCOL
(void()**) KERNEL_IRQ
(byte) col
(byte) col#0 3.75
(byte) col#0 1.5
(byte) col#1 22.0
(byte) col#2 24.0
interrupt(KERNEL_MIN)(void()) irq()
@ -359,15 +354,15 @@ Statement [8] *((const byte*) BGCOL#0) ← (byte) col#0 [ ] ( ) always clobbers
Potential registers zp ZP_BYTE:2 [ col#2 col#0 col#1 ] : zp ZP_BYTE:2 ,
REGISTER UPLIFT SCOPES
Uplift Scope [] 49.75: zp ZP_BYTE:2 [ col#2 col#0 col#1 ]
Uplift Scope [] 47.5: zp ZP_BYTE:2 [ col#2 col#0 col#1 ]
Uplift Scope [main]
Uplift Scope [irq]
Uplifting [] best 312 combination zp ZP_BYTE:2 [ col#2 col#0 col#1 ]
Uplifting [main] best 312 combination
Uplifting [irq] best 312 combination
Uplifting [] best 186 combination zp ZP_BYTE:2 [ col#2 col#0 col#1 ]
Uplifting [main] best 186 combination
Uplifting [irq] best 186 combination
Attempting to uplift remaining variables inzp ZP_BYTE:2 [ col#2 col#0 col#1 ]
Uplifting [] best 312 combination zp ZP_BYTE:2 [ col#2 col#0 col#1 ]
Uplifting [] best 186 combination zp ZP_BYTE:2 [ col#2 col#0 col#1 ]
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
@ -460,7 +455,7 @@ FINAL SYMBOL TABLE
(void()**) KERNEL_IRQ
(const void()**) KERNEL_IRQ#0 KERNEL_IRQ = ((void()**))(word/signed word/dword/signed dword) 788
(byte) col
(byte) col#0 col zp ZP_BYTE:2 3.75
(byte) col#0 col zp ZP_BYTE:2 1.5
(byte) col#1 col zp ZP_BYTE:2 22.0
(byte) col#2 col zp ZP_BYTE:2 24.0
interrupt(KERNEL_MIN)(void()) irq()
@ -473,7 +468,7 @@ zp ZP_BYTE:2 [ col#2 col#0 col#1 ]
FINAL ASSEMBLER
Score: 216
Score: 117
//SEG0 Basic Upstart
.pc = $801 "Basic"

View File

@ -6,7 +6,7 @@
(void()**) KERNEL_IRQ
(const void()**) KERNEL_IRQ#0 KERNEL_IRQ = ((void()**))(word/signed word/dword/signed dword) 788
(byte) col
(byte) col#0 col zp ZP_BYTE:2 3.75
(byte) col#0 col zp ZP_BYTE:2 1.5
(byte) col#1 col zp ZP_BYTE:2 22.0
(byte) col#2 col zp ZP_BYTE:2 24.0
interrupt(KERNEL_MIN)(void()) irq()

View File

@ -204,30 +204,25 @@ irq::@return: scope:[irq] from irq
to:@return
DOMINATORS
irq dominated by irq
@begin dominated by @begin
@2 dominated by @2 @begin
@end dominated by @2 @begin @end
main dominated by @2 @begin main
main::@2 dominated by @2 @begin main::@2 main
irq dominated by @2 @begin @end main::@2 irq irq::@return main
irq::@return dominated by @2 @begin @end main::@2 irq irq::@return main
irq::@return dominated by irq irq::@return
NATURAL LOOPS
Found back edge: Loop head: main::@2 tails: main::@2 blocks: null
Found back edge: Loop head: irq::@return tails: irq blocks: null
Populated: Loop head: main::@2 tails: main::@2 blocks: main::@2
Populated: Loop head: irq::@return tails: irq blocks: irq
Loop head: main::@2 tails: main::@2 blocks: main::@2
Loop head: irq::@return tails: irq blocks: irq
NATURAL LOOPS WITH DEPTH
Found 1 loops in scope [irq]
Loop head: irq::@return tails: irq blocks: irq
Found 0 loops in scope []
Found 1 loops in scope [main]
Loop head: main::@2 tails: main::@2 blocks: main::@2
Found 0 loops in scope [irq]
Loop head: main::@2 tails: main::@2 blocks: main::@2 depth: 1
Loop head: irq::@return tails: irq blocks: irq depth: 1
VARIABLE REGISTER WEIGHTS
@ -300,9 +295,9 @@ Uplift Scope [main]
Uplift Scope [irq]
Uplift Scope []
Uplifting [main] best 250 combination
Uplifting [irq] best 250 combination
Uplifting [] best 250 combination
Uplifting [main] best 133 combination
Uplifting [irq] best 133 combination
Uplifting [] best 133 combination
ASSEMBLER BEFORE OPTIMIZATION
//SEG0 Basic Upstart
@ -388,7 +383,7 @@ interrupt(KERNEL_MIN)(void()) irq()
FINAL ASSEMBLER
Score: 211
Score: 121
//SEG0 Basic Upstart
.pc = $801 "Basic"