From 77d24eddc654032b0a5899526a733ea708c7c80a Mon Sep 17 00:00:00 2001 From: Jesper Gravgaard Date: Mon, 20 May 2019 10:47:53 +0200 Subject: [PATCH] Rafactoring pass 2 --- .../java/dk/camelot64/kickc/Compiler.java | 1 - .../kickc/passes/Pass2TypeInference.java | 33 ------------------- src/test/ref/inline-pointer-2.asm | 3 +- 3 files changed, 2 insertions(+), 35 deletions(-) delete mode 100644 src/main/java/dk/camelot64/kickc/passes/Pass2TypeInference.java diff --git a/src/main/java/dk/camelot64/kickc/Compiler.java b/src/main/java/dk/camelot64/kickc/Compiler.java index ca1139264..d988613f4 100644 --- a/src/main/java/dk/camelot64/kickc/Compiler.java +++ b/src/main/java/dk/camelot64/kickc/Compiler.java @@ -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)); diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass2TypeInference.java b/src/main/java/dk/camelot64/kickc/passes/Pass2TypeInference.java deleted file mode 100644 index b59532300..000000000 --- a/src/main/java/dk/camelot64/kickc/passes/Pass2TypeInference.java +++ /dev/null @@ -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; - } - -} diff --git a/src/test/ref/inline-pointer-2.asm b/src/test/ref/inline-pointer-2.asm index 32a924a78..8cd4e7021 100644 --- a/src/test/ref/inline-pointer-2.asm +++ b/src/test/ref/inline-pointer-2.asm @@ -3,7 +3,8 @@ :BasicUpstart(main) .pc = $80d "Program" main: { + .label screen = 4*$100+$28 lda #'a' - sta 4*$100+$28 + sta screen rts }