Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.294
 
1.295
 
MAIN:ragge:20110803192532
 
trees.c
_>28542854         return p;
 28552855 }
 28562856 
<> 2857+#ifndef WORD_ADDRESSED
  2858+
  2859+static NODE *
  2860+pprop(NODE *p, TWORD t)
  2861+{
  2862+        int o = p->n_op;
  2863+
  2864+        p->n_type = t;
  2865+        switch (o) {
  2866+        case UMUL:
  2867+                t = INCREF(t);
  2868+                break;
  2869+        case ADDROF:
  2870+                t = DECREF(t);
  2871+                break;
  2872+        case PCONV:
  2873+                return p;
  2874+
  2875+        case PLUSEQ:
  2876+        case PLUS:
  2877+        case INCR:
  2878+        case DECR:
  2879+                if (!ISPTR(p->n_left->n_type)) {
  2880+                        if (!ISPTR(p->n_right->n_type))
  2881+                                cerror("no * in PLUS");
  2882+                        p->n_right = pprop(p->n_right, t);
  2883+                } else
  2884+                        p->n_left = pprop(p->n_left, t);
  2885+                return p;
  2886+
  2887+        case MINUSEQ:
  2888+        case MINUS:
  2889+                if (ISPTR(p->n_left->n_type)) {
  2890+                        if (ISPTR(p->n_right->n_type))
  2891+                                break; /* change both */
  2892+                        p->n_left = pprop(p->n_left, t);
  2893+                } else
  2894+                        p->n_right = pprop(p->n_right, t);
  2895+                return p;
  2896+
  2897+        case CALL:
  2898+        case UCALL:
  2899+        case STCALL: /* may end up here if struct passed in regs */
  2900+        case USTCALL:
  2901+                return p;
  2902+
  2903+        case STASG: /* if struct is cast to pointer */
  2904+                return p;
  2905+
  2906+        case ASSIGN:
  2907+                break;
  2908+
  2909+        default:
  2910+                if (coptype(o) == LTYPE)
  2911+                        break;
  2912+
  2913+fwalk(p, eprint, 0);
  2914+                cerror("pprop op error %d\n", o);
  2915+        }
  2916+        if (coptype(o) == BITYPE)
  2917+                p->n_right = pprop(p->n_right, t);
  2918+        if (coptype(o) != LTYPE)
  2919+                p->n_left = pprop(p->n_left, t);
  2920+        return p;
  2921+}
  2922+
  2923+/*
  2924+ * Search for PCONV's that can be removed while still keeping
  2925+ * the type correctness.
  2926+ */
  2927+NODE *
  2928+rmpconv(NODE *p)
  2929+{
  2930+        struct symtab *sp;
  2931+        int o = p->n_op;
  2932+        int ot = coptype(o);
  2933+        NODE *q, *l;
  2934+
  2935+        if (ot != LTYPE)
  2936+                p->n_left = rmpconv(p->n_left);
  2937+        if (ot == BITYPE)
  2938+                p->n_right = rmpconv(p->n_right);
  2939+        if (o != PCONV)
  2940+                return p;
  2941+        l = p->n_left;
  2942+        if (nncon(l) || (cdope(l->n_op) & CALLFLG))
  2943+                ; /* Let any nonamed constant be cast to pointer directly */
  2944+        else if (l->n_type >= INTPTR && l->n_op == ICON) {
  2945+                /* named constants only if >= pointer size */
  2946+                /* create INTPTR type */
  2947+                sp = l->n_sp;
  2948+                l->n_sp = NULL;
  2949+                concast(l, INTPTR);
  2950+                l->n_sp = sp;
  2951+        } else if (!ISPTR(l->n_type))
  2952+                return p;
  2953+        q = pprop(p->n_left, p->n_type);
  2954+        nfree(p);
  2955+        return q;
  2956+}
  2957+#endif
  2958+
28572959 void
 28582960 ecode(NODE *p)  
 28592961 {
     
 !
28732975                         werror("return value ignored");
 28742976         }
 28752977 #endif
<> 2978+#ifndef WORD_ADDRESSED
  2979+        p = rmpconv(p);
  2980+#endif
<_28762981         p = optim(p);
 28772982         p = delasgop(p);
 28782983         p = deldcall(p, 0);
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-02 16:05 +0200