diff --git a/src/main/java/dk/camelot64/kickc/Compiler.java b/src/main/java/dk/camelot64/kickc/Compiler.java index f5a16b1d9..44e3b9ff4 100644 --- a/src/main/java/dk/camelot64/kickc/Compiler.java +++ b/src/main/java/dk/camelot64/kickc/Compiler.java @@ -31,7 +31,10 @@ public class Compiler { private int upliftCombinations = 100; /** Enable the zero-page coalesce pass. It takes a lot of time, but limits the zero page usage significantly. */ - private boolean enableZeroPageCoalasce = false; + private boolean enableZeroPageCoalesce = false; + + /** Disables coalesce completely, which reduces compile time significantly. */ + private boolean disableCoalesce = false; /** Disable the entire register uplift. This will create significantly less optimized ASM since registers are not utilized. */ private boolean disableUplift = false; @@ -81,7 +84,11 @@ public class Compiler { } public void enableZeroPageCoalesce() { - this.enableZeroPageCoalasce = true; + this.enableZeroPageCoalesce = true; + } + + public void disableCoalesce() { + this.disableCoalesce = true; } void enableLoopHeadConstant() { @@ -713,12 +720,15 @@ public class Compiler { // Register coalesce on assignment (saving bytes & cycles) new Pass4MemoryCoalesceAssignment(program).coalesce(); - // Register coalesce on call graph (saving ZP) - new Pass4MemoryCoalesceCallGraph(program).coalesce(); + // Coalesce can be completely disabled for compilation speed reasons during programming and testing. + if(!disableCoalesce) { + // Register coalesce on call graph (saving ZP) + new Pass4MemoryCoalesceCallGraph(program).coalesce(); - if(enableZeroPageCoalasce) { - // Register coalesce using exhaustive search (saving even more ZP - but slow) - new Pass4MemoryCoalesceExhaustive(program).coalesce(); + if (enableZeroPageCoalesce) { + // Register coalesce using exhaustive search (saving even more ZP - but slow) + new Pass4MemoryCoalesceExhaustive(program).coalesce(); + } } new Pass4RegistersFinalize(program).allocate(true, true); new Pass4AssertZeropageAllocation(program).check(); diff --git a/src/main/java/dk/camelot64/kickc/KickC.java b/src/main/java/dk/camelot64/kickc/KickC.java index e79bf722c..53528d19e 100644 --- a/src/main/java/dk/camelot64/kickc/KickC.java +++ b/src/main/java/dk/camelot64/kickc/KickC.java @@ -96,6 +96,9 @@ public class KickC implements Callable { @CommandLine.Option(names = {"-Ocoalesce"}, description = "Optimization Option. Enables zero-page coalesce pass which limits zero-page usage significantly, but takes a lot of compile time.") private boolean optimizeZeroPageCoalesce = false; + @CommandLine.Option(names = {"-Onocoalesce"}, description = "Optimization Option. Disables coalesce completely, which reduces compile time significantly.") + private boolean optimizeNoCoalesce = false; + @CommandLine.Option(names = {"-Oloophead"}, description = "Optimization Option. Enabled experimental loop-head constant pass which identifies loops where the condition is constant on the first iteration.") private boolean optimizeLoopHeadConstant = false; @@ -319,6 +322,8 @@ public class KickC implements Callable { if(optimizeZeroPageCoalesce) compiler.enableZeroPageCoalesce(); + if(optimizeNoCoalesce) + compiler.disableCoalesce(); if(optimizeLoopHeadConstant) compiler.enableLoopHeadConstant();