Kazu Hirata's formatting and comment typo fixes.

This commit is contained in:
Alan Modra
2000-06-23 05:44:30 +00:00
parent e9718fe12e
commit 70d6ecf3bf
2 changed files with 80 additions and 122 deletions

View File

@ -1,3 +1,7 @@
2000-06-22 Kazu Hirata <kazu@hxi.com>
* config/tc-h8300.c: Fix formatting and comment typos.
2000-06-22 Timothy Wall <twall@cygnus.com> 2000-06-22 Timothy Wall <twall@cygnus.com>
* config/tc-ia64.c (note_register_values): Move premature QP * config/tc-ia64.c (note_register_values): Move premature QP

View File

@ -19,7 +19,6 @@
Software Foundation, 59 Temple Place - Suite 330, Boston, MA Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */ 02111-1307, USA. */
/* /*
Written By Steve Chamberlain Written By Steve Chamberlain
sac@cygnus.com sac@cygnus.com
@ -54,7 +53,6 @@ int Smode;
#define DSYMMODE (Hmode ? L_24 : L_16) #define DSYMMODE (Hmode ? L_24 : L_16)
int bsize = L_8; /* default branch displacement */ int bsize = L_8; /* default branch displacement */
void void
h8300hmode () h8300hmode ()
{ {
@ -68,6 +66,7 @@ h8300smode ()
Smode = 1; Smode = 1;
Hmode = 1; Hmode = 1;
} }
void void
sbranch (size) sbranch (size)
int size; int size;
@ -75,14 +74,14 @@ sbranch (size)
bsize = size; bsize = size;
} }
static void pint () static void
pint ()
{ {
cons (Hmode ? 4 : 2); cons (Hmode ? 4 : 2);
} }
const pseudo_typeS md_pseudo_table[] = const pseudo_typeS md_pseudo_table[] =
{ {
{"h8300h", h8300hmode, 0}, {"h8300h", h8300hmode, 0},
{"h8300s", h8300smode, 0}, {"h8300s", h8300smode, 0},
{"sbranch", sbranch, L_8}, {"sbranch", sbranch, L_8},
@ -111,12 +110,9 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
static struct hash_control *opcode_hash_control; /* Opcode mnemonics */ static struct hash_control *opcode_hash_control; /* Opcode mnemonics */
/* /* This function is called once, at assembler startup time. This
This function is called once, at assembler startup time. This should should set up all the tables, etc. that the MD part of the assembler
set up all the tables, etc that the MD part of the assembler needs needs. */
*/
void void
md_begin () md_begin ()
{ {
@ -130,8 +126,7 @@ md_begin ()
for (opcode = h8_opcodes; opcode->name; opcode++) for (opcode = h8_opcodes; opcode->name; opcode++)
{ {
/* Strip off any . part when inserting the opcode and only enter /* Strip off any . part when inserting the opcode and only enter
unique codes into the hash table unique codes into the hash table. */
*/
char *src = opcode->name; char *src = opcode->name;
unsigned int len = strlen (src); unsigned int len = strlen (src);
char *dst = malloc (len + 1); char *dst = malloc (len + 1);
@ -157,12 +152,12 @@ md_begin ()
} }
opcode->idx = idx; opcode->idx = idx;
/* Find the number of operands. */
/* Find the number of operands */
opcode->noperands = 0; opcode->noperands = 0;
while (opcode->args.nib[opcode->noperands] != E) while (opcode->args.nib[opcode->noperands] != E)
opcode->noperands++; opcode->noperands++;
/* Find the length of the opcode in bytes */
/* Find the length of the opcode in bytes. */
opcode->length = 0; opcode->length = 0;
while (opcode->data.nib[opcode->length * 2] != E) while (opcode->data.nib[opcode->length * 2] != E)
opcode->length++; opcode->length++;
@ -171,17 +166,16 @@ md_begin ()
linkrelax = 1; linkrelax = 1;
} }
struct h8_exp struct h8_exp
{ {
char *e_beg; char *e_beg;
char *e_end; char *e_end;
expressionS e_exp; expressionS e_exp;
}; };
int dispreg; int dispreg;
int opsize; /* Set when a register size is seen */ int opsize; /* Set when a register size is seen */
struct h8_op struct h8_op
{ {
op_type mode; op_type mode;
@ -212,7 +206,7 @@ parse_reg (src, mode, reg, direction)
char *end; char *end;
int len; int len;
/* Cribbed from get_symbol_end(). */ /* Cribbed from get_symbol_end. */
if (!is_name_beginner (*src) || *src == '\001') if (!is_name_beginner (*src) || *src == '\001')
return 0; return 0;
end = src + 1; end = src + 1;
@ -373,7 +367,7 @@ colonmod24 (op, src)
if (!mode) if (!mode)
{ {
/* Choose a default mode */ /* Choose a default mode. */
if (op->exp.X_add_number < -32768 if (op->exp.X_add_number < -32768
|| op->exp.X_add_number > 32767) || op->exp.X_add_number > 32767)
{ {
@ -393,7 +387,6 @@ colonmod24 (op, src)
} }
static void static void
get_operand (ptr, op, dst, direction) get_operand (ptr, op, dst, direction)
char **ptr; char **ptr;
@ -462,29 +455,24 @@ get_operand (ptr, op, dst, direction)
op->mode = MEMIND; op->mode = MEMIND;
return; return;
} }
if (*src == '-') if (*src == '-')
{ {
src++; src++;
len = parse_reg (src, &mode, &num, direction); len = parse_reg (src, &mode, &num, direction);
if (len == 0) if (len == 0)
{ {
/* Oops, not a reg after all, must be ordinary exp */ /* Oops, not a reg after all, must be ordinary exp. */
src--; src--;
/* must be a symbol */ /* Must be a symbol. */
op->mode = ABS | PSIZE | direction; op->mode = ABS | PSIZE | direction;
*ptr = skip_colonthing (parse_exp (src, &op->exp), *ptr = skip_colonthing (parse_exp (src, &op->exp),
&op->exp, &op->mode); &op->exp, &op->mode);
return; return;
} }
if ((mode & SIZE) != PSIZE) if ((mode & SIZE) != PSIZE)
as_bad (_("Wrong size pointer register for architecture.")); as_bad (_("Wrong size pointer register for architecture."));
op->mode = RDDEC; op->mode = RDDEC;
@ -494,11 +482,10 @@ get_operand (ptr, op, dst, direction)
} }
if (*src == '(') if (*src == '(')
{ {
/* Disp */ /* Disp. */
src++; src++;
/* Start off assuming a 16 bit offset */ /* Start off assuming a 16 bit offset. */
src = parse_exp (src, &op->exp); src = parse_exp (src, &op->exp);
@ -577,7 +564,6 @@ get_operand (ptr, op, dst, direction)
} }
} }
if (*src == '#') if (*src == '#')
{ {
src++; src++;
@ -624,9 +610,7 @@ get_operand (ptr, op, dst, direction)
} }
} }
static char *
static
char *
get_operands (noperands, op_end, operand) get_operands (noperands, op_end, operand)
unsigned int noperands; unsigned int noperands;
char *op_end; char *op_end;
@ -653,8 +637,8 @@ get_operands (noperands, op_end, operand)
{ {
operand[1].mode = 0; operand[1].mode = 0;
} }
break; break;
case 2: case 2:
ptr++; ptr++;
get_operand (&ptr, operand + 0, 0, SRC); get_operand (&ptr, operand + 0, 0, SRC);
@ -667,16 +651,13 @@ get_operands (noperands, op_end, operand)
abort (); abort ();
} }
return ptr; return ptr;
} }
/* Passed a pointer to a list of opcodes which use different /* Passed a pointer to a list of opcodes which use different
addressing modes, return the opcode which matches the opcodes addressing modes, return the opcode which matches the opcodes
provided provided. */
*/ static struct h8_opcode *
static
struct h8_opcode *
get_specific (opcode, operands, size) get_specific (opcode, operands, size)
struct h8_opcode *opcode; struct h8_opcode *opcode;
struct h8_op *operands; struct h8_op *operands;
@ -732,7 +713,7 @@ get_specific (opcode, operands, size)
opsize = op & SIZE; opsize = op & SIZE;
/* The size of the reg is v important */ /* The size of the reg is v important. */
if ((op & SIZE) != (x & SIZE)) if ((op & SIZE) != (x & SIZE))
found = 0; found = 0;
} }
@ -740,7 +721,7 @@ get_specific (opcode, operands, size)
{ {
operands[i].mode &= ~ABS; operands[i].mode &= ~ABS;
operands[i].mode |= ABSJMP; operands[i].mode |= ABSJMP;
/* But it may not be 24 bits long */ /* But it may not be 24 bits long. */
if (!Hmode) if (!Hmode)
{ {
operands[i].mode &= ~SIZE; operands[i].mode &= ~SIZE;
@ -749,11 +730,11 @@ get_specific (opcode, operands, size)
} }
else if ((op & (KBIT | DBIT)) && (x & IMM)) else if ((op & (KBIT | DBIT)) && (x & IMM))
{ {
/* This is ok if the immediate value is sensible */ /* This is ok if the immediate value is sensible. */
} }
else if (op & PCREL) else if (op & PCREL)
{ {
/* The size of the displacement is important */ /* The size of the displacement is important. */
if ((op & SIZE) != (x & SIZE)) if ((op & SIZE) != (x & SIZE))
found = 0; found = 0;
} }
@ -802,10 +783,10 @@ check_operand (operand, width, string)
if (operand->exp.X_add_symbol == 0 if (operand->exp.X_add_symbol == 0
&& operand->exp.X_op_symbol == 0) && operand->exp.X_op_symbol == 0)
{ {
/* No symbol involved, let's look at offset, it's dangerous if
/* No symbol involved, let's look at offset, it's dangerous if any of any of the high bits are not 0 or ff's, find out by oring or
the high bits are not 0 or ff's, find out by oring or anding with anding with the width and seeing if the answer is 0 or all
the width and seeing if the answer is 0 or all fs*/ fs. */
if ((operand->exp.X_add_number & ~width) != 0 && if ((operand->exp.X_add_number & ~width) != 0 &&
(operand->exp.X_add_number | width) != (~0)) (operand->exp.X_add_number | width) != (~0))
@ -824,7 +805,6 @@ check_operand (operand, width, string)
} }
} }
} }
} }
/* RELAXMODE has one of 3 values: /* RELAXMODE has one of 3 values:
@ -847,7 +827,6 @@ do_a_fix_imm (offset, operand, relaxmode)
int size; int size;
int where; int where;
char *t = operand->mode & IMM ? "#" : "@"; char *t = operand->mode & IMM ? "#" : "@";
if (operand->exp.X_add_symbol == 0) if (operand->exp.X_add_symbol == 0)
@ -880,7 +859,7 @@ do_a_fix_imm (offset, operand, relaxmode)
break; break;
case L_32: case L_32:
/* This should be done with bfd */ /* This should be done with bfd. */
bytes[0] = operand->exp.X_add_number >> 24; bytes[0] = operand->exp.X_add_number >> 24;
bytes[1] = operand->exp.X_add_number >> 16; bytes[1] = operand->exp.X_add_number >> 16;
bytes[2] = operand->exp.X_add_number >> 8; bytes[2] = operand->exp.X_add_number >> 8;
@ -892,13 +871,11 @@ do_a_fix_imm (offset, operand, relaxmode)
} }
break; break;
} }
} }
else else
{ {
switch (operand->mode & SIZE) switch (operand->mode & SIZE)
{ {
case L_24: case L_24:
case L_32: case L_32:
size = 4; size = 4;
@ -937,11 +914,9 @@ do_a_fix_imm (offset, operand, relaxmode)
0, 0,
idx); idx);
} }
} }
/* Now we know what sort of opcodes it is, lets build the bytes - /* Now we know what sort of opcodes it is, let's build the bytes. */
*/
static void static void
build_bytes (this_try, operand) build_bytes (this_try, operand)
struct h8_opcode *this_try; struct h8_opcode *this_try;
@ -977,7 +952,6 @@ build_bytes (this_try, operand)
} }
else else
{ {
if (c & (REG | IND | INC | DEC)) if (c & (REG | IND | INC | DEC))
{ {
nib = operand[d].reg; nib = operand[d].reg;
@ -1036,7 +1010,7 @@ build_bytes (this_try, operand)
as_bad (_("Need #1 or #2 here")); as_bad (_("Need #1 or #2 here"));
break; break;
} }
/* stop it making a fix */ /* Stop it making a fix. */
operand[0].mode = 0; operand[0].mode = 0;
} }
@ -1083,7 +1057,7 @@ build_bytes (this_try, operand)
if (strcmp (this_try->name, "mov.b") == 0) if (strcmp (this_try->name, "mov.b") == 0)
movb = 1; movb = 1;
/* output any fixes */ /* Output any fixes. */
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
{ {
int x = operand[i].mode; int x = operand[i].mode;
@ -1126,7 +1100,6 @@ build_bytes (this_try, operand)
} }
else if (x & MEMIND) else if (x & MEMIND)
{ {
check_operand (operand + i, 0xff, "@@"); check_operand (operand + i, 0xff, "@@");
fix_new_exp (frag_now, fix_new_exp (frag_now,
output - frag_now->fr_literal + 1, output - frag_now->fr_literal + 1,
@ -1137,7 +1110,7 @@ build_bytes (this_try, operand)
} }
else if (x & ABSJMP) else if (x & ABSJMP)
{ {
/* This jmp may be a jump or a branch */ /* This jmp may be a jump or a branch. */
check_operand (operand + i, Hmode ? 0xffffff : 0xffff, "@"); check_operand (operand + i, Hmode ? 0xffffff : 0xffff, "@");
if (operand[i].exp.X_add_number & 1) if (operand[i].exp.X_add_number & 1)
@ -1156,27 +1129,23 @@ build_bytes (this_try, operand)
R_JMPL1); R_JMPL1);
} }
} }
} }
/* /* Try to give an intelligent error message for common and simple to
try and give an intelligent error message for common and simple to detect errors. */
detect errors
*/
static void static void
clever_message (opcode, operand) clever_message (opcode, operand)
struct h8_opcode *opcode; struct h8_opcode *opcode;
struct h8_op *operand; struct h8_op *operand;
{ {
/* Find out if there was more than one possible opccode */ /* Find out if there was more than one possible opcode. */
if ((opcode + 1)->idx != opcode->idx) if ((opcode + 1)->idx != opcode->idx)
{ {
unsigned int argn; unsigned int argn;
/* Only one opcode of this flavour, try and guess which operand /* Only one opcode of this flavour, try to guess which operand
didn't match */ didn't match. */
for (argn = 0; argn < opcode->noperands; argn++) for (argn = 0; argn < opcode->noperands; argn++)
{ {
switch (opcode->args.nib[argn]) switch (opcode->args.nib[argn])
@ -1191,7 +1160,6 @@ clever_message (opcode, operand)
break; break;
case RS8: case RS8:
if (operand[argn].mode != RS8) if (operand[argn].mode != RS8)
{ {
as_bad (_("source operand must be 8 bit register")); as_bad (_("source operand must be 8 bit register"));
@ -1214,7 +1182,6 @@ clever_message (opcode, operand)
} }
break; break;
case ABS16SRC: case ABS16SRC:
if (operand[argn].mode != ABS16SRC) if (operand[argn].mode != ABS16SRC)
{ {
@ -1229,13 +1196,9 @@ clever_message (opcode, operand)
as_bad (_("invalid operands")); as_bad (_("invalid operands"));
} }
/* This is the guts of the machine-dependent assembler. STR points to a /* This is the guts of the machine-dependent assembler. STR points to
machine dependent instruction. This funciton is supposed to emit a machine dependent instruction. This function is supposed to emit
the frags/bytes it assembles to. the frags/bytes it assembles. */
*/
void void
md_assemble (str) md_assemble (str)
char *str; char *str;
@ -1250,11 +1213,11 @@ md_assemble (str)
char c; char c;
int size; int size;
/* Drop leading whitespace */ /* Drop leading whitespace. */
while (*str == ' ') while (*str == ' ')
str++; str++;
/* find the op code end */ /* Find the op code end. */
for (op_start = op_end = str; for (op_start = op_end = str;
*op_end != 0 && *op_end != ' '; *op_end != 0 && *op_end != ' ';
op_end++) op_end++)
@ -1268,8 +1231,6 @@ md_assemble (str)
} }
} }
;
if (op_end == op_start) if (op_end == op_start)
{ {
as_bad (_("can't find opcode ")); as_bad (_("can't find opcode "));
@ -1287,7 +1248,7 @@ md_assemble (str)
return; return;
} }
/* We use to set input_line_pointer to the result of get_operands, /* We used to set input_line_pointer to the result of get_operands,
but that is wrong. Our caller assumes we don't change it. */ but that is wrong. Our caller assumes we don't change it. */
(void) get_operands (opcode->noperands, op_end, operand); (void) get_operands (opcode->noperands, op_end, operand);
@ -1316,7 +1277,7 @@ md_assemble (str)
if (opcode == 0) if (opcode == 0)
{ {
/* Couldn't find an opcode which matched the operands */ /* Couldn't find an opcode which matched the operands. */
char *where = frag_more (2); char *where = frag_more (2);
where[0] = 0x0; where[0] = 0x0;
@ -1334,7 +1295,6 @@ md_assemble (str)
} }
build_bytes (opcode, operand); build_bytes (opcode, operand);
} }
void void
@ -1362,10 +1322,10 @@ tc_headers_hook (headers)
/* Equal to MAX_PRECISION in atof-ieee.c */ /* Equal to MAX_PRECISION in atof-ieee.c */
#define MAX_LITTLENUMS 6 #define MAX_LITTLENUMS 6
/* Turn a string in input_line_pointer into a floating point constant of type /* Turn a string in input_line_pointer into a floating point constant
type, and store the appropriate bytes in *litP. The number of LITTLENUMS of type TYPE, and store the appropriate bytes in *LITP. The number
emitted is stored in *sizeP . An error message is returned, or NULL on OK. of LITTLENUMS emitted is stored in *SIZEP . An error message is
*/ returned, or NULL on OK. */
char * char *
md_atof (type, litP, sizeP) md_atof (type, litP, sizeP)
char type; char type;
@ -1425,6 +1385,7 @@ CONST char *md_shortopts = "";
struct option md_longopts[] = { struct option md_longopts[] = {
{NULL, no_argument, NULL, 0} {NULL, no_argument, NULL, 0}
}; };
size_t md_longopts_size = sizeof (md_longopts); size_t md_longopts_size = sizeof (md_longopts);
int int
@ -1463,8 +1424,8 @@ md_section_align (seg, size)
segT seg; segT seg;
valueT size; valueT size;
{ {
return ((size + (1 << section_alignment[(int) seg]) - 1) & (-1 << section_alignment[(int) seg])); return ((size + (1 << section_alignment[(int) seg]) - 1)
& (-1 << section_alignment[(int) seg]));
} }
void void
@ -1503,8 +1464,7 @@ md_estimate_size_before_relax (fragP, segment_type)
abort (); abort ();
} }
/* Put number into target byte order */ /* Put number into target byte order. */
void void
md_number_to_chars (ptr, use, nbytes) md_number_to_chars (ptr, use, nbytes)
char *ptr; char *ptr;
@ -1513,6 +1473,7 @@ md_number_to_chars (ptr, use, nbytes)
{ {
number_to_chars_bigendian (ptr, use, nbytes); number_to_chars_bigendian (ptr, use, nbytes);
} }
long long
md_pcrel_from (fixP) md_pcrel_from (fixP)
fixS *fixP ATTRIBUTE_UNUSED; fixS *fixP ATTRIBUTE_UNUSED;
@ -1520,7 +1481,6 @@ md_pcrel_from (fixP)
abort (); abort ();
} }
void void
tc_reloc_mangle (fix_ptr, intr, base) tc_reloc_mangle (fix_ptr, intr, base)
fixS *fix_ptr; fixS *fix_ptr;
@ -1533,7 +1493,7 @@ tc_reloc_mangle (fix_ptr, intr, base)
symbol_ptr = fix_ptr->fx_addsy; symbol_ptr = fix_ptr->fx_addsy;
/* If this relocation is attached to a symbol then it's ok /* If this relocation is attached to a symbol then it's ok
to output it */ to output it. */
if (fix_ptr->fx_r_type == TC_CONS_RELOC) if (fix_ptr->fx_r_type == TC_CONS_RELOC)
{ {
/* cons likes to create reloc32's whatever the size of the reloc.. /* cons likes to create reloc32's whatever the size of the reloc..
@ -1551,9 +1511,7 @@ tc_reloc_mangle (fix_ptr, intr, base)
break; break;
default: default:
abort (); abort ();
} }
} }
else else
{ {
@ -1584,8 +1542,4 @@ tc_reloc_mangle (fix_ptr, intr, base)
} }
else else
intr->r_symndx = -1; intr->r_symndx = -1;
} }
/* end of tc-h8300.c */