| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
#include "pass2.h" |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
int |
| 43 |
notoff(TWORD t, int r, CONSZ off, char *cp) |
| 44 |
{ |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
return 0; |
| 50 |
} |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
void |
| 56 |
offstar(NODE * p, int shape) |
| 57 |
{ |
| 58 |
if (x2debug) |
| 59 |
printf("offstar(%p)\n", p); |
| 60 |
|
| 61 |
if (p->n_op == PLUS || p->n_op == MINUS) { |
| 62 |
if (p->n_right->n_op == ICON) { |
| 63 |
if (isreg(p->n_left) == 0) |
| 64 |
(void)geninsn(p->n_left, INAREG); |
| 65 |
|
| 66 |
return; |
| 67 |
} |
| 68 |
} |
| 69 |
(void)geninsn(p, INAREG); |
| 70 |
} |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
void |
| 76 |
myormake(NODE * q) |
| 77 |
{ |
| 78 |
if (x2debug) |
| 79 |
printf("myormake(%p)\n", q); |
| 80 |
} |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
int |
| 86 |
shumul(NODE *p, int shape) |
| 87 |
{ |
| 88 |
if (x2debug) |
| 89 |
printf("shumul(%p)\n", p); |
| 90 |
|
| 91 |
|
| 92 |
if (shape & SOREG) |
| 93 |
return SROREG; |
| 94 |
return SRNOPE; |
| 95 |
} |
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
int |
| 102 |
setbin(NODE * p) |
| 103 |
{ |
| 104 |
|
| 105 |
if (x2debug) |
| 106 |
printf("setbin(%p)\n", p); |
| 107 |
return 0; |
| 108 |
|
| 109 |
} |
| 110 |
|
| 111 |
|
| 112 |
int |
| 113 |
setasg(NODE * p, int cookie) |
| 114 |
{ |
| 115 |
if (x2debug) |
| 116 |
printf("setasg(%p)\n", p); |
| 117 |
return (0); |
| 118 |
} |
| 119 |
|
| 120 |
|
| 121 |
int |
| 122 |
setuni(NODE * p, int cookie) |
| 123 |
{ |
| 124 |
return 0; |
| 125 |
} |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
struct rspecial * |
| 135 |
nspecial(struct optab * q) |
| 136 |
{ |
| 137 |
switch (q->op) { |
| 138 |
|
| 139 |
case SCONV: |
| 140 |
if (q->lshape == SBREG && q->rshape == SCREG) { |
| 141 |
static struct rspecial s[] = { |
| 142 |
{ NLEFT, A0A1 }, |
| 143 |
{ NRES, F0 }, |
| 144 |
{ 0 } |
| 145 |
}; |
| 146 |
return s; |
| 147 |
} else if (q->lshape == SCREG && q->rshape == SBREG) { |
| 148 |
static struct rspecial s[] = { |
| 149 |
{ NLEFT, F0 }, |
| 150 |
{ NRES, A0A1 }, |
| 151 |
{ 0 } |
| 152 |
}; |
| 153 |
return s; |
| 154 |
} else if (q->lshape == SAREG && q->rshape == SCREG) { |
| 155 |
static struct rspecial s[] = { |
| 156 |
{ NLEFT, A0 }, |
| 157 |
{ NRES, F0 }, |
| 158 |
{ 0 } |
| 159 |
}; |
| 160 |
return s; |
| 161 |
} |
| 162 |
break; |
| 163 |
|
| 164 |
case MOD: |
| 165 |
case DIV: |
| 166 |
if (q->lshape == SBREG) { |
| 167 |
static struct rspecial s[] = { |
| 168 |
{ NLEFT, A0A1 }, |
| 169 |
{ NRIGHT, A2A3 }, |
| 170 |
{ NRES, V0V1 }, |
| 171 |
{ 0 }, |
| 172 |
}; |
| 173 |
return s; |
| 174 |
} else if (q->lshape == SAREG) { |
| 175 |
static struct rspecial s[] = { |
| 176 |
{ NLEFT, A0 }, |
| 177 |
{ NRIGHT, A1 }, |
| 178 |
{ NRES, V0 }, |
| 179 |
{ 0 }, |
| 180 |
}; |
| 181 |
return s; |
| 182 |
} |
| 183 |
|
| 184 |
case RS: |
| 185 |
case LS: |
| 186 |
if (q->lshape == SBREG) { |
| 187 |
static struct rspecial s[] = { |
| 188 |
{ NLEFT, A0A1 }, |
| 189 |
{ NRIGHT, A2 }, |
| 190 |
{ NRES, V0V1 }, |
| 191 |
{ 0 }, |
| 192 |
}; |
| 193 |
return s; |
| 194 |
} else if (q->lshape == SAREG) { |
| 195 |
static struct rspecial s[] = { |
| 196 |
{ NLEFT, A0 }, |
| 197 |
{ NRIGHT, A1 }, |
| 198 |
{ NRES, V0 }, |
| 199 |
{ 0 }, |
| 200 |
}; |
| 201 |
return s; |
| 202 |
} |
| 203 |
break; |
| 204 |
|
| 205 |
case STARG: |
| 206 |
{ |
| 207 |
static struct rspecial s[] = { |
| 208 |
{ NEVER, A0 }, |
| 209 |
{ NLEFT, A1 }, |
| 210 |
{ NEVER, A2 }, |
| 211 |
{ 0 } |
| 212 |
}; |
| 213 |
return s; |
| 214 |
} |
| 215 |
|
| 216 |
case STASG: |
| 217 |
{ |
| 218 |
static struct rspecial s[] = { |
| 219 |
{ NEVER, A0 }, |
| 220 |
{ NRIGHT, A1 }, |
| 221 |
{ NEVER, A2 }, |
| 222 |
{ 0 } |
| 223 |
}; |
| 224 |
return s; |
| 225 |
} |
| 226 |
} |
| 227 |
|
| 228 |
comperr("nspecial entry %d: %s", q - table, q->cstring); |
| 229 |
|
| 230 |
return 0; |
| 231 |
} |
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
int |
| 237 |
setorder(NODE * p) |
| 238 |
{ |
| 239 |
return 0; |
| 240 |
} |
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
int * |
| 247 |
livecall(NODE *p) |
| 248 |
{ |
| 249 |
static int r[1] = { -1 }; |
| 250 |
|
| 251 |
return &r[0]; |
| 252 |
} |
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
int |
| 258 |
acceptable(struct optab *op) |
| 259 |
{ |
| 260 |
return 1; |
| 261 |
} |