From: Greg King Date: Mon, 22 Apr 2019 18:27:36 +0000 (-0400) Subject: Made the code that logs indirect-goto referals be a little more efficient. X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=214c90f957f96b094cf88db858d0a0a17747d0de;p=cc65 Made the code that logs indirect-goto referals be a little more efficient. --- diff --git a/src/cc65/goto.c b/src/cc65/goto.c index 939eb65a9..10293642f 100644 --- a/src/cc65/goto.c +++ b/src/cc65/goto.c @@ -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); }