From af5bb803c114ced6a5ea0e2be46314b3a25f0f24 Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Sun, 4 Aug 2019 08:49:34 +0200 Subject: [PATCH] Working on optimizing constant loop heads (Pass2LoopHeadConstantIdentification). #246 --- src/main/java/dk/camelot64/kickc/Compiler.java | 4 ++-- .../kickc/passes/Pass2LoopHeadConstantIdentification.java | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/dk/camelot64/kickc/Compiler.java b/src/main/java/dk/camelot64/kickc/Compiler.java index 435ba96cc..57731aac1 100644 --- a/src/main/java/dk/camelot64/kickc/Compiler.java +++ b/src/main/java/dk/camelot64/kickc/Compiler.java @@ -305,8 +305,8 @@ public class Compiler { optimizations.add(new PassNSimplifyExpressionWithZero(program)); optimizations.add(new PassNEliminateUnusedVars(program, true)); optimizations.add(new Pass2EliminateUnusedBlocks(program)); - //optimizations.add(new PassNStatementIndices(program)); - //optimizations.add(new Pass2LoopHeadConstantIdentification(program)); + optimizations.add(new PassNStatementIndices(program)); + optimizations.add(new Pass2LoopHeadConstantIdentification(program)); return optimizations; } diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass2LoopHeadConstantIdentification.java b/src/main/java/dk/camelot64/kickc/passes/Pass2LoopHeadConstantIdentification.java index a9192f497..d63e57222 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass2LoopHeadConstantIdentification.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass2LoopHeadConstantIdentification.java @@ -38,6 +38,8 @@ public class Pass2LoopHeadConstantIdentification extends Pass2SsaOptimization { return true; } } + // TODO: Move to Program + new PassNStatementIndices(getProgram()).clearStatementIndices(); return false; }