Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.262
 
1.263
 
MAIN:ragge:20101219163635
 
trees.c
_>21412141 }
 21422142 
 21432143 /*
<> 2144+ * Create a node for either TEMP or on-stack storage.
  2145+ */
  2146+static NODE *
  2147+cstknode(TWORD t, union dimfun *df, struct attr *ap)
  2148+{
  2149+        struct symtab *sp;
  2150+
  2151+        /* create a symtab entry suitable for this type */
  2152+        sp = getsymtab("0hej", STEMP);
  2153+        sp->stype = t;
  2154+        sp->sdf = df;
  2155+        sp->sap = ap;
  2156+        sp->sclass = AUTO;
  2157+        sp->soffset = NOOFFSET;
  2158+        oalloc(sp, &autooff);
  2159+        return nametree(sp);
  2160+
  2161+}
  2162+
  2163+/*
21442164  * Massage the output trees to remove C-specific nodes:
 21452165  *      COMOPs are split into separate statements.
 21462166  *      QUEST/COLON are rewritten to branches.
     
 !
21512171 rmcops(NODE *p)
 21522172 {
 21532173         TWORD type;
<>2154 -        NODE *q, *r;
 2155 -        int o, ty, lbl, lbl2, tval = 0;
  2174+        NODE *q, *r, *tval;
  2175+        int o, ty, lbl, lbl2;
21562176 
<> 2177+        tval = NIL;
21572178         o = p->n_op;
 21582179         ty = coptype(o);
 21592180         if (BTYPE(p->n_type) == ENUMTY) { /* fixup enum */
     
 !
21822203                 q = p->n_right->n_left;
 21832204                 comops(q);
 21842205                 if (type != VOID) {
<>2185 -                        r = tempnode(0, q->n_type, q->n_df, q->n_ap);
 2186 -                        tval = regno(r);
 2187 -                        q = buildtree(ASSIGN, r, q);
  2206+                        tval = cstknode(q->n_type, q->n_df, q->n_ap);
  2207+                        q = buildtree(ASSIGN, ccopy(tval), q);
21882208                 }
 21892209                 rmcops(q);
 21902210                 ecode(q); /* Done with assign */
     
 !
21942214                 q = p->n_right->n_right;
 21952215                 comops(q);
 21962216                 if (type != VOID) {
<>2197 -                        r = tempnode(tval, q->n_type, q->n_df, q->n_ap);
 2198 -                        q = buildtree(ASSIGN, r, q);
  2217+                        q = buildtree(ASSIGN, ccopy(tval), q);
21992218                 }
 22002219                 rmcops(q);
 22012220                 ecode(q); /* Done with assign */
     
 !
22042223 
 22052224                 nfree(p->n_right);
 22062225                 if (p->n_type != VOID) {
<>2207 -                        r = tempnode(tval, p->n_type, p->n_df, p->n_ap);
 2208 -                        *p = *r;
 2209 -                        nfree(r);
  2226+                        *p = *tval;
  2227+                        nfree(tval);
22102228                 } else {
 22112229                         p->n_op = ICON;
 22122230                         p->n_lval = 0;
     
 !
22332251                 r = talloc();
 22342252                 *r = *p;
 22352253                 andorbr(r, -1, lbl = getlab());
<>2236 -                q = tempnode(0, p->n_type, p->n_df, p->n_ap);
 2237 -                tval = regno(q);
 2238 -                r = tempnode(tval, p->n_type, p->n_df, p->n_ap);
 2239 -                ecode(buildtree(ASSIGN, q, bcon(1)));
  2254+
  2255+                tval = cstknode(p->n_type, p->n_df, p->n_ap);
  2256+
  2257+                ecode(buildtree(ASSIGN, ccopy(tval), bcon(1)));
22402258                 branch(lbl2 = getlab());
 22412259                 plabel( lbl);
<>2242 -                ecode(buildtree(ASSIGN, r, bcon(0)));
  2260+                ecode(buildtree(ASSIGN, ccopy(tval), bcon(0)));
22432261                 plabel( lbl2);
<>2244 -                r = tempnode(tval, p->n_type, p->n_df, p->n_ap);
 2245 -                *p = *r;
 2246 -                nfree(r);
  2262+
  2263+                *p = *tval;
  2264+                nfree(tval);
  2265+
<_22472266 #endif
 22482267                 break;
 22492268         case CBRANCH:
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 15:58 +0200