Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.240
 
1.241
 
MAIN:ragge:20081115093443
 
reader.c
_>100100         int tempno;
 101101 } *tmpsave;
 102102 
<> 103+static struct interpass ipole;
  104+struct interpass_prolog *ipp, *epp;
  105+
103106 #ifdef PCC_DEBUG
<> 107+static int *lbldef, *lbluse;
104108 static void
 105109 cktree(NODE *p)
 106110 {
<> 111+        int i;
  112+
107113         if (p->n_op > MAXOP)
 108114                 cerror("%p) op %d slipped through", p, p->n_op);
 109115         if (BTYPE(p->n_type) > MAXTYPES)
 110116                 cerror("%p) type %x slipped through", p, p->n_type);
<>111 -        if (p->n_op == CBRANCH && !logop(p->n_left->n_op))
 112 -                cerror("%p) not logop branch", p);
  117+        if (p->n_op == CBRANCH) {
  118+                 if (!logop(p->n_left->n_op))
  119+                        cerror("%p) not logop branch", p);
  120+                i = p->n_right->n_lval;
  121+                if (i < ipp->ip_lblnum || i >= epp->ip_lblnum)
  122+                        cerror("%p) label %d outside boundaries %d-%d",
  123+                            p, i, ipp->ip_lblnum, epp->ip_lblnum);
  124+                lbluse[i-ipp->ip_lblnum] = 1;
  125+        }
113126         if ((dope[p->n_op] & ASGOPFLG) && p->n_op != RETURN)
 114127                 cerror("%p) asgop %d slipped through", p, p->n_op);
<> 128+        if (p->n_op == TEMP &&
  129+            (regno(p) < ipp->ip_tmpnum || regno(p) >= epp->ip_tmpnum))
  130+                cerror("%p) temporary %d outside boundaries %d-%d",
  131+                    p, regno(p), ipp->ip_tmpnum, epp->ip_tmpnum);
  132+        if (p->n_op == GOTO) {
  133+                i = p->n_left->n_lval;
  134+                if (i < ipp->ip_lblnum || i >= epp->ip_lblnum)
  135+                        cerror("%p) label %d outside boundaries %d-%d",
  136+                            p, i, ipp->ip_lblnum, epp->ip_lblnum);
  137+                lbluse[i-ipp->ip_lblnum] = 1;
  138+        }
115139 }
<> 140+
  141+/*
  142+ * Check that the trees are in a suitable state for pass2.
  143+ */
  144+static void
  145+sanitychecks(void)
  146+{
  147+        struct interpass *ip;
  148+        int i;
  149+#ifdef notyet
  150+        TMPMARK();
116151 #endif
<> 152+        lbldef = tmpcalloc(sizeof(int) * (epp->ip_lblnum - ipp->ip_lblnum));
  153+        lbluse = tmpcalloc(sizeof(int) * (epp->ip_lblnum - ipp->ip_lblnum));
117154 
<> 155+        DLIST_FOREACH(ip, &ipole, qelem) {
  156+                if (ip->type == IP_DEFLAB) {
  157+                        i = ip->ip_lbl;
  158+                        if (i < ipp->ip_lblnum || i >= epp->ip_lblnum)
  159+                                cerror("label %d outside boundaries %d-%d",
  160+                                    i, ipp->ip_lblnum, epp->ip_lblnum);
  161+                        lbldef[i-ipp->ip_lblnum] = 1;
  162+                }
  163+                if (ip->type == IP_NODE)
  164+                        walkf(ip->ip_node, cktree);
  165+        }
  166+        for (i = 0; i < (epp->ip_lblnum - ipp->ip_lblnum); i++)
  167+                if (lbluse[i] != 0 && lbldef[i] == 0)
  168+                        cerror("internal label %d not defined",
  169+                            i + ipp->ip_lblnum);
  170+
  171+#ifdef notyet
  172+        TMPFREE();
  173+#endif
  174+}
  175+#endif
  176+
118177 /*
 119178  * Check if a node has side effects.
 120179  */
     
 !
180239         return NULL;
 181240 }
 182241 
<>183 -static struct interpass ipole;
 184 -struct interpass_prolog *ipp, *epp;
 185 -
186242 /*
 187243  * Receives interpass structs from pass1.
 188244  */
     
 !
208264         epp = (struct interpass_prolog *)DLIST_PREV(&ipole, qelem);
 209265         p2maxautooff = p2autooff = epp->ipp_autos;
 210266 
<> 267+#ifdef PCC_DEBUG
  268+        sanitychecks();
  269+#endif
211270         myreader(&ipole); /* local massage of input */
 212271 
 213272         DLIST_FOREACH(ip, &ipole, qelem) {
     
 !
221280                 if (ip->type != IP_NODE)
 222281                         continue;
 223282                 canon(ip->ip_node);
<>224 -#ifdef PCC_DEBUG
 225 -                walkf(ip->ip_node, cktree);
 226 -#endif
<_227283                 if ((ip->ip_node = deluseless(ip->ip_node)) == NULL) {
 228284                         DLIST_REMOVE(ip, qelem);
 229285                 } else while (!DLIST_ISEMPTY(&prepole, qelem)) {
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-30 12:12 +0200