Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.173
 
1.174
 
MAIN:ragge:20060216164630
 
reader.c
_>6161  */
 6262 
 6363 /*
<>64 - * processing order for nodes:
 65 - * - myreader()
 66 - * - gencall()
 67 - * - delay()
 68 - * - canon()
  64+ * Everything is entered via pass2_compile().  Three functions are
  65+ * allowed to recurse into pass2_compile(), so be careful:
6966  * - deluseless()
<>70 - * - saves trees here if optimizing
  67+ * - myreader()
  68+ * Especially in myreader note that trees may be rewritten twice if
  69+ * things are not carefully handled.
7170  */
 7271 
 7372 # include "pass2.h"
     
 !
8887 NODE *nodepole;
 8988 FILE *prfil = stdout;
 9089 
<>91 -int e2print(NODE *p, int down, int *a, int *b);
9290 void saveip(struct interpass *ip);
 9391 void deljumps(void);
 9492 void deltemp(NODE *p);
     
 !
255253 }
 256254 
 257255 static struct interpass ipole;
<>258 -struct interpass_prolog *epp;
  256+struct interpass_prolog *ipp, *epp;
259257 
<>260 -#if 0
 261 -static NODE *
 262 -fixargs(NODE *p, struct interpass *ip)
 263 -{
 264 -        struct interpass *ip2;
 265 -        int num;
 266 -
 267 -        if (canaddr(p))
 268 -                return p;
 269 -        num = epp->ip_tmpnum++;
 270 -        ip2 = ipnode(mkbinode(ASSIGN,
 271 -            mklnode(TEMP, num, 0, p->n_type), p, p->n_type));
 272 -        DLIST_INSERT_BEFORE(ip, ip2, qelem);
 273 -        return mklnode(TEMP, num, 0, p->n_type);
 274 -}
 275 -
276258 /*
<>277 - * Gencall() is the first function in pass2.  It cuts out the
 278 - * call arguments and replaces them with temp variables.
 279 - */
 280 -static void
 281 -xgencall(NODE *p, struct interpass *ip)
 282 -{
 283 -        int o = p->n_op;
 284 -        int ty = optype(o);
 285 -
 286 -        if (ty == LTYPE)
 287 -                return;
 288 -
 289 -        if (ty != UTYPE)
 290 -                xgencall(p->n_right, ip);
 291 -        xgencall(p->n_left, ip);
 292 -
 293 -        if (o != CALL)
 294 -                return;
 295 -
 296 -        if (p->n_right->n_op == CM) {
 297 -                p = p->n_right;
 298 -                while (p->n_left->n_op == CM) {
 299 -                        p->n_right = fixargs(p->n_right, ip);
 300 -                        p = p->n_left;
 301 -                }
 302 -                p->n_right = fixargs(p->n_right, ip);
 303 -                p->n_left = fixargs(p->n_left, ip);
 304 -        } else
 305 -                p->n_right = fixargs(p->n_right, ip);
 306 -}
 307 -#endif
 308 -
 309 -/*
310259  * Receives interpass structs from pass1.
 311260  */
 312261 void
 313262 pass2_compile(struct interpass *ip)
 314263 {
 315264         if (ip->type == IP_PROLOG) {
 316265                 tmpsave = NULL;
<> 266+                ipp = (struct interpass_prolog *)ip;
317267                 DLIST_INIT(&ipole, qelem);
 318268         }
 319269         DLIST_INSERT_BEFORE(&ipole, ip, qelem);
     
 !
326276                 printip(&ipole);
 327277         }
 328278 #endif
<> 279+
329280         epp = (struct interpass_prolog *)DLIST_PREV(&ipole, qelem);
 330281         p2maxautooff = p2autooff = epp->ipp_autos;
<> 282+
  283+        myreader(&ipole); /* local massage of input */
  284+
