1 | /*
|
---|
2 | * Copyright (c) 2008 David Crawshaw <david@zentus.com>
|
---|
3 | *
|
---|
4 | * Permission to use, copy, modify, and/or distribute this software for any
|
---|
5 | * purpose with or without fee is hereby granted, provided that the above
|
---|
6 | * copyright notice and this permission notice appear in all copies.
|
---|
7 | *
|
---|
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
---|
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
---|
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
---|
11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
---|
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
---|
13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
---|
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
---|
15 | */
|
---|
16 |
|
---|
17 | #include "pass2.h"
|
---|
18 |
|
---|
19 | /* is it legal to make an OREG or NAME entry which has an
|
---|
20 | * offset of off, (from a register of r), if the
|
---|
21 | * resulting thing had type t */
|
---|
22 | int
|
---|
23 | notoff(TWORD t, int r, CONSZ off, char *cp)
|
---|
24 | {
|
---|
25 | return !SIMM13(off);
|
---|
26 | }
|
---|
27 |
|
---|
28 | /*
|
---|
29 | * Turn a UMUL-referenced node into OREG.
|
---|
30 | */
|
---|
31 | void
|
---|
32 | offstar(NODE *p, int shape)
|
---|
33 | {
|
---|
34 | if (x2debug)
|
---|
35 | printf("offstar(%p)\n", p);
|
---|
36 |
|
---|
37 | if (p->n_op == PLUS || p->n_op == MINUS) {
|
---|
38 | if (p->n_right->n_op == ICON && SIMM13(p->n_right->n_lval)) {
|
---|
39 | if (isreg(p->n_left) == 0)
|
---|
40 | (void)geninsn(p->n_left, INAREG);
|
---|
41 | /* Converted in ormake() */
|
---|
42 | return;
|
---|
43 | }
|
---|
44 | }
|
---|
45 | (void)geninsn(p, INAREG);
|
---|
46 | }
|
---|
47 |
|
---|
48 | void
|
---|
49 | myormake(NODE *q)
|
---|
50 | {
|
---|
51 | }
|
---|
52 |
|
---|
53 | int
|
---|
54 | shumul(NODE *p, int shape)
|
---|
55 | {
|
---|
56 | if (shape & SOREG)
|
---|
57 | return SROREG;
|
---|
58 | return SRNOPE;
|
---|
59 | }
|
---|
60 |
|
---|
61 | int
|
---|
62 | setbin(NODE *p)
|
---|
63 | {
|
---|
64 | return 0;
|
---|
65 | }
|
---|
66 |
|
---|
67 | int
|
---|
68 | setasg(NODE *p, int cookie)
|
---|
69 | {
|
---|
70 | return 0;
|
---|
71 | }
|
---|
72 |
|
---|
73 | int
|
---|
74 | setuni(NODE *p, int cookie)
|
---|
75 | {
|
---|
76 | return 0;
|
---|
77 | }
|
---|
78 |
|
---|
79 | struct rspecial *
|
---|
80 | nspecial(struct optab *q)
|
---|
81 | {
|
---|
82 | switch (q->op) {
|
---|
83 | case STASG: {
|
---|
84 | static struct rspecial s[] = {
|
---|
85 | { NEVER, O0 },
|
---|
86 | { NRIGHT, O1 },
|
---|
87 | { NEVER, O2 },
|
---|
88 | { 0 }
|
---|
89 | };
|
---|
90 | return s;
|
---|
91 | }
|
---|
92 | }
|
---|
93 |
|
---|
94 | comperr("unknown nspecial %d: %s", q - table, q->cstring);
|
---|
95 | return 0; /* XXX */
|
---|
96 | }
|
---|
97 |
|
---|
98 | int
|
---|
99 | setorder(NODE *p)
|
---|
100 | {
|
---|
101 | return 0;
|
---|
102 | }
|
---|
103 |
|
---|
104 | int *
|
---|
105 | livecall(NODE *p)
|
---|
106 | {
|
---|
107 | static int ret[] = { O0, O1, O2, O3, O4, O5, O6, O7, -1 };
|
---|
108 | return ret;
|
---|
109 | }
|
---|
110 |
|
---|
111 | int
|
---|
112 | acceptable(struct optab *op)
|
---|
113 | {
|
---|
114 | return 1;
|
---|
115 | }
|
---|