mips.c (mips_has_long_branch_p): New function, split out from...
gcc/ * config/mips/mips.c (mips_has_long_branch_p): New function, split out from... (mips_expand_ghost_gp_insns): ...here. Look inside sequences. From-SVN: r190701
This commit is contained in:
parent
62332eba32
commit
a1c741f02e
2 changed files with 35 additions and 17 deletions
|
@ -1,3 +1,9 @@
|
|||
2012-08-26 Richard Sandiford <rdsandiford@googlemail.com>
|
||||
|
||||
* config/mips/mips.c (mips_has_long_branch_p): New function,
|
||||
split out from...
|
||||
(mips_expand_ghost_gp_insns): ...here. Look inside sequences.
|
||||
|
||||
2012-08-26 Richard Sandiford <rdsandiford@googlemail.com>
|
||||
|
||||
* config/mips/mips.c (r10k_safe_mem_expr_p): Use get_inner_reference.
|
||||
|
|
|
@ -15478,23 +15478,15 @@ mips_reorg_process_insns (void)
|
|||
htab_delete (htab);
|
||||
}
|
||||
|
||||
/* If we are using a GOT, but have not decided to use a global pointer yet,
|
||||
see whether we need one to implement long branches. Convert the ghost
|
||||
global-pointer instructions into real ones if so. */
|
||||
/* Return true if the function has a long branch instruction. */
|
||||
|
||||
static bool
|
||||
mips_expand_ghost_gp_insns (void)
|
||||
mips_has_long_branch_p (void)
|
||||
{
|
||||
rtx insn;
|
||||
rtx insn, subinsn;
|
||||
int normal_length;
|
||||
|
||||
/* Quick exit if we already know that we will or won't need a
|
||||
global pointer. */
|
||||
if (!TARGET_USE_GOT
|
||||
|| cfun->machine->global_pointer == INVALID_REGNUM
|
||||
|| mips_must_initialize_gp_p ())
|
||||
return false;
|
||||
|
||||
/* We need up-to-date instruction lengths. */
|
||||
shorten_branches (get_insns ());
|
||||
|
||||
/* Look for a branch that is longer than normal. The normal length for
|
||||
|
@ -15503,12 +15495,32 @@ mips_expand_ghost_gp_insns (void)
|
|||
but they have no delay slot. */
|
||||
normal_length = (TARGET_MIPS16 ? 4 : 8);
|
||||
for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
|
||||
if (JUMP_P (insn)
|
||||
&& USEFUL_INSN_P (insn)
|
||||
&& get_attr_length (insn) > normal_length)
|
||||
break;
|
||||
FOR_EACH_SUBINSN (subinsn, insn)
|
||||
if (JUMP_P (subinsn)
|
||||
&& USEFUL_INSN_P (subinsn)
|
||||
&& get_attr_length (subinsn) > normal_length
|
||||
&& (any_condjump_p (subinsn) || any_uncondjump_p (subinsn)))
|
||||
return true;
|
||||
|
||||
if (insn == NULL_RTX)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* If we are using a GOT, but have not decided to use a global pointer yet,
|
||||
see whether we need one to implement long branches. Convert the ghost
|
||||
global-pointer instructions into real ones if so. */
|
||||
|
||||
static bool
|
||||
mips_expand_ghost_gp_insns (void)
|
||||
{
|
||||
/* Quick exit if we already know that we will or won't need a
|
||||
global pointer. */
|
||||
if (!TARGET_USE_GOT
|
||||
|| cfun->machine->global_pointer == INVALID_REGNUM
|
||||
|| mips_must_initialize_gp_p ())
|
||||
return false;
|
||||
|
||||
/* Run a full check for long branches. */
|
||||
if (!mips_has_long_branch_p ())
|
||||
return false;
|
||||
|
||||
/* We've now established that we need $gp. */
|
||||
|
|
Loading…
Add table
Reference in a new issue