Quick Search:

View

Revision:
Expand:  
Changeset: MAIN:ragge:20080622152459

Diff

Diff from 1.23 to:

Annotations

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

Annotated File View

mickey
1.1
1 /*      $OpenBSD$       */
2
3 /*
4  * Copyright (c) 2007 Michael Shalayeff
5  * Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se).
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. The name of the author may not be used to endorse or promote products
17  *    derived from this software without specific prior written permission
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30
31
32 # include "pass2.h"
33 # include <ctype.h>
34 # include <string.h>
35
36 void acon(NODE *p);
mickey
1.7
37 void prtprolog(struct interpass_prolog *, int);
mickey
1.12
38 int countargs(NODE *pint *);
39 void fixcalls(NODE *p);
mickey
1.1
40
41 static int stkpos;
mickey
1.12
42 int p2calls;
mickey
1.1
43
mickey
1.14
44 static const int rl[] =
mickey
1.9
45   { R0R1R1R1R1R1R31R31R31R31,
mickey
1.14
46     R4R5R6R7R8R9R10R11R12R13R14R15R16R17R18,
47     T1T4T3T2ARG3ARG1RET1 };
48 static const int rh[] =
mickey
1.9
49   { R0R31T4T3T2T1T4T3T2T1,
mickey
1.14
50     R18R4R5R6R7R8R9R10R11R12R13R14R15R16R17,
51     T4T3T2T1ARG2ARG0RET0 };
mickey
1.1
52
53 void
54 deflab(int label)
55 {
56         printf("\t.label\t" LABFMT "\n"label);
57 }
58
59 static int regoff[MAXREGS];
60 static TWORD ftype;
61
62 /*
63  * Print out the prolog assembler.
64  * addto and regoff are already calculated.
65  */
mickey
1.7
66 void
mickey
1.1
67 prtprolog(struct interpass_prolog *ippint addto)
68 {
69         int i;
70
mickey
1.12
71         /* if this functions calls nothing -- no frame is needed */
72         if (p2calls || p2maxautooff > 4) {
73                 printf("\tcopy\t%%r3,%%r1\n\tcopy\t%%sp,%%r3\n");
74                 if (addto < 0x2000)
75                         printf("\tstw,ma\t%%r1,%d(%%sp)\n"addto);
76                 else if (addto < 0x802000)
77                         printf("\tstw,ma\t%%r1,8192(%%sp)\n"
78                             "\taddil\t%d-8192,%%sp\n"
79                             "\tcopy\t%%r1,%%sp\n"addto);
80                 else
81                         comperr("too much local allocation");
82                 if (p2calls)
83                         printf("\tstw\t%%rp,-20(%%r3)\n");
84         }
mickey
1.7
85
mickey
1.1
86         for (i = 0i < MAXREGSi++)
87                 if (TESTBIT(ipp->ipp_regsi)) {
88                         if (i <= R31)
mickey
1.17
89                                 printf("\tstw\t%s,%d(%%r3)\n",
mickey
1.7
90                                     rnames[i], regoff[i]);
91                         else if (i <= RETD0)
mickey
1.17
92                                 printf("\tstw\t%s,%d(%%r3)\n"
93                                     "\tstw\t%s,%d(%%r3)\n",
mickey
1.7
94                                     rnames[rl[i - RD0]], regoff[i] + 0,
95                                     rnames[rh[i - RD0]], regoff[i] + 4);
mickey
1.1
96                         else if (i <= FR31)
mickey
1.17
97                                 printf("\tfstws\t%s,%d(%%r3)\n",
mickey
1.7
98                                     rnames[i], regoff[i]);
mickey
1.1
99                         else
mickey
1.17
100                                 printf("\tfstds\t%s,%d(%%r3)\n",
mickey
1.7
101                                     rnames[i], regoff[i]);
mickey
1.1
102                 }
103 }
104
105 /*
106  * calculate stack size and offsets
107  */
108 static int
109 offcalc(struct interpass_prolog *ipp)
110 {
mickey
1.17
111         int iaddtooff;
mickey
1.1
112
113         addto = 32;
mickey
1.12
114         if (p2calls) {
115                 i = p2calls - 1;
116                 /* round up to 4 args */
117                 if (i < 4)
118                         i = 4;
119                 addto += i * 4;
120         }
121
mickey
1.17
122         for (off = 4i = 0i < MAXREGSi++)
mickey
1.1
123                 if (TESTBIT(ipp->ipp_regsi)) {
mickey
1.17
124                         regoff[i] = off;
125                         off += szty(PERMTYPE(i)) * SZINT/SZCHAR;
mickey
1.1
126                 }
mickey
1.17
127         addto += off + p2maxautooff;
mickey
1.1
128         return (addto + 63) & ~63;
129 }
130
131 void
132 prologue(struct interpass_prolog *ipp)
133 {
134         int addto;
135
136         ftype = ipp->ipp_type;
137
138         /*
mickey
1.21
139          * We here know what registers to save and how much to 
mickey
1.1
140          * add to the stack.
141          */
142         addto = offcalc(ipp);
mickey
1.21
143         printf("\t.proc\ncallinfo frame=%d, save_rp, save_sp\n\t.entry\n",
144             addto);
mickey
1.1
145         prtprolog(ippaddto);
146 }
147
148 void
149 eoftn(struct interpass_prolog *ipp)
150 {
151         int i;
152
153         if (ipp->ipp_ip.ip_lbl == 0)
154                 return/* no code needs to be generated */
155
156         /* return from function code */
157         for (i = 0i < MAXREGSi++)
mickey
1.7
158                 if (TESTBIT(ipp->ipp_regsi)) {
159                         if (i <= R31)
mickey
1.17
160                                 printf("\tldw\t%d(%%r3),%s\n",
mickey
1.7
161                                     regoff[i], rnames[i]);
162                         else if (i <= RETD0)
mickey
1.17
163                                 printf("\tldw\t%d(%%r3),%s\n"
164                                     "\tldw\t%d(%%r3),%s\n",
mickey
1.7
165                                     regoff[i] + 0rnames[rl[i - RD0]],
166                                     regoff[i] + 4rnames[rh[i - RD0]]);
167                         else if (i <= FR31)
mickey
1.17
168                                 printf("\tfldws\t%d(%%r3),%s\n",
mickey
1.7
169                                     regoff[i], rnames[i]);
170                         else
mickey
1.17
171                                 printf("\tfldds\t%d(%%r3),%s\n",
mickey
1.7
172                                     regoff[i], rnames[i]);
173                 }
mickey
1.1
174
mickey
1.12
175         if (p2calls || p2maxautooff > 4) {
176                 if (p2calls)
177                         printf("\tldw\t-20(%%r3),%%rp\n");
178                 printf("\tcopy\t%%r3,%%r1\n"
mickey
1.20
179                     "\tldw\t0(%%r3),%%r3\n"
mickey
1.12
180                     "\tbv\t%%r0(%%rp)\n"
181                     "\tcopy\t%%r1,%%sp\n");
182         } else
183                 printf("\tbv\t%%r0(%%rp)\n\tnop\n");
184
185         printf("\t.exit\n\t.procend\n\t.size\t%s, .-%s\n",
mickey
1.1
186             ipp->ipp_nameipp->ipp_name);
187 }
188
189 /*
190  * add/sub/...
191  *
192  * Param given:
193  */
194 void
195 hopcode(int fint o)
196 {
197         char *str;
198
199         switch (o) {
200         case PLUS:
201                 str = "add";
202                 break;
203         case MINUS:
204                 str = "sub";
205                 break;
206         case AND:
207                 str = "and";
208                 break;
209         case OR:
210                 str = "or";
211                 break;
212         case ER:
213                 str = "xor";
214                 break;
215         case EQ:
216                 str = "=";
217                 break;
218         case NE:
219                 str = "<>";
220                 break;
221         case LE:
222                 str = "<";
223                 break;
224         case LT:
225                 str = "<=";
226                 break;
227         case ULE:
228                 str = "<<";
229                 break;
230         case ULT:
231                 str = "<<=";
232                 break;
mickey
1.10
233         case GE:
234                 str = ">=";
235                 break;
236         case GT:
237                 str = ">";
238                 break;
mickey
1.1
239         case UGE:
240                 str = ">>";
241                 break;
242         case UGT:
243                 str = ">>=";
244                 break;
245         default:
246                 comperr("hopcode2: %d"o);
247                 str = 0/* XXX gcc */
248         }
249         printf("%s%c"strf);
250 }
251
252 /*
253  * Return type size in bytes.  Used by R2REGS, arg 2 to offset().
254  */
255 int
256 tlen(pNODE *p;
257 {
258         switch(p->n_type) {
259                 case CHAR:
260                 case UCHAR:
261                         return(1);
262
263                 case SHORT:
264                 case USHORT:
265                         return(SZSHORT/SZCHAR);
266
267                 case FLOAT:
268                         return(SZFLOAT/SZCHAR);
269
270                 case DOUBLE:
271                         return(SZDOUBLE/SZCHAR);
272
273                 case INT:
274                 case UNSIGNED:
275                 case LONG:
276                 case ULONG:
277                         return(SZINT/SZCHAR);
278
279                 case LONGLONG:
280                 case ULONGLONG:
281                         return SZLONGLONG/SZCHAR;
282
283                 default:
284                         if (!ISPTR(p->n_type))
mickey
1.17
285                                 comperr("tlen type %d not pointer"p->n_type);
mickey
1.1
286                         return SZPOINT(p->n_type)/SZCHAR;
287                 }
288 }
289
290 static int
291 argsiz(NODE *p)
292 {
mickey
1.19
293         NODE *q;
mickey
1.1
294         TWORD t = p->n_type;
295
296         if (t < LONGLONG || t == FLOAT || t > BTMASK)
297                 return 4;
298         if (t == LONGLONG || t == ULONGLONG || t == DOUBLE)
299                 return 8;
300         if (t == LDOUBLE)
mickey
1.19
301                 return 8;       /* LDOUBLE is 16 */
302         if ((t == STRTY || t == UNIONTY) && p->n_right->n_op == STARG)
303                 return 4 + p->n_right->n_stsize;
304         /* perhaps it's down there somewhere -- let me take another look! */
305         if ((t == STRTY || t == UNIONTY) && p->n_right->n_op == CALL) {
306                 q = p->n_right->n_right->n_left->n_left->n_right;
307                 if (q->n_op == STARG)
308                         return 4 + q->n_stsize;
309         }
310         comperr("argsiz %p"p);
mickey
1.1
311         return 0;
312 }
313
mickey
1.13
314 /*
315  * Emit code to compare two longlong numbers.
316  */
317 static void
318 twollcomp(NODE *p)
319 {
320         int o = p->n_op;
321         int s = getlab();
322         int e = p->n_label;
323         int cb1cb2;
324
325         if (o >= ULE)
326                 o -= (ULE-LE);
327         switch (o) {
328         case NE:
329                 cb1 = 0;
330                 cb2 = NE;
331                 break;
332         case EQ:
333                 cb1 = NE;
334                 cb2 = 0;
335                 break;
336         case LE:
337         case LT:
338                 cb1 = GT;
339                 cb2 = LT;
340                 break;
341         case GE:
342         case GT:
343                 cb1 = LT;
344                 cb2 = GT;
345                 break;
346         
347         default:
348                 cb1 = cb2 = 0/* XXX gcc */
349         }
350         if (p->n_op >= ULE)
351                 cb1 += 4cb2 += 4;
mickey
1.16
352         if (cb1) {
353                 p->n_op = cb1;
354                 p->n_label = s;
355                 expand(p0"\tcomb,O\tUR,UL,LC\n\tnop\n");
356                 p->n_label = e;
357                 p->n_op = o;
358         }
359         if (cb2) {
360                 p->n_op = cb2;
361                 expand(p0"\tcomb,O\tUR,UL,LC\n\tnop\n");
362                 p->n_op = o;
363         }
364         expand(p0"\tcomb,O\tAR,AL,LC\n\tnop\n");
mickey
1.13
365         deflab(s);
366 }
367
mickey
1.1
368 void
369 zzzcode(NODE *pint c)
370 {
371         int n;
372
373         switch (c) {
374
375         case 'C':       /* after-call fixup */
mickey
1.13
376                 n = p->n_qual;  /* args */
mickey
1.1
377                 break;
378
379         case 'P':       /* returning struct-call setup */
mickey
1.13
380                 n = p->n_qual;  /* args */
381                 break;
382
383         case 'D':       /* Long long comparision */
384                 twollcomp(p);
385                 break;
386
387         case 'F':       /* struct as an arg */
mickey
1.1
388
389         default:
390                 comperr("zzzcode %c"c);
391         }
392 }
393
394 int canaddr(NODE *);
395 int
396 canaddr(NODE *p)
397 {
398         int o = p->n_op;
399
400         if (o == NAME || o == REG || o == ICON || o == OREG ||
401             (o == UMUL && shumul(p->n_left)))
402                 return(1);
403         return(0);
404 }
405
stefan
1.15
406 int
407 fldexpand(NODE *pint cookiechar **cp)
408 {
409         return 0;
410 }
411
mickey
1.1
412 /*
413  * Does the bitfield shape match?
414  */
415 int
416 flshape(NODE *p)
417 {
418         int o = p->n_op;
419
mickey
1.2
420         if (isreg(p))
mickey
1.1
421                 return SRDIR/* Direct match */
mickey
1.2
422
mickey
1.1
423         return SRREG/* put it into a register */
424 }
425
426 /* INTEMP shapes must not contain any temporary registers */
427 /* XXX should this go away now? */
428 int
429 shtemp(NODE *p)
430 {
431         return 0;
432 #if 0
433         int r;
434
435         if (p->n_op == STARG )
436                 p = p->n_left;
437
438         switch (p->n_op) {
439         case REG:
440                 return (!istreg(p->n_rval));
441
442         case OREG:
443                 r = p->n_rval;
444                 if (R2TEST(r)) {
445                         if (istreg(R2UPK1(r)))
446                                 return(0);
447                         r = R2UPK2(r);
448                 }
449                 return (!istreg(r));
450
451         case UMUL:
452                 p = p->n_left;
453                 return (p->n_op != UMUL && shtemp(p));
454         }
455
456         if (optype(p->n_op) != LTYPE)
457                 return(0);
458         return(1);
459 #endif
460 }
461
462 void
463 adrcon(CONSZ val)
464 {
465         /* fix for L% and R% */
466         printf(CONFMTval);
467 }
468
469 void
470 conput(FILE *fpNODE *p)
471 {
mickey
1.22
472         CONSZ val = p->n_lval;
mickey
1.1
473
474         switch (p->n_op) {
475         case ICON:
476                 if (p->n_name[0] != '\0') {
mickey
1.22
477                         fprintf(fp"RR'%s-$global$"p->n_name);
mickey
1.1
478                         if (val)
mickey
1.22
479                                 fprintf(fp"+" CONFMTval);
mickey
1.1
480                 } else
mickey
1.22
481                         fprintf(fpCONFMTval);
mickey
1.1
482                 return;
483
484         default:
485                 comperr("illegal conput, p %p"p);
486         }
487 }
488
489 /*ARGSUSED*/
490 void
491 insput(NODE *p)
492 {
493         comperr("insput");
494 }
495
496 /*
497  * Write out the upper address, like the upper register of a 2-register
498  * reference, or the next memory location.
499  */
500 void
501 upput(NODE *pint size)
502 {
503
504         size /= SZCHAR;
505         switch (p->n_op) {
506         case REG:
507                 printf("%s"rnames[rh[p->n_rval - RD0]]);
508                 break;
509
510         case OREG:
511                 p->n_lval += size;
512                 adrput(stdoutp);
513                 p->n_lval -= size;
514                 break;
515
516         case ICON:
517         case NAME:
518                 if (p->n_name[0] != '\0') {
mickey
1.22
519                         printf("LR'%s-$global$"p->n_name);
mickey
1.1
520                         if (p->n_lval != 0)
521                                 printf("+" CONFMTp->n_lval);
522                 } else
mickey
1.3
523                         printf("L%%" CONFMTp->n_lval >> 32);
mickey
1.1
524                 break;
525         default:
526                 comperr("upput bad op %d size %d"p->n_opsize);
527         }
528 }
529
530 void
531 adrput(FILE *ioNODE *p)
532 {
533         int r;
534         /* output an address, with offsets, from p */
535
536         if (p->n_op == FLD)
537                 p = p->n_left;
538
539         switch (p->n_op) {
540
541         case ICON:
542         case NAME:
543                 if (p->n_name[0] != '\0') {
mickey
1.22
544                         fprintf(io"RR'%s-$global$"p->n_name);
mickey
1.1
545                         if (p->n_lval != 0)
546                                 fprintf(io"+" CONFMTp->n_lval);
547                 } else
mickey
1.3
548                         fprintf(io"R%%" CONFMTp->n_lval);
mickey
1.1
549                 return;
550
551         case OREG:
552                 r = p->n_rval;
553                 if (p->n_name[0] != '\0') {
mickey
1.22
554                         fprintf(io"RR'%s-$global$"p->n_name);
mickey
1.1
555                         if (p->n_lval != 0)
556                                 fprintf(io"+" CONFMTp->n_lval);
mickey
1.20
557                 } else
mickey
1.1
558                         fprintf(io"%d", (int)p->n_lval);
559                 if (R2TEST(r)) {
560                         fprintf(io"%s(%s)"rnames[R2UPK1(r)],
561                             rnames[R2UPK2(r)]);
562                 } else
563                         fprintf(io"(%s)"rnames[p->n_rval]);
564                 return;
565         case REG:
566                 if (RD0 <= p->n_rval && p->n_rval <= RETD0)
567                         fprintf(io"%s"rnames[rl[p->n_rval - RD0]]);
568                 else
569                         fprintf(io"%s"rnames[p->n_rval]);
570                 return;
571
572         default:
573                 comperr("illegal address, op %d, node %p"p->n_opp);
574                 return;
575
576         }
577 }
578
579 /* not used */
580 void
581 cbgen(int oint lab)
582 {
583 }
584
mickey
1.12
585 int
586 countargs(NODE *pint *n)
587 {
588         int sz;
589         
590         if (p->n_op == CM) {
591                 countargs(p->n_leftn);
592                 countargs(p->n_rightn);
593                 return *n;
594         }
595
596         sz = argsiz(p) / 4;
597         if (*n % (sz > 44 : sz))
598                 (*n)++; /* XXX */
599
600         return *n += sz;
601 }
602
603 void
mickey
1.1
604 fixcalls(NODE *p)
605 {
mickey
1.12
606         int no;
607
mickey
1.1
608         /* Prepare for struct return by allocating bounce space on stack */
mickey
1.12
609         switch (o = p->n_op) {
mickey
1.1
610         case STCALL:
611         case USTCALL:
mickey
1.12
612                 if (p->n_stsize + p2autooff > stkpos)
613                         stkpos = p->n_stsize + p2autooff;
614                 /* FALLTHROGH */
615         case CALL:
616         case UCALL:
617                 n = 0;
618                 n = 1 + countargs(p->n_right, &n);
619                 if (n > p2calls)
620                         p2calls = n;
mickey
1.1
621                 break;
622         }
623 }
624
625 void
626 myreader(struct interpass *ipole)
627 {
628         struct interpass *ip;
629
630         stkpos = p2autooff;
631         DLIST_FOREACH(ipipoleqelem) {
mickey
1.12
632                 switch (ip->type) {
633                 case IP_PROLOG:
634                         p2calls = 0;
635                         break;
636
637                 case IP_NODE:
638                         walkf(ip->ip_nodefixcalls);
639                         break;
640                 }
mickey
1.1
641         }
642         if (stkpos > p2autooff)
643                 p2autooff = stkpos;
644         if (stkpos > p2maxautooff)
645                 p2maxautooff = stkpos;
646         if (x2debug)
647                 printip(ipole);
648 }
649
650 /*
651  * Remove some PCONVs after OREGs are created.
652  */
653 static void
654 pconv2(NODE *p)
655 {
656         NODE *q;
657
658         if (p->n_op == PLUS) {
659                 if (p->n_type == (PTR|SHORT) || p->n_type == (PTR|USHORT)) {
660                         if (p->n_right->n_op != ICON)
661                                 return;
662                         if (p->n_left->n_op != PCONV)
663                                 return;
664                         if (p->n_left->n_left->n_op != OREG)
665                                 return;
666                         q = p->n_left->n_left;
667                         nfree(p->n_left);
668                         p->n_left = q;
669                         /*
670                          * This will be converted to another OREG later.
671                          */
672                 }
673         }
674 }
675
676 void
677 mycanon(NODE *p)
678 {
679         walkf(ppconv2);
680 }
681
682 void
mickey
1.12
683 myoptim(struct interpass *ipole)
mickey
1.1
684 {
685 }
686
687 void
688 rmove(int sint dTWORD t)
689 {
690         int slshdldh;
691
692         switch (t) {
693         case LONGLONG:
694         case ULONGLONG:
695                 sl = rl[s-RD0];
696                 sh = rh[s-RD0];
697                 dl = rl[d-RD0];
698                 dh = rh[d-RD0];
699
700 #define SW(x,y) { int i = x; x = y; y = i; }
701                 if (sl == dh || sh == dl) {
702                         /* Swap if moving to itself */
703                         SW(slsh);
704                         SW(dldh);
705                 }
706                 if (sl != dl)
707                         printf("\tcopy\t%s,%s\n"rnames[sl], rnames[dl]);
708                 if (sh != dh)
709                         printf("\tcopy\t%s,%s\n"rnames[sh], rnames[dh]);
710                 break;
711         case FLOAT:
712                 printf("\tfcpy,sgl\t%s,%s\n"rnames[s], rnames[d]);
713                 break;
714         case DOUBLE:
715         case LDOUBLE:
716                 printf("\tfcpy,dbl\t%s,%s\n"rnames[s], rnames[d]);
717                 break;
718         default:
719                 printf("\tcopy\t%s,%s\n"rnames[s], rnames[d]);
720         }
721 }
722
723 /*
724  * For class c, find worst-case displacement of the number of
725  * registers in the array r[] indexed by class.
726  */
727 int
728 COLORMAP(int cint *r)
729 {
730         int num;
731
732         switch (c) {
733         case CLASSA:
734                 num = 2 * r[CLASSB];
735                 num += r[CLASSA];
736                 return num < 28;
737         case CLASSB:
738                 num = r[CLASSA];
739                 num += r[CLASSB] * 2;
740                 return num < 28;
741         case CLASSC:
742                 num = (r[CLASSD] > 88 : r[CLASSD]) * 2;
743                 num += r[CLASSC];
744                 return num < 28;
745         case CLASSD:
746                 num = (r[CLASSC] + 1) / 2;
747                 num += r[CLASSD];
748                 return num < 28;
749         }
750         return 0/* XXX gcc */
751 }
752
753 const char * const rnames[MAXREGS] = {
mickey
1.9
754         "%r0""%r1""%rp""%r3""%r4""%r5""%r6""%r7""%r8""%r9",
mickey
1.1
755         "%r10""%r11""%r12""%r13""%r14""%r15""%r16""%r17""%r18",
756         "%t4""%t3""%t2""%t1""%arg3""%arg2""%arg1""%arg0""%dp",
757         "%ret0""%ret1""%sp""%r31",
758         "%rd0""%rd1""%rd2""%rd3""%rd4""%rd5""%rd6""%rd7",
mickey
1.9
759         "%rd8""%rd9""%rd10""%rd11""%rd12""%rd13""%rd14""%rd15",
760         "%rd16""%rd17""%rd18""%rd19""%rd20""%rd21""%rd22""%rd23",
761         "%rd24""%td4""%td3""%td2""%td1""%ad1""%ad0""%retd0",
mickey
1.1
762         "%fr0""%fr4""%fr5""%fr6""%fr7""%fr8""%fr9""%fr10",
763         "%fr11""%fr12""%fr13""%fr14""%fr15""%fr16""%fr17""%fr18",
764         "%fr19""%fr20""%fr21""%fr22""%fr23""%fr24""%fr25""%fr26",
765         "%fr27""%fr28""%fr29""%fr30""%fr31",
766         "%fr0l""%fr0r""%fr4l""%fr4r""%fr5l""%fr5r""%fr6l""%fr6r",
767         "%fr7l""%fr7r""%fr8l""%fr8r""%fr9l""%fr9r",
768         "%fr10l""%fr10r""%fr11l""%fr11r""%fr12l""%fr12r",
769         "%fr13l""%fr13r""%fr14l""%fr14r""%fr15l""%fr15r",
mickey
1.9
770         "%fr16l""%fr16r""%fr17l""%fr17r""%fr18l""%fr18r",
mickey
1.1
771 #ifdef __hppa64__
mickey
1.9
772         "%fr19l""%fr19r",
mickey
1.1
773         "%fr20l""%fr20r""%fr21l""%fr21r""%fr22l""%fr22r",
774         "%fr23l""%fr23r""%fr24l""%fr24r""%fr25l""%fr25r",
775         "%fr26l""%fr26r""%fr27l""%fr27r""%fr28l""%fr28r",
776         "%fr29l""%fr29r""%fr30l""%fr30r""%fr31l""%fr31r",
777 #endif
778 };
779
780 /*
781  * Return a class suitable for a specific type.
782  */
783 int
784 gclass(TWORD t)
785 {
786         switch (t) {
787         case LONGLONG:
788         case ULONGLONG:
789                 return CLASSB;
790         case FLOAT:
791                 return CLASSC;
792         case DOUBLE:
793         case LDOUBLE:
794                 return CLASSD;
795         default:
796                 return CLASSA;
797         }
798 }
799
800 /*
801  * Calculate argument sizes.
802  */
803 void
804 lastcall(NODE *p)
805 {
806         NODE *op = p;
807         int size = 64;
808
809         p->n_qual = size;
810         if (p->n_op != CALL && p->n_op != FORTCALL && p->n_op != STCALL)
811                 return;
812         for (p = p->n_rightp->n_op == CMp = p->n_left)
813                 size += argsiz(p->n_right);
814         size += argsiz(p);
815         op->n_qual = size/* XXX */
816 }
817
818 /*
819  * Special shapes.
820  */
821 int
822 special(NODE *pint shape)
823 {
824         int o = p->n_op;
825
826         switch (shape) {
827         case SFUNCALL:
828                 if (o == STCALL || o == USTCALL)
829                         return SRREG;
830                 break;
mickey
1.8
831         case SPIMM:
832                 if (o != ICON || p->n_name[0] ||
833                     p->n_lval < -31 || p->n_lval >= 32)
834                         break;
835                 return SRDIR;
mickey
1.1
836         case SPICON:
837                 if (o != ICON || p->n_name[0] ||
838                     p->n_lval < -1024 || p->n_lval >= 1024)
839                         break;
840                 return SRDIR;
841         case SPCON:
842                 if (o != ICON || p->n_name[0] ||
843                     p->n_lval < -8192 || p->n_lval >= 8192)
844                         break;
845                 return SRDIR;
846         case SPNAME:
847                 if (o != ICON || !p->n_name[0])
848                         break;
849                 return SRDIR;
850         }
851         return SRNOPE;
852 }
mickey
1.11
853
854 /*
855  * Target-dependent command-line options.
856  */
857 void
858 mflags(char *str)
859 {
860 }
ragge
1.23
861 /*
862  * Do something target-dependent for xasm arguments.
863  * Supposed to find target-specific constraints and rewrite them.
864  */
865 int
866 myxasm(struct interpass *ipNODE *p)
867 {
868         return 0;
869 }
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-03 09:10 +0200