1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-08 15:29:37 +00:00

Made the code that logs indirect-goto referals be a little more efficient.

This commit is contained in:
Greg King 2019-04-22 14:27:36 -04:00
parent 55ce618bf2
commit 214c90f957

View File

@ -79,7 +79,6 @@ void GotoStatement (void)
ExprDesc desc;
CodeEntry *E;
unsigned char val;
unsigned I;
NextToken ();
@ -135,27 +134,25 @@ void GotoStatement (void)
ConsumeRBrack ();
/* Loop over all target labels, specifying this as a jump point.
** It's not exact - if there's multiple gotos, the last will be used,
** but it's only needed so the optimizer does not remove the labels.
** It's not exact -- if there's multiple gotos, the last will be used;
** but, it's needed only so the optimizer does not remove the labels.
*/
I = CS_GetEntryCount (CS->Code) - 1;
E = CS_GetEntry (CS->Code, I);
E = CS_GetEntry (CS->Code, CS_GetEntryCount (CS->Code) - 1);
tab = GetLabelSymTab ();
if (tab) {
cur = tab->SymHead;
while (cur) {
if ((cur->Flags & (SC_LABEL|SC_GOTO_IND)) == (SC_LABEL|SC_GOTO_IND)) {
if ((cur->Flags & SC_GOTO_IND) != 0) {
cur->V.L.IndJumpFrom = E;
}
cur = cur->NextSym;
}
}
} else { /* It was not TOK_IDENT, or we couldn't find the symbol */
} else {
/* It was not TOK_IDENT, or we couldn't find the symbol */
Error ("Array name expected");
}
} else {
Error ("Label name expected");
}
}
@ -170,6 +167,7 @@ void DoLabel (void)
/* Emit the jump label */
CodeLabel* L = CS_AddLabel (CS->Code, LocalLabelName (Entry->V.L.Label));
if (Entry->V.L.IndJumpFrom) {
CollAppend (&L->JumpFrom, Entry->V.L.IndJumpFrom);
}