mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-12-20 23:30:43 +00:00
- Coalesce optimization option implemented:
- nocoalesce: disables coalesce completely. - Removed the coalesce testing if both classes were equal, as this does not make any sense ...
This commit is contained in:
parent
7e5b2caa37
commit
ca791df458
@ -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() {
|
||||
@ -712,12 +719,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();
|
||||
|
@ -96,6 +96,12 @@ public class KickC implements Callable<Integer> {
|
||||
@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 = {"-Ofastcoalesce"}, description = "Optimization Option. Enables zero-page only coalesce, which reduces compile time significantly, but with less coalesce optimimzation.")
|
||||
private boolean optimizeFastCoalesce = 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 +325,8 @@ public class KickC implements Callable<Integer> {
|
||||
|
||||
if(optimizeZeroPageCoalesce)
|
||||
compiler.enableZeroPageCoalesce();
|
||||
if(optimizeNoCoalesce)
|
||||
compiler.disableCoalesce();
|
||||
|
||||
if(optimizeLoopHeadConstant)
|
||||
compiler.enableLoopHeadConstant();
|
||||
|
@ -140,9 +140,6 @@ public abstract class Pass4MemoryCoalesce extends Pass2Base {
|
||||
// Check the both registers are in memory
|
||||
if(!register1.isMem() || !register2.isMem())
|
||||
return false;
|
||||
// Check the both registers have the same type
|
||||
if(!register1.getType().equals(register2.getType()))
|
||||
return false;
|
||||
if(register1.getType() == Registers.RegisterType.MAIN_MEM)
|
||||
return false;
|
||||
// Check the both registers have the same size
|
||||
|
Loading…
Reference in New Issue
Block a user