|
|
1.1 root 1: /*
2: * The routine in this file handles the insertion of LEAF nodes.
3: */
4: #ifdef vax
5: #include "INC$LIB:cc1.h"
6: #else
7: #include "cc1.h"
8: #endif
9:
10: /*
11: * This function inserts LEAF tree nodes at the places
12: * where the value of a subexpression must be computed.
13: * It must be done in a pass by itself because the
14: * fancy folder rearranges expressions.
15: */
16: TREE *
17: modleaf(tp, ac)
18: register TREE *tp;
19: {
20: register ldown, rdown;
21: TREE *tp1, *tp2, *tp3;
22: int c, ldentry, op, psf;
23: FLAG flag;
24:
25: if ((c=ac)==MINIT || c==MRETURN || c==MSWITCH)
26: c = MRVALUE;
27: op = tp->t_op;
28: if ((op==EQ || op==NE) && isnval(tp->t_rp, 0)) {
29: tp1 = tp->t_lp;
30: while (tp1->t_op == LEAF)
31: tp1 = tp1->t_lp;
32: tp->t_lp = modleaf(tp1, MFLOW);
33: return (tp);
34: }
35: if (!isleaf(op)) {
36: ldentry = ldtab[op-MIOBASE];
37: if ((ldown=getli(ldentry)) == MPASSED)
38: ldown = c;
39: else if (ldown == MHARD)
40: ldown = getldown(tp, c);
41: if ((rdown=getri(ldentry)) == MPASSED) {
42: rdown = c;
43: if ((op==QUEST || op==COMMA)
44: && (rdown==MLADDR || rdown==MRADDR))
45: rdown = MRVALUE;
46: } else if (rdown == MHARD)
47: rdown = getrdown(tp, c);
48: tp1 = tp->t_lp;
49: while (tp1->t_op == LEAF)
50: tp1 = tp1->t_lp;
51: tp->t_lp = modleaf(tp1, ldown);
52: if (op!=FIELD && (tp1=tp->t_rp)!=NULL) {
53: while (tp1->t_op == LEAF)
54: tp1 = tp1->t_lp;
55: tp->t_rp = modleaf(tp1, rdown);
56: }
57: }
58: if (ac!=MINIT && tp->t_op!=LEAF) {
59: flag = tp->t_flag;
60: if ((flag&T_LEAF) != 0) {
61: if ((flag&T_NLEAF) == 0) {
62: tp2 = findoffs(tp);
63: psf = 0; /* Pointer seen flag */
64: tp1 = tp;
65: for (;;) {
66: tp3 = tp1->t_rp;
67: if (tp3 != NULL
68: && ispoint(tp3->t_type))
69: psf = 1;
70: tp3 = tp1->t_lp;
71: if (tp3 == tp2)
72: break;
73: tp1 = tp3;
74: }
75: flag = tp2->t_flag;
76: if ((flag&T_LEAF)!=0 && tp2->t_op!=LEAF) {
77: tp2 = leafnode(tp2);
78: amd(tp2);
79: tp1->t_lp = tp2;
80: }
81: if ((tp2->t_op==LEAF || tp2->t_op==CONVERT
82: || tp2->t_op==CAST)
83: && psf == 0)
84: setofstype(tp2);
85: }
86: if (ac!=MLADDR && ac!=MRADDR && tp->t_op!=LEAF) {
87: tp = leafnode(tp);
88: if (ac == MFNARG)
89: fixtoptype(tp);
90: amd(tp);
91: }
92: }
93: }
94: return (tp);
95: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.