1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 19:29:37 +00:00

Quick fix for a problem in the OptLoad3 function. The fix isn't perfect and

may fail for inline assembly code, but at least it's less buggy than before.


git-svn-id: svn://svn.cc65.org/cc65/trunk@5982 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2013-02-12 19:51:11 +00:00
parent 274a7210e7
commit e8964cde74

View File

@ -248,6 +248,8 @@ static unsigned OptLoad3 (CodeSeg* S)
/* Check if this insn is a load */ /* Check if this insn is a load */
if (E->Info & OF_LOAD) { if (E->Info & OF_LOAD) {
CodeEntry* N;
/* If we had a preceeding load that is identical, remove this one. /* If we had a preceeding load that is identical, remove this one.
* If it is not identical, or we didn't have one, remember it. * If it is not identical, or we didn't have one, remember it.
*/ */
@ -255,7 +257,9 @@ static unsigned OptLoad3 (CodeSeg* S)
E->OPC == Load->OPC && E->OPC == Load->OPC &&
E->AM == Load->AM && E->AM == Load->AM &&
((E->Arg == 0 && Load->Arg == 0) || ((E->Arg == 0 && Load->Arg == 0) ||
strcmp (E->Arg, Load->Arg) == 0)) { strcmp (E->Arg, Load->Arg) == 0) &&
(N = CS_GetNextEntry (S, I)) != 0 &&
(N->Info & OF_CBRA) == 0) {
/* Now remove the call to the subroutine */ /* Now remove the call to the subroutine */
CS_DelEntry (S, I); CS_DelEntry (S, I);