Remove some 65C02 code generation that is now in the backend.

git-svn-id: svn://svn.cc65.org/cc65/trunk@1057 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2001-10-18 19:10:24 +00:00
parent 43530d1604
commit 86a90e463d

View File

@@ -719,12 +719,8 @@ void g_getlocal (unsigned flags, int offs)
case CF_CHAR: case CF_CHAR:
if ((flags & CF_FORCECHAR) || (flags & CF_TEST)) { if ((flags & CF_FORCECHAR) || (flags & CF_TEST)) {
if (CPU == CPU_65C02 && offs == 0) { ldyconst (offs);
AddCodeLine ("lda (sp)"); AddCodeLine ("lda (sp),y");
} else {
ldyconst (offs);
AddCodeLine ("lda (sp),y");
}
} else { } else {
ldyconst (offs); ldyconst (offs);
AddCodeLine ("ldx #$00"); AddCodeLine ("ldx #$00");
@@ -881,12 +877,8 @@ void g_leavariadic (int Offs)
CheckLocalOffs (ArgSizeOffs); CheckLocalOffs (ArgSizeOffs);
/* Get the size of all parameters. */ /* Get the size of all parameters. */
if (ArgSizeOffs == 0 && CPU == CPU_65C02) { ldyconst (ArgSizeOffs);
AddCodeLine ("lda (sp)"); AddCodeLine ("lda (sp),y");
} else {
ldyconst (ArgSizeOffs);
AddCodeLine ("lda (sp),y");
}
/* Add the value of the stackpointer */ /* Add the value of the stackpointer */
if (CodeSizeFactor > 250) { if (CodeSizeFactor > 250) {
@@ -963,12 +955,8 @@ void g_putlocal (unsigned Flags, int Offs, long Val)
if (Flags & CF_CONST) { if (Flags & CF_CONST) {
AddCodeLine ("lda #$%02X", (unsigned char) Val); AddCodeLine ("lda #$%02X", (unsigned char) Val);
} }
if (CPU == CPU_65C02 && Offs == 0) { ldyconst (Offs);
AddCodeLine ("sta (sp)"); AddCodeLine ("sta (sp),y");
} else {
ldyconst (Offs);
AddCodeLine ("sta (sp),y");
}
break; break;
case CF_INT: case CF_INT:
@@ -980,37 +968,25 @@ void g_putlocal (unsigned Flags, int Offs, long Val)
/* Place high byte into X */ /* Place high byte into X */
AddCodeLine ("tax"); AddCodeLine ("tax");
} }
if (CPU == CPU_65C02 && Offs == 0) { if ((Val & 0xFF) == Offs+1) {
AddCodeLine ("lda #$%02X", (unsigned char) Val); /* The value we need is already in Y */
AddCodeLine ("sta (sp)"); AddCodeLine ("tya");
AddCodeLine ("dey");
} else { } else {
if ((Val & 0xFF) == Offs+1) { AddCodeLine ("dey");
/* The value we need is already in Y */ AddCodeLine ("lda #$%02X", (unsigned char) Val);
AddCodeLine ("tya");
AddCodeLine ("dey");
} else {
AddCodeLine ("dey");
AddCodeLine ("lda #$%02X", (unsigned char) Val);
}
AddCodeLine ("sta (sp),y");
} }
AddCodeLine ("sta (sp),y");
} else { } else {
if ((Flags & CF_NOKEEP) == 0 || CodeSizeFactor < 160) { if ((Flags & CF_NOKEEP) == 0 || CodeSizeFactor < 160) {
ldyconst (Offs); ldyconst (Offs);
AddCodeLine ("jsr staxysp"); AddCodeLine ("jsr staxysp");
} else { } else {
if (CPU == CPU_65C02 && Offs == 0) { ldyconst (Offs);
AddCodeLine ("sta (sp)"); AddCodeLine ("sta (sp),y");
ldyconst (1); AddCodeLine ("iny");
AddCodeLine ("txa"); AddCodeLine ("txa");
AddCodeLine ("sta (sp),y"); AddCodeLine ("sta (sp),y");
} else {
ldyconst (Offs);
AddCodeLine ("sta (sp),y");
AddCodeLine ("iny");
AddCodeLine ("txa");
AddCodeLine ("sta (sp),y");
}
} }
} }
break; break;
@@ -3078,7 +3054,7 @@ void g_inc (unsigned flags, unsigned long val)
if (flags & CF_FORCECHAR) { if (flags & CF_FORCECHAR) {
if (CPU == CPU_65C02 && val <= 2) { if (CPU == CPU_65C02 && val <= 2) {
while (val--) { while (val--) {
AddCodeLine ("ina"); AddCodeLine ("ina");
} }
} else { } else {
AddCodeLine ("clc"); AddCodeLine ("clc");
@@ -3107,14 +3083,14 @@ void g_inc (unsigned flags, unsigned long val)
} }
} else { } else {
/* Inline the code */ /* Inline the code */
if (val < 0x300) { if (val <= 0x300) {
if ((val & 0xFF) != 0) { if ((val & 0xFF) != 0) {
unsigned L = GetLocalLabel(); unsigned L = GetLocalLabel();
AddCodeLine ("clc"); AddCodeLine ("clc");
AddCodeLine ("adc #$%02X", (unsigned char) val); AddCodeLine ("adc #$%02X", (unsigned char) val);
AddCodeLine ("bcc %s", LocalLabelName (L)); AddCodeLine ("bcc %s", LocalLabelName (L));
AddCodeLine ("inx"); AddCodeLine ("inx");
g_defcodelabel (L); g_defcodelabel (L);
} }
if (val >= 0x100) { if (val >= 0x100) {
AddCodeLine ("inx"); AddCodeLine ("inx");
@@ -3122,6 +3098,9 @@ void g_inc (unsigned flags, unsigned long val)
if (val >= 0x200) { if (val >= 0x200) {
AddCodeLine ("inx"); AddCodeLine ("inx");
} }
if (val >= 0x300) {
AddCodeLine ("inx");
}
} else { } else {
AddCodeLine ("clc"); AddCodeLine ("clc");
if ((val & 0xFF) != 0) { if ((val & 0xFF) != 0) {