mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-23 08:32:39 +00:00
Rafactoring pass 2
This commit is contained in:
parent
5d988dd859
commit
77d24eddc6
@ -256,7 +256,6 @@ public class Compiler {
|
||||
optimizations.add(new Pass2ConstantStringConsolidation(program));
|
||||
optimizations.add(new Pass2FixInlineConstructorsNew(program));
|
||||
optimizations.add(new PassNAddTypeConversionAssignment(program));
|
||||
optimizations.add(new Pass2TypeInference(program));
|
||||
optimizations.add(new Pass2EliminateRedundantCasts(program));
|
||||
optimizations.add(new Pass2RangeResolving(program));
|
||||
optimizations.add(new Pass2ComparisonOptimization(program));
|
||||
|
@ -1,33 +0,0 @@
|
||||
package dk.camelot64.kickc.passes;
|
||||
|
||||
import dk.camelot64.kickc.model.ControlFlowBlock;
|
||||
import dk.camelot64.kickc.model.Program;
|
||||
import dk.camelot64.kickc.model.statements.Statement;
|
||||
import dk.camelot64.kickc.model.statements.StatementAssignment;
|
||||
import dk.camelot64.kickc.model.statements.StatementCall;
|
||||
import dk.camelot64.kickc.model.types.SymbolTypeInference;
|
||||
|
||||
/**
|
||||
* Pass through the all statements (re-)inferring types of variables.
|
||||
*/
|
||||
public class Pass2TypeInference extends Pass2SsaOptimization {
|
||||
|
||||
public Pass2TypeInference(Program program) {
|
||||
super(program);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean step() {
|
||||
for(ControlFlowBlock block : getProgram().getGraph().getAllBlocks()) {
|
||||
for(Statement statement : block.getStatements()) {
|
||||
if(statement instanceof StatementAssignment) {
|
||||
SymbolTypeInference.inferAssignmentLValue(getProgram(), (StatementAssignment) statement, true);
|
||||
} else if(statement instanceof StatementCall) {
|
||||
SymbolTypeInference.inferCallLValue(getProgram(), (StatementCall) statement, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -3,7 +3,8 @@
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
main: {
|
||||
.label screen = 4*$100+$28
|
||||
lda #'a'
|
||||
sta 4*$100+$28
|
||||
sta screen
|
||||
rts
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user