1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-09 22:29:35 +00:00

Several minor changes and fixes

git-svn-id: svn://svn.cc65.org/cc65/trunk@1192 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2002-03-16 14:11:15 +00:00
parent 0655cac6a6
commit 486640200b
3 changed files with 42 additions and 17 deletions

View File

@ -156,6 +156,15 @@ static void SetUseChgInfo (CodeEntry* E, const OPCDesc* D)
/* Check for special zero page registers used */
switch (E->AM) {
case AM65_ACC:
if (E->OPC == OP65_ASL || E->OPC == OP65_DEC ||
E->OPC == OP65_INC || E->OPC == OP65_LSR ||
E->OPC == OP65_ROL || E->OPC == OP65_ROR) {
/* A is changed by these insns */
E->Chg |= REG_A;
}
break;
case AM65_ZP:
case AM65_ABS:
/* Be conservative: */
@ -661,6 +670,22 @@ void CE_GenRegInfo (CodeEntry* E, RegContents* InputRegs)
if (Chg & REG_SREG_HI) {
Out->SRegHi = -1;
}
/* Quick hack for some known functions: */
if (strcmp (E->Arg, "tosandax") == 0) {
if (In->RegA == 0) {
Out->RegA = 0;
}
if (In->RegX == 0) {
Out->RegX = 0;
}
} else if (strcmp (E->Arg, "tosorax") == 0) {
if (In->RegA == 0xFF) {
Out->RegA = 0xFF;
}
if (In->RegX == 0xFF) {
Out->RegX = 0xFF;
}
}
break;
case OP65_JVC:

View File

@ -566,17 +566,17 @@ unsigned GetKnownReg (unsigned Use, const RegContents* RC)
*/
{
if ((Use & REG_A) != 0) {
return (RC && RC->RegA >= 0)? REG_A : REG_NONE;
return (RC == 0 || RC->RegA >= 0)? REG_A : REG_NONE;
} else if ((Use & REG_X) != 0) {
return (RC && RC->RegX >= 0)? REG_X : REG_NONE;
return (RC == 0 || RC->RegX >= 0)? REG_X : REG_NONE;
} else if ((Use & REG_Y) != 0) {
return (RC && RC->RegY >= 0)? REG_Y : REG_NONE;
return (RC == 0 || RC->RegY >= 0)? REG_Y : REG_NONE;
} else if ((Use & REG_TMP1) != 0) {
return (RC && RC->Tmp1 >= 0)? REG_TMP1 : REG_NONE;
return (RC == 0 || RC->Tmp1 >= 0)? REG_TMP1 : REG_NONE;
} else if ((Use & REG_SREG_LO) != 0) {
return (RC && RC->SRegLo >= 0)? REG_SREG_LO : REG_NONE;
return (RC == 0 || RC->SRegLo >= 0)? REG_SREG_LO : REG_NONE;
} else if ((Use & REG_SREG_HI) != 0) {
return (RC && RC->SRegHi >= 0)? REG_SREG_HI : REG_NONE;
return (RC == 0 || RC->SRegHi >= 0)? REG_SREG_HI : REG_NONE;
} else {
return REG_NONE;
}

View File

@ -75,8 +75,8 @@ const OPCDesc OPCTable[OPCODE_COUNT] = {
{ OP65_ASL, /* opcode */
"asl", /* mnemonic */
0, /* size */
REG_A, /* use */
REG_A, /* chg */
REG_NONE, /* use */
REG_NONE, /* chg */
OF_SETF /* flags */
},
{ OP65_BCC, /* opcode */
@ -362,8 +362,8 @@ const OPCDesc OPCTable[OPCODE_COUNT] = {
{ OP65_LSR, /* opcode */
"lsr", /* mnemonic */
0, /* size */
REG_A, /* use */
REG_A, /* chg */
REG_NONE, /* use */
REG_NONE, /* chg */
OF_SETF /* flags */
},
{ OP65_NOP, /* opcode */
@ -406,7 +406,7 @@ const OPCDesc OPCTable[OPCODE_COUNT] = {
1, /* size */
REG_Y, /* use */
REG_NONE, /* chg */
OF_NONE /* flags */
OF_NONE /* flags */
},
{ OP65_PLA, /* opcode */
"pla", /* mnemonic */
@ -439,16 +439,16 @@ const OPCDesc OPCTable[OPCODE_COUNT] = {
{ OP65_ROL, /* opcode */
"rol", /* mnemonic */
0, /* size */
REG_A, /* use */
REG_A, /* chg */
OF_SETF /* flags */
REG_NONE, /* use */
REG_NONE, /* chg */
OF_SETF /* flags */
},
{ OP65_ROR, /* opcode */
"ror", /* mnemonic */
0, /* size */
REG_A, /* use */
REG_A, /* chg */
OF_SETF /* flags */
REG_NONE, /* use */
REG_NONE, /* chg */
OF_SETF /* flags */
},
{ OP65_RTI, /* opcode */
"rti", /* mnemonic */