diff --git a/src/dk/camelot64/kickc/icl/CallGraph.java b/src/dk/camelot64/kickc/icl/CallGraph.java index b5b3cbad8..d133604a4 100644 --- a/src/dk/camelot64/kickc/icl/CallGraph.java +++ b/src/dk/camelot64/kickc/icl/CallGraph.java @@ -3,7 +3,9 @@ package dk.camelot64.kickc.icl; import java.util.ArrayList; import java.util.List; -/** The call graph for the entire control flow graph, */ +/** The call graph for the entire control flow graph. + * Created by {@link dk.camelot64.kickc.passes.Pass3CallGraphAnalysis} + * */ public class CallGraph { private List callBlocks; diff --git a/src/dk/camelot64/kickc/icl/LiveRangeEquivalenceClass.java b/src/dk/camelot64/kickc/icl/LiveRangeEquivalenceClass.java index 3ea766292..64a69e2c5 100644 --- a/src/dk/camelot64/kickc/icl/LiveRangeEquivalenceClass.java +++ b/src/dk/camelot64/kickc/icl/LiveRangeEquivalenceClass.java @@ -32,7 +32,7 @@ public class LiveRangeEquivalenceClass { if(variables.contains(variable)) { return; } - VariableLiveRanges liveRanges = program.getScope().getLiveRanges(); + LiveRangeVariables liveRanges = program.getScope().getLiveRanges(); LiveRange varLiveRange = liveRanges.getLiveRange(variable); if (classLiveRange.overlaps(varLiveRange)) { throw new RuntimeException("Compilation error! Variable live range overlaps live range equivalence class live range. " + variable); diff --git a/src/dk/camelot64/kickc/icl/VariableLiveRanges.java b/src/dk/camelot64/kickc/icl/LiveRangeVariables.java similarity index 88% rename from src/dk/camelot64/kickc/icl/VariableLiveRanges.java rename to src/dk/camelot64/kickc/icl/LiveRangeVariables.java index 788394844..e752b6ff6 100644 --- a/src/dk/camelot64/kickc/icl/VariableLiveRanges.java +++ b/src/dk/camelot64/kickc/icl/LiveRangeVariables.java @@ -4,12 +4,14 @@ import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; -/** Live ranges for all variables. */ -public class VariableLiveRanges { +/** Live ranges for all variables. + * Created by * Created by {@link dk.camelot64.kickc.passes.Pass3CallGraphAnalysis} + */ +public class LiveRangeVariables { private LinkedHashMap liveRanges; - public VariableLiveRanges() { + public LiveRangeVariables() { this.liveRanges = new LinkedHashMap<>(); } diff --git a/src/dk/camelot64/kickc/icl/NaturalLoopSet.java b/src/dk/camelot64/kickc/icl/NaturalLoopSet.java index 2130ac8f4..250d9307c 100644 --- a/src/dk/camelot64/kickc/icl/NaturalLoopSet.java +++ b/src/dk/camelot64/kickc/icl/NaturalLoopSet.java @@ -7,6 +7,7 @@ import java.util.Set; /** A set of natural loops in a control flow graph. *

For definitions and more see http://www.cs.colostate.edu/~cs553/ClassNotes/lecture09-control-dominators.ppt.pdf + *

Created by {@link dk.camelot64.kickc.passes.Pass3LoopAnalysis} * */ public class NaturalLoopSet { diff --git a/src/dk/camelot64/kickc/icl/ProgramScope.java b/src/dk/camelot64/kickc/icl/ProgramScope.java index f3952470a..e421c3338 100644 --- a/src/dk/camelot64/kickc/icl/ProgramScope.java +++ b/src/dk/camelot64/kickc/icl/ProgramScope.java @@ -11,7 +11,7 @@ public class ProgramScope extends Scope { private RegisterAllocation allocation; - private VariableLiveRanges liveRanges; + private LiveRangeVariables liveRanges; public ProgramScope() { super("", null); @@ -50,11 +50,11 @@ public class ProgramScope extends Scope { return allocation; } - public void setLiveRanges(VariableLiveRanges liveRanges) { + public void setLiveRanges(LiveRangeVariables liveRanges) { this.liveRanges = liveRanges; } - public VariableLiveRanges getLiveRanges() { + public LiveRangeVariables getLiveRanges() { return liveRanges; } diff --git a/src/dk/camelot64/kickc/icl/StatementBase.java b/src/dk/camelot64/kickc/icl/StatementBase.java index 82b76cfe7..326cfbd1b 100644 --- a/src/dk/camelot64/kickc/icl/StatementBase.java +++ b/src/dk/camelot64/kickc/icl/StatementBase.java @@ -49,7 +49,7 @@ public abstract class StatementBase implements Statement { if(scope==null || scope.getLiveRanges()==null) { return ""; } - VariableLiveRanges liveRanges = scope.getLiveRanges(); + LiveRangeVariables liveRanges = scope.getLiveRanges(); List alive = liveRanges.getAlive(this); StringBuilder str = new StringBuilder(); str.append(" [ "); diff --git a/src/dk/camelot64/kickc/passes/Pass3LiveRangesAnalysis.java b/src/dk/camelot64/kickc/passes/Pass3LiveRangesAnalysis.java index 83262d276..8cc39f598 100644 --- a/src/dk/camelot64/kickc/passes/Pass3LiveRangesAnalysis.java +++ b/src/dk/camelot64/kickc/passes/Pass3LiveRangesAnalysis.java @@ -23,7 +23,7 @@ public class Pass3LiveRangesAnalysis { public void findLiveRanges() { generateStatementIndexes(); - VariableLiveRanges liveRanges = initializeLiveRanges(); + LiveRangeVariables liveRanges = initializeLiveRanges(); program.getScope().setLiveRanges(liveRanges); //log.append("CONTROL FLOW GRAPH - LIVE RANGES"); //log.append(program.getGraph().toString(program.getScope())); @@ -57,7 +57,7 @@ public class Pass3LiveRangesAnalysis { * * @return The initial live ranges. */ - private VariableLiveRanges initializeLiveRanges() { + private LiveRangeVariables initializeLiveRanges() { LiveRangeInitializer liveRangeInitializer = new LiveRangeInitializer(program); return liveRangeInitializer.initialize(); } @@ -65,7 +65,7 @@ public class Pass3LiveRangesAnalysis { private static class LiveRangeInitializer extends ControlFlowGraphBaseVisitor { private final Program program; - private VariableLiveRanges liveRanges; + private LiveRangeVariables liveRanges; /** * Contains the previous statement through the iteration of each block. null if this statement is the first in the block. @@ -78,10 +78,10 @@ public class Pass3LiveRangesAnalysis { public LiveRangeInitializer(Program program) { this.program = program; - this.liveRanges = new VariableLiveRanges(); + this.liveRanges = new LiveRangeVariables(); } - public VariableLiveRanges initialize() { + public LiveRangeVariables initialize() { this.visitGraph(program.getGraph()); return liveRanges; } @@ -195,7 +195,7 @@ public class Pass3LiveRangesAnalysis { * * @return true if any propagation was done. (and more propagation is necessary to complete the live ranges) */ - private boolean propagateLiveRanges(VariableLiveRanges liveRanges) { + private boolean propagateLiveRanges(LiveRangeVariables liveRanges) { LiveRangePropagator liveRangePropagator = new LiveRangePropagator(program, liveRanges); return liveRangePropagator.propagate(); } @@ -210,7 +210,7 @@ public class Pass3LiveRangesAnalysis { /** * The variable live ranges being propagated. */ - private VariableLiveRanges liveRanges; + private LiveRangeVariables liveRanges; /** * Has anything been modified. @@ -227,7 +227,7 @@ public class Pass3LiveRangesAnalysis { */ private ControlFlowBlock currentBlock; - public LiveRangePropagator(Program program, VariableLiveRanges liveRanges) { + public LiveRangePropagator(Program program, LiveRangeVariables liveRanges) { this.program = program; this.liveRanges = liveRanges; this.modified = false; diff --git a/src/dk/camelot64/kickc/passes/Pass4ZeroPageAllocationLiveRange.java b/src/dk/camelot64/kickc/passes/Pass4ZeroPageAllocationLiveRange.java index 858e5a737..0b869f50a 100644 --- a/src/dk/camelot64/kickc/passes/Pass4ZeroPageAllocationLiveRange.java +++ b/src/dk/camelot64/kickc/passes/Pass4ZeroPageAllocationLiveRange.java @@ -82,11 +82,11 @@ public class Pass4ZeroPageAllocationLiveRange { } private void addToEquivalenceClassSet(VariableRef lValVar, List preferences) { - VariableLiveRanges variableLiveRanges = program.getScope().getLiveRanges(); + LiveRangeVariables liveRangeVariables = program.getScope().getLiveRanges(); LiveRangeEquivalenceClass lValEquivalenceClass = liveRangeEquivalenceClassSet.getEquivalenceClass(lValVar); if(lValEquivalenceClass==null) { - LiveRange lValLiveRange = variableLiveRanges.getLiveRange(lValVar); + LiveRange lValLiveRange = liveRangeVariables.getLiveRange(lValVar); // Variable in need of an equivalence class - Look through preferences LiveRangeEquivalenceClass chosen = null; for (VariableRef preference : preferences) {