1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-12-25 11:32:07 +00:00

Added commandline option to disable long branch fixing. Closes #744

This commit is contained in:
jespergravgaard 2022-01-02 11:51:16 +01:00
parent 1662d491a3
commit 6ddcb9e358
2 changed files with 18 additions and 1 deletions

View File

@ -36,6 +36,9 @@ public class Compiler {
/** Disable the entire register uplift. This will create significantly less optimized ASM since registers are not utilized. */
private boolean disableUplift = false;
/** Disable the long branch fix pass. */
private boolean disableLongBranchFix = false;
/**
* Enable loop head constant optimization. It identified whenever a while()/for() has a constant condition on the first iteration and rewrites it.
* Currently the optimization is flaky and results in NPE's and wrong values in some programs.
@ -57,6 +60,10 @@ public class Compiler {
this.disableUplift = disableUplift;
}
public void setDisableLongBranchFix(boolean disableLongBranchFix) {
this.disableLongBranchFix = disableLongBranchFix;
}
public void setWarnFragmentMissing(boolean warnFragmentMissing) {
program.setWarnFragmentMissing(warnFragmentMissing);
}
@ -759,7 +766,11 @@ public class Compiler {
}
new Pass5ReindexAsmLines(program).optimize();
new Pass5FixLongBranches(program).optimize();
if(disableLongBranchFix) {
getLog().append("LONG BRANCH FIX DISABLED.");
} else {
new Pass5FixLongBranches(program).optimize();
}
getLog().append("\nFINAL SYMBOL TABLE");
getLog().append(program.getScope().toStringVars(program, false));

View File

@ -89,6 +89,9 @@ public class KickC implements Callable<Integer> {
@CommandLine.Option(names = {"-Onouplift"}, description = "Optimization Option. Disable the register uplift allocation phase. This will be much faster but produce significantly slower ASM.")
private boolean optimizeNoUplift = false;
@CommandLine.Option(names = {"-Onolongbranchfix"}, description = "Optimization Option. Disable the pass that fixes long branches. This is relevant when using the PCEAS assembler.")
private boolean optimizeDisableLongBranchFix = false;
@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;
@ -306,6 +309,9 @@ public class KickC implements Callable<Integer> {
if(optimizeNoUplift)
compiler.setDisableUplift(true);
if(optimizeDisableLongBranchFix)
compiler.setDisableLongBranchFix(true);
if(optimizeUpliftCombinations != null)
compiler.setUpliftCombinations(optimizeUpliftCombinations);