Some modifications to reduce the number of terminals (for Ultrix)

This commit is contained in:
ceriel
1990-11-30 09:42:49 +00:00
parent 8f661ca8a9
commit df77506e1f
7 changed files with 94 additions and 98 deletions

View File

@@ -11,7 +11,6 @@
%token <y_word> DREG
%token <y_word> AREG
%token <y_word> PC
%token <y_word> ZPC
%token <y_word> CREG
%token <y_word> SPEC
%token <y_word> ABCD
@@ -39,17 +38,15 @@
%token <y_word> DIVL
%token <y_word> CMP
%token <y_word> MOVE
%token <y_word> MOVEP
%token <y_word> MOVEM
%token <y_word> MOVEC
%token <y_word> MOVES
%token <y_word> MOVESP
%token <y_word> SWAP
%token <y_word> LINK
%token <y_word> UNLK
%token <y_word> TRAP
%token <y_word> STOP
%token <y_word> EXG
%token <y_word> RTD
%token <y_word> OP_IMM
%token <y_word> BKPT
%token <y_word> CALLM
%token <y_word> CAS
@@ -58,8 +55,7 @@
%token <y_word> CPBCC
%token <y_word> CPDBCC
%token <y_word> CPGEN
%token <y_word> CPRESTORE
%token <y_word> CPSAVE
%token <y_word> CPSAVREST
%token <y_word> CPSCC
%token <y_word> CPTRAPCC
%token <y_word> FPCR

View File

@@ -31,7 +31,7 @@
0, AREG, 07, "sp",
0, PC, 0, "pc",
0, ZPC, 0, "zpc",
0, PC, 0200, "zpc",
0, CREG, 04001, "vbr",
0, CREG, 0, "sfc",
@@ -190,9 +190,9 @@
0, CMP, 0, "cmp",
0, MOVE, 0, "move",
0, MOVEP, 0, "movep",
0, MOVESP, 0, "movep",
0, MOVEM, 0, "movem",
0, MOVES, 0, "moves",
0, MOVESP, 1, "moves",
0, MOVEC, 0, "movec",
0, SWAP, 0, "swap",
@@ -203,7 +203,7 @@
0, TRAP, 0, "trap",
0, STOP, 0, "stop",
0, OP_IMM, 047162, "stop",
0, CHK, 0, "chk",
@@ -213,7 +213,7 @@
0, LEA, 0, "lea",
0, RTD, 0, "rtd",
0, OP_IMM, 047164, "rtd",
0, BKPT, 0, "bkpt",
@@ -238,8 +238,8 @@
0, CPTRAPCC, 0170170, ".trap",
0, CPBCC, 0170200, ".br", /* 'r' to distinguish from SIZE_B
*/
0, CPSAVE, 0170400, ".save",
0, CPRESTORE, 0170500, ".restore",
0, CPSAVREST, 0170400, ".save",
0, CPSAVREST, 0170500, ".restore",
/* floating point coprocessor ... */

View File

@@ -6,6 +6,10 @@
/*
* Motorola 68020 syntax rules
*/
/* Please do not add more terminal symbols. As it is, 127 terminal symbols
are used, and this is the limit for some "yacc" implementations,
notably the Ultrix one.
*/
operation
: { instrp = instr;
@@ -123,14 +127,15 @@ instruction
}
| MOVE sizenon ea_ea
{ move($2);}
| MOVEP sizedef ea_ea
{ movep($2);}
| MOVEM sizedef regs ',' notimmreg
{ movem(0, $2, $3);}
| MOVEM sizedef notimmreg ',' regs
{ movem(1, $2, $5);}
| MOVES sizedef ea_ea
{ if (mrg_1 <= 017) {
| MOVESP sizedef ea_ea
{ if ($1 == 0) {
/* movep */
movep($2);
} else if (mrg_1 <= 017) {
T_EMIT2(007000 | $2 | mrg_2,0,0,0);
T_EMIT2(mrg_1 << 12 | 04000,0,0,0);
ea_2($2,ALT|MEM);
@@ -165,8 +170,8 @@ instruction
}
| SWAP DREG
{ T_EMIT2(044100 | $2,0,0,0);}
| STOP imm
{ T_EMIT2(047162, 0, 0, 0);
| OP_IMM imm
{ T_EMIT2($1, 0, 0, 0);
ea_2(SIZE_W, 0);
}
| LINK sizenon AREG ',' imm
@@ -177,10 +182,6 @@ instruction
{ fit(fit4($3));
T_EMIT2(047100|low4($3),0,0,0);
}
| RTD imm
{ T_EMIT2(047164,0,0,0);
ea_2(SIZE_W, 0);
}
| BKPT '#' absexp
{ fit(($3 & ~07) == 0);
T_EMIT2(044110 | low3($3),0,0,0);
@@ -335,9 +336,9 @@ areg_index
}
;
areg : AREG
| PC { mrg_2 |= PC_MODE;}
| ZPC { mrg_2 |= PC_MODE;
ffew_2 |= 0200; /* base-reg suppressed */
| PC { mrg_2 |= PC_MODE;
ffew_2 |= $1; /* base-reg suppressed for zpc */
$$ = 0;
}
;
index : reg sizedef scale
@@ -633,13 +634,13 @@ mm_op1 : /* Coprocessor instructions; syntax may be changed (please).
* NO EFFECTIVE ADDRESS IS CALCULATED (SYNTAX ?)
*/
}
| CPRESTORE ea
| CPSAVREST ea
{ T_EMIT2($1 | co_id | mrg_2,0,0,0);
ea_2(SIZE_W, (mrg_2 & 070)==030 ? 0 : CTR);
}
| CPSAVE ea
{ T_EMIT2($1 | co_id | mrg_2,0,0,0);
ea_2(SIZE_W,(mrg_2 & 070)==020 ? 0 : CTR|ALT);
if ($1 & 0100) {
/* restore */
ea_2(SIZE_W, (mrg_2 & 070)==030 ? 0 : CTR);
}
else ea_2(SIZE_W,(mrg_2 & 070)==020 ? 0 : CTR|ALT);
}
| CPSCC cp_cond ea
{ T_EMIT2($1 | co_id | mrg_2,0,0,0);
@@ -657,7 +658,7 @@ mm_op1 : /* Coprocessor instructions; syntax may be changed (please).
T_EMIT2($2,0,0,0);
}
;
cp_cond : '.' absexp
cp_cond : DOT absexp
{ fit(fit6($2));
$$ = low6($2);
}