OLD | NEW |
1 // Inferno utils/5c/peep.c | 1 // Inferno utils/5c/peep.c |
2 // http://code.google.com/p/inferno-os/source/browse/utils/5c/peep.c | 2 // http://code.google.com/p/inferno-os/source/browse/utils/5c/peep.c |
3 // | 3 // |
4 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. | 4 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. |
5 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) | 5 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) |
6 // Portions Copyright © 1997-1999 Vita Nuova Limited | 6 // Portions Copyright © 1997-1999 Vita Nuova Limited |
7 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov
a.com) | 7 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov
a.com) |
8 // Portions Copyright © 2004,2006 Bruce Ellis | 8 // Portions Copyright © 2004,2006 Bruce Ellis |
9 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) | 9 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) |
10 // Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others | 10 // Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 if(isdconst(&p->from)) { | 126 if(isdconst(&p->from)) { |
127 constprop(&p->from, &p->to, r->s1); | 127 constprop(&p->from, &p->to, r->s1); |
128 } | 128 } |
129 break; | 129 break; |
130 #endif | 130 #endif |
131 } | 131 } |
132 } | 132 } |
133 if(t) | 133 if(t) |
134 goto loop1; | 134 goto loop1; |
135 | 135 |
136 return; | |
137 | 136 |
138 #ifdef NOTDEF | |
139 for(r=firstr; r!=R; r=r->link) { | 137 for(r=firstr; r!=R; r=r->link) { |
140 p = r->prog; | 138 p = r->prog; |
141 switch(p->as) { | 139 switch(p->as) { |
142 //» » case AEOR: | 140 » » case AEOR: |
143 //» » » /* | 141 » » » /* |
144 //» » » * EOR -1,x,y => MVN x,y | 142 » » » * EOR -1,x,y => MVN x,y |
145 //» » » */ | 143 » » » */ |
146 //» » » if(isdconst(&p->from) && p->from.offset == -1) { | 144 » » » if(isdconst(&p->from) && p->from.offset == -1) { |
147 //» » » » p->as = AMVN; | 145 » » » » p->as = AMVN; |
148 //» » » » p->from.type = D_REG; | 146 » » » » p->from.type = D_REG; |
149 //» » » » if(p->reg != NREG) | 147 » » » » if(p->reg != NREG) |
150 //» » » » » p->from.reg = p->reg; | 148 » » » » » p->from.reg = p->reg; |
151 //» » » » else | 149 » » » » else |
152 //» » » » » p->from.reg = p->to.reg; | 150 » » » » » p->from.reg = p->to.reg; |
153 //» » » » p->reg = NREG; | 151 » » » » p->reg = NREG; |
154 //» » » } | 152 » » » } |
155 //» » » break; | 153 » » » break; |
156 | 154 |
157 case AMOVH: | 155 case AMOVH: |
158 case AMOVHU: | 156 case AMOVHU: |
159 case AMOVB: | 157 case AMOVB: |
160 case AMOVBU: | 158 case AMOVBU: |
161 /* | 159 /* |
162 * look for MOVB x,R; MOVB R,R | 160 * look for MOVB x,R; MOVB R,R |
163 */ | 161 */ |
| 162 r1 = r->link; |
164 if(p->to.type != D_REG) | 163 if(p->to.type != D_REG) |
165 break; | 164 break; |
166 if(r1 == R) | 165 if(r1 == R) |
167 break; | 166 break; |
168 p1 = r1->prog; | 167 p1 = r1->prog; |
169 if(p1->as != p->as) | 168 if(p1->as != p->as) |
170 break; | 169 break; |
171 if(p1->from.type != D_REG || p1->from.reg != p->to.reg) | 170 if(p1->from.type != D_REG || p1->from.reg != p->to.reg) |
172 break; | 171 break; |
173 if(p1->to.type != D_REG || p1->to.reg != p->to.reg) | 172 if(p1->to.type != D_REG || p1->to.reg != p->to.reg) |
174 break; | 173 break; |
175 excise(r1); | 174 excise(r1); |
176 break; | 175 break; |
177 } | 176 } |
178 r1 = r->link; | |
179 } | 177 } |
| 178 #ifdef NOTDEF |
180 | 179 |
181 // for(r=firstr; r!=R; r=r->link) { | 180 // for(r=firstr; r!=R; r=r->link) { |
182 // p = r->prog; | 181 // p = r->prog; |
183 // switch(p->as) { | 182 // switch(p->as) { |
184 // case AMOVW: | 183 // case AMOVW: |
185 // case AMOVB: | 184 // case AMOVB: |
186 // case AMOVBU: | 185 // case AMOVBU: |
187 // if(p->from.type == D_OREG && p->from.offset == 0) | 186 // if(p->from.type == D_OREG && p->from.offset == 0) |
188 // xtramodes(r, &p->from); | 187 // xtramodes(r, &p->from); |
189 // else | 188 // else |
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1520 } | 1519 } |
1521 } | 1520 } |
1522 | 1521 |
1523 int | 1522 int |
1524 isdconst(Addr *a) | 1523 isdconst(Addr *a) |
1525 { | 1524 { |
1526 if(a->type == D_CONST && a->reg == NREG) | 1525 if(a->type == D_CONST && a->reg == NREG) |
1527 return 1; | 1526 return 1; |
1528 return 0; | 1527 return 0; |
1529 } | 1528 } |
OLD | NEW |