mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-14 23:04:57 +00:00
Removed cast calls to getSymbol()
This commit is contained in:
parent
6ef3af4fdf
commit
4c0a9cd241
@ -186,7 +186,7 @@ public abstract class Scope implements Symbol {
|
||||
}
|
||||
|
||||
public Label getLabel(LabelRef labelRef) {
|
||||
return (Label) symbols.get(labelRef);
|
||||
return (Label) getSymbol(labelRef);
|
||||
}
|
||||
|
||||
public Procedure addProcedure(String name, SymbolType type) {
|
||||
@ -208,6 +208,10 @@ public abstract class Scope implements Symbol {
|
||||
}
|
||||
}
|
||||
|
||||
public Procedure getProcedure(ProcedureRef ref) {
|
||||
return (Procedure) getSymbol(ref);
|
||||
}
|
||||
|
||||
abstract RegisterAllocation getAllocation();
|
||||
|
||||
@JsonIgnore
|
||||
|
@ -25,7 +25,7 @@ public class Pass1ProcedureCallParameters extends ControlFlowGraphCopyVisitor {
|
||||
// Procedure strategy implemented is currently variable-based transfer of parameters/return values
|
||||
// Generate parameter passing assignments
|
||||
ProcedureRef procedureRef = origCall.getProcedure();
|
||||
Procedure procedure = (Procedure) scope.getSymbol(procedureRef);
|
||||
Procedure procedure = scope.getProcedure(procedureRef);
|
||||
List<Variable> parameterDecls = procedure.getParameters();
|
||||
List<RValue> parameterValues = origCall.getParameters();
|
||||
for (int i = 0; i < parameterDecls.size(); i++) {
|
||||
|
@ -23,8 +23,7 @@ public class Pass1ProcedureCallsReturnValue extends ControlFlowGraphCopyVisitor
|
||||
// Procedure strategy implemented is currently variable-based transfer of parameters/return values
|
||||
// Generate return value assignment
|
||||
ProcedureRef procedureRef = origCall.getProcedure();
|
||||
Procedure procedure = (Procedure) scope.getSymbol(procedureRef);
|
||||
|
||||
Procedure procedure = scope.getProcedure(procedureRef);
|
||||
String procedureName = origCall.getProcedureName();
|
||||
StatementCall copyCall = new StatementCall(null, procedureName, null);
|
||||
copyCall.setParametersByAssignment(true);
|
||||
|
@ -27,7 +27,7 @@ public class Pass1TypeInference {
|
||||
if(statement instanceof StatementProcedureBegin) {
|
||||
StatementProcedureBegin procedureBegin = (StatementProcedureBegin) statement;
|
||||
ProcedureRef procedureRef = procedureBegin.getProcedure();
|
||||
Procedure procedure = (Procedure) programScope.getSymbol(procedureRef);
|
||||
Procedure procedure = programScope.getProcedure(procedureRef);
|
||||
scopes.push(procedure);
|
||||
} else if(statement instanceof StatementProcedureEnd) {
|
||||
scopes.pop();
|
||||
|
@ -93,7 +93,7 @@ public class Pass2AssertSymbols extends Pass2SsaAssertion {
|
||||
@Override
|
||||
public Void visitProcedureBegin(StatementProcedureBegin statement) {
|
||||
ProcedureRef procedureRef = statement.getProcedure();
|
||||
Procedure procedure = (Procedure) programScope.getSymbol(procedureRef);
|
||||
Procedure procedure = programScope.getProcedure(procedureRef);
|
||||
symbols.add(procedure);
|
||||
return super.visitProcedureBegin(statement);
|
||||
}
|
||||
@ -101,7 +101,7 @@ public class Pass2AssertSymbols extends Pass2SsaAssertion {
|
||||
@Override
|
||||
public Void visitProcedureEnd(StatementProcedureEnd statement) {
|
||||
ProcedureRef procedureRef = statement.getProcedure();
|
||||
Procedure procedure = (Procedure) programScope.getSymbol(procedureRef);
|
||||
Procedure procedure = programScope.getProcedure(procedureRef);
|
||||
symbols.add(procedure);
|
||||
return super.visitProcedureEnd(statement);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public class Pass2CullEmptyBlocks extends Pass2SsaOptimization {
|
||||
phiFixVisitor.visitBlock(successor);
|
||||
getGraph().getAllBlocks().remove(removeBlock);
|
||||
LabelRef removeBlockLabelRef = removeBlock.getLabel();
|
||||
Label removeBlockLabel = (Label) getSymbols().getSymbol(removeBlockLabelRef);
|
||||
Label removeBlockLabel = getSymbols().getLabel(removeBlockLabelRef);
|
||||
removeBlockLabel.getScope().remove(removeBlockLabel);
|
||||
log.append("Culled Empty Block " + removeBlockLabel.getTypedName());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user