Line 1... |
Line 1... |
/* tc-mips.c -- assemble code for a MIPS chip.
|
/* tc-mips.c -- assemble code for a MIPS chip.
|
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
Contributed by the OSF and Ralph Campbell.
|
Contributed by the OSF and Ralph Campbell.
|
Written by Keith Knowles and Ralph Campbell, working independently.
|
Written by Keith Knowles and Ralph Campbell, working independently.
|
Modified for ECOFF and R4000 support by Ian Lance Taylor of Cygnus
|
Modified for ECOFF and R4000 support by Ian Lance Taylor of Cygnus
|
Support.
|
Support.
|
Line 3685... |
Line 3685... |
can_swap_branch_p (struct mips_cl_insn *ip)
|
can_swap_branch_p (struct mips_cl_insn *ip)
|
{
|
{
|
unsigned long pinfo, pinfo2, prev_pinfo, prev_pinfo2;
|
unsigned long pinfo, pinfo2, prev_pinfo, prev_pinfo2;
|
unsigned int gpr_read, gpr_write, prev_gpr_read, prev_gpr_write;
|
unsigned int gpr_read, gpr_write, prev_gpr_read, prev_gpr_write;
|
|
|
|
|
/* -O2 and above is required for this optimization. */
|
/* -O2 and above is required for this optimization. */
|
if (mips_optimize < 2)
|
if (mips_optimize < 2)
|
return FALSE;
|
return FALSE;
|
|
|
/* If we have seen .set volatile or .set nomove, don't optimize. */
|
/* If we have seen .set volatile or .set nomove, don't optimize. */
|
Line 3727... |
Line 3726... |
if (seg_info (now_seg)->label_list)
|
if (seg_info (now_seg)->label_list)
|
return FALSE;
|
return FALSE;
|
|
|
/* If the previous instruction is in a variant frag other than this
|
/* If the previous instruction is in a variant frag other than this
|
branch's one, we cannot do the swap. This does not apply to
|
branch's one, we cannot do the swap. This does not apply to
|
MIPS16/microMIPS code, which uses variant frags for different
|
MIPS16 code, which uses variant frags for different purposes. */
|
purposes. */
|
if (!mips_opts.mips16
|
if (!HAVE_CODE_COMPRESSION
|
|
&& history[0].frag
|
&& history[0].frag
|
&& history[0].frag->fr_type == rs_machine_dependent)
|
&& history[0].frag->fr_type == rs_machine_dependent)
|
return FALSE;
|
return FALSE;
|
|
|
/* We do not swap with instructions that cannot architecturally
|
/* We do not swap with instructions that cannot architecturally
|
Line 3918... |
Line 3916... |
s = colon (micromips_label_name ());
|
s = colon (micromips_label_name ());
|
micromips_label_inc ();
|
micromips_label_inc ();
|
#if defined(OBJ_ELF) || defined(OBJ_MAYBE_ELF)
|
#if defined(OBJ_ELF) || defined(OBJ_MAYBE_ELF)
|
if (IS_ELF)
|
if (IS_ELF)
|
S_SET_OTHER (s, ELF_ST_SET_MICROMIPS (S_GET_OTHER (s)));
|
S_SET_OTHER (s, ELF_ST_SET_MICROMIPS (S_GET_OTHER (s)));
|
|
#else
|
|
(void) s;
|
#endif
|
#endif
|
}
|
}
|
|
|
/* If assembling microMIPS code, then return the microMIPS reloc
|
/* If assembling microMIPS code, then return the microMIPS reloc
|
corresponding to the requested one if any. Otherwise return
|
corresponding to the requested one if any. Otherwise return
|
Line 4589... |
Line 4589... |
/* End a nested noreorder block. */
|
/* End a nested noreorder block. */
|
|
|
static void
|
static void
|
end_noreorder (void)
|
end_noreorder (void)
|
{
|
{
|
|
|
mips_opts.noreorder--;
|
mips_opts.noreorder--;
|
if (mips_opts.noreorder == 0 && prev_nop_frag != NULL)
|
if (mips_opts.noreorder == 0 && prev_nop_frag != NULL)
|
{
|
{
|
/* Commit to inserting prev_nop_frag_required nops and go back to
|
/* Commit to inserting prev_nop_frag_required nops and go back to
|
handling nop insertion the .set reorder way. */
|
handling nop insertion the .set reorder way. */
|
Line 18226... |
Line 18225... |
s = subtype & (RELAX_DELAY_SLOT_16BIT
|
s = subtype & (RELAX_DELAY_SLOT_16BIT
|
| RELAX_DELAY_SLOT_SIZE_FIRST
|
| RELAX_DELAY_SLOT_SIZE_FIRST
|
| RELAX_DELAY_SLOT_SIZE_SECOND);
|
| RELAX_DELAY_SLOT_SIZE_SECOND);
|
msg = macro_warning (s);
|
msg = macro_warning (s);
|
if (msg != NULL)
|
if (msg != NULL)
|
as_warn_where (fragp->fr_file, fragp->fr_line, msg);
|
as_warn_where (fragp->fr_file, fragp->fr_line, "%s", msg);
|
subtype &= ~s;
|
subtype &= ~s;
|
}
|
}
|
|
|
/* Possibly emit a warning if we've chosen the longer option. */
|
/* Possibly emit a warning if we've chosen the longer option. */
|
if (use_second == second_longer)
|
if (use_second == second_longer)
|
Line 18240... |
Line 18239... |
|
|
s = (subtype
|
s = (subtype
|
& (RELAX_SECOND_LONGER | RELAX_NOMACRO | RELAX_DELAY_SLOT));
|
& (RELAX_SECOND_LONGER | RELAX_NOMACRO | RELAX_DELAY_SLOT));
|
msg = macro_warning (s);
|
msg = macro_warning (s);
|
if (msg != NULL)
|
if (msg != NULL)
|
as_warn_where (fragp->fr_file, fragp->fr_line, msg);
|
as_warn_where (fragp->fr_file, fragp->fr_line, "%s", msg);
|
subtype &= ~s;
|
subtype &= ~s;
|
}
|
}
|
|
|
/* Go through all the fixups for the first sequence. Disable them
|
/* Go through all the fixups for the first sequence. Disable them
|
(by marking them as done) if we're going to use the second
|
(by marking them as done) if we're going to use the second
|