]> git.sur5r.net Git - cc65/commitdiff
Fixed a problem of the optimizer. Unknown internal functions are marked as
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 24 Mar 2006 15:24:34 +0000 (15:24 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 24 Mar 2006 15:24:34 +0000 (15:24 +0000)
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

src/cc65/codeinfo.c

index 712dd1ea602c647fe74a0bb2fb894face4f65ae4..d5db42c557fb5259848a6f4d2d05f59ec5ef302c 100644 (file)
@@ -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);