/* tc-d30v.c -- Assembler code for the Mitsubishi D30V
- Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
if (bits == 32)
{
if (sizeof (unsigned long) * CHAR_BIT == 32)
- return 0;
+ return 0;
/* We don't record signed or unsigned for 32-bit quantities.
Allow either. */
min = -((unsigned long) 1 << (bits - 1));
max = ((unsigned long) 1 << bits) - 1;
- return (long)num < min || (long)num > max;
+ return (long) num < min || (long) num > max;
}
if (flags & OPERAND_SHIFT)
{
/* We know that all shifts are right by three bits. */
+ num >>= 3;
if (flags & OPERAND_SIGNED)
- num = (unsigned long) ((long) num >= 0)
- ? (((long) num) >> 3)
- : ((num >> 3) | ~(~(unsigned long) 0 >> 3));
- else
- num >>= 3;
+ {
+ unsigned long sign_bit = ((unsigned long) -1L >> 4) + 1;
+ num = (num ^ sign_bit) - sign_bit;
+ }
}
if (flags & OPERAND_SIGNED)
{
max = ((unsigned long) 1 << (bits - 1)) - 1;
min = - ((unsigned long) 1 << (bits - 1));
- return (long)num > max || (long)num < min;
+ return (long) num > max || (long) num < min;
}
else
{
max = ((unsigned long) 1 << bits) - 1;
- min = 0;
- return num > max || num < min;
+ return num > (unsigned long) max;
}
}
int
md_parse_option (c, arg)
int c;
- char *arg;
+ char *arg ATTRIBUTE_UNUSED;
{
switch (c)
{
symbolS *
md_undefined_symbol (name)
- char *name;
+ char *name ATTRIBUTE_UNUSED;
{
return 0;
}
void
md_convert_frag (abfd, sec, fragP)
- bfd *abfd;
- asection *sec;
- fragS *fragP;
+ bfd *abfd ATTRIBUTE_UNUSED;
+ asection *sec ATTRIBUTE_UNUSED;
+ fragS *fragP ATTRIBUTE_UNUSED;
{
abort ();
}
/* Truncate to the proper number of bits. */
if ((opers[i].X_op == O_constant) && check_range (number, bits, flags))
- as_bad (_("operand out of range: %d"), number);
+ as_bad (_("operand out of range: %ld"), number);
if (bits < 31)
number &= 0x7FFFFFFF >> (31 - bits);
if (flags & OPERAND_SHIFT)
static void
write_long (opcode, insn, fx)
- struct d30v_insn *opcode;
+ struct d30v_insn *opcode ATTRIBUTE_UNUSED;
long long insn;
Fixups *fx;
{
we are not optimizing, then we have been asked to produce
an error about such constructs. For the purposes of this
test, subroutine calls are considered to be branches. */
- write_1_short (opcode1, insn1, fx->next, false);
+ write_1_short (opcode1, insn1, fx->next, FALSE);
return 1;
}
/* We must treat repeat instructions likewise, since the
following instruction has to be separate from the repeat
in order to be repeated. */
- write_1_short (opcode1, insn1, fx->next, false);
+ write_1_short (opcode1, insn1, fx->next, FALSE);
return 1;
}
else if (prev_left_kills_right_p)
{
/* The left instruction kils the right slot, so we
must leave it empty. */
- write_1_short (opcode1, insn1, fx->next, false);
+ write_1_short (opcode1, insn1, fx->next, FALSE);
return 1;
}
else if (opcode1->op->unit == IU)
/* Case 103810 is a request from Mitsubishi that opcodes
with EITHER_BUT_PREFER_MU should not be executed in
reverse sequential order. */
- write_1_short (opcode1, insn1, fx->next, false);
+ write_1_short (opcode1, insn1, fx->next, FALSE);
return 1;
}
return 0;
}
else
- if ((mod_reg[0][j] & (mod_reg[1][j] | used_reg[1][j])) != 0)
+ if ((mod_reg[0][j] & (mod_reg[1][j] | used_reg[1][j])) != 0)
return 0;
}
if ((prev_insn != -1) && prev_seg
&& ((prev_seg != now_seg) || (prev_subseg != now_subseg)))
- d30v_cleanup (false);
+ d30v_cleanup (FALSE);
if (d30v_current_align < 3)
d30v_align (3, NULL, d30v_last_label);
/* If two instructions are present and we already have one saved,
then first write it out. */
- d30v_cleanup (false);
+ d30v_cleanup (FALSE);
/* Assemble first instruction and save it. */
prev_insn = do_assemble (str, &prev_opcode, 1, 0);
of NOPs for us. */
if (prev_insn != -1 && (strcmp (prev_opcode.op->name, "nop") == 0))
- d30v_cleanup (false);
+ d30v_cleanup (FALSE);
else
{
char *f;
if (prev_insn != -1)
- d30v_cleanup (true);
+ d30v_cleanup (TRUE);
else
{
f = frag_more (8);
{
/* Can't parallelize, flush current instruction and add a
sequential NOP. */
- write_1_short (&opcode, (long) insn, fixups->next->next, true);
+ write_1_short (&opcode, (long) insn, fixups->next->next, TRUE);
/* Make the previous instruction the current one. */
extype = EXEC_UNKNOWN;
{
if (extype != EXEC_UNKNOWN)
as_bad (_("Instruction uses long version, so it cannot be mixed as specified"));
- d30v_cleanup (false);
+ d30v_cleanup (FALSE);
write_long (&opcode, insn, fixups);
prev_insn = -1;
}
arelent *
tc_gen_reloc (seg, fixp)
- asection *seg;
+ asection *seg ATTRIBUTE_UNUSED;
fixS *fixp;
{
arelent *reloc;
(int) fixp->fx_r_type);
return NULL;
}
- reloc->addend = fixp->fx_addnumber;
+
+ reloc->addend = 0;
return reloc;
}
int
md_estimate_size_before_relax (fragp, seg)
- fragS *fragp;
- asection *seg;
+ fragS *fragp ATTRIBUTE_UNUSED;
+ asection *seg ATTRIBUTE_UNUSED;
{
abort ();
return 0;
void
md_apply_fix3 (fixP, valP, seg)
fixS *fixP;
- valueT * valP;
- segT seg;
+ valueT *valP;
+ segT seg ATTRIBUTE_UNUSED;
{
char *where;
unsigned long insn, insn2;
- long value = * (long *) valP;
+ long value = *valP;
if (fixP->fx_addsy == (symbolS *) NULL)
fixP->fx_done = 1;
- else if (fixP->fx_pcrel)
- ;
-
- else
- {
- value = fixP->fx_offset;
-
- if (fixP->fx_subsy != (symbolS *) NULL)
- {
- if (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section)
- value -= S_GET_VALUE (fixP->fx_subsy);
- else
- /* We don't actually support subtracting a symbol. */
- as_bad_where (fixP->fx_file, fixP->fx_line,
- _("expression too complex"));
- }
- }
+ /* We don't support subtracting a symbol. */
+ if (fixP->fx_subsy != (symbolS *) NULL)
+ as_bad_where (fixP->fx_file, fixP->fx_line, _("expression too complex"));
/* Fetch the instruction, insert the fully resolved operand
value, and stuff the instruction back again. */
as_bad (_("line %d: unable to place address of symbol '%s' into a byte"),
fixP->fx_line, S_GET_NAME (fixP->fx_addsy));
else if (((unsigned)value) > 0xff)
- as_bad (_("line %d: unable to place value %x into a byte"),
+ as_bad (_("line %d: unable to place value %lx into a byte"),
fixP->fx_line, value);
else
*(unsigned char *) where = value;
as_bad (_("line %d: unable to place address of symbol '%s' into a short"),
fixP->fx_line, S_GET_NAME (fixP->fx_addsy));
else if (((unsigned)value) > 0xffff)
- as_bad (_("line %d: unable to place value %x into a short"),
+ as_bad (_("line %d: unable to place value %lx into a short"),
fixP->fx_line, value);
else
bfd_putb16 ((bfd_vma) value, (unsigned char *) where);
subseg_set (seg, subseg);
prev_insn = -1;
if (use_sequential)
- prev_mul32_p = false;
+ prev_mul32_p = FALSE;
}
return 1;
c++;
if (*c == '.')
- d30v_cleanup (false);
+ d30v_cleanup (FALSE);
}
static void
symbolS *lab;
{
/* Emit any pending instructions. */
- d30v_cleanup (false);
+ d30v_cleanup (FALSE);
/* Update the label's address with the current output pointer. */
symbol_set_frag (lab, frag_now);
this alignement request. The alignment of the current frag
can be changed under our feet, for example by a .ascii
directive in the source code. cf testsuite/gas/d30v/reloc.s */
- d30v_cleanup (false);
+ d30v_cleanup (FALSE);
if (pfill == NULL)
{
if (label != NULL)
{
symbolS *sym;
- int label_seen = false;
+ int label_seen = FALSE;
struct frag *old_frag;
valueT old_value;
valueT new_value;
if (symbol_get_frag (sym) == old_frag
&& S_GET_VALUE (sym) == old_value)
{
- label_seen = true;
+ label_seen = TRUE;
symbol_set_frag (sym, frag_now);
S_SET_VALUE (sym, new_value);
}
static void
s_d30v_align (ignore)
- int ignore;
+ int ignore ATTRIBUTE_UNUSED;
{
int align;
char fill, *pfill = NULL;