Replace a bunch of magic constants in tc-mips.c with their proper

defines from mips.h.
This commit is contained in:
Thiemo Seufer
2001-08-07 13:22:46 +00:00
parent 9a41af6410
commit 38487616e6
2 changed files with 54 additions and 42 deletions

View File

@ -1,3 +1,9 @@
2001-08-07 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
/gas/ChangeLog
* tc-mips.c (macro_build): Replace magic constants by defines.
(mips_ip): Likewise. Typo.
2001-08-04 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de> 2001-08-04 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
/gas/ChangeLog /gas/ChangeLog

View File

@ -2559,62 +2559,65 @@ macro_build (place, counter, ep, name, fmt, va_alist)
case 't': case 't':
case 'w': case 'w':
case 'E': case 'E':
insn.insn_opcode |= va_arg (args, int) << 16; insn.insn_opcode |= va_arg (args, int) << OP_SH_RT;
continue; continue;
case 'c': case 'c':
insn.insn_opcode |= va_arg (args, int) << OP_SH_CODE;
continue;
case 'T': case 'T':
case 'W': case 'W':
insn.insn_opcode |= va_arg (args, int) << 16; insn.insn_opcode |= va_arg (args, int) << OP_SH_FT;
continue; continue;
case 'd': case 'd':
case 'G': case 'G':
insn.insn_opcode |= va_arg (args, int) << 11; insn.insn_opcode |= va_arg (args, int) << OP_SH_RD;
continue; continue;
case 'U': case 'U':
{ {
int tmp = va_arg (args, int); int tmp = va_arg (args, int);
insn.insn_opcode |= tmp << 16; insn.insn_opcode |= tmp << OP_SH_RT;
insn.insn_opcode |= tmp << 11; insn.insn_opcode |= tmp << OP_SH_RD;
continue; continue;
} }
case 'V': case 'V':
case 'S': case 'S':
insn.insn_opcode |= va_arg (args, int) << 11; insn.insn_opcode |= va_arg (args, int) << OP_SH_FS;
continue; continue;
case 'z': case 'z':
continue; continue;
case '<': case '<':
insn.insn_opcode |= va_arg (args, int) << 6; insn.insn_opcode |= va_arg (args, int) << OP_SH_SHAMT;
continue; continue;
case 'D': case 'D':
insn.insn_opcode |= va_arg (args, int) << 6; insn.insn_opcode |= va_arg (args, int) << OP_SH_FD;
continue; continue;
case 'B': case 'B':
insn.insn_opcode |= va_arg (args, int) << 6; insn.insn_opcode |= va_arg (args, int) << OP_SH_CODE20;
continue; continue;
case 'J': case 'J':
insn.insn_opcode |= va_arg (args, int) << 6; insn.insn_opcode |= va_arg (args, int) << OP_SH_CODE19;
continue; continue;
case 'q': case 'q':
insn.insn_opcode |= va_arg (args, int) << 6; insn.insn_opcode |= va_arg (args, int) << OP_SH_CODE2;
continue; continue;
case 'b': case 'b':
case 's': case 's':
case 'r': case 'r':
case 'v': case 'v':
insn.insn_opcode |= va_arg (args, int) << 21; insn.insn_opcode |= va_arg (args, int) << OP_SH_RS;
continue; continue;
case 'i': case 'i':
@ -7004,16 +7007,19 @@ mips_ip (str, ip)
{ {
case 'r': case 'r':
case 'v': case 'v':
ip->insn_opcode |= lastregno << 21; ip->insn_opcode |= lastregno << OP_SH_RS;
continue; continue;
case 'w': case 'w':
ip->insn_opcode |= lastregno << OP_SH_RT;
continue;
case 'W': case 'W':
ip->insn_opcode |= lastregno << 16; ip->insn_opcode |= lastregno << OP_SH_FT;
continue; continue;
case 'V': case 'V':
ip->insn_opcode |= lastregno << 11; ip->insn_opcode |= lastregno << OP_SH_FS;
continue; continue;
} }
break; break;
@ -7047,9 +7053,9 @@ mips_ip (str, ip)
{ {
as_warn (_("Improper shift amount (%ld)"), as_warn (_("Improper shift amount (%ld)"),
(long) imm_expr.X_add_number); (long) imm_expr.X_add_number);
imm_expr.X_add_number = imm_expr.X_add_number & 0x1f; imm_expr.X_add_number &= OP_MASK_SHAMT;
} }
ip->insn_opcode |= imm_expr.X_add_number << 6; ip->insn_opcode |= imm_expr.X_add_number << OP_SH_SHAMT;
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;
@ -7060,7 +7066,7 @@ mips_ip (str, ip)
if ((unsigned long) imm_expr.X_add_number < 32 if ((unsigned long) imm_expr.X_add_number < 32
|| (unsigned long) imm_expr.X_add_number > 63) || (unsigned long) imm_expr.X_add_number > 63)
break; break;
ip->insn_opcode |= (imm_expr.X_add_number - 32) << 6; ip->insn_opcode |= (imm_expr.X_add_number - 32) << OP_SH_SHAMT;
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;
@ -7091,9 +7097,9 @@ mips_ip (str, ip)
{ {
as_warn (_("Illegal break code (%ld)"), as_warn (_("Illegal break code (%ld)"),
(long) imm_expr.X_add_number); (long) imm_expr.X_add_number);
imm_expr.X_add_number &= 0x3ff; imm_expr.X_add_number &= OP_MASK_CODE;
} }
ip->insn_opcode |= imm_expr.X_add_number << 16; ip->insn_opcode |= imm_expr.X_add_number << OP_SH_CODE;
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;
@ -7105,9 +7111,9 @@ mips_ip (str, ip)
{ {
as_warn (_("Illegal lower break code (%ld)"), as_warn (_("Illegal lower break code (%ld)"),
(long) imm_expr.X_add_number); (long) imm_expr.X_add_number);
imm_expr.X_add_number &= 0x3ff; imm_expr.X_add_number &= OP_MASK_CODE2;
} }
ip->insn_opcode |= imm_expr.X_add_number << 6; ip->insn_opcode |= imm_expr.X_add_number << OP_SH_CODE2;
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;
@ -7115,10 +7121,10 @@ mips_ip (str, ip)
case 'B': /* 20-bit syscall/break code. */ case 'B': /* 20-bit syscall/break code. */
my_getExpression (&imm_expr, s); my_getExpression (&imm_expr, s);
check_absolute_expr (ip, &imm_expr); check_absolute_expr (ip, &imm_expr);
if ((unsigned) imm_expr.X_add_number > 0xfffff) if ((unsigned) imm_expr.X_add_number > OP_MASK_CODE20)
as_warn (_("Illegal 20-bit code (%ld)"), as_warn (_("Illegal 20-bit code (%ld)"),
(long) imm_expr.X_add_number); (long) imm_expr.X_add_number);
ip->insn_opcode |= imm_expr.X_add_number << 6; ip->insn_opcode |= imm_expr.X_add_number << OP_SH_CODE20;
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;
@ -7140,10 +7146,10 @@ mips_ip (str, ip)
case 'J': /* 19-bit wait code. */ case 'J': /* 19-bit wait code. */
my_getExpression (&imm_expr, s); my_getExpression (&imm_expr, s);
check_absolute_expr (ip, &imm_expr); check_absolute_expr (ip, &imm_expr);
if ((unsigned) imm_expr.X_add_number > 0x7ffff) if ((unsigned) imm_expr.X_add_number > OP_MASK_CODE19)
as_warn (_("Illegal 19-bit code (%ld)"), as_warn (_("Illegal 19-bit code (%ld)"),
(long) imm_expr.X_add_number); (long) imm_expr.X_add_number);
ip->insn_opcode |= imm_expr.X_add_number << 6; ip->insn_opcode |= imm_expr.X_add_number << OP_SH_CODE19;
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;
@ -7153,11 +7159,11 @@ mips_ip (str, ip)
check_absolute_expr (ip, &imm_expr); check_absolute_expr (ip, &imm_expr);
if (imm_expr.X_add_number != 0 && imm_expr.X_add_number != 1) if (imm_expr.X_add_number != 0 && imm_expr.X_add_number != 1)
{ {
as_warn (_("Invalidate performance regster (%ld)"), as_warn (_("Invalid performance register (%ld)"),
(long) imm_expr.X_add_number); (long) imm_expr.X_add_number);
imm_expr.X_add_number &= 1; imm_expr.X_add_number &= OP_MASK_PERFREG;
} }
ip->insn_opcode |= (imm_expr.X_add_number << 1); ip->insn_opcode |= (imm_expr.X_add_number << OP_SH_PERFREG);
imm_expr.X_op = O_absent; imm_expr.X_op = O_absent;
s = expr_end; s = expr_end;
continue; continue;
@ -7282,20 +7288,20 @@ mips_ip (str, ip)
case 's': case 's':
case 'v': case 'v':
case 'b': case 'b':
ip->insn_opcode |= regno << 21; ip->insn_opcode |= regno << OP_SH_RS;
break; break;
case 'd': case 'd':
case 'G': case 'G':
ip->insn_opcode |= regno << 11; ip->insn_opcode |= regno << OP_SH_RD;
break; break;
case 'U': case 'U':
ip->insn_opcode |= regno << 11; ip->insn_opcode |= regno << OP_SH_RD;
ip->insn_opcode |= regno << 16; ip->insn_opcode |= regno << OP_SH_RT;
break; break;
case 'w': case 'w':
case 't': case 't':
case 'E': case 'E':
ip->insn_opcode |= regno << 16; ip->insn_opcode |= regno << OP_SH_RT;
break; break;
case 'x': case 'x':
/* This case exists because on the r3000 trunc /* This case exists because on the r3000 trunc
@ -7326,10 +7332,10 @@ mips_ip (str, ip)
{ {
case 'r': case 'r':
case 'v': case 'v':
ip->insn_opcode |= lastregno << 21; ip->insn_opcode |= lastregno << OP_SH_RS;
continue; continue;
case 'w': case 'w':
ip->insn_opcode |= lastregno << 16; ip->insn_opcode |= lastregno << OP_SH_RT;
continue; continue;
} }
break; break;
@ -7382,18 +7388,18 @@ mips_ip (str, ip)
switch (c) switch (c)
{ {
case 'D': case 'D':
ip->insn_opcode |= regno << 6; ip->insn_opcode |= regno << OP_SH_FD;
break; break;
case 'V': case 'V':
case 'S': case 'S':
ip->insn_opcode |= regno << 11; ip->insn_opcode |= regno << OP_SH_FS;
break; break;
case 'W': case 'W':
case 'T': case 'T':
ip->insn_opcode |= regno << 16; ip->insn_opcode |= regno << OP_SH_FT;
break; break;
case 'R': case 'R':
ip->insn_opcode |= regno << 21; ip->insn_opcode |= regno << OP_SH_FR;
break; break;
} }
lastregno = regno; lastregno = regno;
@ -7403,10 +7409,10 @@ mips_ip (str, ip)
switch (*args++) switch (*args++)
{ {
case 'V': case 'V':
ip->insn_opcode |= lastregno << 11; ip->insn_opcode |= lastregno << OP_SH_FS;
continue; continue;
case 'W': case 'W':
ip->insn_opcode |= lastregno << 16; ip->insn_opcode |= lastregno << OP_SH_FT;
continue; continue;
} }
break; break;