1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-06-03 07:29:37 +00:00

Fine-tuned the verbose of the text and the weight of the equivalence classes allocation.

This commit is contained in:
Sven Van de Velde 2023-12-05 14:09:26 +01:00
parent a4bbf1fd4f
commit 53a918025a
2 changed files with 27 additions and 3 deletions

View File

@ -185,15 +185,15 @@ public class Pass4RegistersFinalize extends Pass2Base {
int sizeBytes = variable.getType().getSizeBytes();
if(overflowToMainMem) {
if (zp + sizeBytes > 0x100) {
// Zero-page exhausted - move to main memory instead (TODO: prioritize!)
// Zero-page exhausted - move to main memory instead (TODO: prioritize!) SVEN: I AGREE
register = new Registers.RegisterMainMem(variableRef, variable.getType().getSizeBytes(), null, false);
getLog().append("Zero-page exhausted. Moving allocation to main memory " + variable.toString());
//getLog().append("Zero-page exhausted. Moving allocation to main memory " + variable.toString());
}
}
}
equivalenceClass.setRegister(register);
if(before == null || !before.equals(register.toString())) {
getLog().append("Allocated " + (before == null ? "" : ("(was " + before + ") ")) + equivalenceClass.toString());
getLog().append((before == null ? "Allocated" : "Re-allocated " + before) + " to " + equivalenceClass.toString() + " // " + registerWeights.getTotalWeight(equivalenceClass));
}
}
}

View File

@ -0,0 +1,24 @@
#pragma zp_reserve(0..1, 4..255)
__export char p = *((char*)0x400);
__export char a = *((char*)0x401);
__export char b = *((char*)0x402);
__export char r;
__export char* ptr = ((char*)p);
void main() {
ptr = (char*)calc_ptr(ptr, a);
r = r + calc(ptr, b, p);
}
char calc(char* ptr, char v, char p) {
char x, y;
for(char i=0; i<=200; i++) {
x += i + v;
}
return x+v+p;
}
char* calc_ptr(char* ptr, char i) {
return ptr+i*2;
}