Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.123
 
1.124
 
MAIN:ragge:20050402144817
 
reader.c
_>105105 int asgops(NODE *p, int);
 106106 NODE *store(NODE *);
 107107 void rcount(void);
<> 108+#ifdef NEW_READER
  109+void compile2(struct interpass *ip);
  110+void compile3(struct interpass *ip);
  111+void compile4(struct interpass *ip);
  112+struct interpass delayq;
  113+#endif
108114 
 109115 static void gencode(NODE *p, int cookie);
 110116 
     
 !
137143 }
 138144 #endif
 139145 
<> 146+#ifndef NEW_READER
140147 static void
 141148 p2compile(NODE *p)
 142149 {
     
 !
166173                 codgen(deltrees[i], FOREFF);  /* do the rest */
 167174         tfree(p);
 168175 }
<> 176+#endif
169177 
 170178 #ifdef NEW_READER
 171179 
     
 !
296304                 myreader(ip->ip_node); /* local massage of input */
 297305                 mkhardops(ip->ip_node);
 298306                 gencall(ip->ip_node, NIL);
<>299 -                while ((p = delay(ip->ip_node)) != NULL)
 300 -                        pass2_compile(...);
 301 -                canon(ip->ip_node);
 302 -                if ((ip->ip_node = deluseless(ip->ip_node)) == NULL)
 303 -                        return; /* nothing to do */
  307+                compile2(ip);
  308+        } else
  309+                compile4(ip);
  310+}
  311+
  312+void
  313+compile2(struct interpass *ip)
  314+{
  315+        DLIST_INIT(&delayq, qelem);
  316+        delay(ip->ip_node);
  317+        compile3(ip);
  318+        while (DLIST_NEXT(&delayq, qelem) != &delayq) {
  319+                ip = DLIST_NEXT(&delayq, qelem);
  320+                DLIST_REMOVE(ip, qelem);
  321+                compile3(ip);
304322         }
<> 323+}
  324+
  325+void
  326+compile3(struct interpass *ip)
  327+{
  328+        NODE *p = ip->ip_node;
  329+
  330+        canon(p);
  331+        if ((p = deluseless(p)) == NULL)
  332+                return; /* nothing to do */
  333+#ifdef PCC_DEBUG
  334+        walkf(p, cktree);
  335+        if (e2debug) {
  336+                fprintf(stderr, "Entering pass2\n");
  337+                fwalk(p, e2print, 0);
  338+        }
  339+#endif
  340+        ip->ip_node = p;
  341+        compile4(ip);
  342+}
  343+
  344+void
  345+compile4(struct interpass *ip)
  346+{
  347+        NODE *p;
  348+        int o;
  349+
305350         if (Oflag)
 306351                 return saveip(ip);
 307352 
 308353         /*
 309354          * ends up here only if not optimizing.
 310355          */
<> 356+        switch (ip->type) {
  357+        case IP_NODE:
  358+                p = ip->ip_node;
  359+                do {
  360+                        geninsn(p, FOREFF); /* Assign instructions for tree */
  361+                } while (sucomp(p) < 0);  /* Calculate tree evaluation order */
  362+
  363+                genregs(p); /* allocate registers for instructions */
  364+                mygenregs(p);
  365+
  366+                switch (p->n_op) {
  367+                case CBRANCH:
  368+                        /* Only emit branch insn if RESCC */
  369+                        if (table[TBLIDX(p->n_left->n_su)].rewrite & RESCC) {
  370+                                o = p->n_left->n_op;
  371+                                gencode(p, FORCC);
  372+                                cbgen(o, p->n_right->n_lval);
  373+                        } else
  374+                                gencode(p, FORCC);
  375+                        break;
  376+                case FORCE:
  377+                        gencode(p->n_left, INTAREG|INTBREG);
  378+                        break;
  379+                default:
  380+                        if (p->n_op != REG || p->n_type != VOID) /* XXX */
  381+                                gencode(p, FOREFF); /* Emit instructions */
  382+                }
  383+
  384+                tfree(p);
  385+                break;
  386+        case IP_PROLOG:
  387+                prologue((struct interpass_prolog *)ip);
  388+                break;
  389+        case IP_EPILOG:
  390+                eoftn((struct interpass_prolog *)ip);
  391+                tmpsave = NULL/* Always forget old nodes */
  392+                p2maxautooff = p2autooff = AUTOINIT;
  393+                break;
  394+        case IP_STKOFF:
  395+                p2autooff = ip->ip_off;
  396+                if (p2autooff > p2maxautooff)
  397+                        p2maxautooff = p2autooff;
  398+                break;
  399+        case IP_DEFLAB:
  400+                deflab(ip->ip_lbl);
  401+                break;
  402+        case IP_ASM:
  403+                printf("\t%s\n", ip->ip_asm);
  404+                break;
  405+        default:
  406+                cerror("compile4 %d", ip->type);
  407+        }
311408 }
<> 409+
  410+void
  411+Ocompile(struct interpass *ibase)
  412+{
  413+#if 0
  414+        struct interpass *ip;
  415+        NODE *p;
  416+
  417+        /* Loop over all trees, while generating instructions */
  418+        DLIST_FOREACH(ip, ibase, qelem) {
  419+                if (ip->type != IP_NODE)
  420+                        continue;
  421+
  422+                p = ip->ip_node;
  423+                do {
  424+                        geninsn(p, FOREFF); /* Assign instructions for tree */
  425+                } while (sucomp(p) < 0);  /* Calculate tree evaluation order */
  426+
  427+                genregs(p); /* allocate registers for instructions */
  428+                mygenregs(p);
  429+        }
  430+
  431+        /* Now also the stack max usage is complete, output insns */
  432+        DLIST_FOREACH(ip, ibase, qelem) {
  433+                
  434+                switch (p->n_op) {
  435+                case CBRANCH:
  436+                        /* Only emit branch insn if RESCC */
  437+                        if (table[TBLIDX(p->n_left->n_su)].rewrite & RESCC) {
  438+                                o = p->n_left->n_op;
  439+                                gencode(p, FORCC);
  440+                                cbgen(o, p->n_right->n_lval);
  441+                        } else
  442+                                gencode(p, FORCC);
  443+                        break;
  444+                case FORCE:
  445+                        gencode(p->n_left, INTAREG|INTBREG);
  446+                        break;
  447+                default:
  448+                        if (p->n_op != REG || p->n_type != VOID) /* XXX */
  449+                                gencode(p, FOREFF); /* Emit instructions */
  450+                }
  451+        }
  452+
  453+        case IP_PROLOG:
  454+                prologue((struct interpass_prolog *)ip);
  455+                break;
  456+        case IP_EPILOG:
  457+                eoftn((struct interpass_prolog *)ip);
  458+                tmpsave = NULL/* Always forget old nodes */
  459+                p2maxautooff = p2autooff = AUTOINIT;
  460+                break;
  461+        case IP_STKOFF:
  462+                p2autooff = ip->ip_off;
  463+                if (p2autooff > p2maxautooff)
  464+                        p2maxautooff = p2autooff;
  465+                break;
  466+        case IP_DEFLAB:
  467+                deflab(ip->ip_lbl);
  468+                break;
  469+        case IP_ASM:
  470+                printf("\t%s\n", ip->ip_asm);
  471+                break;
  472+        default:
  473+                cerror("compile4 %d", ip->type);
  474+        }
  475+#endif
  476+}
  477+
<_312478 #else
 313479 
 314480 #ifdef TAILCALL
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-21 16:09 +0200