* src/hc08/gen.c (genJumpTab, emitcode, genhc08code): fixed stack error
authorepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 4 May 2004 19:10:40 +0000 (19:10 +0000)
committerepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 4 May 2004 19:10:40 +0000 (19:10 +0000)
and inappropriate peephole optimization in jump tables

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3303 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/hc08/gen.c

index 1045f2b089dabdc48d585feccabee38b4d806830..1520e3115e6a31190e48e0dea6727f1a26d3d86c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-05-04 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
+
+       * src/hc08/gen.c (genJumpTab, emitcode, genhc08code): fixed stack error
+       and inappropriate peephole optimization in jump tables
+
 2004-04-30 Jesus Calvino-Fraga <jesusc AT ece.ubc.ca>
 
        * as/hc08/m08pst.c,
index 1cf7271ceac429489c6ab9d5bd166d06c66a00da..68f5ec34181a226e3458a1ba56444aa383ffab87 100644 (file)
@@ -68,6 +68,7 @@ static struct
     int stackPushes;
     short regsinuse;
     set *sendSet;
+    iCode *current_iCode;
   }
 _G;
 
@@ -168,6 +169,7 @@ emitcode (char *inst, char *fmt,...)
                (lineHead = newLineNode (lb)));
   lineCurr->isInline = _G.inLine;
   lineCurr->isDebug = _G.debugLine;
+  lineCurr->ic = _G.current_iCode;
 
   //printf("%s\n", lb);
   va_end (ap);
@@ -7210,6 +7212,7 @@ genJumpTab (iCode * ic)
   emitcode ("add","1,s");
   transferRegReg (hc08_reg_a, hc08_reg_x, TRUE);
   loadRegFromConst (hc08_reg_h, zero);
+  pullReg (hc08_reg_a);
 
   jtab = newiTempLabel (NULL);
   emitcode ("jmp", "%05d$,x", jtab->key + 100);
@@ -7597,7 +7600,8 @@ genhc08Code (iCode * lic)
 
   for (ic = lic; ic; ic = ic->next)
     {
-
+      _G.current_iCode = ic;
+      
       if (ic->lineno && cln != ic->lineno)
        {
          if (options.debug)