Debian Codegraph @

arch/pdp11/local2.c

raw symbols SCIP
1 /* $Id: local2.c,v 1.20 2019/04/27 20:35:52 ragge Exp $ */
2 /*
3 * Copyright (c) 2003 Anders Magnusson ([email protected]).
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27 # include "pass2.h"
28 # include <ctype.h>
29 # include <string.h>
30
31 static int spcoff;
32 static int argsiz(NODE *p);
33 static void negcon(FILE *fp, int con);
34
35 void
36 deflab(int label)
37 {
38 printf(LABFMT ":\n", label);
39 }
40
41 void
42 prologue(struct interpass_prolog *ipp)
43 {
44 int addto;
45
46 #ifdef LANG_F77
47 if (ipp->ipp_vis)
48 printf(" .globl %s\n", ipp->ipp_name);
49 printf("%s:\n", ipp->ipp_name);
50 #endif
51 printf("jsr r5,csv\n");
52 addto = p2maxautooff;
53 if (addto >= AUTOINIT/SZCHAR)
54 addto -= AUTOINIT/SZCHAR;
55 if (addto & 1)
56 addto++;
57 if (addto == 2)
58 printf("tst -(sp)\n");
59 else if (addto == 4)
60 printf("cmp -(sp),-(sp)\n");
61 else if (addto > 4)
62 printf("sub $%o,sp\n", addto);
63 spcoff = 0;
64 }
65
66 void
67 eoftn(struct interpass_prolog *ipp)
68 {
69 if (spcoff)
70 comperr("spcoff == %d", spcoff);
71 if (ipp->ipp_ip.ip_lbl == 0)
72 return; /* no code needs to be generated */
73 printf("jmp cret\n");
74 }
75
76 /*
77 * add/sub/...
78 *
79 * Param given:
80 */
81 void
82 hopcode(int f, int o)
83 {
84 char *str;
85
86 switch (o) {
87 case PLUS:
88 str = "add";
89 break;
90 case MINUS:
91 str = "sub";
92 break;
93 case AND:
94 str = "and";
95 break;
96 case OR:
97 str = "or";
98 break;
99 case ER:
100 str = "xor";
101 break;
102 default:
103 comperr("hopcode2: %d", o);
104 str = 0; /* XXX gcc */
105 }
106 printf("%s%c", str, f);
107 }
108
109 /*
110 * Return type size in bytes. Used by R2REGS, arg 2 to offset().
111 */
112 int
113 tlen(p) NODE *p;
114 {
115 switch(p->n_type) {
116 case CHAR:
117 case UCHAR:
118 return(1);
119
120 case SHORT:
121 case USHORT:
122 return(SZSHORT/SZCHAR);
123
124 case DOUBLE:
125 return(SZDOUBLE/SZCHAR);
126
127 case INT:
128 case UNSIGNED:
129 case LONG:
130 case ULONG:
131 return(SZINT/SZCHAR);
132
133 case LONGLONG:
134 case ULONGLONG:
135 return SZLONGLONG/SZCHAR;
136
137 default:
138 if (!ISPTR(p->n_type))
139 comperr("tlen type %d not pointer");
140 return SZPOINT(p->n_type)/SZCHAR;
141 }
142 }
143
144 /*
145 * Emit code to compare two long numbers.
146 */
147 static void
148 twolcomp(NODE *p)
149 {
150 int u;
151 int s = getlab2();
152 int e = p->n_label;
153 int cb1, cb2;
154
155 switch (u = p->n_op) {
156 case NE:
157 cb1 = 0;
158 cb2 = NE;
159 break;
160 case EQ:
161 cb1 = NE;
162 cb2 = 0;
163 break;
164 case LE:
165 case LT:
166 u += (ULE-LE);
167 /* FALLTHROUGH */
168 case ULE:
169 case ULT:
170 cb1 = GT;
171 cb2 = LT;
172 break;
173 case GE:
174 case GT:
175 u += (ULE-LE);
176 /* FALLTHROUGH */
177 case UGE:
178 case UGT:
179 cb1 = LT;
180 cb2 = GT;
181 break;
182
183 default:
184 cb1 = cb2 = 0; /* XXX gcc */
185 }
186 if (p->n_op >= ULE)
187 cb1 += 4, cb2 += 4;
188 expand(p, 0, "cmp AL,AR\n");
189 if (cb1) cbgen(cb1, s);
190 if (cb2) cbgen(cb2, e);
191 expand(p, 0, "cmp UL,UR\n");
192 cbgen(u, e);
193 deflab(s);
194 }
195
196 /*
197 * print out a 32-bit constant as arg.
198 */
199 static void
200 lconarg(NODE *p)
201 {
202 CONSZ c = getlval(p);
203 char *m = spcoff ? "-" : "";
204
205 spcoff += 4;
206
207 if (c == 0) {
208 printf("clr %s(sp)\nclr -(sp)\n", m);
209 } else if (c >= 0 && c < 65536) {
210 printf("mov $%llo,%s(sp)\nclr -(sp)\n", c, m);
211 } else if (c >= -32768 && c < 32768) {
212 printf("mov $%llo,%s(sp)\nsxt -(sp)\n",
213 c & 0177777, m);
214 } else {
215 printf("mov $%llo,%s(sp)\nmov $%llo,-(sp)\n",
216 c & 0177777, m, (c >> 16) & 0177777);
217 }
218 }
219
220 void
221 zzzcode(NODE *p, int c)
222 {
223 struct attr *ap;
224 NODE *l;
225 char *s;
226 int o;
227
228 switch (c) {
229 case 'A': /* print out - if not first arg */
230 if (spcoff || (p->n_type == FLOAT || p->n_type == DOUBLE))
231 printf("-");
232 spcoff += argsiz(p);
233 break;
234
235 case 'B': /* arg is pointer to block */
236 expand(p->n_left, FOREFF, "mov AL,ZA(sp)\n");
237 expand(p->n_left, FOREFF, "sub AR,(sp)\n");
238 break;
239
240 case 'C': /* subtract stack after call */
241 spcoff -= p->n_qual;
242 if (spcoff == 0 /* && !(p->n_flags & NLOCAL1) XXX FIXME */)
243 p->n_qual -= 2;
244 if (p->n_qual == 2)
245 printf("tst (sp)+\n");
246 else if (p->n_qual == 4)
247 printf("cmp (sp)+,(sp)+\n");
248 else if (p->n_qual > 2)
249 printf("add $%o,sp\n", (int)p->n_qual);
250 break;
251
252 case 'D': /* long constant as arg */
253 lconarg(p->n_left);
254 break;
255
256 case 'E': /* long move */
257 rmove(regno(p->n_right), regno(p->n_left), p->n_type);
258 break;
259
260 case 'F': /* long comparision */
261 twolcomp(p);
262 break;
263
264 case 'G': /* printout a subnode for post-inc */
265 adrput(stdout, p->n_left->n_left);
266 break;
267
268 case 'H': /* arg with post-inc */
269 expand(p->n_left->n_left, FOREFF, "mov AL,ZA(sp)\n");
270 expand(p->n_left->n_left, FOREFF, "inc AL\n");
271 break;
272
273 case 'I': /* struct assign. Right in R0, left R1, counter R2. */
274 ap = attr_find(p->n_ap, ATTR_P2STRUCT);
275 l = p->n_left;
276 if (l->n_op == OREG) {
277 int r = l->n_rval;
278 if (R2TEST(r)) {
279 l->n_rval = R2UPK1(r);
280 expand(p, FOREFF, "mov AL,r1\n");
281 l->n_rval = r;
282 } else {
283 printf("mov %s,r1\n", rnames[r]);
284 if (getlval(l)) {
285 printf("add $");
286 negcon(stdout, getlval(l));
287 printf(",r1\n");
288 }
289 }
290 } else
291 printf("mov $%s,r1\n", l->n_name);
292 printf("mov $%o,r2\n", (ap->iarg(0)+1) >> 1);
293 printf("1: mov (r0)+,(r1)+\n");
294 printf("sob r2,1b\n");
295 break;
296
297 case 'J': /* struct argument */
298 ap = attr_find(p->n_ap, ATTR_P2STRUCT);
299 o = (ap->iarg(0) + 1) & ~1;
300 printf("sub $%o,sp\n", spcoff == 0 ? o-2 : o);
301 printf("mov sp,r0\n");
302 printf("mov $%o,r2\n", o >> 1);
303 printf("1: mov (r1)+,(r0)+\n");
304 printf("sob r2,1b\n");
305 spcoff += argsiz(p);
306 break;
307
308 case 'K': /* long long mul/div */
309 o = spcoff++;
310 if (p->n_right->n_op == ICON) {
311 lconarg(p->n_right);
312 } else
313 expand(p, FOREFF, "mov UR,-(sp)\nmov AR,-(sp)\n");
314 if (p->n_left->n_op == ICON) {
315 lconarg(p->n_left);
316 } else
317 expand(p, FOREFF, "mov UL,-(sp)\nmov AL,-(sp)\n");
318 s = p->n_op == MUL ? "lmul" :
319 p->n_type == ULONG ? "uldiv" : "ldiv";
320 printf("jsr pc,%s\nadd $10,sp\n", s);
321 spcoff = o;
322 break;
323
324 default:
325 comperr("zzzcode %c", c);
326 }
327 }
328
329 /*ARGSUSED*/
330 int
331 rewfld(NODE *p)
332 {
333 return(1);
334 }
335
336 int canaddr(NODE *);
337 int
338 canaddr(NODE *p)
339 {
340 int o = p->n_op;
341
342 if (o==NAME || o==REG || o==ICON || o==OREG ||
343 (o==UMUL && shumul(p->n_left, STARNM|SOREG)))
344 return(1);
345 return(0);
346 }
347
348 /*
349 * Does the bitfield shape match?
350 */
351 int
352 flshape(NODE *p)
353 {
354 int o = p->n_op;
355
356 if (o == OREG || o == REG || o == NAME)
357 return SRDIR; /* Direct match */
358 if (o == UMUL && shumul(p->n_left, SOREG))
359 return SROREG; /* Convert into oreg */
360 return SRREG; /* put it into a register */
361 }
362
363 /* INTEMP shapes must not contain any temporary registers */
364 /* XXX should this go away now? */
365 int
366 shtemp(NODE *p)
367 {
368 return 0;
369 }
370
371 static void
372 negcon(FILE *fp, int con)
373 {
374 if (con < 0)
375 fprintf(fp, "-"), con = -con;
376 fprintf(fp, "%o", con & 0177777);
377 }
378
379 void
380 adrcon(CONSZ val)
381 {
382 printf("$" CONFMT, val);
383 }
384
385 void
386 conput(FILE *fp, NODE *p)
387 {
388 int val = getlval(p);
389
390 switch (p->n_op) {
391 case ICON:
392 if (p->n_name[0] != '\0') {
393 fprintf(fp, "%s", p->n_name);
394 if (val)
395 fprintf(fp, "+%o", val & 0177777);
396 } else if (p->n_type == LONG || p->n_type == ULONG)
397 negcon(fp, val >> 16);
398 else
399 negcon(fp, val);
400 return;
401
402 default:
403 comperr("illegal conput, p %p", p);
404 }
405 }
406
407 /*ARGSUSED*/
408 void
409 insput(NODE *p)
410 {
411 comperr("insput");
412 }
413
414 /*
415 * Write out the upper address, like the upper register of a 2-register
416 * reference, or the next memory location.
417 */
418 void
419 upput(NODE *p, int size)
420 {
421 size /= SZINT;
422 switch (p->n_op) {
423 case NAME:
424 case OREG:
425 setlval(p, getlval(p) + size);
426 adrput(stdout, p);
427 setlval(p, getlval(p) - size);
428 break;
429 case REG:
430 printf("r%c", rnames[p->n_rval][2]);
431 break;
432 case ICON:
433 /* On PDP11 upper value is low 16 bits */
434 printf("$");
435 negcon(stdout, getlval(p) & 0177777);
436 break;
437 default:
438 comperr("upput bad op %d size %d", p->n_op, size);
439 }
440 }
441
442 /*
443 * output an address, with offsets, from p
444 */
445 void
446 adrput(FILE *io, NODE *p)
447 {
448 int r;
449
450 if (p->n_op == FLD)
451 p = p->n_left;
452
453 switch (p->n_op) {
454 case NAME:
455 if (p->n_name[0] != '\0') {
456 fputs(p->n_name, io);
457 if (getlval(p) != 0)
458 fprintf(io, "+%o", (int)(getlval(p) & 0177777));
459 } else
460 negcon(io, getlval(p));
461 return;
462
463 case OREG:
464 r = p->n_rval;
465 if (p->n_name[0])
466 printf("%s%s", p->n_name, getlval(p) ? "+" : "");
467 if (R2TEST(r) && R2UPK3(r) == 0)
468 printf("*");
469 if (getlval(p))
470 negcon(io, getlval(p));
471 if (R2TEST(r)) {
472 fprintf(io, "(%s)", rnames[R2UPK1(r)]);
473 if (R2UPK3(r) == 1)
474 fprintf(io, "+");
475 } else
476 fprintf(io, "(%s)", rnames[p->n_rval]);
477 return;
478 case ICON:
479 /* addressable value of the constant */
480 printf("$");
481 conput(io, p);
482 return;
483
484 case REG:
485 switch (p->n_type) {
486 case LONG:
487 case ULONG:
488 fprintf(io, "r%c", rnames[p->n_rval][1]);
489 break;
490 default:
491 fprintf(io, "%s", rnames[p->n_rval]);
492 }
493 return;
494
495 case UMUL:
496 if (tshape(p, STARNM)) {
497 printf("*");
498 adrput(io, p->n_left);
499 break;
500 }
501 /* FALLTHROUGH */
502 default:
503 comperr("illegal address, op %d, node %p", p->n_op, p);
504 return;
505
506 }
507 }
508
509 static char *
510 ccbranches[] = {
511 "jeq", /* jumpe */
512 "jne", /* jumpn */
513 "jle", /* jumple */
514 "jlt", /* jumpl */
515 "jge", /* jumpge */
516 "jgt", /* jumpg */
517 "jlos", /* jumple (jlequ) */
518 "jlo", /* jumpl (jlssu) */
519 "jhis", /* jumpge (jgequ) */
520 "jhi", /* jumpg (jgtru) */
521 };
522
523
524 /* printf conditional and unconditional branches */
525 void
526 cbgen(int o, int lab)
527 {
528 if (o < EQ || o > UGT)
529 comperr("bad conditional branch: %s", opst[o]);
530 printf("%s " LABFMT "\n", ccbranches[o-EQ], lab);
531 }
532
533 #define IS1CON(p) ((p)->n_op == ICON && getlval(p) == 1)
534
535 /*
536 * Move postfix operators to the next statement, unless they are
537 * within a function call or a branch.
538 */
539 static void
540 cvtree(NODE *p, struct interpass *ip2)
541 {
542 struct interpass *ip;
543 NODE *q;
544
545 if (callop(p->n_op) || p->n_op == CBRANCH)
546 return;
547
548 if ((p->n_op == PLUS || p->n_op == MINUS) &&
549 IS1CON(p->n_right) && (q = p->n_left)->n_op == ASSIGN &&
550 treecmp(q->n_left, q->n_right->n_left) &&
551 IS1CON(q->n_right->n_right)) {
552 if ((p->n_op == PLUS && q->n_right->n_op == MINUS) ||
553 (p->n_op == MINUS && q->n_right->n_op == PLUS)) {
554 nfree(p->n_right);
555 *p = *q->n_left;
556 if (optype(p->n_op) != LTYPE)
557 p->n_left = tcopy(p->n_left);
558 ip = ipnode(q);
559 DLIST_INSERT_AFTER(ip2, ip, qelem);
560 return;
561 }
562 }
563 if (optype(p->n_op) == BITYPE)
564 cvtree(p->n_right, ip2);
565 if (optype(p->n_op) != LTYPE)
566 cvtree(p->n_left, ip2);
567 }
568
569 /*
570 * Convert AND to BIC.
571 */
572 static void
573 fixops(NODE *p, void *arg)
574 {
575 static int fltwritten;
576 NODE *r;
577
578 if (!fltwritten && (p->n_type == FLOAT || p->n_type == DOUBLE)) {
579 printf(".globl fltused\n");
580 fltwritten = 1;
581 }
582 switch (p->n_op) {
583 case AND:
584 if (p->n_right->n_op == ICON) {
585 CONSZ val = getlval(p->n_right);
586 TWORD t = p->n_right->n_type;
587 if (t == LONGLONG || t == ULONGLONG)
588 val = ~val;
589 else if (t == LONG || t == ULONG)
590 val = ((~val) & 0xffffffff);
591 else
592 val = ((~val) & 0177777);
593 setlval(p->n_right, val);
594 } else if (p->n_right->n_op == COMPL) {
595 NODE *q = p->n_right->n_left;
596 nfree(p->n_right);
597 p->n_right = q;
598 } else
599 p->n_right = mkunode(COMPL, p->n_right, 0, p->n_type);
600 break;
601 case RS:
602 r = p->n_right;
603 if (r->n_op == ICON)
604 setlval(r, -getlval(r));
605 else
606 p->n_right = mkunode(UMINUS, r, 0, r->n_type);
607 if (p->n_type == UNSIGNED || p->n_type == UCHAR)
608 break;
609 p->n_op = LS;
610 break;
611 #if 0
612 case EQ:
613 case NE: /* Hack not to clear bits if FORCC */
614 if (p->n_left->n_op == AND)
615 fixops(p->n_left, 0); /* Convert an extra time */
616 break;
617 #endif
618 }
619 }
620
621 void
622 myreader(struct interpass *ipole)
623 {
624 struct interpass *ip;
625
626 #ifdef PCC_DEBUG
627 if (x2debug) {
628 printf("myreader before\n");
629 printip(ipole);
630 }
631 #endif
632 DLIST_FOREACH(ip, ipole, qelem) {
633 if (ip->type != IP_NODE)
634 continue;
635 walkf(ip->ip_node, fixops, 0);
636 canon(ip->ip_node); /* call it early */
637 }
638 #ifdef PCC_DEBUG
639 if (x2debug) {
640 printf("myreader middle\n");
641 printip(ipole);
642 }
643 #endif
644 #if 0
645 DLIST_FOREACH(ip, ipole, qelem) {
646 if (ip->type == IP_NODE)
647 cvtree(ip->ip_node, ip);
648 }
649 #endif
650 #ifdef PCC_DEBUG
651 if (x2debug) {
652 printf("myreader after\n");
653 printip(ipole);
654 }
655 #endif
656 }
657
658 /*
659 * Remove SCONVs where the left node is an OREG with a smaller type.
660 */
661 static void
662 delsconv(NODE *p, void *arg)
663 {
664 #if 0
665 NODE *l;
666
667 if (p->n_op != SCONV || (l = p->n_left)->n_op != OREG)
668 return;
669 if (DEUNSIGN(p->n_type) == INT && DEUNSIGN(l->n_type) == LONG) {
670 p->n_op = OREG;
671 p->n_lval = l->n_lval; /* high word */
672 p->n_rval = l->n_rval;
673 nfree(l);
674 }
675 #endif
676 /* Could do this for char etc. also */
677 }
678
679 void
680 mycanon(NODE *p)
681 {
682 walkf(p, delsconv, 0);
683 }
684
685 void
686 myoptim(struct interpass *ip)
687 {
688 }
689
690 void
691 rmove(int s, int d, TWORD t)
692 {
693 if (t < LONG || t > BTMASK) {
694 printf("mov%s %s,%s\n", t < SHORT ? "b" : "",
695 rnames[s],rnames[d]); /* XXX char should be full reg? */
696 } else if (t == LONG || t == ULONG) {
697 /* avoid trashing double regs */
698 if (d > s)
699 printf("mov r%c,r%c\nmov r%c,r%c\n",
700 rnames[s][2],rnames[d][2],
701 rnames[s][1],rnames[d][1]);
702 else
703 printf("mov r%c,r%c\nmov r%c,r%c\n",
704 rnames[s][1],rnames[d][1],
705 rnames[s][2],rnames[d][2]);
706 } else if (t == FLOAT || t == DOUBLE) {
707 printf("movf %s,%s\n", rnames[s],rnames[d]);
708 } else
709 comperr("bad float rmove: %d %d %x", s, d, t);
710
711 }
712
713 /*
714 * For class c, find worst-case displacement of the number of
715 * registers in the array r[] indexed by class.
716 */
717 int
718 COLORMAP(int c, int *r)
719 {
720 switch (c) {
721 case CLASSA:
722 return (r[CLASSB] * 2 + r[CLASSA]) < 5;
723 case CLASSB:
724 if (r[CLASSB] > 1) return 0;
725 if (r[CLASSB] == 1 && r[CLASSA] > 0) return 0;
726 if (r[CLASSA] > 2) return 0;
727 return 1;
728 case CLASSC:
729 return r[CLASSC] < 4;
730 }
731 return 0;
732 }
733
734 char *rnames[] = {
735 "r0", "r1", "r2", "r3", "r4", "r5", "sp", "pc",
736 "r01", "r12", "r23", "r34", "XXX", "XXX", "XXX", "XXX",
737 "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "XXX", "XXX",
738 };
739
740 /*
741 * Return a class suitable for a specific type.
742 */
743 int
744 gclass(TWORD t)
745 {
746 if (t < LONG || t > BTMASK)
747 return CLASSA;
748 if (t == LONG || t == ULONG)
749 return CLASSB;
750 if (t == FLOAT || t == DOUBLE || t == LDOUBLE)
751 return CLASSC;
752 comperr("gclass");
753 return CLASSD;
754 }
755
756 static int
757 argsiz(NODE *p)
758 {
759 TWORD t = p->n_type;
760
761 if (t == LONG || t == ULONG || t == FLOAT)
762 return 4;
763 if (t == DOUBLE)
764 return 8;
765 if (t == STRTY || t == UNIONTY)
766 return attr_find(p->n_ap, ATTR_P2STRUCT)->iarg(0);
767 return 2;
768 }
769
770 /*
771 * Argument specialties.
772 */
773 void
774 lastcall(NODE *p)
775 {
776 NODE *op = p;
777 int size = 0;
778
779 /*
780 * Calculate arg sizes.
781 * Mark first arg not to have - before it.
782 */
783 p->n_qual = 0;
784 if (p->n_op != CALL && p->n_op != FORTCALL && p->n_op != STCALL)
785 return;
786 for (p = p->n_right; p->n_op == CM; p = p->n_left) {
787 p->n_right->n_qual = 0;
788 size += argsiz(p->n_right);
789 }
790 p->n_qual = 0;
791 size += argsiz(p);
792 p = op->n_right;
793
794 if (p->n_op == CM)
795 p = p->n_right;
796 #if 0 /* XXX fixme */
797 if (p->n_type == FLOAT || p->n_type == DOUBLE ||
798 p->n_type == STRTY || p->n_type == UNIONTY)
799 op->n_flags |= NLOCAL1; /* Does not use stack slot */
800 else
801 op->n_flags &= ~NLOCAL1;
802 #endif
803 op->n_qual = size; /* XXX */
804 }
805
806 static int
807 is1con(NODE *p)
808 {
809 if (p->n_op == ICON && getlval(p) == 1)
810 return 1;
811 return 0;
812 }
813
814 /*
815 * Special shapes.
816 */
817 int
818 special(NODE *p, int shape)
819 {
820 CONSZ s;
821
822 switch (shape) {
823 case SANDSCON:
824 s = ~getlval(p);
825 if (s < 65536 || s > -65537)
826 return SRDIR;
827 break;
828 case SINCB: /* Check if subject for post-inc */
829 if (p->n_op == ASSIGN && p->n_right->n_op == PLUS &&
830 treecmp(p->n_left, p->n_right->n_left) &&
831 is1con(p->n_right->n_right))
832 return SRDIR;
833 break;
834 case SARGSUB:
835 if (p->n_op == MINUS && p->n_right->n_op == ICON &&
836 p->n_left->n_op == REG)
837 return SRDIR;
838 break;
839 case SARGINC:
840 if (p->n_op == MINUS && is1con(p->n_right))
841 return special(p->n_left, SINCB);
842 break;
843 }
844 return SRNOPE;
845 }
846
847 /*
848 * Target-dependent command-line options.
849 */
850 void
851 mflags(char *str)
852 {
853 }
854
855 /*
856 * Do something target-dependent for xasm arguments.
857 */
858 int
859 myxasm(struct interpass *ip, NODE *p)
860 {
861 return 0;
862 }
863
864 int
865 fldexpand(NODE *p, int cookie, char **cp)
866 {
867 return 0;
868 }
869