mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-16 21:07:56 +00:00
Removed special small number handling.
This commit is contained in:
parent
be74ec1b9e
commit
d6d1250f51
414
src/main/fragment/cache/fragment-cache-mos6502x.asm
vendored
414
src/main/fragment/cache/fragment-cache-mos6502x.asm
vendored
@ -9627,6 +9627,210 @@ lsr {z1}+1
|
||||
ror {z1}
|
||||
lsr {z1}+1
|
||||
ror {z1}
|
||||
//FRAGMENT vbum1=vbum2
|
||||
lda {m2}
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbum2_plus_vbum3
|
||||
lda {m2}
|
||||
clc
|
||||
adc {m3}
|
||||
sta {m1}
|
||||
//FRAGMENT pbuc1_derefidx_vbum1=vbum2
|
||||
lda {m2}
|
||||
ldy {m1}
|
||||
sta {c1},y
|
||||
//FRAGMENT vbum1=vbuaa
|
||||
sta {m1}
|
||||
//FRAGMENT vbuaa=vbum1
|
||||
lda {m1}
|
||||
//FRAGMENT vbuxx=vbum1
|
||||
ldx {m1}
|
||||
//FRAGMENT vbum1=vbuaa_plus_vbum2
|
||||
clc
|
||||
adc {m2}
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuxx_plus_vbum2
|
||||
txa
|
||||
clc
|
||||
adc {m2}
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuyy_plus_vbum2
|
||||
tya
|
||||
clc
|
||||
adc {m2}
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbum2_plus_vbuaa
|
||||
clc
|
||||
adc {m2}
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuaa_plus_vbuaa
|
||||
asl
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuxx_plus_vbuaa
|
||||
stx $ff
|
||||
clc
|
||||
adc $ff
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuyy_plus_vbuaa
|
||||
sty $ff
|
||||
clc
|
||||
adc $ff
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbum2_plus_vbuxx
|
||||
txa
|
||||
clc
|
||||
adc {m2}
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuaa_plus_vbuxx
|
||||
stx $ff
|
||||
clc
|
||||
adc $ff
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuxx_plus_vbuxx
|
||||
txa
|
||||
asl
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuyy_plus_vbuxx
|
||||
txa
|
||||
sty $ff
|
||||
clc
|
||||
adc $ff
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbum2_plus_vbuyy
|
||||
tya
|
||||
clc
|
||||
adc {m2}
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuaa_plus_vbuyy
|
||||
sty $ff
|
||||
clc
|
||||
adc $ff
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuxx_plus_vbuyy
|
||||
txa
|
||||
sty $ff
|
||||
clc
|
||||
adc $ff
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuyy_plus_vbuyy
|
||||
tya
|
||||
asl
|
||||
sta {m1}
|
||||
//FRAGMENT vbuaa=vbum1_plus_vbum2
|
||||
lda {m1}
|
||||
clc
|
||||
adc {m2}
|
||||
//FRAGMENT vbuaa=vbuaa_plus_vbum1
|
||||
clc
|
||||
adc {m1}
|
||||
//FRAGMENT vbuaa=vbuxx_plus_vbum1
|
||||
txa
|
||||
clc
|
||||
adc {m1}
|
||||
//FRAGMENT vbuaa=vbuyy_plus_vbum1
|
||||
tya
|
||||
clc
|
||||
adc {m1}
|
||||
//FRAGMENT vbuaa=vbum1_plus_vbuaa
|
||||
clc
|
||||
adc {m1}
|
||||
//FRAGMENT vbuaa=vbum1_plus_vbuxx
|
||||
txa
|
||||
clc
|
||||
adc {m1}
|
||||
//FRAGMENT vbuaa=vbum1_plus_vbuyy
|
||||
tya
|
||||
clc
|
||||
adc {m1}
|
||||
//FRAGMENT vbuxx=vbum1_plus_vbum2
|
||||
lda {m1}
|
||||
clc
|
||||
adc {m2}
|
||||
tax
|
||||
//FRAGMENT vbuxx=vbuaa_plus_vbum1
|
||||
clc
|
||||
adc {m1}
|
||||
tax
|
||||
//FRAGMENT vbuxx=vbuxx_plus_vbum1
|
||||
txa
|
||||
clc
|
||||
adc {m1}
|
||||
tax
|
||||
//FRAGMENT vbuxx=vbuyy_plus_vbum1
|
||||
tya
|
||||
clc
|
||||
adc {m1}
|
||||
tax
|
||||
//FRAGMENT vbuxx=vbum1_plus_vbuaa
|
||||
clc
|
||||
adc {m1}
|
||||
tax
|
||||
//FRAGMENT vbuxx=vbum1_plus_vbuxx
|
||||
txa
|
||||
clc
|
||||
adc {m1}
|
||||
tax
|
||||
//FRAGMENT vbuxx=vbum1_plus_vbuyy
|
||||
tya
|
||||
clc
|
||||
adc {m1}
|
||||
tax
|
||||
//FRAGMENT vbuyy=vbum1_plus_vbum2
|
||||
lda {m1}
|
||||
clc
|
||||
adc {m2}
|
||||
tay
|
||||
//FRAGMENT vbuyy=vbuaa_plus_vbum1
|
||||
clc
|
||||
adc {m1}
|
||||
tay
|
||||
//FRAGMENT vbuyy=vbuxx_plus_vbum1
|
||||
txa
|
||||
clc
|
||||
adc {m1}
|
||||
tay
|
||||
//FRAGMENT vbuyy=vbuyy_plus_vbum1
|
||||
tya
|
||||
clc
|
||||
adc {m1}
|
||||
tay
|
||||
//FRAGMENT vbuyy=vbum1_plus_vbuaa
|
||||
clc
|
||||
adc {m1}
|
||||
tay
|
||||
//FRAGMENT vbuyy=vbum1_plus_vbuxx
|
||||
txa
|
||||
clc
|
||||
adc {m1}
|
||||
tay
|
||||
//FRAGMENT vbuyy=vbum1_plus_vbuyy
|
||||
tya
|
||||
clc
|
||||
adc {m1}
|
||||
tay
|
||||
//FRAGMENT pbuc1_derefidx_vbuxx=vbum1
|
||||
lda {m1}
|
||||
sta {c1},x
|
||||
//FRAGMENT pbuc1_derefidx_vbuyy=vbum1
|
||||
lda {m1}
|
||||
sta {c1},y
|
||||
//FRAGMENT pbuc1_derefidx_vbum1=vbuaa
|
||||
ldy {m1}
|
||||
sta {c1},y
|
||||
//FRAGMENT vbum1=vbuxx
|
||||
stx {m1}
|
||||
//FRAGMENT vbuyy=vbum1
|
||||
ldy {m1}
|
||||
//FRAGMENT vbum1=vbuyy
|
||||
sty {m1}
|
||||
//FRAGMENT pbuc1_derefidx_vbum1=vbuxx
|
||||
ldy {m1}
|
||||
txa
|
||||
sta {c1},y
|
||||
//FRAGMENT pbuc1_derefidx_vbum1=vbuyy
|
||||
tya
|
||||
ldy {m1}
|
||||
sta {c1},y
|
||||
//FRAGMENT vbuz1=_deref_pbuc1_bxor_vbuc2
|
||||
lda #{c2}
|
||||
eor {c1}
|
||||
@ -10318,15 +10522,6 @@ sta ({z1}),y
|
||||
lda #{c2}
|
||||
ldy {m1}
|
||||
sta {c1},y
|
||||
//FRAGMENT vbuz1=vbum2
|
||||
lda {m2}
|
||||
sta {z1}
|
||||
//FRAGMENT vbuaa=vbum1
|
||||
lda {m1}
|
||||
//FRAGMENT vbuxx=vbum1
|
||||
ldx {m1}
|
||||
//FRAGMENT vbuyy=vbum1
|
||||
ldy {m1}
|
||||
//FRAGMENT qbuc1_derefidx_vbuz1=pbuc2
|
||||
ldy {z1}
|
||||
lda #<{c2}
|
||||
@ -11535,12 +11730,6 @@ sta {m1}
|
||||
tay
|
||||
lda {m1}
|
||||
sta {c1},y
|
||||
//FRAGMENT pbuc1_derefidx_vbuxx=vbum1
|
||||
lda {m1}
|
||||
sta {c1},x
|
||||
//FRAGMENT pbuc1_derefidx_vbuyy=vbum1
|
||||
lda {m1}
|
||||
sta {c1},y
|
||||
//FRAGMENT vbum1=vbum1_plus_vbuxx
|
||||
txa
|
||||
clc
|
||||
@ -11588,6 +11777,9 @@ sta {m1}
|
||||
bcc !+
|
||||
inc {m1}+1
|
||||
!:
|
||||
//FRAGMENT vbuz1=vbum2
|
||||
lda {m2}
|
||||
sta {z1}
|
||||
//FRAGMENT vwsz1=vwsz1_plus_vbsz2
|
||||
lda {z2}
|
||||
pha
|
||||
@ -13629,9 +13821,6 @@ adc #1
|
||||
//FRAGMENT 0_neq_vbsyy_then_la1
|
||||
cpy #0
|
||||
bne {la1}
|
||||
//FRAGMENT vbum1=vbum2
|
||||
lda {m2}
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbum1_plus_vbuc1
|
||||
lax {m1}
|
||||
axs #-[{c1}]
|
||||
@ -13654,192 +13843,3 @@ sta {c1},x
|
||||
lda #{c2}
|
||||
ora {c1},y
|
||||
sta {c1},y
|
||||
//FRAGMENT vbum1=vbum2_plus_vbum3
|
||||
lda {m2}
|
||||
clc
|
||||
adc {m3}
|
||||
sta {m1}
|
||||
//FRAGMENT pbuc1_derefidx_vbum1=vbum2
|
||||
lda {m2}
|
||||
ldy {m1}
|
||||
sta {c1},y
|
||||
//FRAGMENT vbum1=vbuaa
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuaa_plus_vbum2
|
||||
clc
|
||||
adc {m2}
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuxx_plus_vbum2
|
||||
txa
|
||||
clc
|
||||
adc {m2}
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuyy_plus_vbum2
|
||||
tya
|
||||
clc
|
||||
adc {m2}
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbum2_plus_vbuaa
|
||||
clc
|
||||
adc {m2}
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuaa_plus_vbuaa
|
||||
asl
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuxx_plus_vbuaa
|
||||
stx $ff
|
||||
clc
|
||||
adc $ff
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuyy_plus_vbuaa
|
||||
sty $ff
|
||||
clc
|
||||
adc $ff
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbum2_plus_vbuxx
|
||||
txa
|
||||
clc
|
||||
adc {m2}
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuaa_plus_vbuxx
|
||||
stx $ff
|
||||
clc
|
||||
adc $ff
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuxx_plus_vbuxx
|
||||
txa
|
||||
asl
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuyy_plus_vbuxx
|
||||
txa
|
||||
sty $ff
|
||||
clc
|
||||
adc $ff
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbum2_plus_vbuyy
|
||||
tya
|
||||
clc
|
||||
adc {m2}
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuaa_plus_vbuyy
|
||||
sty $ff
|
||||
clc
|
||||
adc $ff
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuxx_plus_vbuyy
|
||||
txa
|
||||
sty $ff
|
||||
clc
|
||||
adc $ff
|
||||
sta {m1}
|
||||
//FRAGMENT vbum1=vbuyy_plus_vbuyy
|
||||
tya
|
||||
asl
|
||||
sta {m1}
|
||||
//FRAGMENT vbuaa=vbum1_plus_vbum2
|
||||
lda {m1}
|
||||
clc
|
||||
adc {m2}
|
||||
//FRAGMENT vbuaa=vbuaa_plus_vbum1
|
||||
clc
|
||||
adc {m1}
|
||||
//FRAGMENT vbuaa=vbuxx_plus_vbum1
|
||||
txa
|
||||
clc
|
||||
adc {m1}
|
||||
//FRAGMENT vbuaa=vbuyy_plus_vbum1
|
||||
tya
|
||||
clc
|
||||
adc {m1}
|
||||
//FRAGMENT vbuaa=vbum1_plus_vbuaa
|
||||
clc
|
||||
adc {m1}
|
||||
//FRAGMENT vbuaa=vbum1_plus_vbuxx
|
||||
txa
|
||||
clc
|
||||
adc {m1}
|
||||
//FRAGMENT vbuaa=vbum1_plus_vbuyy
|
||||
tya
|
||||
clc
|
||||
adc {m1}
|
||||
//FRAGMENT vbuxx=vbum1_plus_vbum2
|
||||
lda {m1}
|
||||
clc
|
||||
adc {m2}
|
||||
tax
|
||||
//FRAGMENT vbuxx=vbuaa_plus_vbum1
|
||||
clc
|
||||
adc {m1}
|
||||
tax
|
||||
//FRAGMENT vbuxx=vbuxx_plus_vbum1
|
||||
txa
|
||||
clc
|
||||
adc {m1}
|
||||
tax
|
||||
//FRAGMENT vbuxx=vbuyy_plus_vbum1
|
||||
tya
|
||||
clc
|
||||
adc {m1}
|
||||
tax
|
||||
//FRAGMENT vbuxx=vbum1_plus_vbuaa
|
||||
clc
|
||||
adc {m1}
|
||||
tax
|
||||
//FRAGMENT vbuxx=vbum1_plus_vbuxx
|
||||
txa
|
||||
clc
|
||||
adc {m1}
|
||||
tax
|
||||
//FRAGMENT vbuxx=vbum1_plus_vbuyy
|
||||
tya
|
||||
clc
|
||||
adc {m1}
|
||||
tax
|
||||
//FRAGMENT vbuyy=vbum1_plus_vbum2
|
||||
lda {m1}
|
||||
clc
|
||||
adc {m2}
|
||||
tay
|
||||
//FRAGMENT vbuyy=vbuaa_plus_vbum1
|
||||
clc
|
||||
adc {m1}
|
||||
tay
|
||||
//FRAGMENT vbuyy=vbuxx_plus_vbum1
|
||||
txa
|
||||
clc
|
||||
adc {m1}
|
||||
tay
|
||||
//FRAGMENT vbuyy=vbuyy_plus_vbum1
|
||||
tya
|
||||
clc
|
||||
adc {m1}
|
||||
tay
|
||||
//FRAGMENT vbuyy=vbum1_plus_vbuaa
|
||||
clc
|
||||
adc {m1}
|
||||
tay
|
||||
//FRAGMENT vbuyy=vbum1_plus_vbuxx
|
||||
txa
|
||||
clc
|
||||
adc {m1}
|
||||
tay
|
||||
//FRAGMENT vbuyy=vbum1_plus_vbuyy
|
||||
tya
|
||||
clc
|
||||
adc {m1}
|
||||
tay
|
||||
//FRAGMENT pbuc1_derefidx_vbum1=vbuaa
|
||||
ldy {m1}
|
||||
sta {c1},y
|
||||
//FRAGMENT vbum1=vbuxx
|
||||
stx {m1}
|
||||
//FRAGMENT vbum1=vbuyy
|
||||
sty {m1}
|
||||
//FRAGMENT pbuc1_derefidx_vbum1=vbuxx
|
||||
ldy {m1}
|
||||
txa
|
||||
sta {c1},y
|
||||
//FRAGMENT pbuc1_derefidx_vbum1=vbuyy
|
||||
tya
|
||||
ldy {m1}
|
||||
sta {c1},y
|
||||
|
@ -250,38 +250,15 @@ public class AsmFormat {
|
||||
getAsmConstant(program, operand, operator.getPrecedence(), codeScope);
|
||||
}
|
||||
}
|
||||
|
||||
/** String format for all numbers < $100 for speeding up the compilation. */
|
||||
private static String SHORT_ASM_NUMBERS[] = {
|
||||
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "$a", "$b", "$c", "$d", "$e", "$f",
|
||||
"$10", "$11", "$12", "$13", "$14", "$15", "$16", "$17", "$18", "$19", "$1a", "$1b", "$1c", "$1d", "$1e", "$1f",
|
||||
"$20", "$21", "$22", "$23", "$24", "$25", "$26", "$27", "$28", "$29", "$2a", "$2b", "$2c", "$2d", "$2e", "$2f",
|
||||
"$30", "$31", "$32", "$33", "$34", "$35", "$36", "$37", "$38", "$39", "$3a", "$3b", "$3c", "$3d", "$3e", "$3f",
|
||||
"$40", "$41", "$42", "$43", "$44", "$45", "$46", "$47", "$48", "$49", "$4a", "$4b", "$4c", "$4d", "$4e", "$4f",
|
||||
"$50", "$51", "$52", "$53", "$54", "$55", "$56", "$57", "$58", "$59", "$5a", "$5b", "$5c", "$5d", "$5e", "$5f",
|
||||
"$60", "$61", "$62", "$63", "$64", "$65", "$66", "$67", "$68", "$69", "$6a", "$6b", "$6c", "$6d", "$6e", "$6f",
|
||||
"$70", "$71", "$72", "$73", "$74", "$75", "$76", "$77", "$78", "$79", "$7a", "$7b", "$7c", "$7d", "$7e", "$7f",
|
||||
"$80", "$81", "$82", "$83", "$84", "$85", "$86", "$87", "$88", "$89", "$8a", "$8b", "$8c", "$8d", "$8e", "$8f",
|
||||
"$90", "$91", "$92", "$93", "$94", "$95", "$96", "$97", "$98", "$99", "$9a", "$9b", "$9c", "$9d", "$9e", "$9f",
|
||||
"$a0", "$a1", "$a2", "$a3", "$a4", "$a5", "$a6", "$a7", "$a8", "$a9", "$aa", "$ab", "$ac", "$ad", "$ae", "$af",
|
||||
"$b0", "$b1", "$b2", "$b3", "$b4", "$b5", "$b6", "$b7", "$b8", "$b9", "$ba", "$bb", "$bc", "$bd", "$be", "$bf",
|
||||
"$c0", "$c1", "$c2", "$c3", "$c4", "$c5", "$c6", "$c7", "$c8", "$c9", "$ca", "$cb", "$cc", "$cd", "$ce", "$cf",
|
||||
"$d0", "$d1", "$d2", "$d3", "$d4", "$d5", "$d6", "$d7", "$d8", "$d9", "$da", "$db", "$dc", "$dd", "$de", "$df",
|
||||
"$e0", "$e1", "$e2", "$e3", "$e4", "$e5", "$e6", "$e7", "$e8", "$e9", "$ea", "$eb", "$ec", "$ed", "$ee", "$ef",
|
||||
"$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7", "$f8", "$f9", "$fa", "$fb", "$fc", "$fd", "$fe", "$ff"
|
||||
};
|
||||
|
||||
|
||||
public static String getAsmNumber(Number number) {
|
||||
if(number instanceof Long || number instanceof Integer) {
|
||||
// Use cached small numbers. */
|
||||
if(number.longValue() >= 0L && number.longValue() <= 255L) {
|
||||
return SHORT_ASM_NUMBERS[number.intValue()];
|
||||
if(number.longValue() < 0) {
|
||||
return "-" + getAsmNumber(-number.longValue());
|
||||
} else if(number.longValue()<10){
|
||||
return String.format("%d", number.longValue());
|
||||
} else {
|
||||
if(number.longValue() < 0) {
|
||||
return "-" + getAsmNumber(-number.longValue());
|
||||
} else {
|
||||
return String.format("$%x", number.longValue());
|
||||
}
|
||||
return String.format("$%x", number.longValue());
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("Unsupported number type " + number);
|
||||
@ -312,8 +289,8 @@ public class AsmFormat {
|
||||
public static String getAsmSymbolName(Program program, Symbol symbol, ScopeRef codeScopeRef) {
|
||||
ScopeRef symbolScopeRef = symbol.getScope().getRef();
|
||||
String asmName = symbol.getLocalName();
|
||||
if(symbol instanceof Variable && ((Variable) symbol).getAsmName()!=null)
|
||||
asmName = ((Variable) symbol).getAsmName();
|
||||
if(symbol instanceof Variable && ((Variable) symbol).getAsmName() != null)
|
||||
asmName = ((Variable) symbol).getAsmName();
|
||||
if(!symbolScopeRef.equals(codeScopeRef)) {
|
||||
if(symbolScopeRef.getFullName().length() > 0)
|
||||
// Reference to symbol in another scope
|
||||
@ -321,9 +298,9 @@ public class AsmFormat {
|
||||
else {
|
||||
// Check if the local code scope has a symbol with the same name
|
||||
final Scope codeScope = program.getScope().getScope(codeScopeRef);
|
||||
if(codeScope.getLocalSymbol(symbol.getLocalName())!=null)
|
||||
if(codeScope.getLocalSymbol(symbol.getLocalName()) != null)
|
||||
// Explicit reference to global symbol
|
||||
return "@"+asmFix(asmName);
|
||||
return "@" + asmFix(asmName);
|
||||
else
|
||||
// Implicit reference to global symbol
|
||||
return asmFix(asmName);
|
||||
|
Loading…
Reference in New Issue
Block a user