331285         DLIST_FOREACH(ip, &ipole, qelem) {
 332286                 if (ip->type != IP_NODE)
 333287                         continue;
<>334 -                myreader(ip->ip_node); /* local massage of input */
335288                 if (xtemps == 0)
 336289                         walkf(ip->ip_node, deltemp);
 337290                 DLIST_INIT(&delayq, qelem);
     
 !
483436         case IP_EPILOG:
 484437                 eoftn((struct interpass_prolog *)ip);
 485438                 tmpsave = NULL/* Always forget old nodes */
<>486 -                p2maxautooff = p2autooff = AUTOINIT;
  439+                p2maxautooff = p2autooff = AUTOINIT/SZCHAR;
487440                 break;
 488441         case IP_DEFLAB:
 489442                 deflab(ip->ip_lbl);
     
 !
630583                 goto again;
 631584 
 632585         case ASSIGN:
<> 586+        case STASG:
633587                 rv = findasg(p, cookie);
 634588                 break;
 635589 
     
 !
708662                 break;
 709663 
 710664         default:
<>711 -                comperr("geninsn: bad op %d, node %p", o, p);
  665+                comperr("geninsn: bad op %s, node %p", opst[o], p);
712666         }
 713667         if (rv == FFAIL)
 714668                 comperr("Cannot generate code, node %p op %s", p,opst[p->n_op]);
     
 !
888842         if (p->n_su == 0)
 889843                 return;
 890844 
<> 845+        if (callop(p->n_op))
  846+                lastcall(p); /* last chance before function args */
891847         if (p->n_op == CALL || p->n_op == FORTCALL || p->n_op == STCALL) {
 892848                 /* Print out arguments first */
<>893 -                lastcall(p); /* last chance before printing out insn */
894849                 for (p1 = p->n_right; p1->n_op == CM; p1 = p1->n_left)
 895850                         gencode(p1->n_right, FOREFF);
 896851                 gencode(p1, FOREFF);
     
 !
920875 
 921876 #ifdef PCC_DEBUG
 922877 #undef  PRTABLE
<>923 -int
  878+void
924879 e2print(NODE *p, int down, int *a, int *b)
 925880 {
 926881 #ifdef PRTABLE
     
 !
983938 #endif
 984939             ltyp[LMASK&p->n_su],
 985940             rtyp[(p->n_su&RMASK) >> 2], p->n_su & DORIGHT ? "DORIGHT" : "");
<>986 -        return 0;
987941 }
 988942 #endif
 989943 
 990944 #ifndef FIELDOPS
 991945 /*
 992946  * do this if there is no special hardware support for fields
 993947  */
<>994 -static int
  948+static void
995949 ffld(NODE *p, int down, int *down1, int *down2 )
 996950 {
 997951         /*
     
 !
1006960 
 1007961         if( !down && p->n_op == FLD ){ /* rewrite the node */
 1008962 
<>1009 -                if( !rewfld(p) ) return 0;
  963+                if( !rewfld(p) ) return;
1010964 
 1011965                 ty = p->n_type;
 1012966                 v = p->n_rval;
     
 !
1033987                         /* whew! */
 1034988                 }
 1035989         }
<>1036 -        return 0;
1037990 }
 1038991 #endif
 1039992 
     
 !
12131166         int t;
 12141167 
 12151168         if (k > 1)
<>1216 -                SETOFF(p2autooff, ALDOUBLE);
  1169+                SETOFF(p2autooff, ALDOUBLE/ALCHAR);
12171170 
 12181171         t = p2autooff;
<>1219 -        p2autooff += k*SZINT;
  1172+        p2autooff += k*(SZINT/SZCHAR);
12201173         if (p2autooff > p2maxautooff)
 12211174                 p2maxautooff = p2autooff;
 12221175         return (t);
 12231176 
 12241177 #else
<>1225 -        p2autooff += k*SZINT;
  1178+        p2autooff += k*(SZINT/SZCHAR);
12261179         if (k > 1)
<>1227 -                SETOFF(p2autooff, ALDOUBLE);
  1180+                SETOFF(p2autooff, ALDOUBLE/ALCHAR);
<_12281181 
 12291182         if (p2autooff > p2maxautooff)
 12301183                 p2maxautooff = p2autooff;
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 20:59 +0200