mirror of
https://github.com/cc65/cc65.git
synced 2025-01-26 17:36:57 +00:00
Fixed a problem of the optimizer. Unknown internal functions are marked as
using just EAX as input, and destroy all registers. This did cause the optimizer to remove loads to zero page locations needed in the routines or later. Print a warning for unknown internal functions when in debug mode. git-svn-id: svn://svn.cc65.org/cc65/trunk@3711 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
f196e7c5c9
commit
d187424389
@ -6,10 +6,10 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2001-2002 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* (C) 2001-2006, Ullrich von Bassewitz */
|
||||
/* Römerstraße 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
@ -39,6 +39,7 @@
|
||||
/* common */
|
||||
#include "chartype.h"
|
||||
#include "coll.h"
|
||||
#include "debugflag.h"
|
||||
|
||||
/* cc65 */
|
||||
#include "codeent.h"
|
||||
@ -114,6 +115,12 @@ static const FuncInfo FuncInfoTable[] = {
|
||||
{ "decsp8", REG_NONE, REG_A },
|
||||
{ "incax1", REG_AX, REG_AX },
|
||||
{ "incax2", REG_AX, REG_AX },
|
||||
{ "incax3", REG_AX, REG_AX },
|
||||
{ "incax4", REG_AX, REG_AX },
|
||||
{ "incax5", REG_AX, REG_AX },
|
||||
{ "incax6", REG_AX, REG_AX },
|
||||
{ "incax7", REG_AX, REG_AX },
|
||||
{ "incax8", REG_AX, REG_AX },
|
||||
{ "incsp1", REG_NONE, REG_NONE },
|
||||
{ "incsp2", REG_NONE, REG_Y },
|
||||
{ "incsp3", REG_NONE, REG_Y },
|
||||
@ -337,8 +344,19 @@ void GetFuncInfo (const char* Name, unsigned short* Use, unsigned short* Chg)
|
||||
/* Use the information we have */
|
||||
*Use = Info->Use;
|
||||
*Chg = Info->Chg;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
/* It's an internal function we have no information for. If in
|
||||
* debug mode, output an additional warning, so we have a chance
|
||||
* to fix it. Otherwise assume that the internal function will
|
||||
* use and change all registers.
|
||||
*/
|
||||
if (Debug) {
|
||||
fprintf (stderr, "No info about internal function `%s'", Name);
|
||||
}
|
||||
*Use = REG_ALL;
|
||||
*Chg = REG_ALL;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* Function not found - assume that the primary register is input, and all
|
||||
@ -483,7 +501,7 @@ static unsigned GetRegInfo2 (CodeSeg* S,
|
||||
|
||||
} else {
|
||||
|
||||
/* Jump to external label. This will effectively exit the
|
||||
/* Jump to external label. This will effectively exit the
|
||||
* function, so we use the exitregs information here.
|
||||
*/
|
||||
U1 = S->ExitRegs;
|
||||
@ -496,7 +514,7 @@ static unsigned GetRegInfo2 (CodeSeg* S,
|
||||
}
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user