Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.112
 
1.113
 
MAIN:ragge:20050120212414
 
reader.c
_>6767 #include <stdarg.h>
 6868 #include <stdlib.h>
 6969 
<> 70+#define TAILCALL
  71+
7072 /*      some storage declarations */
 7173 int nrecur;
 7274 int lflag;
     
 !
262264         return NULL;
 263265 }
 264266 
<>265 -static void epilogue(int regs, int autos, int retlab);
  267+#ifdef TAILCALL
  268+int earlylab, retlab2;
  269+char *cftname;
  270+#endif
266271 
 267272 void
 268273 pass2_compile(struct interpass *ip)
 269274 {
 270275         static int curlocc;
<> 276+        NODE *p;
  277+
  278+#ifdef TAILCALL
  279+        if (xtailcallflag) {
  280+                if (earlylab == -1) {
  281+                        if (ip->type != IP_DEFLAB)
  282+                                comperr("missing deflab");
  283+                        earlylab = ip->ip_lbl;
  284+                } else if (ip->type == IP_PROLOG) {
  285+                        earlylab = -1;
  286+                        retlab2 = ip->ip_lbl;
  287+                        cftname = ((struct interpass_prolog *)ip)->ipp_name;
  288+                } else if (ip->type == IP_EPILOG)
  289+                        earlylab = 0;
  290+        }
  291+#endif
  292+
271293         if (ip->type == IP_NODE) {
 272294                 thisline = ip->lineno;
 273295 #ifdef PCC_DEBUG
     
 !
283305 # ifdef MYREADER
 284306         MYREADER(ip->ip_node);  /* do your own laundering of the input */
 285307 # endif
<> 308+
  309+#ifdef TAILCALL
  310+                /* Check for tail call optimization early */
  311+                if (xtailcallflag) {
  312+                        static struct interpass *ipp;
  313+                        static int passany;
  314+
  315+                        if (passany == 0) {
  316+                                p = ip->ip_node;
  317+                                if (ipp) {
  318+                                        if (p->n_op == GOTO &&
  319+                                            p->n_left->n_lval == retlab2) {
  320+                                                passany = 1;
  321+                                                mktailopt(ipp, ip);
  322+                                                passany = 0;
  323+                                                ipp = NULL;
  324+                                                return;
  325+                                        } else {
  326+                                                passany = 1;
  327+                                                pass2_compile(ipp);
  328+                                                passany = 0;
  329+                                        }
  330+                                        ipp = NULL;
  331+                                } else if (p->n_op == FORCE &&
  332+                                    callop(p->n_left->n_op)) {
  333+                                        ipp = ip;
  334+                                        return;
  335+                                }
  336+                        }
  337+                }
  338+#endif
  339+
286340                 mkhardops(ip->ip_node);
 287341 //printf("gencall...\n");
 288342 //fwalk(ip->ip_node, e2print, 0);
     
 !
307361                 tfree(ip->ip_node);
 308362                 break;
 309363         case IP_PROLOG:
<>310 -                prologue(ip->ip_regs, ip->ip_auto, ip->ip_retl);
  364+                prologue((struct interpass_prolog *)ip);
311365                 break;
 312366         case IP_EPILOG:
<>313 -                epilogue(ip->ip_regs, ip->ip_auto, ip->ip_retl);
  367+                eoftn((struct interpass_prolog *)ip);
314368                 break;
 315369         case IP_LOCCTR:
 316370                 curlocc = ip->ip_locc;
     
 !
326380         }
 327381 }
 328382 
<>329 -static void
 330 -epilogue(int regs, int autos, int retlab)
 331 -{
 332 -        eoftn(regs, autos, retlab);
 333 -}
 334 -
<_335383 /*
 336384  * generate the code for p;
 337385  * store may call codgen recursively
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-09-20 07:57 +0200