Fixed an omission in AdjustStackOffset. Use CS_IsBasicBlock in OptStackOps.
git-svn-id: svn://svn.cc65.org/cc65/trunk@1450 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
9a62c92489
commit
a0496ca53d
1 changed files with 23 additions and 7 deletions
|
@ -94,14 +94,27 @@ static unsigned AdjustStackOffset (CodeSeg* S, unsigned Start, unsigned Stop,
|
||||||
|
|
||||||
CodeEntry* E = CS_GetEntry (S, I);
|
CodeEntry* E = CS_GetEntry (S, I);
|
||||||
|
|
||||||
if (E->Use & REG_SP) {
|
int NeedCorrection = 0;
|
||||||
|
if ((E->Use & REG_SP) != 0) {
|
||||||
CodeEntry* P;
|
|
||||||
|
|
||||||
/* Check for some things that should not happen */
|
/* Check for some things that should not happen */
|
||||||
CHECK (E->AM == AM65_ZP_INDY || E->RI->In.RegY >= (short) Offs);
|
CHECK (E->AM == AM65_ZP_INDY || E->RI->In.RegY >= (short) Offs);
|
||||||
CHECK (strcmp (E->Arg, "sp") == 0);
|
CHECK (strcmp (E->Arg, "sp") == 0);
|
||||||
|
|
||||||
|
/* We need to correct this one */
|
||||||
|
NeedCorrection = 1;
|
||||||
|
|
||||||
|
} else if (CE_IsCall (E, "ldaxysp")) {
|
||||||
|
|
||||||
|
/* We need to correct this one */
|
||||||
|
NeedCorrection = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NeedCorrection) {
|
||||||
|
|
||||||
|
CodeEntry* P;
|
||||||
|
|
||||||
/* Get the code entry before this one. If it's a LDY, adjust the
|
/* Get the code entry before this one. If it's a LDY, adjust the
|
||||||
* value.
|
* value.
|
||||||
*/
|
*/
|
||||||
|
@ -632,8 +645,7 @@ unsigned OptStackOps (CodeSeg* S)
|
||||||
* It depends on the code between the two if we can handle/transform the
|
* It depends on the code between the two if we can handle/transform the
|
||||||
* sequence, so check this code for the following list of things:
|
* sequence, so check this code for the following list of things:
|
||||||
*
|
*
|
||||||
* - there must not be a jump or conditional branch (this may
|
* - the range must be a basic block (one entry, one exit)
|
||||||
* get relaxed later).
|
|
||||||
* - there may not be accesses to local variables with unknown
|
* - there may not be accesses to local variables with unknown
|
||||||
* offsets (because we have to adjust these offsets).
|
* offsets (because we have to adjust these offsets).
|
||||||
* - no subroutine calls
|
* - no subroutine calls
|
||||||
|
@ -653,8 +665,7 @@ unsigned OptStackOps (CodeSeg* S)
|
||||||
|
|
||||||
if ((E->Info & OF_BRA) != 0 ||
|
if ((E->Info & OF_BRA) != 0 ||
|
||||||
((E->Use & REG_SP) != 0 &&
|
((E->Use & REG_SP) != 0 &&
|
||||||
(E->AM != AM65_ZP_INDY || E->RI->In.RegY < 0)) ||
|
(E->AM != AM65_ZP_INDY || E->RI->In.RegY < 0))) {
|
||||||
CE_HasLabel (E)) {
|
|
||||||
|
|
||||||
/* All this stuff is not allowed in a sequence */
|
/* All this stuff is not allowed in a sequence */
|
||||||
InSeq = 0;
|
InSeq = 0;
|
||||||
|
@ -696,6 +707,11 @@ unsigned OptStackOps (CodeSeg* S)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Determine if we have a basic block */
|
||||||
|
if (PreCondOk) {
|
||||||
|
PreCondOk = CS_IsBasicBlock (S, Push, I);
|
||||||
|
}
|
||||||
|
|
||||||
/* If preconditions are ok, call the optimizer function */
|
/* If preconditions are ok, call the optimizer function */
|
||||||
if (PreCondOk) {
|
if (PreCondOk) {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue