996
|
1 /* Automatically generated output, edit source and recompile to change */
|
|
2 #include "oil.h"
|
|
3 int optimize_pass1_0(node *np)
|
|
4 { int opted=0;
|
|
5 unsigned long c,c1,c2,c3,c4,c5,c6,c7,c8,c9;
|
|
6 unsigned long x,x1,x2,x3,x4,x5,x6,x7,x8,x9,r;
|
|
7 int tempw;
|
|
8 node *tp;
|
|
9 checknodeactbits(np);
|
|
10 if(np->opcode==MINGLE &&
|
|
11 (np->lval->opcode==MESH || np->lval->opcode==MESH32) &&
|
|
12 (np->rval->opcode==MESH || np->rval->opcode==MESH32))
|
|
13 do
|
|
14 {
|
|
15 x2=np->rval->constant; c2=np->rval->optdata;
|
|
16 x1=np->lval->constant; c1=np->lval->optdata;
|
|
17 OPTING(minglefold);
|
|
18 tp=newnode();
|
|
19 MAYBENEWNODE(tp);
|
|
20 tp->opcode=MESH32;
|
|
21 tp->width=32;
|
|
22 tp->constant=(mingle(x1,x2));
|
|
23 nodefree(np->lval); nodefree(np->rval);
|
|
24 tempw=np->width; *np=*tp; np->width=tempw; free(tp);
|
|
25 } while(0);
|
|
26
|
|
27 checknodeactbits(np);
|
|
28 if(np->opcode==SELECT &&
|
|
29 (np->lval->opcode==MESH || np->lval->opcode==MESH32) &&
|
|
30 (np->rval->opcode==MESH || np->rval->opcode==MESH32))
|
|
31 do
|
|
32 {
|
|
33 x2=np->rval->constant; c2=np->rval->optdata;
|
|
34 x1=np->lval->constant; c1=np->lval->optdata;
|
|
35 OPTING(selectfold);
|
|
36 tp=newnode();
|
|
37 MAYBENEWNODE(tp);
|
|
38 tp->opcode=MESH32;
|
|
39 tp->width=32;
|
|
40 tp->constant=(iselect(x1,x2));
|
|
41 nodefree(np->lval); nodefree(np->rval);
|
|
42 tempw=np->width; *np=*tp; np->width=tempw; free(tp);
|
|
43 } while(0);
|
|
44
|
|
45 checknodeactbits(np);
|
|
46 if(np->opcode==AND &&
|
|
47 np->width==32 &&
|
|
48 (np->rval->opcode==MESH || np->rval->opcode==MESH32))
|
|
49 do
|
|
50 {
|
|
51 x1=np->rval->constant; c1=np->rval->optdata;
|
|
52 OPTING(and32fold);
|
|
53 tp=newnode();
|
|
54 MAYBENEWNODE(tp);
|
|
55 tp->opcode=MESH32;
|
|
56 tp->width=32;
|
|
57 tp->constant=(and32(x1));
|
|
58 nodefree(np->lval); nodefree(np->rval);
|
|
59 tempw=np->width; *np=*tp; np->width=tempw; free(tp);
|
|
60 } while(0);
|
|
61
|
|
62 checknodeactbits(np);
|
|
63 if(np->opcode==OR &&
|
|
64 np->width==32 &&
|
|
65 (np->rval->opcode==MESH || np->rval->opcode==MESH32))
|
|
66 do
|
|
67 {
|
|
68 x1=np->rval->constant; c1=np->rval->optdata;
|
|
69 OPTING(or32fold);
|
|
70 tp=newnode();
|
|
71 MAYBENEWNODE(tp);
|
|
72 tp->opcode=MESH32;
|
|
73 tp->width=32;
|
|
74 tp->constant=(or32(x1));
|
|
75 nodefree(np->lval); nodefree(np->rval);
|
|
76 tempw=np->width; *np=*tp; np->width=tempw; free(tp);
|
|
77 } while(0);
|
|
78
|
|
79 checknodeactbits(np);
|
|
80 if(np->opcode==XOR &&
|
|
81 np->width==32 &&
|
|
82 (np->rval->opcode==MESH || np->rval->opcode==MESH32))
|
|
83 do
|
|
84 {
|
|
85 x1=np->rval->constant; c1=np->rval->optdata;
|
|
86 OPTING(xor32fold);
|
|
87 tp=newnode();
|
|
88 MAYBENEWNODE(tp);
|
|
89 tp->opcode=MESH32;
|
|
90 tp->width=32;
|
|
91 tp->constant=(xor32(x1));
|
|
92 nodefree(np->lval); nodefree(np->rval);
|
|
93 tempw=np->width; *np=*tp; np->width=tempw; free(tp);
|
|
94 } while(0);
|
|
95
|
|
96 checknodeactbits(np);
|
|
97 if(np->opcode==AND &&
|
|
98 np->width==16 &&
|
|
99 (np->rval->opcode==MESH || np->rval->opcode==MESH32))
|
|
100 do
|
|
101 {
|
|
102 x1=np->rval->constant; c1=np->rval->optdata;
|
|
103 OPTING(and16fold);
|
|
104 tp=newnode();
|
|
105 MAYBENEWNODE(tp);
|
|
106 tp->opcode=MESH32;
|
|
107 tp->width=32;
|
|
108 tp->constant=(and16(x1));
|
|
109 nodefree(np->lval); nodefree(np->rval);
|
|
110 tempw=np->width; *np=*tp; np->width=tempw; free(tp);
|
|
111 } while(0);
|
|
112
|
|
113 checknodeactbits(np);
|
|
114 if(np->opcode==OR &&
|
|
115 np->width==16 &&
|
|
116 (np->rval->opcode==MESH || np->rval->opcode==MESH32))
|
|
117 do
|
|
118 {
|
|
119 x1=np->rval->constant; c1=np->rval->optdata;
|
|
120 OPTING(or16fold);
|
|
121 tp=newnode();
|
|
122 MAYBENEWNODE(tp);
|
|
123 tp->opcode=MESH32;
|
|
124 tp->width=32;
|
|
125 tp->constant=(or16(x1));
|
|
126 nodefree(np->lval); nodefree(np->rval);
|
|
127 tempw=np->width; *np=*tp; np->width=tempw; free(tp);
|
|
128 } while(0);
|
|
129
|
|
130 checknodeactbits(np);
|
|
131 if(np->opcode==XOR &&
|
|
132 np->width==16 &&
|
|
133 (np->rval->opcode==MESH || np->rval->opcode==MESH32))
|
|
134 do
|
|
135 {
|
|
136 x1=np->rval->constant; c1=np->rval->optdata;
|
|
137 OPTING(xor16fold);
|
|
138 tp=newnode();
|
|
139 MAYBENEWNODE(tp);
|
|
140 tp->opcode=MESH32;
|
|
141 tp->width=32;
|
|
142 tp->constant=(xor16(x1));
|
|
143 nodefree(np->lval); nodefree(np->rval);
|
|
144 tempw=np->width; *np=*tp; np->width=tempw; free(tp);
|
|
145 } while(0);
|
|
146
|
|
147 checknodeactbits(np);
|
|
148 if(np->opcode==C_AND &&
|
|
149 (np->lval->opcode==MESH || np->lval->opcode==MESH32) &&
|
|
150 (np->rval->opcode==MESH || np->rval->opcode==MESH32))
|
|
151 do
|
|
152 {
|
|
153 x2=np->rval->constant; c2=np->rval->optdata;
|
|
154 x1=np->lval->constant; c1=np->lval->optdata;
|
|
155 OPTING(cfold);
|
|
156 tp=newnode();
|
|
157 MAYBENEWNODE(tp);
|
|
158 tp->opcode=MESH32;
|
|
159 tp->width=32;
|
|
160 tp->constant=(x1 & x2);
|
|
161 nodefree(np->lval); nodefree(np->rval);
|
|
162 tempw=np->width; *np=*tp; np->width=tempw; free(tp);
|
|
163 } while(0);
|
|
164
|
|
165 checknodeactbits(np);
|
|
166 if(np->opcode==C_OR &&
|
|
167 (np->lval->opcode==MESH || np->lval->opcode==MESH32) &&
|
|
168 (np->rval->opcode==MESH || np->rval->opcode==MESH32))
|
|
169 do
|
|
170 {
|
|
171 x2=np->rval->constant; c2=np->rval->optdata;
|
|
172 x1=np->lval->constant; c1=np->lval->optdata;
|
|
173 OPTING(cfold);
|
|
174 tp=newnode();
|
|
175 MAYBENEWNODE(tp);
|
|
176 tp->opcode=MESH32;
|
|
177 tp->width=32;
|
|
178 tp->constant=(x1 | x2);
|
|
179 nodefree(np->lval); nodefree(np->rval);
|
|
180 tempw=np->width; *np=*tp; np->width=tempw; free(tp);
|
|
181 } while(0);
|
|
182
|
|
183 checknodeactbits(np);
|
|
184 if(np->opcode==C_XOR &&
|
|
185 (np->lval->opcode==MESH || np->lval->opcode==MESH32) &&
|
|
186 (np->rval->opcode==MESH || np->rval->opcode==MESH32))
|
|
187 do
|
|
188 {
|
|
189 x2=np->rval->constant; c2=np->rval->optdata;
|
|
190 x1=np->lval->constant; c1=np->lval->optdata;
|
|
191 OPTING(cfold);
|
|
192 tp=newnode();
|
|
193 MAYBENEWNODE(tp);
|
|
194 tp->opcode=MESH32;
|
|
195 tp->width=32;
|
|
196 tp->constant=(x1 ^ x2);
|
|
197 nodefree(np->lval); nodefree(np->rval);
|
|
198 tempw=np->width; *np=*tp; np->width=tempw; free(tp);
|
|
199 } while(0);
|
|
200
|
|
201 checknodeactbits(np);
|
|
202 if(np->opcode==C_PLUS &&
|
|
203 (np->lval->opcode==MESH || np->lval->opcode==MESH32) &&
|
|
204 (np->rval->opcode==MESH || np->rval->opcode==MESH32))
|
|
205 do
|
|
206 {
|
|
207 x2=np->rval->constant; c2=np->rval->optdata;
|
|
208 x1=np->lval->constant; c1=np->lval->optdata;
|
|
209 OPTING(cfold);
|
|
210 tp=newnode();
|
|
211 MAYBENEWNODE(tp);
|
|
212 tp->opcode=MESH32;
|
|
213 tp->width=32;
|
|
214 tp->constant=(x1 + x2);
|
|
215 nodefree(np->lval); nodefree(np->rval);
|
|
216 tempw=np->width; *np=*tp; np->width=tempw; free(tp);
|
|
217 } while(0);
|
|
218
|
|
219 checknodeactbits(np);
|
|
220 if(np->opcode==C_MINUS &&
|
|
221 (np->lval->opcode==MESH || np->lval->opcode==MESH32) &&
|
|
222 (np->rval->opcode==MESH || np->rval->opcode==MESH32))
|
|
223 do
|
|
224 {
|
|
225 x2=np->rval->constant; c2=np->rval->optdata;
|
|
226 x1=np->lval->constant; c1=np->lval->optdata;
|
|
227 OPTING(cfold);
|
|
228 tp=newnode();
|
|
229 MAYBENEWNODE(tp);
|
|
230 tp->opcode=MESH32;
|
|
231 tp->width=32;
|
|
232 tp->constant=(x1 - x2);
|
|
233 nodefree(np->lval); nodefree(np->rval);
|
|
234 tempw=np->width; *np=*tp; np->width=tempw; free(tp);
|
|
235 } while(0);
|
|
236
|
|
237 checknodeactbits(np);
|
|
238 if(np->opcode==C_TIMES &&
|
|
239 (np->lval->opcode==MESH || np->lval->opcode==MESH32) &&
|
|
240 (np->rval->opcode==MESH || np->rval->opcode==MESH32))
|
|
241 do
|
|
242 {
|
|
243 x2=np->rval->constant; c2=np->rval->optdata;
|
|
244 x1=np->lval->constant; c1=np->lval->optdata;
|
|
245 OPTING(cfold);
|
|
246 tp=newnode();
|
|
247 MAYBENEWNODE(tp);
|
|
248 tp->opcode=MESH32;
|
|
249 tp->width=32;
|
|
250 tp->constant=(x1 * x2);
|
|
251 nodefree(np->lval); nodefree(np->rval);
|
|
252 tempw=np->width; *np=*tp; np->width=tempw; free(tp);
|
|
253 } while(0);
|
|
254
|
|
255 checknodeactbits(np);
|
|
256 if(np->opcode==C_DIVIDEBY &&
|
|
257 (np->lval->opcode==MESH || np->lval->opcode==MESH32) &&
|
|
258 (np->rval->opcode==MESH || np->rval->opcode==MESH32))
|
|
259 do
|
|
260 {
|
|
261 x2=np->rval->constant; c2=np->rval->optdata;
|
|
262 x1=np->lval->constant; c1=np->lval->optdata;
|
|
263 OPTING(cfold);
|
|
264 tp=newnode();
|
|
265 MAYBENEWNODE(tp);
|
|
266 tp->opcode=MESH32;
|
|
267 tp->width=32;
|
|
268 tp->constant=(x1 / x2);
|
|
269 nodefree(np->lval); nodefree(np->rval);
|
|
270 tempw=np->width; *np=*tp; np->width=tempw; free(tp);
|
|
271 } while(0);
|
|
272
|
|
273 checknodeactbits(np);
|
|
274 if(np->opcode==C_MODULUS &&
|
|
275 (np->lval->opcode==MESH || np->lval->opcode==MESH32) &&
|
|
276 (np->rval->opcode==MESH || np->rval->opcode==MESH32))
|
|
277 do
|
|
278 {
|
|
279 x2=np->rval->constant; c2=np->rval->optdata;
|
|
280 x1=np->lval->constant; c1=np->lval->optdata;
|
|
281 OPTING(cfold);
|
|
282 tp=newnode();
|
|
283 MAYBENEWNODE(tp);
|
|
284 tp->opcode=MESH32;
|
|
285 tp->width=32;
|
|
286 tp->constant=(x1 % x2);
|
|
287 nodefree(np->lval); nodefree(np->rval);
|
|
288 tempw=np->width; *np=*tp; np->width=tempw; free(tp);
|
|
289 } while(0);
|
|
290
|
|
291 checknodeactbits(np);
|
|
292 if(np->opcode==C_GREATER &&
|
|
293 (np->lval->opcode==MESH || np->lval->opcode==MESH32) &&
|
|
294 (np->rval->opcode==MESH || np->rval->opcode==MESH32))
|
|
295 do
|
|
296 {
|
|
297 x2=np->rval->constant; c2=np->rval->optdata;
|
|
298 x1=np->lval->constant; c1=np->lval->optdata;
|
|
299 OPTING(cfold);
|
|
300 tp=newnode();
|
|
301 MAYBENEWNODE(tp);
|
|
302 tp->opcode=MESH32;
|
|
303 tp->width=32;
|
|
304 tp->constant=(x1 > x2);
|
|
305 nodefree(np->lval); nodefree(np->rval);
|
|
306 tempw=np->width; *np=*tp; np->width=tempw; free(tp);
|
|
307 } while(0);
|
|
308
|
|
309 checknodeactbits(np);
|
|
310 if(np->opcode==C_LESS &&
|
|
311 (np->lval->opcode==MESH || np->lval->opcode==MESH32) &&
|
|
312 (np->rval->opcode==MESH || np->rval->opcode==MESH32))
|
|
313 do
|
|
314 {
|
|
315 x2=np->rval->constant; c2=np->rval->optdata;
|
|
316 x1=np->lval->constant; c1=np->lval->optdata;
|
|
317 OPTING(cfold);
|
|
318 tp=newnode();
|
|
319 MAYBENEWNODE(tp);
|
|
320 tp->opcode=MESH32;
|
|
321 tp->width=32;
|
|
322 tp->constant=(x1 < x2);
|
|
323 nodefree(np->lval); nodefree(np->rval);
|
|
324 tempw=np->width; *np=*tp; np->width=tempw; free(tp);
|
|
325 } while(0);
|
|
326
|
|
327 checknodeactbits(np);
|
|
328 if(np->opcode==C_RSHIFTBY &&
|
|
329 (np->lval->opcode==MESH || np->lval->opcode==MESH32) &&
|
|
330 (np->rval->opcode==MESH || np->rval->opcode==MESH32))
|
|
331 do
|
|
332 {
|
|
333 x2=np->rval->constant; c2=np->rval->optdata;
|
|
334 x1=np->lval->constant; c1=np->lval->optdata;
|
|
335 OPTING(cfold);
|
|
336 tp=newnode();
|
|
337 MAYBENEWNODE(tp);
|
|
338 tp->opcode=MESH32;
|
|
339 tp->width=32;
|
|
340 tp->constant=(x1 >> x2);
|
|
341 nodefree(np->lval); nodefree(np->rval);
|
|
342 tempw=np->width; *np=*tp; np->width=tempw; free(tp);
|
|
343 } while(0);
|
|
344
|
|
345 c=c1=c2=c3=c4=c5=c6=c7=c8=c9=0;
|
|
346 x=x1=x2=x3=x4=x5=x6=x7=x8=x9=r=0;
|
|
347 if(c+c1+c2+c3+c4+c5+c6+c7+c8+c9+r+
|
|
348 x+x1+x2+x3+x4+x5+x6+x7+x8+x9) raise(SIGSEGV);
|
|
349 return opted;
|
|
350 }
|