ack/mach/arm/as/mach4.c

130 lines
2.3 KiB
C
Raw Normal View History

1994-06-24 14:02:31 +00:00
/* $Id: mach4.c, v1.9 15-Mar-89 AJM */
1988-11-07 09:24:36 +00:00
1988-02-18 09:20:09 +00:00
operation : BRANCH optlink expr
{branch($1, $2, $3.val);}
| DATA1 optcond opts optp REG ',' REG ',' operand
{data($1,$2|$3|$4|$5<<12|$7<<16,$9.val,$9.typ);}
| DATA2 optcond opts optp REG ',' operand
{data($1,$2|$3|$4|$5<<12,$7.val,$7.typ);}
| DATA3 optcond opts optp REG ',' operand
{data($1,$2|$3|$4|$5<<16,$7.val,$7.typ);}
| SDT optcond optb optt REG ',' address
1990-11-12 15:29:14 +00:00
{strldr($1,$2|$3|$4|$5<<12,$7);}
1988-02-18 09:20:09 +00:00
| BDT optcond REG optexc ',' reglist optpsr
{emit4($1|$2|$3<<16|$4|$6|$7);}
| SWI optcond expr
1988-11-07 09:24:36 +00:00
{emit4($1|$2|$3.val);}
| ADR optcond REG ',' expr
1990-11-12 15:29:14 +00:00
{calcadr($2,$3,$5.val,$5.typ);}
1988-11-07 09:24:36 +00:00
| MUL optcond REG ',' REG ',' REG
{emit4($1|$2|$3<<16|$5|$7<<8);}
| MLA optcond REG ',' REG ',' REG ',' REG
{emit4($1|$2|$3<<16|$5|$7<<8|$9<<12);}
1988-02-18 09:20:09 +00:00
;
optlink : {$$=0;}
| LINK
{$$=$1;}
;
optcond : {$$=0xE0000000;}
| COND
{$$=$1;}
;
opts : {$$=0;}
| SET
{$$=$1;}
;
optt : {$$=0;}
| TRANS
{$$=$1;}
;
optp : {$$=0;}
| PEE
{$$=$1;}
;
optb : {$$=0;}
| BYTE
{$$=$1;}
;
optexc : {$$=0;}
| '<'
{$$=0x00200000;}
;
optpsr : {$$=0;}
| '^'
{$$=0x00400000;}
;
operand : REG optshift
{$$.val = $1|$2; $$.typ = S_REG;}
| '#'expr
{$$ = $2;}
;
optshift : ',' SHIFT shftcnt
{$$ = $2|$3;}
1988-11-07 09:24:36 +00:00
| ',' RRX
1988-02-18 09:20:09 +00:00
{$$ = $2;}
|
{$$ = 0;}
;
1990-11-12 15:29:14 +00:00
aoptshift : ',' SHIFT '#' expr
{$$ = $2|calcshft($4.val, $4.typ, $<y_word>0);}
| ',' RRX
{$$ = $2;}
|
{$$ = 0;}
;
1988-02-18 09:20:09 +00:00
shftcnt : '#' expr
{$$ = calcshft($2.val, $2.typ, $<y_word>0);}
| REG
{$$ = $1<<8|0x10;}
;
address : expr
1990-11-12 15:29:14 +00:00
{success = 0; $$ = $1.val;}
1988-02-18 09:20:09 +00:00
| '[' REG ']'
1990-11-12 15:29:14 +00:00
{success = 1; $$ = 0x01000000|$2<<16;}
1988-02-18 09:20:09 +00:00
| '[' REG ',' offset ']' optexc
1990-11-12 15:29:14 +00:00
{success = 1; $$ = $2<<16|$4|$6|0x01000000;}
1988-02-18 09:20:09 +00:00
| '[' REG ']' ',' offset
1990-11-12 15:29:14 +00:00
{success = 1; $$ = $2<<16|$5;}
1988-02-18 09:20:09 +00:00
;
offset : '#' expr
{$$ = calcoffset($2.val);}
1990-11-12 15:29:14 +00:00
| optsign REG aoptshift
1988-02-18 09:20:09 +00:00
{$$ = 0x02000000|$1|$2|$3;}
;
optsign : {$$ = 0x00800000;}
| '+'
{$$ = 0x00800000;}
| '-'
{$$ = 0x0;}
;
reglist : '{' rlist '}'
{$$ = $2;}
;
rlist : REG
{$$ = 1<<$1;}
| rlist ',' REG
{$$ = $1|1<<$3;}
1990-11-12 15:29:14 +00:00
| REG '-' REG
{
for ($$ = 0; $1 <= $3; $1++)
$$ |= (1<<$1);
}
1988-02-18 09:20:09 +00:00
;