19 %token <lval> LTYPE1 LTYPE2 LTYPE3 LTYPE4 LTYPE5
20 %token <lval> LTYPE6 LTYPE7 LTYPE8 LTYPE9 LTYPEA LTYPEB
21 %token <lval> LCONST LSP LSB LFP LPC LTOS LAREG LDREG LFREG LWID
24 %token <sym> LNAME LLAB LVAR
25 %type <lval> con expr scale type pointer reg offset
26 %type <addr> name areg xreg
28 %type <gen2> noaddr gengen dstgen spec1 spec2 spec3 srcgen dstrel genrel
37 yyerror("redeclaration of %s", $1->name);
60 yyerror("redeclaration of %s", $1->name);
63 | LTYPE1 gengen { outcode($1, &$2); }
64 | LTYPE2 noaddr { outcode($1, &$2); }
65 | LTYPE3 dstgen { outcode($1, &$2); }
66 | LTYPE4 spec1 { outcode($1, &$2); }
67 | LTYPE5 srcgen { outcode($1, &$2); }
68 | LTYPE6 dstrel { outcode($1, &$2); }
69 | LTYPE7 genrel { outcode($1, &$2); }
70 | LTYPE8 dstgen { outcode($1, &$2); }
71 | LTYPE8 gengen { outcode($1, &$2); }
72 | LTYPE9 noaddr { outcode($1, &$2); }
73 | LTYPE9 dstgen { outcode($1, &$2); }
74 | LTYPEA spec2 { outcode($1, &$2); }
75 | LTYPEB spec3 { outcode($1, &$2); }
138 spec1: /* DATA opcode */
146 spec2: /* bit field opcodes */
147 gen ',' gen ',' con ',' con
155 spec3: /* TEXT opcode */
157 | gen ',' con ',' gen
175 yyerror("undefined label: %s", $1->name);
185 $$.offset = $1->value + $2;
208 if($2.type == D_AUTO || $2.type == D_PARAM)
209 yyerror("constant cannot be automatic: %s",
211 $$.type = $2.type | I_ADDR;
217 memcpy($$.sval, $2, sizeof($$.sval));
246 $$.type = D_CONST | I_INDIR;
252 $$.type = $3 | I_INDDEC;
257 $$.type = $2 | I_INDINC;
268 if(($$.type & D_MASK) == D_NONE) {
269 $$.index = D_NONE | I_INDEX1;
283 $$.index = $2.type | I_INDEX1;
284 $$.scale = $2.offset;
295 $$.index = $4.type | I_INDEX2;
296 $$.scale = $4.offset;
299 | con '(' areg ')' xreg
308 $$.index = $5.type | I_INDEX2;
309 $$.scale = $5.offset;
321 $$.index = D_NONE | I_INDEX3;
334 $$.index = D_NONE | I_INDEX3;
347 $$.index = $3.type | I_INDEX3;
348 $$.scale = $3.offset;
351 | con '(' areg xreg ')'
360 $$.index = $4.type | I_INDEX3;
361 $$.scale = $4.offset;
380 '(' reg LWID scale ')'
405 yyerror("bad scale: %ld", $2);
420 $$.type = $2 | I_INDIR;
426 $$.type = $3 | I_INDIR;
432 $$.type = D_NONE | I_INDIR;
438 $$.type = D_NONE | I_INDIR;
445 LNAME offset '(' pointer ')'
451 | LNAME '<' '>' offset '(' LSB ')'