Re-added register variables.
Changed/added several optimizer steps to detect register variables correctly or to handle them in a special way. git-svn-id: svn://svn.cc65.org/cc65/trunk@1636 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -132,9 +132,9 @@ static const char* GetLabelName (unsigned Flags, unsigned long Label, long Offs)
|
||||
break;
|
||||
|
||||
default:
|
||||
Internal ("Invalid address flags");
|
||||
Internal ("Invalid address flags: %04X", Flags);
|
||||
}
|
||||
|
||||
|
||||
/* Return a pointer to the static buffer */
|
||||
return Buf;
|
||||
}
|
||||
@@ -485,11 +485,51 @@ void g_leave (void)
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Register variables */
|
||||
/* Register variables */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
void g_swap_regvars (int StackOffs, int RegOffs, unsigned Bytes)
|
||||
/* Swap a register variable with a location on the stack */
|
||||
{
|
||||
/* Calculate the actual stack offset and check it */
|
||||
StackOffs -= oursp;
|
||||
CheckLocalOffs (StackOffs);
|
||||
|
||||
/* Generate code */
|
||||
if (Bytes == 1) {
|
||||
|
||||
if (CodeSizeFactor < 165) {
|
||||
ldyconst (StackOffs);
|
||||
ldxconst (RegOffs);
|
||||
AddCodeLine ("jsr regswap1");
|
||||
} else {
|
||||
ldyconst (StackOffs);
|
||||
AddCodeLine ("lda (sp),y");
|
||||
AddCodeLine ("ldx regbank%+d", RegOffs);
|
||||
AddCodeLine ("sta regbank%+d", RegOffs);
|
||||
AddCodeLine ("txa");
|
||||
AddCodeLine ("sta (sp),y");
|
||||
}
|
||||
|
||||
} else if (Bytes == 2) {
|
||||
|
||||
ldyconst (StackOffs);
|
||||
ldxconst (RegOffs);
|
||||
AddCodeLine ("jsr regswap2");
|
||||
|
||||
} else {
|
||||
|
||||
ldyconst (StackOffs);
|
||||
ldxconst (RegOffs);
|
||||
ldaconst (Bytes);
|
||||
AddCodeLine ("jsr regswap");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void g_save_regvars (int RegOffs, unsigned Bytes)
|
||||
/* Save register variables */
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user