1
0
mirror of https://github.com/cc65/cc65.git synced 2025-04-08 19:38:55 +00:00

Fixed a bug

git-svn-id: svn://svn.cc65.org/cc65/trunk@3513 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2005-05-17 12:42:34 +00:00
parent 2ef65e7eda
commit 412a1300f9
2 changed files with 29 additions and 22 deletions

View File

@ -144,7 +144,7 @@ static void SetUseChgInfo (CodeEntry* E, const OPCDesc* D)
* lookup the information about this function and use it. The jump itself
* does not change any registers, so we don't need to use the data from D.
*/
if ((E->Info & (OF_BRA | OF_CALL)) != 0 && E->JumpTo == 0) {
if ((E->Info & (OF_UBRA | OF_CALL)) != 0 && E->JumpTo == 0) {
/* A subroutine call or jump to external symbol (function exit) */
GetFuncInfo (E->Arg, &E->Use, &E->Chg);
} else {

View File

@ -416,7 +416,7 @@ static unsigned GetRegInfo2 (CodeSeg* S,
/* Evaluate the used registers */
R = E->Use;
if (E->OPC == OP65_RTS ||
((E->Info & OF_BRA) != 0 && E->JumpTo == 0)) {
((E->Info & OF_UBRA) != 0 && E->JumpTo == 0)) {
/* This instruction will leave the function */
R |= S->ExitRegs;
}
@ -472,30 +472,37 @@ static unsigned GetRegInfo2 (CodeSeg* S,
*/
} else if ((E->Info & OF_CBRA) != 0) {
/* Recursively determine register usage at the branch target */
unsigned U1;
unsigned U2;
if (E->JumpTo) {
/* Recursively determine register usage at the branch target */
unsigned U1;
unsigned U2;
/* Jump to internal label */
U1 = GetRegInfo2 (S, E->JumpTo->Owner, -1, Visited, Used, Unused, Wanted);
if (U1 == REG_ALL) {
/* All registers used, no need for second call */
return REG_AXY;
}
if (Index < 0) {
Index = CS_GetEntryIndex (S, E);
}
if ((E = CS_GetEntry (S, ++Index)) == 0) {
Internal ("GetRegInfo2: No next entry!");
}
U2 = GetRegInfo2 (S, E, Index, Visited, Used, Unused, Wanted);
return U1 | U2; /* Used in any of the branches */
} else {
/* Jump to global symbol */
break;
}
} else {
/* Jump to external label. This will effectively exit the
* function, so we use the exitregs information here.
*/
U1 = S->ExitRegs;
}
/* Get the next entry */
if (Index < 0) {
Index = CS_GetEntryIndex (S, E);
}
if ((E = CS_GetEntry (S, ++Index)) == 0) {
Internal ("GetRegInfo2: No next entry!");
}
/* Follow flow if branch not taken */
U2 = GetRegInfo2 (S, E, Index, Visited, Used, Unused, Wanted);
/* Registers are used if they're use in any of the branches */
return U1 | U2;
} else {