mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-10-15 09:23:47 +00:00
Removed all redundant fragment ASM files.
This commit is contained in:
parent
4f30cef2d3
commit
aeba75906b
@ -8,7 +8,6 @@ import org.antlr.v4.runtime.CharStreams;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.text.NumberFormat;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -103,10 +102,12 @@ public class AsmFragmentManager {
|
|||||||
* @param log The compile log to add the output to
|
* @param log The compile log to add the output to
|
||||||
*/
|
*/
|
||||||
public static void logUsages(CompileLog log) {
|
public static void logUsages(CompileLog log) {
|
||||||
log.append("ASM FRAGMENT USAGES");
|
|
||||||
|
|
||||||
ArrayList<String> signatures = new ArrayList<>(fragmentTemplateCache.keySet());
|
ArrayList<String> signatures = new ArrayList<>(fragmentTemplateCache.keySet());
|
||||||
Collections.sort(signatures);
|
Collections.sort(signatures);
|
||||||
|
|
||||||
|
/*
|
||||||
|
log.append("ASM FRAGMENT USAGES");
|
||||||
for (String signature : signatures) {
|
for (String signature : signatures) {
|
||||||
List<AsmFragmentTemplate> templates = fragmentTemplateCache.get(signature);
|
List<AsmFragmentTemplate> templates = fragmentTemplateCache.get(signature);
|
||||||
for (AsmFragmentTemplate template : templates) {
|
for (AsmFragmentTemplate template : templates) {
|
||||||
@ -115,6 +116,34 @@ public class AsmFragmentManager {
|
|||||||
log.append(String.format("%8d", usage)+" "+template.getName());
|
log.append(String.format("%8d", usage)+" "+template.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Find all file fragments that were bested by a synthesized fragment
|
||||||
|
log.append("\nREDUNDANT ASM FRAGMENT FILES - REMOVE FROM DISK");
|
||||||
|
for (String signature : signatures) {
|
||||||
|
List<AsmFragmentTemplate> templates = fragmentTemplateCache.get(signature);
|
||||||
|
AsmFragmentTemplate fileTemplate = null;
|
||||||
|
int fileUsage = 0;
|
||||||
|
AsmFragmentTemplate maxTemplate = null;
|
||||||
|
int maxUsage = 0;
|
||||||
|
for (AsmFragmentTemplate template : templates) {
|
||||||
|
Integer usage = fragmentTemplateUsage.get(template);
|
||||||
|
if(usage==null) usage = 0;
|
||||||
|
if(template.isFile()) {
|
||||||
|
fileTemplate = template;
|
||||||
|
fileUsage = usage;
|
||||||
|
}
|
||||||
|
if(usage>maxUsage) {
|
||||||
|
maxUsage = usage;
|
||||||
|
maxTemplate = template;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(fileTemplate!=null && fileUsage==0 && maxUsage>0) {
|
||||||
|
log.append("rm "+fileTemplate.getName()+".asm #synthesized by "+maxTemplate.getName()+" - usages: "+maxUsage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public class AsmFragmentTemplate {
|
|||||||
private KickCParser.AsmLinesContext bodyAsm;
|
private KickCParser.AsmLinesContext bodyAsm;
|
||||||
|
|
||||||
/** true if the fragment was loaded from disk. */
|
/** true if the fragment was loaded from disk. */
|
||||||
boolean loaded;
|
boolean file;
|
||||||
|
|
||||||
/** The synthesis that created the fragment. null if the fragment template was loaded. */
|
/** The synthesis that created the fragment. null if the fragment template was loaded. */
|
||||||
private AsmFragmentSynthesis synthesis;
|
private AsmFragmentSynthesis synthesis;
|
||||||
@ -31,7 +31,7 @@ public class AsmFragmentTemplate {
|
|||||||
public AsmFragmentTemplate(String signature, String body) {
|
public AsmFragmentTemplate(String signature, String body) {
|
||||||
this.signature = signature;
|
this.signature = signature;
|
||||||
this.body = body;
|
this.body = body;
|
||||||
this.loaded = true;
|
this.file = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AsmFragmentTemplate(String signature, String body, AsmFragmentSynthesis synthesis, AsmFragmentTemplate subFragment) {
|
AsmFragmentTemplate(String signature, String body, AsmFragmentSynthesis synthesis, AsmFragmentTemplate subFragment) {
|
||||||
@ -39,7 +39,7 @@ public class AsmFragmentTemplate {
|
|||||||
this.body = body;
|
this.body = body;
|
||||||
this.synthesis = synthesis;
|
this.synthesis = synthesis;
|
||||||
this.subFragment = subFragment;
|
this.subFragment = subFragment;
|
||||||
this.loaded = false;
|
this.file = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -90,8 +90,8 @@ public class AsmFragmentTemplate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isLoaded() {
|
public boolean isFile() {
|
||||||
return loaded;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AsmFragmentSynthesis getSynthesis() {
|
public AsmFragmentSynthesis getSynthesis() {
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
lda #{c2}
|
|
||||||
sta {c1}
|
|
@ -1,2 +0,0 @@
|
|||||||
lda {z1}
|
|
||||||
sta {c1}
|
|
@ -1,3 +0,0 @@
|
|||||||
ldy #0
|
|
||||||
lda #{c1}
|
|
||||||
sta ({z1}),y
|
|
@ -1,3 +0,0 @@
|
|||||||
txa
|
|
||||||
ldy #0
|
|
||||||
sta ({z1}),y
|
|
@ -1,3 +0,0 @@
|
|||||||
tya
|
|
||||||
ldy #0
|
|
||||||
sta ({z1}),y
|
|
@ -1,3 +0,0 @@
|
|||||||
ldy #0
|
|
||||||
lda {z2}
|
|
||||||
sta ({z1}),y
|
|
@ -1,3 +0,0 @@
|
|||||||
tay
|
|
||||||
txa
|
|
||||||
sta {c1},y
|
|
@ -1,3 +0,0 @@
|
|||||||
tax
|
|
||||||
tya
|
|
||||||
sta {c1},x
|
|
@ -1,3 +0,0 @@
|
|||||||
tax
|
|
||||||
lda {z1}
|
|
||||||
sta {c1},x
|
|
@ -1,2 +0,0 @@
|
|||||||
lda #{c2}
|
|
||||||
sta {c1},x
|
|
@ -1,2 +0,0 @@
|
|||||||
txa
|
|
||||||
sta {c1},x
|
|
@ -1,2 +0,0 @@
|
|||||||
tya
|
|
||||||
sta {c1},x
|
|
@ -1,2 +0,0 @@
|
|||||||
lda {z1}
|
|
||||||
sta {c1},x
|
|
@ -1,2 +0,0 @@
|
|||||||
lda #{c2}
|
|
||||||
sta {c1},y
|
|
@ -1,2 +0,0 @@
|
|||||||
txa
|
|
||||||
sta {c1},y
|
|
@ -1,2 +0,0 @@
|
|||||||
tya
|
|
||||||
sta {c1},y
|
|
@ -1,2 +0,0 @@
|
|||||||
lda {z1}
|
|
||||||
sta {c1},y
|
|
@ -1,3 +0,0 @@
|
|||||||
lda #{c2}
|
|
||||||
ldx {z1}
|
|
||||||
sta {c1},x
|
|
@ -1,3 +0,0 @@
|
|||||||
txa
|
|
||||||
ldx {z1}
|
|
||||||
sta {c1},x
|
|
@ -1,3 +0,0 @@
|
|||||||
tya
|
|
||||||
ldy {z1}
|
|
||||||
sta {c1},y
|
|
@ -1,4 +0,0 @@
|
|||||||
lda #<{c1}
|
|
||||||
sta {z1}
|
|
||||||
lda #>{c1}
|
|
||||||
sta {z1}+1
|
|
@ -1,4 +0,0 @@
|
|||||||
inc {z1}
|
|
||||||
bne !+
|
|
||||||
inc {z1}+1
|
|
||||||
!:
|
|
@ -1,8 +0,0 @@
|
|||||||
lda {z1}
|
|
||||||
clc
|
|
||||||
adc #<{c1}
|
|
||||||
sta {z1}
|
|
||||||
lda {z1}+1
|
|
||||||
adc #>{c1}
|
|
||||||
sta {z1}+1
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
|||||||
lda {z2}
|
|
||||||
clc
|
|
||||||
adc #1
|
|
||||||
sta {z1}
|
|
||||||
lda {z2}+1
|
|
||||||
adc #0
|
|
||||||
sta {z1}+1
|
|
@ -1,7 +0,0 @@
|
|||||||
lda #<{c1}
|
|
||||||
clc
|
|
||||||
adc {z2}
|
|
||||||
sta {z1}
|
|
||||||
lda #>{c1}
|
|
||||||
adc {z2}+1
|
|
||||||
sta {z1}+1
|
|
@ -1,4 +0,0 @@
|
|||||||
stx $ff
|
|
||||||
tay
|
|
||||||
lda $ff
|
|
||||||
sta ({z1}),y
|
|
@ -1,4 +0,0 @@
|
|||||||
sty $ff
|
|
||||||
tay
|
|
||||||
lda $ff
|
|
||||||
sta ({z1}),y
|
|
@ -1,3 +0,0 @@
|
|||||||
tay
|
|
||||||
lda {z2}
|
|
||||||
sta ({z1}),y
|
|
@ -1,3 +0,0 @@
|
|||||||
txa
|
|
||||||
ldy #{c1}
|
|
||||||
sta ({z1}),y
|
|
@ -1,3 +0,0 @@
|
|||||||
tya
|
|
||||||
ldy #{c1}
|
|
||||||
sta ({z1}),y
|
|
@ -1,3 +0,0 @@
|
|||||||
lda {z2}
|
|
||||||
ldy #{c1}
|
|
||||||
sta ({z1}),y
|
|
@ -1,5 +0,0 @@
|
|||||||
sty $ff
|
|
||||||
txa
|
|
||||||
tay
|
|
||||||
lda $ff
|
|
||||||
sta ({z1}),y
|
|
@ -1,2 +0,0 @@
|
|||||||
lda {z2}
|
|
||||||
sta ({z1}),y
|
|
@ -1,3 +0,0 @@
|
|||||||
ldy {z2}
|
|
||||||
txa
|
|
||||||
sta ({z1}),y
|
|
@ -1,3 +0,0 @@
|
|||||||
tya
|
|
||||||
ldy {z2}
|
|
||||||
sta ({z1}),y
|
|
@ -1,3 +0,0 @@
|
|||||||
lda {z3}
|
|
||||||
ldy {z2}
|
|
||||||
sta ({z1}),y
|
|
@ -1 +0,0 @@
|
|||||||
txa
|
|
@ -1 +0,0 @@
|
|||||||
tya
|
|
@ -1 +0,0 @@
|
|||||||
dex
|
|
@ -1 +0,0 @@
|
|||||||
inx
|
|
@ -1 +0,0 @@
|
|||||||
dey
|
|
@ -1 +0,0 @@
|
|||||||
iny
|
|
@ -1 +0,0 @@
|
|||||||
txa
|
|
@ -1 +0,0 @@
|
|||||||
tya
|
|
@ -1,2 +0,0 @@
|
|||||||
sec
|
|
||||||
sbc #1
|
|
@ -1,3 +0,0 @@
|
|||||||
lda {c1},y
|
|
||||||
ldy #0
|
|
||||||
ora ({z1}),y
|
|
@ -1,2 +0,0 @@
|
|||||||
clc
|
|
||||||
adc #1
|
|
@ -1,3 +0,0 @@
|
|||||||
txa
|
|
||||||
clc
|
|
||||||
adc #1
|
|
@ -1,3 +0,0 @@
|
|||||||
tya
|
|
||||||
clc
|
|
||||||
adc #1
|
|
@ -1,3 +0,0 @@
|
|||||||
lda {z1}
|
|
||||||
clc
|
|
||||||
adc #1
|
|
@ -1,2 +0,0 @@
|
|||||||
tax
|
|
||||||
lda {c1},x
|
|
@ -1,2 +0,0 @@
|
|||||||
ldx {z1}
|
|
||||||
lda {c1},x
|
|
@ -1,2 +0,0 @@
|
|||||||
tay
|
|
||||||
lda ({z1}),y
|
|
@ -1,2 +0,0 @@
|
|||||||
ldy {z2}
|
|
||||||
lda ({z1}),y
|
|
@ -1,4 +0,0 @@
|
|||||||
stx $ff
|
|
||||||
lda #{c1}
|
|
||||||
sec
|
|
||||||
sbc $ff
|
|
@ -1,4 +0,0 @@
|
|||||||
sty $ff
|
|
||||||
lda #{c1}
|
|
||||||
sec
|
|
||||||
sbc $ff
|
|
@ -1,3 +0,0 @@
|
|||||||
lda {z1}
|
|
||||||
clc
|
|
||||||
adc #{c1}
|
|
@ -1,2 +0,0 @@
|
|||||||
stx $ff
|
|
||||||
ora $ff
|
|
@ -1,3 +0,0 @@
|
|||||||
txa
|
|
||||||
sec
|
|
||||||
sbc #{c1}
|
|
@ -1,4 +0,0 @@
|
|||||||
txa
|
|
||||||
sty $ff
|
|
||||||
sec
|
|
||||||
sbc $ff
|
|
@ -1,3 +0,0 @@
|
|||||||
txa
|
|
||||||
sec
|
|
||||||
sbc {z1}
|
|
@ -1,3 +0,0 @@
|
|||||||
stx $ff
|
|
||||||
clc
|
|
||||||
adc $ff
|
|
@ -1,3 +0,0 @@
|
|||||||
txa
|
|
||||||
clc
|
|
||||||
adc #{c1}
|
|
@ -1,4 +0,0 @@
|
|||||||
stx $ff
|
|
||||||
tya
|
|
||||||
clc
|
|
||||||
adc $ff
|
|
@ -1,3 +0,0 @@
|
|||||||
txa
|
|
||||||
clc
|
|
||||||
adc {z1}
|
|
@ -1,3 +0,0 @@
|
|||||||
txa
|
|
||||||
lsr
|
|
||||||
lsr
|
|
@ -1,2 +0,0 @@
|
|||||||
sty $ff
|
|
||||||
ora $ff
|
|
@ -1,3 +0,0 @@
|
|||||||
tya
|
|
||||||
sec
|
|
||||||
sbc #{c1}
|
|
@ -1,4 +0,0 @@
|
|||||||
tya
|
|
||||||
stx $ff
|
|
||||||
sec
|
|
||||||
sbc $ff
|
|
@ -1,3 +0,0 @@
|
|||||||
tya
|
|
||||||
sec
|
|
||||||
sbc {z1}
|
|
@ -1,3 +0,0 @@
|
|||||||
sty $ff
|
|
||||||
clc
|
|
||||||
adc $ff
|
|
@ -1,3 +0,0 @@
|
|||||||
tya
|
|
||||||
clc
|
|
||||||
adc #{c1}
|
|
@ -1,4 +0,0 @@
|
|||||||
sty $ff
|
|
||||||
txa
|
|
||||||
clc
|
|
||||||
adc $ff
|
|
@ -1,3 +0,0 @@
|
|||||||
tya
|
|
||||||
clc
|
|
||||||
adc {z1}
|
|
@ -1,3 +0,0 @@
|
|||||||
tya
|
|
||||||
lsr
|
|
||||||
lsr
|
|
@ -1,4 +0,0 @@
|
|||||||
stx $ff
|
|
||||||
lda {z1}
|
|
||||||
sec
|
|
||||||
sbc $ff
|
|
@ -1,4 +0,0 @@
|
|||||||
sty $ff
|
|
||||||
lda {z1}
|
|
||||||
sec
|
|
||||||
sbc $ff
|
|
@ -1,3 +0,0 @@
|
|||||||
lda {z1}
|
|
||||||
sec
|
|
||||||
sbc {z2}
|
|
@ -1,3 +0,0 @@
|
|||||||
lda {z1}
|
|
||||||
clc
|
|
||||||
adc #1
|
|
@ -1,2 +0,0 @@
|
|||||||
clc
|
|
||||||
adc {z1}
|
|
@ -1,3 +0,0 @@
|
|||||||
lda {z1}
|
|
||||||
clc
|
|
||||||
adc #{c1}
|
|
@ -1,3 +0,0 @@
|
|||||||
txa
|
|
||||||
clc
|
|
||||||
adc {z1}
|
|
@ -1,3 +0,0 @@
|
|||||||
tya
|
|
||||||
clc
|
|
||||||
adc {z1}
|
|
@ -1,3 +0,0 @@
|
|||||||
lda {z1}
|
|
||||||
clc
|
|
||||||
adc {z2}
|
|
@ -1,3 +0,0 @@
|
|||||||
lda {z1}
|
|
||||||
lsr
|
|
||||||
lsr
|
|
@ -1 +0,0 @@
|
|||||||
tax
|
|
@ -1,2 +0,0 @@
|
|||||||
sty $ff
|
|
||||||
ldx $ff
|
|
@ -1,3 +0,0 @@
|
|||||||
ldy #0
|
|
||||||
lda ({z1}),y
|
|
||||||
tax
|
|
@ -1,3 +0,0 @@
|
|||||||
sty $ff
|
|
||||||
ldx $ff
|
|
||||||
inx
|
|
@ -1 +0,0 @@
|
|||||||
tay
|
|
@ -1,2 +0,0 @@
|
|||||||
stx $ff
|
|
||||||
ldy $ff
|
|
@ -1,3 +0,0 @@
|
|||||||
stx $ff
|
|
||||||
ldy $ff
|
|
||||||
iny
|
|
@ -1,3 +0,0 @@
|
|||||||
sty $ff
|
|
||||||
cpx $ff
|
|
||||||
bne {la1}
|
|
@ -1,2 +0,0 @@
|
|||||||
sta {z1}
|
|
||||||
inc {z1}
|
|
@ -1,3 +0,0 @@
|
|||||||
lda {z2}
|
|
||||||
sta {z1}
|
|
||||||
inc {z1}
|
|
@ -1,3 +0,0 @@
|
|||||||
ldy {z3}
|
|
||||||
lda ({z2}),y
|
|
||||||
sta {z1}
|
|
@ -1,4 +0,0 @@
|
|||||||
txa
|
|
||||||
lsr
|
|
||||||
lsr
|
|
||||||
sta {z1}
|
|
@ -1,5 +0,0 @@
|
|||||||
sta $ff
|
|
||||||
lda {z1}
|
|
||||||
sec
|
|
||||||
sbc $ff
|
|
||||||
sta {z1}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user