* config/tc-a29k.c: Include ctype.h with angle brackets.

(define_some_regs): Add new special register names defined on the
	29040.
	(parse_operand): Add argument opt.  If non-zero, don't warn about
	a missing operand.
	(machine_ip): If handling argument type 'I', pass opt as non-zero
	to parse_operand.  Handle new optional operand type 'I'.
	(md_undefined_symbol): Handle special register names (srNN).
This commit is contained in:
Ian Lance Taylor
1994-10-19 17:46:43 +00:00
parent 009946c974
commit 030915dc25
2 changed files with 58 additions and 12 deletions

View File

@ -1,3 +1,14 @@
Wed Oct 19 13:41:56 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
* config/tc-a29k.c: Include ctype.h with angle brackets.
(define_some_regs): Add new special register names defined on the
29040.
(parse_operand): Add argument opt. If non-zero, don't warn about
a missing operand.
(machine_ip): If handling argument type 'I', pass opt as non-zero
to parse_operand. Handle new optional operand type 'I'.
(md_undefined_symbol): Handle special register names (srNN).
Tue Oct 18 00:45:24 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) Tue Oct 18 00:45:24 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* write.c (renumber_sections): New static BFD_ASSEMBLER function. * write.c (renumber_sections): New static BFD_ASSEMBLER function.

View File

@ -21,7 +21,7 @@
to convert it to new machines' assemblers as desired. There was too to convert it to new machines' assemblers as desired. There was too
much bloody rewriting required before. There still probably is. */ much bloody rewriting required before. There still probably is. */
#include "ctype.h" #include <ctype.h>
#include "as.h" #include "as.h"
#include "opcode/a29k.h" #include "opcode/a29k.h"
@ -243,6 +243,12 @@ define_some_regs ()
insert_sreg ("iba1", SREG + 25); insert_sreg ("iba1", SREG + 25);
insert_sreg ("ibc1", SREG + 26); insert_sreg ("ibc1", SREG + 26);
/* Additional registers for the 29040. */
insert_sreg ("dba", SREG + 27);
insert_sreg ("dbc", SREG + 28);
insert_sreg ("cir", SREG + 29);
insert_sreg ("cdr", SREG + 30);
/* Unprotected special-purpose register names */ /* Unprotected special-purpose register names */
insert_sreg ("ipc", SREG + 128); insert_sreg ("ipc", SREG + 128);
insert_sreg ("ipa", SREG + 129); insert_sreg ("ipa", SREG + 129);
@ -373,16 +379,17 @@ md_assemble (str)
} }
char * char *
parse_operand (s, operandp) parse_operand (s, operandp, opt)
char *s; char *s;
expressionS *operandp; expressionS *operandp;
int opt;
{ {
char *save = input_line_pointer; char *save = input_line_pointer;
char *new; char *new;
input_line_pointer = s; input_line_pointer = s;
expression (operandp); expression (operandp);
if (operandp->X_op == O_absent) if (operandp->X_op == O_absent && ! opt)
as_bad ("missing operand"); as_bad ("missing operand");
new = input_line_pointer; new = input_line_pointer;
input_line_pointer = save; input_line_pointer = save;
@ -443,7 +450,10 @@ machine_ip (str)
and do a "continue". If an operand fails to match, we "break". */ and do a "continue". If an operand fails to match, we "break". */
if (insn->args[0] != '\0') if (insn->args[0] != '\0')
s = parse_operand (s, operand); /* Prime the pump */ {
/* Prime the pump. */
s = parse_operand (s, operand, insn->args[0] == 'I');
}
for (args = insn->args;; ++args) for (args = insn->args;; ++args)
{ {
@ -463,7 +473,8 @@ machine_ip (str)
case ',': /* Must match a comma */ case ',': /* Must match a comma */
if (*s++ == ',') if (*s++ == ',')
{ {
s = parse_operand (s, operand); /* Parse next opnd */ /* Parse next operand. */
s = parse_operand (s, operand, args[1] == 'I');
continue; continue;
} }
break; break;
@ -648,6 +659,18 @@ machine_ip (str)
} }
break; break;
case 'I': /* ID bits of INV and IRETINV. */
/* This operand is optional. */
if (operand->X_op == O_absent)
continue;
else if (operand->X_op == O_constant
&& operand->X_add_number < 4)
{
opcode |= operand->X_add_number << 16;
continue;
}
break;
case 'd': /* FD bits of CONVERT */ case 'd': /* FD bits of CONVERT */
if (operand->X_op == O_constant && if (operand->X_op == O_constant &&
operand->X_add_number < 4) operand->X_add_number < 4)
@ -1065,29 +1088,41 @@ md_undefined_symbol (name)
long regnum; long regnum;
char testbuf[5 + /*SLOP*/ 5]; char testbuf[5 + /*SLOP*/ 5];
if (name[0] == 'g' || name[0] == 'G' || name[0] == 'l' || name[0] == 'L') if (name[0] == 'g' || name[0] == 'G'
|| name[0] == 'l' || name[0] == 'L'
|| name[0] == 's' || name[0] == 'S')
{ {
/* Perhaps a global or local register name */ /* Perhaps a global or local register name */
if (name[1] == 'r' || name[1] == 'R') if (name[1] == 'r' || name[1] == 'R')
{ {
/* Parse the number, make sure it has no extra zeroes or trailing long maxreg;
chars */
/* Parse the number, make sure it has no extra zeroes or
trailing chars. */
regnum = atol (&name[2]); regnum = atol (&name[2]);
if (regnum > 127)
return 0; if (name[0] == 's' || name[0] == 'S')
maxreg = 255;
else
maxreg = 127;
if (regnum > maxreg)
return NULL;
sprintf (testbuf, "%ld", regnum); sprintf (testbuf, "%ld", regnum);
if (strcmp (testbuf, &name[2]) != 0) if (strcmp (testbuf, &name[2]) != 0)
return 0; /* gr007 or lr7foo or whatever */ return NULL; /* gr007 or lr7foo or whatever */
/* We have a wiener! Define and return a new symbol for it. */ /* We have a wiener! Define and return a new symbol for it. */
if (name[0] == 'l' || name[0] == 'L') if (name[0] == 'l' || name[0] == 'L')
regnum += 128; regnum += 128;
else if (name[0] == 's' || name[0] == 'S')
regnum += SREG;
return (symbol_new (name, SEG_REGISTER, (valueT) regnum, return (symbol_new (name, SEG_REGISTER, (valueT) regnum,
&zero_address_frag)); &zero_address_frag));
} }
} }
return 0; return NULL;
} }
/* Parse an operand that is machine-specific. */ /* Parse an operand that is machine-specific. */