1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-12-20 07:30:00 +00:00

Optimized effective live ranges further to improce uplift speed

This commit is contained in:
jespergravgaard 2017-11-10 00:12:34 +01:00
parent a3c18cf756
commit 514797897e

View File

@ -21,10 +21,8 @@ public class LiveRangeVariablesEffective {
*/ */
private Map<ProcedureRef, CallPaths> procedureCallPaths; private Map<ProcedureRef, CallPaths> procedureCallPaths;
/** /** Variables (normally) alive at each statement by index. */
* Normal variable live ranges. private Map<Integer, Collection<VariableRef>> statementsLiveVariables;
*/
private LiveRangeVariables liveRangeVariables;
/** /**
* Information about which procedures reference which variables. * Information about which procedures reference which variables.
@ -34,8 +32,13 @@ public class LiveRangeVariablesEffective {
public LiveRangeVariablesEffective(Program program, Map<ProcedureRef, CallPaths> procedureCallPaths, LiveRangeVariables liveRangeVariables, VariableReferenceInfos referenceInfo) { public LiveRangeVariablesEffective(Program program, Map<ProcedureRef, CallPaths> procedureCallPaths, LiveRangeVariables liveRangeVariables, VariableReferenceInfos referenceInfo) {
this.program = program; this.program = program;
this.procedureCallPaths = procedureCallPaths; this.procedureCallPaths = procedureCallPaths;
this.liveRangeVariables = liveRangeVariables;
this.referenceInfo = referenceInfo; this.referenceInfo = referenceInfo;
this.statementsLiveVariables = new LinkedHashMap<>();
for (ControlFlowBlock block : program.getGraph().getAllBlocks()) {
for (Statement statement : block.getStatements()) {
statementsLiveVariables.put(statement.getIndex(), liveRangeVariables.getAlive(statement));
}
}
} }
/** /**
@ -163,7 +166,7 @@ public class LiveRangeVariablesEffective {
* @return All combinations of variables alive at the statement * @return All combinations of variables alive at the statement
*/ */
public AliveCombinations getAliveCombinations(Statement statement) { public AliveCombinations getAliveCombinations(Statement statement) {
List<VariableRef> aliveAtStmt = liveRangeVariables.getAlive(statement); Collection<VariableRef> aliveAtStmt = statementsLiveVariables.get(statement.getIndex());
CallPaths callPaths; CallPaths callPaths;
Collection<VariableRef> referencedInProcedure; Collection<VariableRef> referencedInProcedure;
ControlFlowBlock block = program.getStatementBlocks().getBlock(statement); ControlFlowBlock block = program.getStatementBlocks().getBlock(statement);