Quick Search:

View

Revision:
Expand:  
Changeset: MAIN:plunky:20110605085442

Diff

Diff from 1.15 to:

Annotations

Annotate by Age | Author | Mixed | None
/fisheye/browse/pcc/pcc/arch/hppa/table.c

Annotated File View

plunky
1.15
1 /*      $Id: table.c,v 1.15 2011/06/05 08:54:42 plunky Exp $    */
mickey
1.7
2 /*      $OpenBSD: table.c,v 1.2 2007/12/19 20:19:54 otto Exp $  */
mickey
1.1
3
4 /*
5  * Copyright (c) 2007 Michael Shalayeff
6  * Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se).
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. The name of the author may not be used to endorse or promote products
18  *    derived from this software without specific prior written permission
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31
32 #include "pass2.h"
33
34 #define TLL             TLONGLONG|TULONGLONG
35 #define ANYSIGNED       TINT|TLONG|TSHORT|TCHAR
36 #define ANYUSIGNED      TUNSIGNED|TULONG|TUSHORT|TUCHAR
37 #define ANYFIXED        ANYSIGNED|ANYUSIGNED
38 #define TUWORD          TUNSIGNED|TULONG
39 #define TSWORD          TINT|TLONG
40 #define TWORD           TUWORD|TSWORD
41 #define THWORD          TUSHORT|TSHORT
42 #define TBYTE           TUCHAR|TCHAR
43
44 #define SHINT   SAREG   /* char, short and int */
45 #define ININT   INAREG
46 #define SHLL    SBREG   /* shape for long long */
47 #define INLL    INBREG
48 #define SHFL    SCREG   /* shape for float */
49 #define INFL    INCREG
50 #define SHDBL   SDREG   /* shape for double */
51 #define INDBL   INDREG
52
53 struct optab table[] = {
54 /* First entry must be an empty entry */
55 { -1FOREFFSANYTANYSANYTANY00"", },
56
57 /* PCONVs are usually not necessary */
58 PCONV,        INAREG,
59         SAREG,  TWORD|TPOINT,
60         SAREG,  TWORD|TPOINT,
61                 0,      RLEFT,
62                 "", },
63 /*
64  * A bunch conversions of integral<->integral types
65  * There are lots of them, first in table conversions to itself
66  * and then conversions from each type to the others.
67  */
68
69 /* itself to itself, including pointers */
70
71 /* convert int,short,char <-> int,short,char. */
72 SCONV,        ININT,
73         SHINT,  TBYTE,
74         SHINT,  TBYTE,
75                 0,      RLEFT,
76                 "", },
77
78 SCONV,        ININT,
79         SHINT,  THWORD,
80         SHINT,  THWORD,
81                 0,      RLEFT,
82                 "", },
83
84 SCONV,        ININT,
85         SHINT,  TWORD,
86         SHINT,  TWORD,
87                 0,      RLEFT,
88                 "", },
89
90 /* convert pointers to int. */
91 SCONV,        ININT,
mickey
1.5
92         SHINT,  TWORD|TPOINT,
mickey
1.1
93         SANY,   TWORD,
94                 0,      RLEFT,
95                 "", },
96
97 /* convert (u)longlong to (u)longlong. */
98 SCONV,        INLL,
99         SHLL,   TLL,
100         SHLL,   TLL,
101                 0,      RLEFT,
102                 "", },
103
104 /* convert pointers to pointers. */
105 SCONV,        ININT,
106         SHINT,  TPOINT,
107         SANY,   TPOINT,
108                 0,      RLEFT,
109                 "", },
110
111 /* convert double <-> ldouble. nothing to do here (or support quads later) */
112 SCONV,        INDBL,
113         SHDBL,  TDOUBLE|TLDOUBLE,
114         SHDBL,  TDOUBLE|TLDOUBLE,
115                 0,      RLEFT,
116                 "", },
117
118 /* convert float -> double */
119 SCONV,        INFL,
120         SHFL,   TFLOAT,
121         SHDBL,  TDOUBLE|TLDOUBLE,
122                 0,      0,
123                 "\tfcnvff,sgl,dbl AL,AR\n", },
124
125 /* convert double -> float */
126 SCONV,        INDBL,
127         SHDBL,  TDOUBLE|TLDOUBLE,
128         SHFL,   TFLOAT,
129                 0,      0,
130                 "\tfcnvff,dbl,sgl\tAL,AR\n", },
131
132 /* convert int,short,char to (u)long long */
133 SCONV,        INLL,
134         SHINT,  ANYSIGNED,
135         SANY,   TLL,
136                 NBREG,  RESC1,
137                 "\tcopy\tAL,A1\n"
138                 "\textrs\tAL,0,1,U1\n", },
139
140 /* convert unsigned int,short,char to (u)long long */
141 SCONV,        INLL,
142         SHINT,  TWORD,
143         SANY,   TLL,
144                 NBREG,  RESC1,
145                 "\tcopy\tAL,A1\n"
146                 "\tcopy\t%r0,U1\n", },
147
148 /* convert int,short,char (in memory) to float */
149 SCONV,        INFL,
150         SOREG,  ANYSIGNED,
151         SHFL,   TFLOAT,
152                 NCREG,  RESC1,
153                 "\tfldws\tAL,A1\n"
154                 "\tfcnvxf,sgl,sgl\tA1,A1\n", },
155
156 /* convert int,short,char (in memory) to double */
157 SCONV,        INDBL,
158         SOREG,  TSWORD,
159         SHDBL,  TDOUBLE|TLDOUBLE,
160                 NDREG,  RESC1,
161                 "\tfldws\tAL,A1\n"
162                 "\tfcnvxf,sgl,dbl\tA1,A1\n", },
163
164 /* convert (u)long (in memory) to double */
165 SCONV,        INDBL,
166         SOREG,  TLL,
167         SHDBL,  TDOUBLE|TLDOUBLE,
168                 NDREG,  RESC1,
169                 "\tfldds\tAL,A1\n"
170                 "\tfcnvxf,dbl,dbl\tA1,A1\n", },
171
172 /* convert int,short,char (in register) to float */
173 SCONV,        INFL,
174         SHINT,  TSWORD,
175         SHFL,   TFLOAT,
176                 NCREG,  RESC1,
177                 "\tstw,ma\tAL,4(%sp)\n"
178                 "\tfldws,ma\t-4(%sp),A1\n"
179                 "\tfcnvxf,sgl,sgl\tA1,A1\n", },
180
181 /* convert int,short,char (in register) to double */
182 SCONV,        INDBL,
183         SHINT,  TSWORD,
184         SHDBL,  TDOUBLE|TLDOUBLE,
185                 NDREG,  RESC1,
186                 "\tstw,ma\tAL,4(%sp)\n"
187                 "\tfldws,mb\t-4(%sp),AR\n"
188                 "\tfcnvxf,sgl,dbl\tA1,A1\n", },
189
190 /* convert (u)long (in register) to double */
191 SCONV,        INDBL,
192         SHLL,   TLL,
193         SHDBL,  TDOUBLE|TLDOUBLE,
194                 NDREG,  RESC1,
195                 "\tldo\t8(%sp),%sp\n"
196                 "\tstw\tAL,-8(%sp)\n"
197                 "\tstw\tUL,-4(%sp)\n"
198                 "\tfldds,mb\t-8(%sp),A1\n"
199                 "\tfcnvxf,dbl,dbl\tA1,A1\n", },
200
201 /* convert char to (unsigned) short/int. */
202 SCONV,        ININT,
203         SAREG,  TCHAR,
mickey
1.4
204         SAREG,  THWORD|TWORD,
mickey
1.1
205                 NASL|NAREG,     RESC1,
206                 "\textrs\tAL,31,8,A1\n", },
207
208 /* convert unsigned char to (unsigned) short/int. */
209 SCONV,        ININT,
210         SAREG,  TUCHAR,
mickey
1.4
211         SAREG,  THWORD|TWORD,
mickey
1.1
212                 NASL|NAREG,     RESC1,
213                 "\textru\tAL,31,8,A1\n", },
214
215 /* convert char to (unsigned) long long. */
216 SCONV,        INLL,
217         SAREG,  TCHAR,
mickey
1.4
218         SBREG,  TLL,
mickey
1.1
219                 NBSL|NBREG,     RESC1,
220                 "\textrs\tAL,31,8,A1\n\textrs\tA1,0,1,U1", },
221
222 /* convert unsigned char to (unsigned) long long. */
223 SCONV,        INLL,
224         SAREG,  TUCHAR,
mickey
1.4
225         SBREG,  TLL,
mickey
1.1
226                 NBSL|NBREG,     RESC1,
227                 "\textru\tAL,31,8,A1\n\tcopy\t%r0,U1", },
228
229 /* convert short to (unsigned) int. */
230 SCONV,        ININT,
231         SAREG,  TSHORT,
mickey
1.4
232         SAREG,  TWORD,
mickey
1.1
233                 NASL|NAREG,     RESC1,
234                 "\textrs\tAL,31,16,A1\n", },
235
236 /* convert unsigned short to (unsigned) int. */
237 SCONV,        ININT,
238         SAREG,  TUSHORT,
mickey
1.4
239         SAREG,  THWORD,
mickey
1.1
240                 NASL|NAREG,     RESC1,
241                 "\textru\tAL,31,16,A1\n", },
242
243 /* convert short to (unsigned) long long. */
244 SCONV,        INLL,
245         SAREG,  TSHORT,
mickey
1.4
246         SBREG,  TLL,
mickey
1.1
247                 NBSL|NBREG,     RESC1,
248                 "\textrs\tAL,31,16,A1\n\textrs\tA1,0,1,U1", },
249
250 /* convert unsigned short to (unsigned) long long. */
251 SCONV,        INLL,
252         SAREG,  TUSHORT,
mickey
1.4
253         SBREG,  TLL,
mickey
1.1
254                 NBSL|NBREG,     RESC1,
255                 "\textru\tAL,31,16,A1\n\tcopy\t%r0,U1", },
256
257 /* convert int,short,char (in memory) to int,short,char */
258 SCONV,        ININT,
259         SOREG,  TBYTE,
mickey
1.4
260         SHINT,  TBYTE|TPOINT,
mickey
1.1
261                 NAREG|NASL,     RESC1,
262                 "\tldb\tAL,A1\n", },
263
264 SCONV,        ININT,
265         SOREG,  THWORD,
mickey
1.4
266         SHINT,  THWORD|TPOINT,
mickey
1.1
267                 NAREG|NASL,     RESC1,
268                 "\tldh\tAL,A1\n", },
269
270 SCONV,        ININT,
271         SOREG,  TWORD,
mickey
1.4
272         SHINT,  TWORD|TPOINT,
mickey
1.1
273                 NAREG|NASL,     RESC1,
274                 "\tldw\tAL,A1\n", },
275
276 /* convert (u)long long (in register) to int,short,char */
277 SCONV,        ININT,
278         SHLL,   TLL,
279         SHINT,  ANYFIXED,
280                 NAREG|NASL,     RESC1,
281                 "\tcopy\tAL,A1\n", },
282
283 /* convert (u)long (in memory) to int,short,char */
284 SCONV,        ININT,
285         SOREG,  TLL,
mickey
1.4
286         SHINT,  ANYFIXED,
mickey
1.1
287                 NAREG|NASL,     RESC1,
288                 "\tldw\tAL,A1\n", },
289
290 /* convert float (in register) to (u)int */
291 SCONV,        ININT,
292         SHFL,   TFLOAT,
293         SHINT,  TWORD,
294                 NAREG,  RESC1,
295                 "\tfcnvfxt,sgl,sgl\tAL,AL\n"
296                 "\tfstws,ma\tAL,4(%sp)\n"
mickey
1.8
297                 "\tldw,mb\t-4(%sp),A1\n", },
mickey
1.1
298
299 /* convert double (in register) to (u)int */
300 SCONV,        ININT,
301         SHDBL,  TDOUBLE|TLDOUBLE,
302         SHINT,  TWORD,
303                 NCREG|NCSL|NAREG,       RESC2,
304                 "\tfcnvfxt,dbl,sgl\tAL,A1\n"
305                 "\tfstws,ma\tA1,4(%sp)\n"
mickey
1.8
306                 "\tldw,mb\t-4(%sp),A2\n", },
mickey
1.1
307
308 /* convert float (in register) to (u)long */
309 SCONV,        INLL,
310         SHFL,   TFLOAT,
311         SHLL,   TLL,
312                 NDREG|NDSL|NBREG,       RESC2,
313                 "\tfcnvfxt,sgl,dbl\tAL,A1\n"
314                 "\tfstds,ma\tA1,8(%sp)\n"
315                 "\tldw\t-8(%sp),A2\n"
316                 "\tldw\t-4(%sp),U2\n"
317                 "\tldo\t-8(%sp),%sp)\n", },
318
319 /* convert double (in register) to (u)long */
320 SCONV,        INLL,
321         SHDBL,  TDOUBLE|TLDOUBLE,
322         SHLL,   TLL,
323                 NBREG,  RESC1,
324                 "\tfcnvfxt,dbl,dbl\tAL,AL\n"
325                 "\tfstds,ma\tAL,8(%sp)\n"
326                 "\tldw\t-8(%sp),A1\n"
327                 "\tldw\t-4(%sp),U1\n"
328                 "\tldo\t-8(%sp),%sp)\n", },
329
330 /*
331  * Subroutine calls.
332  */
333
mickey
1.5
334 CALL,         FOREFF,
mickey
1.1
335         SAREG,  TANY,
336         SANY,   TANY,
337                 0,      0,
338                 "ZP\tblr\t%r0, %rp\n"
339                 "\tbv,n\t%r0(AL)\n"
340                 "\tnop\nZC",    },
341
mickey
1.5
342 UCALL,        FOREFF,
343         SAREG,  TANY,
mickey
1.1
344         SANY,   TANY,
345                 0,      0,
mickey
1.5
346                 "ZP\tblr\t%r0, %rp\n"
347                 "\tbv,n\t%r0(AL)\n"
348                 "\tnop\nZC",    },
349
350 CALL,         ININT,
351         SAREG,  TANY,
352         SHINT,  ANYFIXED|TPOINT,
353                 NAREG|NASL,     RESC1,
354                 "ZP\tblr\t%r0, %rp\n"
355                 "\tbv,n\t%r0(AL)\n"
356                 "\tnop\nZC",    },
357
358 UCALL,        ININT,
359         SAREG,  TANY,
360         SHINT,  ANYFIXED|TPOINT,
361                 NAREG|NASL,     RESC1,
362                 "ZP\tblr\t%r0, %rp\n"
363                 "\tbv,n\t%r0(AL)\n"
364                 "\tnop\nZC",    },
mickey
1.1
365
366 CALL,         INLL,
367         SAREG,  TANY,
mickey
1.5
368         SHLL,   TLL,
369                 NBREG|NBSL,     RESC1,
mickey
1.1
370                 "ZP\tblr\t%r0, %rp\n"
371                 "\tbv,n\t%r0(AL)\n"
372                 "\tnop\nZC",    },
373
374 UCALL,        INLL,
375         SAREG,  TANY,
mickey
1.5
376         SHLL,   TLL,
377                 NBREG|NBSL,     RESC1,
mickey
1.1
378                 "ZP\tblr\t%r0, %rp\n"
379                 "\tbv,n\t%r0(AL)\n"
380                 "\tnop\nZC",    },
381
382 CALL,         INFL,
383         SAREG,  TANY,
384         SHFL,   TFLOAT,
mickey
1.5
385                 NCREG|NCSL,     RESC1,
mickey
1.1
386                 "ZP\tblr\t%r0, %rp\n"
387                 "\tbv,n\t%r0(AL)\n"
388                 "\tnop\nZC",    },
389
390 UCALL,        INFL,
391         SAREG,  TANY,
392         SHFL,   TFLOAT,
mickey
1.5
393                 NCREG|NCSL,     RESC1,
mickey
1.1
394                 "ZP\tblr\t%r0, %rp\n"
395                 "\tbv,n\t%r0(AL)\n"
396                 "\tnop\nZC",    },
397
398 CALL,         INDBL,
399         SAREG,  TANY,
400         SHDBL,  TDOUBLE|TLDOUBLE,
mickey
1.5
401                 NDREG|NDSL,     RESC1,
mickey
1.1
402                 "ZP\tblr\t%r0, %rp\n"
403                 "\tbv,n\t%r0(AL)\n"
404                 "\tnop\nZC",    },
405
mickey
1.5
406 UCALL,        INDBL,
mickey
1.1
407         SAREG,  TANY,
408         SHDBL,  TDOUBLE|TLDOUBLE,
mickey
1.5
409                 NDREG|NDSL,     RESC1,
mickey
1.1
410                 "ZP\tblr\t%r0, %rp\n"
411                 "\tbv,n\t%r0(AL)\n"
412                 "\tnop\nZC",    },
413
414 /*
415  * The next rules handle all binop-style operators.
416  */
417 /* TODO fix char/short overflows */
418
419 PLUS,         INLL,
420         SHLL,   TLL,
421         SPICONTANY,
422                 NBREG|NBSL,     RESC1,
423                 "\taddi\tAL,AR,A1\n"
424                 "\taddc\tUL,%r0,U1\n", },
425
426 PLUS,         INLL,
427         SHLL,   TLL,
428         SHLL,   TLL,
429                 NBREG|NBSL|NBSR,        RESC1,
430                 "\tadd\tAL,AR,A1\n"
431                 "\taddc\tUL,UR,U1\n", },
432
433 PLUS,         INFL,
434         SHFL,   TFLOAT,
435         SHFL,   TFLOAT,
436                 NCREG|NCSL|NCSR,        RESC1,
437                 "\tfadd,sgl\tAL,AR,A1\n", },
438
439 PLUS,         INDBL,
440         SHDBL,  TDOUBLE|TLDOUBLE,
441         SHDBL,  TDOUBLE|TLDOUBLE,
442                 NDREG|NDSL|NDSR,        RESC1,
443                 "\tfadd,dbl\tAL,AR,A1\n", },
444
445 PLUS,         ININT,
446         SHINT,  ANYFIXED|TPOINT,
447         SONE,   TANY,
448                 NAREG|NASL,     RESC1,
449                 "\tldo\t1(AL),A1\n", },
450
451 PLUS,         ININT,
452         SHINT,  ANYFIXED|TPOINT,
453         SPCON,  TANY,
454                 NAREG|NASL,     RESC1,
455                 "\tldo\tCR(AL),A1\n", },
456
457 MINUS,        INLL,
458         SHLL,   TLL,
459         SPICONTANY,
460                 NBREG|NBSL|NBSR,        RESC1,
461                 "\tsubi\tAL,AR,A1\n"
462                 "\tsubb\tUL,%r0,U1\n", },
463
464 PLUS,         ININT,
465         SHINT,  TANY|TPOINT,
466         SPNAMETANY,
467                 NAREG|NASL,     RESC1,
468                 "\tldo\tAR(AL),A1\n", },
469
470 MINUS,        INLL,
471         SHLL,   TLL,
472         SHLL,   TLL,
473                 NBREG|NBSL|NBSR,        RESC1,
474                 "\tsub\tAL,AR,A1\n"
475                 "\tsubb\tUL,UR,U1\n", },
476
477 MINUS,        INFL,
478         SHFL,   TFLOAT,
479         SHFL,   TFLOAT,
480                 NCREG|NCSL|NCSR,        RESC1,
481                 "\tfsub,sgl\tAL,AR,A1\n", },
482
483 MINUS,        INDBL,
484         SHDBL,  TDOUBLE|TLDOUBLE,
485         SHDBL,  TDOUBLE|TLDOUBLE,
486                 NDREG|NDSL|NDSR,        RESC1,
487                 "\tfsub,dbl\tAL,AR,A1\n", },
488
489 MINUS,        ININT,
490         SHINT,  ANYFIXED|TPOINT,
491         SONE,   TANY,
492                 NAREG|NASL,     RESC1,
493                 "\tldo\t-1(AL),A1\n", },
494
495 MINUS,        ININT,
496         SHINT,  ANYFIXED|TPOINT,
497         SPCON,  TANY,
498                 NAREG|NASL,     RESC1,
499                 "\tldo\t-CR(AL),A1\n", },
500
501 /* Simple reg->reg ops */
502 OPSIMP,       ININT,
503         SAREG,  TWORD|TPOINT,
504         SAREG,  TWORD|TPOINT,
505                 NAREG|NASL,     RESC1,
506                 "\tO\tAL,AR,A1\n", },
507
508 OPSIMP,       INLL,
509         SHLL,   TLL,
510         SHLL,   TLL,
511                 NBREG|NBSL|NBSR,        RESC1,
512                 "\tO\tAL,AR,A1\n"
513                 "\tO\tUL,UR,U1\n", },
514
515 /*
516  * The next rules handle all shift operators.
517  */
518 LS,   ININT,
519         SHINT,  ANYFIXED,
520         SCON,   ANYFIXED,
521                 NAREG|NASL,     RESC1,
522                 "\tzdep\tAL,31-AR,32-AR,A1\n", },
523
524 LS,   ININT,
525         SHINT,  ANYFIXED,
526         SHINT,  ANYFIXED,
527                 NAREG|NASR,     RESC1,
528                 "\tsubi\t31,AR,A1\n"
529                 "\tmtsar\tA1\n"
530                 "\tzvdep\tAL,32,A1\n", },
531
532 RS,   INLL,
533         SHLL,   TLONGLONG,
534         SCON,   ANYFIXED,
535                 NBREG|NBSL,     RESC1,
536                 "\tshd\tUL,AL,31-AR,A1\n"
537                 "\textrs\tUL,31-AR,32,U1\n", },
538
539 RS,   INLL,
540         SHLL,   TULONGLONG,
541         SCON,   ANYFIXED,
542                 NBREG|NBSL,     RESC1,
543                 "\tshd\tUL,AL,AR,A1\n"
544                 "\textru\tUL,31-AR,32,U1\n", },
545
546 RS,   ININT,
547         SHINT,  ANYSIGNED,
548         SCON,   ANYFIXED,
549                 NAREG|NASL,     RESC1,
550                 "\textrs\tAL,31-AR,32,A1\n", },
551
552 RS,   ININT,
553         SHINT,  ANYUSIGNED,
554         SCON,   ANYFIXED,
555                 NAREG|NASL,     RESC1,
556                 "\textru\tAL,31-AR,32,A1\n", },
557
558 /* TODO the following should be split into mtsar and actual shift parts */
559 RS,   ININT,
560         SHINT,  ANYSIGNED,
561         SHINT,  ANYFIXED,
562                 NAREG|NASR,     RESC1,
563                 "\tsubi\t31,AR,A1\n"
564                 "\tmtsar\tA1\n"
565                 "\tvextrs\tAL,32,A1\n", },
566
567 RS,   ININT,
568         SHINT,  ANYUSIGNED,
569         SHINT,  ANYFIXED,
570                 NAREG|NASR,     RESC1,
571                 "\tsubi\t31,AR,A1\n"
572                 "\tmtsar\tA1\n"
573                 "\tvextru\tAL,32,A1\n", },
574
575 /*
576  * The next rules takes care of assignments. "=".
577  */
578
579 ASSIGN,       FOREFF|INAREG,
580         SAREG,  TWORD|TPOINT,
581         SPCON,  TANY,
582                 0,      RDEST,
583                 "\tldi\tAR,AL\n", },
584
585 ASSIGN,       FOREFF|INAREG,
586         SOREG,  TBYTE,
mickey
1.7
587         SHINT,  TBYTE,
mickey
1.1
588                 0,      RDEST,
589                 "\tstb\tAR,AL\n", },
590
591 ASSIGN,       FOREFF|INAREG,
592         SOREG,  THWORD,
mickey
1.7
593         SHINT,  THWORD,
mickey
1.1
594                 0,      RDEST,
595                 "\tsth\tAR,AL\n", },
596
597 ASSIGN,       FOREFF|INAREG,
598         SOREG,  TWORD|TPOINT,
mickey
1.4
599         SHINT,  TWORD|TPOINT,
mickey
1.1
600                 0,      RDEST,
601                 "\tstw\tAR,AL\n", },
602
603 ASSIGN,       FOREFF|INLL,
604         SOREG,  TLL,
mickey
1.7
605         SHLL,   TLL,
mickey
1.1
606                 0,      RDEST,
607                 "\tstw\tAR,AL\n"
608                 "\tstw\tUR,UL\n", },
609
610 ASSIGN,       FOREFF|INAREG,
611         SHINT,  TBYTE,
612         SOREG,  TBYTE,
613                 0,      RDEST,
614                 "\tldb\tAR,AL\n", },
615
616 ASSIGN,       FOREFF|INAREG,
617         SHINT,  THWORD,
618         SOREG,  THWORD,
619                 0,      RDEST,
620                 "\tldh\tAR,AL\n", },
621
622 ASSIGN,       FOREFF|INAREG,
623         SHINT,  TWORD|TPOINT,
624         SOREG,  TWORD|TPOINT,
625                 0,      RDEST,
626                 "\tldw\tAR,AL\n", },
627
628 ASSIGN,       FOREFF|INLL,
629         SHLL,   TLL,
630         SOREG,  TLL,
631                 0,      RDEST,
632                 "\tldw\tAR,AL\n"
633                 "\tldw\tUR,UL\n", },
634
635 ASSIGN,       FOREFF|ININT,
636         SHINT,  TWORD|TPOINT,
637         SHINT,  TWORD|TPOINT,
638                 0,      RDEST,
639                 "\tcopy\tAR,AL\n", },
640
641 ASSIGN,       FOREFF|ININT,
642         SHINT,  ANYFIXED,
643         SHINT,  ANYFIXED,
644                 0,      RDEST,
645                 "\tcopy\tAR,AL\n", },
646
mickey
1.2
647 ASSIGN,       FOREFF|ININT,
648         SFLD,   TANY,
mickey
1.3
649         SPIMM,  TANY,
mickey
1.2
650                 0,      RDEST,
651                 "\tdepi\tAR,31-H,S,AL\n", },
652
653 ASSIGN,       FOREFF|ININT,
654         SFLD,   TANY,
655         SHINT,  TANY,
656                 0,      RDEST,
657                 "\tdep\tAR,31-H,S,AL\n", },
658
mickey
1.1
659 ASSIGN,       FOREFF|INLL,
660         SHLL,   TLL,
661         SHLL,   TLL,
662                 0,      RDEST,
663                 "\tcopy\tAR,AL\n"
664                 "\tcopy\tUR,UL\n", },
665
666 ASSIGN,       FOREFF|INFL,
667         SHFL,   TFLOAT,
668         SHFL,   TFLOAT,
669                 0,      RDEST,
670                 "\tfcpy,sgl\tAR,AL\n", },
671
672 ASSIGN,       FOREFF|INDBL,
673         SHDBL,  TDOUBLE|TLDOUBLE,
674         SHDBL,  TDOUBLE|TLDOUBLE,
675                 0,      RDEST,
676                 "\tfcpy,dbl\tAR,AL\n", },
677
678 ASSIGN,       FOREFF|INFL,
679         SHFL,   TFLOAT,
680         SOREG,  TFLOAT,
681                 0,      RDEST,
682                 "\tfldws\tAR,AL\n", },
683
684 ASSIGN,       FOREFF|INDBL,
685         SHDBL,  TDOUBLE|TLDOUBLE,
686         SOREG,  TDOUBLE|TLDOUBLE,
687                 0,      RDEST,
688                 "\tfldds\tAR,AL\n", },
689
690 ASSIGN,       FOREFF|INFL,
691         SOREG,  TFLOAT,
692         SHFL,   TFLOAT,
693                 0,      RDEST,
694                 "\tfstws\tAR,AL\n", },
695
696 ASSIGN,       FOREFF|INDBL,
697         SOREG,  TDOUBLE|TLDOUBLE,
698         SHDBL,  TDOUBLE|TLDOUBLE,
699                 0,      RDEST,
700                 "\tfstds\tAR,AL\n", },
701
702 /*
703  * DIV/MOD/MUL
704  */
705 DIV,  INFL,
706         SHFL,   TFLOAT,
707         SHFL,   TFLOAT,
708                 NCREG|NCSL|NCSR,        RESC1,
709                 "\tfdiv,sgl\tAL,AR,A1\n", },
710
711 DIV,  INDBL,
712         SHDBL,  TDOUBLE|TLDOUBLE,
713         SHDBL,  TDOUBLE|TLDOUBLE,
714                 NDREG|NDSL|NDSR,        RESC1,
715                 "\tfdiv,dbl\tAL,AR,A1\n", },
716
717 MUL,  INFL,
718         SHFL,   TFLOAT,
719         SHFL,   TFLOAT,
720                 NCREG|NCSL|NCSR,        RESC1,
721                 "\tfmul,sgl\tAL,AR,A1\n", },
722
723 MUL,  INDBL,
724         SHDBL,  TDOUBLE|TLDOUBLE,
725         SHDBL,  TDOUBLE|TLDOUBLE,
726                 NDREG|NDSL|NDSR,        RESC1,
727                 "\tfmul,dbl\tAL,AR,A1\n", },
728
729 /*
730  * Indirection operators.
731  */
732 UMULINLL,
733         SANY,   TANY,
734         SOREG,  TLL,
735                 NBREG,  RESC1,
736                 "\tldw\tAL,A1\n"
737                 "\tldw\tUL,U1\n", },
738
739 UMULININT,
740         SANY,   TPOINT|TWORD,
741         SOREG,  TPOINT|TWORD,
742                 NAREG|NASL,     RESC1,
743                 "\tldw\tAL,A1\n", },
744
745 UMULININT,
746         SANY,   TANY,
747         SOREG,  THWORD,
748                 NAREG|NASL,     RESC1,
749                 "\tldh\tAL,A1\n", },
750
751 UMULININT,
752         SANY,   TANY,
753         SOREG,  TBYTE,
754                 NAREG|NASL,     RESC1,
755                 "\tldb\tAL,A1\n", },
756
757 UMULINDBL,
758         SANY,   TANY,
759         SOREG,  TDOUBLE|TLDOUBLE,
760                 NDREG|NDSL,     RESC1,
761                 "\tfldds\tAL,A1\n", },
762
763 UMULINFL,
764         SANY,   TANY,
765         SOREG,  TFLOAT,
766                 NCREG|NCSL,     RESC1,
767                 "\tfldws\tAL,A1\n", },
768
769 /*
770  * Logical/branching operators
771  */
772 OPLOG,        FORCC,
773         SHLL,   TLL,
774         SHLL,   TLL,
775                 0,      0,
776                 "ZD", },
777
778 OPLOG,        FORCC,
mickey
1.5
779         SHINT,  ANYFIXED|TPOINT,
780         SPIMM,  ANYFIXED|TPOINT,
mickey
1.1
781                 0,      0,
mickey
1.3
782                 "\tcomib,O\tAR,AL,LC\n\tnop\n", },
mickey
1.1
783
784 OPLOG,        FORCC,
mickey
1.5
785         SHINT,  ANYFIXED|TPOINT,
786         SHINT,  ANYFIXED|TPOINT,
mickey
1.1
787                 0,      0,
mickey
1.3
788                 "\tcomb,O\tAR,AL,LC\n\tnop\n", },
mickey
1.1
789
790 OPLOG,        FORCC,
791         SHFL,   TFLOAT,
792         SHFL,   TFLOAT,
793                 0,      RESCC,
794                 "\tfcmp,sgl,!O\tAR,AL\n"
795                 "\tftest\n"
796                 "\tb\tLC\n"
797                 "\tnop", },
798
799 OPLOG,        FORCC,
800         SHDBL,  TDOUBLE|TLDOUBLE,
801         SHDBL,  TDOUBLE|TLDOUBLE,
802                 0,      RESCC,
803                 "\tfcmp,dbl,!O\tAR,AL\n"
804                 "\tftest\n"
805                 "\tb\tLC\n"
806                 "\tnop", },
807
808 /*
809  * Jumps.
810  */
811 GOTO,         FOREFF,
812         SCON,   TANY,
813         SANY,   TANY,
814                 0,      RNOP,
815                 "\tb\tLL\n\tnop\n", },
816
817 #ifdef GCC_COMPAT
818 GOTO,         FOREFF,
819         SAREG,  TANY,
820         SANY,   TANY,
821                 0,      RNOP,
822                 "\tbv\t%r0(AL)\n\tnop\n", },
823 #endif
824
825
826 /*
827  * Convert LTYPE to reg.
828  */
829
830 OPLTYPE,      INAREG,
831         SAREG,  TANY,
832         SNAME,  TANY,
833                 0,      RDEST,
mickey
1.10
834                 "\taddil\tUR,%r27\n", },
835
836 OPLTYPE,      INAREG,
837         SAREG,  TANY,
838         SCON,   TPOINT,
839                 0,      RDEST,
840                 "\taddil\tUR,%r27\n", },
mickey
1.1
841
842 OPLTYPE,      INLL,
843         SANY,   TANY,
844         SOREG,  TLL,
845                 NBREG|NBSL,     RESC1,
846                 "\tldw\tAL,A1\n"
847                 "\tldw\tUL,U1\n", },
848
849 OPLTYPE,      INAREG,
850         SANY,   TANY,
851         SOREG,  TWORD|TPOINT,
852                 NAREG|NASL,     RESC1,
853                 "\tldw\tAL,A1\n", },
854
855 OPLTYPE,      INAREG,
856         SANY,   TANY,
857         SAREG,  TWORD|TPOINT,
858                 NAREG|NASL,     RESC1,
859                 "\tcopy\tAL,A1\n", },
860
861 OPLTYPE,      INAREG,
862         SANY,   TANY,
mickey
1.14
863         SPCNHIANYFIXED,
864                 NAREG,          RESC1,
865                 "\tldil\tUR,A1\n", },
866
867 OPLTYPE,      INAREG,
868         SANY,   TANY,
mickey
1.1
869         SPCON,  ANYFIXED,
870                 NAREG,          RESC1,
871                 "\tldi\tAR,A1\n", },
872
873 OPLTYPE,      INLL,
874         SANY,   TANY,
875         SPCON,  TLL,
mickey
1.9
876                 NBREG,          RESC1,
mickey
1.1
877                 "\tldi\tAR,A1\n"
878                 "\tcopy\t%r0,U1\n", },
879
880 OPLTYPE,      ININT,
881         SANY,   TANY,
mickey
1.10
882         SCON,   TWORD,
mickey
1.1
883                 NAREG,          RESC1,
884                 "\tldil\tUR,A1\n"
885                 "\tldo\tAR(A1),A1\n", },
886
mickey
1.5
887 OPLTYPE,      INLL,
888         SHLL,   TLL,
mickey
1.13
889         SPCNHWTLL,
890                 NBREG,          RESC1,
891                 "\tldil\tUR>>32,U1\n"
892                 "\tldo\tAR>>32(U1),U1\n"
893                 "\tcopy\t%r0,A1\n", },
894
895 OPLTYPE,      INLL,
896         SHLL,   TLL,
897         SPCNLWTLL,
898                 NBREG,          RESC1,
899                 "\tcopy\t%r0,U1\n"
900                 "\tldil\tUR,A1\n"
901                 "\tldo\tAR(A1),A1\n", },
902
903 OPLTYPE,      INLL,
904         SHLL,   TLL,
mickey
1.5
905         SCON,   TLL,
906                 NBREG,          RESC1,
907                 "\tldil\tUR,A1\n"
908                 "\tldo\tAR(A1),A1\n"
909                 "\tldil\tUR>>32,U1\n"
mickey
1.12
910                 "\tldo\tAR>>32(U1),U1\n", },
mickey
1.5
911
mickey
1.1
912 OPLTYPE,      INCREG,
913         SANY,   TFLOAT,
914         SHFL,   TFLOAT,
915                 NCREG,  RESC1,
916                 "\tfldws\tAL,A1\n", },
917
918 OPLTYPE,      INDREG,
919         SANY,   TDOUBLE|TLDOUBLE,
920         SHDBL,  TDOUBLE|TLDOUBLE,
921                 NDREG,  RESC1,
922                 "\tfldds\tAL,A1\n", },
923
924 /*
925  * Negate a word.
926  */
927 UMINUS,       INLL,
928         SHLL,   TLL,
929         SHLL,   TLL,
930                 NBREG|NBSL,     RESC1,
931                 "\tsub\t%r0,AL,A1\n"
932                 "\tsubb\t%r0,UL,A1\n", },
933
934 UMINUS,       ININT,
935         SHINT,  TWORD,
936         SHINT,  TWORD,
937                 NAREG|NASL,     RESC1,
938                 "\tsub\t%r0,AL,A1\n", },
939
940 UMINUS,       INFL,
941         SHFL,   TFLOAT,
942         SHFL,   TFLOAT,
943                 NCREG|NCSL,     RESC1,
944                 "\tfsub,sgl\t%fr0,AL,A1\n", },
945
946 UMINUS,       INDBL,
947         SHDBL,  TDOUBLE|TLDOUBLE,
948         SHDBL,  TDOUBLE|TLDOUBLE,
949                 NDREG|NDSL,     RESC1,
950                 "\tfsub,dbl\t%fr0,AL,A1\n", },
951
952 COMPL,        INLL,
953         SHLL,   TLL,
954         SANY,   TANY,
955                 NBREG|NBSL,     RESC1,
956                 "\tuaddcm\t%r0,AL,A1\n"
957                 "\tuaddcm\t%r0,UL,U1\n", },
958
959 COMPL,        ININT,
960         SHINT,  ANYFIXED,
961         SANY,   TANY,
962                 NAREG|NASL,     RESC1,
963                 "\tuaddcm\t%r0,AL,A1\n", },
964
965 /*
966  * Arguments to functions.
967  */
968
969 STARG,        FOREFF,
970         SAREG|SOREG|SNAME|SCONTANY,
971         SANY,   TSTRUCT,
mickey
1.11
972                 NAREG | RNULL,  0,
973                 "ZS", },
mickey
1.1
974
mickey
1.2
975 /*
976  * struct field ops
977  */
978 FLD,  ININT,
979         SHINT,  TANY,
980         SFLD,   ANYSIGNED,
981                 NAREG|NASL,     RESC1,
982                 "\textrs\tAL,31-H,S,A1\n", },
983
984 FLD,  ININT,
985         SHINT,  TANY,
986         SFLD,   ANYUSIGNED,
987                 NAREG|NASL,     RESC1,
988                 "\textru\tAL,31-H,S,A1\n", },
989
mickey
1.1
990 # define DF(x) FORREW,SANY,TANY,SANY,TANY,REWRITE,x,""
991
992 UMULDFUMUL ), },
993
994 ASSIGNDF(ASSIGN), },
995
996 STASGDF(STASG), },
997
998 FLDDF(FLD), },
999
1000 OPLEAFDF(NAME), },
1001
1002 /* { INIT, DF(INIT), }, */
1003
1004 OPUNARYDF(UMINUS), },
1005
1006 OPANYDF(BITYPE), },
1007
1008 FREE,         FREE,
1009         FREE,   FREE,
1010         FREE,   FREE,
1011                 FREE,   FREE,
1012                 "HELP; I'm in trouble\n" },
1013 };
1014
1015 int tablesize = sizeof(table)/sizeof(table[0]);
FishEye: Open Source License registered to PCC.
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-12-20 15:27 +0100