mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-08-08 13:25:12 +00:00
Less logging during uplift.
This commit is contained in:
@@ -79,7 +79,7 @@ public class Compiler {
|
|||||||
program.getLog().append(program.getRegisterUpliftProgram().toString((program.getVariableRegisterWeights())));
|
program.getLog().append(program.getRegisterUpliftProgram().toString((program.getVariableRegisterWeights())));
|
||||||
|
|
||||||
// Attempt uplifting registers through a lot of combinations
|
// Attempt uplifting registers through a lot of combinations
|
||||||
new Pass3RegisterUpliftCombinations(program).performUplift(10_000);
|
new Pass3RegisterUpliftCombinations(program).performUplift(30_000);
|
||||||
|
|
||||||
// Attempt uplifting registers one at a time to catch remaining potential not realized by combination search
|
// Attempt uplifting registers one at a time to catch remaining potential not realized by combination search
|
||||||
new Pass3RegisterUpliftRemains(program).performUplift();
|
new Pass3RegisterUpliftRemains(program).performUplift();
|
||||||
|
@@ -19,6 +19,10 @@ public class RegisterCombination {
|
|||||||
allocation.put(equivalenceClass, register);
|
allocation.put(equivalenceClass, register);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RegisterAllocation.Register getRegister(LiveRangeEquivalenceClass equivalenceClass) {
|
||||||
|
return allocation.get(equivalenceClass);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate the registers of the combination into the programs register allocation
|
* Allocate the registers of the combination into the programs register allocation
|
||||||
*/
|
*/
|
||||||
|
@@ -28,6 +28,9 @@ public class Pass3RegisterUpliftCombinations extends Pass2Base {
|
|||||||
int countCombinations = 0;
|
int countCombinations = 0;
|
||||||
while (combinationIterator.hasNext() && countCombinations<maxCombinations) {
|
while (combinationIterator.hasNext() && countCombinations<maxCombinations) {
|
||||||
countCombinations++;
|
countCombinations++;
|
||||||
|
if(countCombinations%10000==0) {
|
||||||
|
getLog().append("Uplift attempts ["+upliftScope.getScopeRef()+"] "+countCombinations+"/"+combinationIterator.getNumIterations()+" (limiting to "+maxCombinations+")");
|
||||||
|
}
|
||||||
RegisterCombination combination = combinationIterator.next();
|
RegisterCombination combination = combinationIterator.next();
|
||||||
// Reset register allocation to original zero page allocation
|
// Reset register allocation to original zero page allocation
|
||||||
new Pass3RegistersFinalize(getProgram()).allocate(false);
|
new Pass3RegistersFinalize(getProgram()).allocate(false);
|
||||||
@@ -38,32 +41,32 @@ public class Pass3RegisterUpliftCombinations extends Pass2Base {
|
|||||||
new Pass3CodeGeneration(getProgram()).generate();
|
new Pass3CodeGeneration(getProgram()).generate();
|
||||||
} catch (AsmFragment.UnknownFragmentException e) {
|
} catch (AsmFragment.UnknownFragmentException e) {
|
||||||
unknownFragments.add(e.getFragmentSignature());
|
unknownFragments.add(e.getFragmentSignature());
|
||||||
StringBuilder msg = new StringBuilder();
|
//StringBuilder msg = new StringBuilder();
|
||||||
msg.append("Uplift attempt [" + upliftScope.getScopeRef() + "] ");
|
//msg.append("Uplift attempt [" + upliftScope.getScopeRef() + "] ");
|
||||||
msg.append("missing fragment " + e.getFragmentSignature());
|
//msg.append("missing fragment " + e.getFragmentSignature());
|
||||||
msg.append(" allocation: ").append(combination.toString());
|
//msg.append(" allocation: ").append(combination.toString());
|
||||||
getLog().append(msg.toString());
|
//getLog().append(msg.toString());
|
||||||
continue;
|
continue;
|
||||||
} catch (AsmFragment.AluNotApplicableException e) {
|
} catch (AsmFragment.AluNotApplicableException e) {
|
||||||
StringBuilder msg = new StringBuilder();
|
//StringBuilder msg = new StringBuilder();
|
||||||
msg.append("Uplift attempt [" + upliftScope.getScopeRef() + "] ");
|
//msg.append("Uplift attempt [" + upliftScope.getScopeRef() + "] ");
|
||||||
msg.append("alu not applicable");
|
//msg.append("alu not applicable");
|
||||||
msg.append(" allocation: ").append(combination.toString());
|
//msg.append(" allocation: ").append(combination.toString());
|
||||||
getLog().append(msg.toString());
|
//getLog().append(msg.toString());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// If no clobber - Find value of the resulting allocation
|
// If no clobber - Find value of the resulting allocation
|
||||||
boolean hasClobberProblem = new Pass3AssertNoCpuClobber(getProgram()).hasClobberProblem(false);
|
boolean hasClobberProblem = new Pass3AssertNoCpuClobber(getProgram()).hasClobberProblem(false);
|
||||||
int combinationScore = getAsmScore(getProgram());
|
int combinationScore = getAsmScore(getProgram());
|
||||||
StringBuilder msg = new StringBuilder();
|
StringBuilder msg = new StringBuilder();
|
||||||
msg.append("Uplift attempt [" + upliftScope.getScopeRef() + "] ");
|
//msg.append("Uplift attempt [" + upliftScope.getScopeRef() + "] ");
|
||||||
if (hasClobberProblem) {
|
//if (hasClobberProblem) {
|
||||||
msg.append("clobber");
|
// msg.append("clobber");
|
||||||
} else {
|
//} else {
|
||||||
msg.append(combinationScore);
|
// msg.append(combinationScore);
|
||||||
}
|
//}
|
||||||
msg.append(" allocation: ").append(combination.toString());
|
//msg.append(" allocation: ").append(combination.toString());
|
||||||
getLog().append(msg.toString());
|
//getLog().append(msg.toString());
|
||||||
if (!hasClobberProblem) {
|
if (!hasClobberProblem) {
|
||||||
if (combinationScore < bestScore) {
|
if (combinationScore < bestScore) {
|
||||||
bestScore = combinationScore;
|
bestScore = combinationScore;
|
||||||
|
@@ -45,32 +45,32 @@ public class Pass3RegisterUpliftRemains extends Pass2Base {
|
|||||||
new Pass3CodeGeneration(getProgram()).generate();
|
new Pass3CodeGeneration(getProgram()).generate();
|
||||||
} catch (AsmFragment.UnknownFragmentException e) {
|
} catch (AsmFragment.UnknownFragmentException e) {
|
||||||
unknownFragments.add(e.getFragmentSignature());
|
unknownFragments.add(e.getFragmentSignature());
|
||||||
StringBuilder msg = new StringBuilder();
|
//StringBuilder msg = new StringBuilder();
|
||||||
msg.append("Uplift remains attempt [" + equivalenceClass + "] ");
|
//msg.append("Uplift remains attempt [" + equivalenceClass + "] ");
|
||||||
msg.append("missing fragment " + e.getFragmentSignature());
|
//msg.append("missing fragment " + e.getFragmentSignature());
|
||||||
msg.append(" allocation: ").append(combination.toString());
|
//msg.append(" allocation: ").append(combination.toString());
|
||||||
getLog().append(msg.toString());
|
//getLog().append(msg.toString());
|
||||||
continue;
|
continue;
|
||||||
} catch (AsmFragment.AluNotApplicableException e) {
|
} catch (AsmFragment.AluNotApplicableException e) {
|
||||||
StringBuilder msg = new StringBuilder();
|
//StringBuilder msg = new StringBuilder();
|
||||||
msg.append("Uplift remains attempt [" + equivalenceClass + "] ");
|
//msg.append("Uplift remains attempt [" + equivalenceClass + "] ");
|
||||||
msg.append("alu not applicable");
|
//msg.append("alu not applicable");
|
||||||
msg.append(" allocation: ").append(combination.toString());
|
//msg.append(" allocation: ").append(combination.toString());
|
||||||
getLog().append(msg.toString());
|
//getLog().append(msg.toString());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// If no clobber - Find value of the resulting allocation
|
// If no clobber - Find value of the resulting allocation
|
||||||
boolean hasClobberProblem = new Pass3AssertNoCpuClobber(getProgram()).hasClobberProblem(false);
|
boolean hasClobberProblem = new Pass3AssertNoCpuClobber(getProgram()).hasClobberProblem(false);
|
||||||
int combinationScore = getAsmScore(getProgram());
|
int combinationScore = getAsmScore(getProgram());
|
||||||
StringBuilder msg = new StringBuilder();
|
//StringBuilder msg = new StringBuilder();
|
||||||
msg.append("Uplift remains attempt [" + equivalenceClass + "] ");
|
//msg.append("Uplift remains attempt [" + equivalenceClass + "] ");
|
||||||
if (hasClobberProblem) {
|
//if (hasClobberProblem) {
|
||||||
msg.append("clobber");
|
// msg.append("clobber");
|
||||||
} else {
|
//} else {
|
||||||
msg.append(combinationScore);
|
// msg.append(combinationScore);
|
||||||
}
|
//}
|
||||||
msg.append(" allocation: ").append(combination.toString());
|
//msg.append(" allocation: ").append(combination.toString());
|
||||||
getLog().append(msg.toString());
|
//getLog().append(msg.toString());
|
||||||
if (!hasClobberProblem) {
|
if (!hasClobberProblem) {
|
||||||
if (combinationScore < bestScore) {
|
if (combinationScore < bestScore) {
|
||||||
bestScore = combinationScore;
|
bestScore = combinationScore;
|
||||||
@@ -79,8 +79,10 @@ public class Pass3RegisterUpliftRemains extends Pass2Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Save the best combination in the equivalence class
|
// Save the best combination in the equivalence class
|
||||||
bestCombination.store(equivalenceClassSet);
|
if(!bestCombination.getRegister(equivalenceClass).isZp()) {
|
||||||
getLog().append("Uplifting remains [" + equivalenceClass + "] best " + bestScore + " combination " + bestCombination.toString());
|
bestCombination.store(equivalenceClassSet);
|
||||||
|
getLog().append("Uplifting remains [" + equivalenceClass + "] best " + bestScore + " combination " + bestCombination.toString());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -75,12 +75,12 @@ render__B2_from_B1:
|
|||||||
render__B2_from_B5:
|
render__B2_from_B5:
|
||||||
render__B2:
|
render__B2:
|
||||||
lda 7
|
lda 7
|
||||||
sta 10
|
|
||||||
lda 2
|
|
||||||
sta 11
|
sta 11
|
||||||
|
lda 2
|
||||||
|
sta 12
|
||||||
jsr findcol
|
jsr findcol
|
||||||
render__B5:
|
render__B5:
|
||||||
lda 9
|
lda 10
|
||||||
ldy 7
|
ldy 7
|
||||||
sta (3),y
|
sta (3),y
|
||||||
lda #230
|
lda #230
|
||||||
@@ -114,80 +114,75 @@ render__Breturn:
|
|||||||
findcol:
|
findcol:
|
||||||
findcol__B1_from_findcol:
|
findcol__B1_from_findcol:
|
||||||
lda #0
|
lda #0
|
||||||
sta 9
|
sta 10
|
||||||
ldy #255
|
lda #255
|
||||||
ldx #0
|
sta 8
|
||||||
|
ldy #0
|
||||||
findcol__B1_from_B13:
|
findcol__B1_from_B13:
|
||||||
findcol__B1:
|
findcol__B1:
|
||||||
lda 4096,x
|
lda 4096,y
|
||||||
sta 8
|
ldx 4352,y
|
||||||
lda 4352,x
|
cmp 11
|
||||||
sta 12
|
|
||||||
lda 10
|
|
||||||
cmp 8
|
|
||||||
beq findcol__B2
|
beq findcol__B2
|
||||||
findcol__B3:
|
findcol__B3:
|
||||||
lda 10
|
cmp 11
|
||||||
cmp 8
|
bcs findcol__B6
|
||||||
bcc findcol__B6
|
|
||||||
findcol__B7:
|
findcol__B7:
|
||||||
lda 10
|
eor #255
|
||||||
sec
|
sec
|
||||||
sbc 8
|
adc 11
|
||||||
sta 8
|
sta 9
|
||||||
findcol__B8_from_B7:
|
findcol__B8_from_B7:
|
||||||
findcol__B8:
|
findcol__B8:
|
||||||
lda 11
|
cpx 12
|
||||||
cmp 12
|
bcs findcol__B9
|
||||||
bcc findcol__B9
|
|
||||||
findcol__B10:
|
findcol__B10:
|
||||||
lda 11
|
stx 255
|
||||||
|
lda 12
|
||||||
sec
|
sec
|
||||||
sbc 12
|
sbc 255
|
||||||
clc
|
clc
|
||||||
adc 8
|
adc 9
|
||||||
sta 8
|
tax
|
||||||
findcol__B11_from_B10:
|
findcol__B11_from_B10:
|
||||||
findcol__B11:
|
findcol__B11:
|
||||||
cpy 8
|
cpx 8
|
||||||
bcs findcol__B12
|
bcc findcol__B12
|
||||||
findcol__B13_from_B11:
|
findcol__B13_from_B11:
|
||||||
findcol__B13:
|
findcol__B13:
|
||||||
inx
|
iny
|
||||||
cpx #6
|
cpy #6
|
||||||
bcc findcol__B1_from_B13
|
bcc findcol__B1_from_B13
|
||||||
findcol__Breturn_from_B13:
|
findcol__Breturn_from_B13:
|
||||||
jmp findcol__Breturn
|
jmp findcol__Breturn
|
||||||
findcol__Breturn_from_B2:
|
findcol__Breturn_from_B2:
|
||||||
lda #0
|
lda #0
|
||||||
sta 9
|
sta 10
|
||||||
findcol__Breturn:
|
findcol__Breturn:
|
||||||
rts
|
rts
|
||||||
findcol__B12:
|
findcol__B12:
|
||||||
lda 4608,x
|
lda 4608,y
|
||||||
sta 9
|
sta 10
|
||||||
ldy 8
|
stx 8
|
||||||
findcol__B13_from_B12:
|
findcol__B13_from_B12:
|
||||||
jmp findcol__B13
|
jmp findcol__B13
|
||||||
findcol__B9:
|
findcol__B9:
|
||||||
lda 12
|
txa
|
||||||
sec
|
sec
|
||||||
sbc 11
|
sbc 12
|
||||||
clc
|
clc
|
||||||
adc 8
|
adc 9
|
||||||
sta 8
|
tax
|
||||||
findcol__B11_from_B9:
|
findcol__B11_from_B9:
|
||||||
jmp findcol__B11
|
jmp findcol__B11
|
||||||
findcol__B6:
|
findcol__B6:
|
||||||
lda 8
|
|
||||||
sec
|
sec
|
||||||
sbc 10
|
sbc 11
|
||||||
sta 8
|
sta 9
|
||||||
findcol__B8_from_B6:
|
findcol__B8_from_B6:
|
||||||
jmp findcol__B8
|
jmp findcol__B8
|
||||||
findcol__B2:
|
findcol__B2:
|
||||||
lda 11
|
cpx 12
|
||||||
cmp 12
|
|
||||||
beq findcol__Breturn_from_B2
|
beq findcol__Breturn_from_B2
|
||||||
jmp findcol__B3
|
jmp findcol__B3
|
||||||
addpoint:
|
addpoint:
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -32,33 +32,33 @@
|
|||||||
(label) findcol::@9
|
(label) findcol::@9
|
||||||
(label) findcol::@return
|
(label) findcol::@return
|
||||||
(byte) findcol::diff
|
(byte) findcol::diff
|
||||||
(byte) findcol::diff#0 zp byte:8 20002.0
|
(byte) findcol::diff#0 zp byte:9 20002.0
|
||||||
(byte) findcol::diff#1 zp byte:8 20002.0
|
(byte) findcol::diff#1 zp byte:9 20002.0
|
||||||
(byte~) findcol::diff#13 reg byte y 20002.0
|
(byte~) findcol::diff#13 zp byte:8 20002.0
|
||||||
(byte) findcol::diff#2 zp byte:8 20002.0
|
(byte) findcol::diff#2 reg byte x 20002.0
|
||||||
(byte) findcol::diff#3 zp byte:8 20002.0
|
(byte) findcol::diff#3 reg byte x 20002.0
|
||||||
(byte) findcol::diff#4 zp byte:8 10001.0
|
(byte) findcol::diff#4 zp byte:9 10001.0
|
||||||
(byte) findcol::diff#6 zp byte:8 13334.666666666666
|
(byte) findcol::diff#6 reg byte x 13334.666666666666
|
||||||
(byte) findcol::i
|
(byte) findcol::i
|
||||||
(byte) findcol::i#1 reg byte x 15001.5
|
(byte) findcol::i#1 reg byte y 15001.5
|
||||||
(byte) findcol::i#12 reg byte x 2631.842105263158
|
(byte) findcol::i#12 reg byte y 2631.842105263158
|
||||||
(byte) findcol::mincol
|
(byte) findcol::mincol
|
||||||
(byte) findcol::mincol#1 zp byte:9 10001.0
|
(byte) findcol::mincol#1 zp byte:10 10001.0
|
||||||
(byte) findcol::mincol#11 zp byte:9 1250.125
|
(byte) findcol::mincol#11 zp byte:10 1250.125
|
||||||
(byte) findcol::mincol#2 zp byte:9 13334.666666666666
|
(byte) findcol::mincol#2 zp byte:10 13334.666666666666
|
||||||
(byte) findcol::mindiff
|
(byte) findcol::mindiff
|
||||||
(byte) findcol::mindiff#10 reg byte y 1875.1875
|
(byte) findcol::mindiff#10 zp byte:8 1875.1875
|
||||||
(byte) findcol::mindiff#11 reg byte y 10001.0
|
(byte) findcol::mindiff#11 zp byte:8 10001.0
|
||||||
(byte) findcol::return
|
(byte) findcol::return
|
||||||
(byte) findcol::return#0 zp byte:9 343.8125
|
(byte) findcol::return#0 zp byte:10 343.8125
|
||||||
(byte) findcol::x
|
(byte) findcol::x
|
||||||
(byte) findcol::x#0 zp byte:10 1577.1153846153845
|
(byte) findcol::x#0 zp byte:11 1577.1153846153845
|
||||||
(byte) findcol::xp
|
(byte) findcol::xp
|
||||||
(byte) findcol::xp#0 zp byte:8 10001.0
|
(byte) findcol::xp#0 reg byte a 10001.0
|
||||||
(byte) findcol::y
|
(byte) findcol::y
|
||||||
(byte) findcol::y#0 zp byte:11 1640.2
|
(byte) findcol::y#0 zp byte:12 1640.2
|
||||||
(byte) findcol::yp
|
(byte) findcol::yp
|
||||||
(byte) findcol::yp#0 zp byte:12 6250.625
|
(byte) findcol::yp#0 reg byte x 6250.625
|
||||||
(void()) main()
|
(void()) main()
|
||||||
(label) main::@1
|
(label) main::@1
|
||||||
(label) main::@3
|
(label) main::@3
|
||||||
@@ -94,16 +94,18 @@ zp byte:2 [ render::y#2 render::y#1 addpoint::c#6 ]
|
|||||||
zp ptr byte:3 [ render::colline#2 render::colline#1 ]
|
zp ptr byte:3 [ render::colline#2 render::colline#1 ]
|
||||||
zp ptr byte:5 [ render::chrline#2 render::chrline#1 ]
|
zp ptr byte:5 [ render::chrline#2 render::chrline#1 ]
|
||||||
zp byte:7 [ render::x#2 render::x#1 ]
|
zp byte:7 [ render::x#2 render::x#1 ]
|
||||||
reg byte x [ findcol::i#12 findcol::i#1 ]
|
reg byte y [ findcol::i#12 findcol::i#1 ]
|
||||||
reg byte y [ findcol::mindiff#10 findcol::mindiff#11 findcol::diff#13 ]
|
zp byte:8 [ findcol::mindiff#10 findcol::mindiff#11 findcol::diff#13 ]
|
||||||
zp byte:8 [ findcol::diff#4 findcol::diff#0 findcol::diff#1 findcol::diff#6 findcol::diff#3 findcol::diff#2 findcol::xp#0 ]
|
zp byte:9 [ findcol::diff#4 findcol::diff#0 findcol::diff#1 ]
|
||||||
zp byte:9 [ findcol::return#0 findcol::mincol#11 findcol::mincol#2 findcol::mincol#1 ]
|
reg byte x [ findcol::diff#6 findcol::diff#3 findcol::diff#2 ]
|
||||||
|
zp byte:10 [ findcol::return#0 findcol::mincol#11 findcol::mincol#2 findcol::mincol#1 ]
|
||||||
reg byte a [ addpoint::x#6 ]
|
reg byte a [ addpoint::x#6 ]
|
||||||
reg byte y [ addpoint::idx#6 ]
|
reg byte y [ addpoint::idx#6 ]
|
||||||
reg byte x [ addpoint::y#6 ]
|
reg byte x [ addpoint::y#6 ]
|
||||||
zp byte:10 [ findcol::x#0 ]
|
zp byte:11 [ findcol::x#0 ]
|
||||||
zp byte:11 [ findcol::y#0 ]
|
zp byte:12 [ findcol::y#0 ]
|
||||||
reg byte a [ render::col#0 ]
|
reg byte a [ render::col#0 ]
|
||||||
zp byte:12 [ findcol::yp#0 ]
|
reg byte a [ findcol::xp#0 ]
|
||||||
|
reg byte x [ findcol::yp#0 ]
|
||||||
reg byte a [ findcol::$10 ]
|
reg byte a [ findcol::$10 ]
|
||||||
reg byte a [ findcol::$8 ]
|
reg byte a [ findcol::$8 ]
|
||||||
|
Reference in New Issue
Block a user