FreeBSD/contrib/binutils/gas/config/tc-mips.c
/* Return the number of nops that would be needed to work around the
   VR4130 mflo/mfhi errata if instruction INSN immediately followed
   the MAX_VR4130_NOPS instructions described by HISTORY.  */
Return the number of nops that would be needed to work around the
VR4130 mflo/mfhi errata if instruction INSN immediately followed
the MAX_VR4130_NOPS instructions described by HISTORY.
Return the number of nops that would be needed to work around the VR4130 mflo / mfhi errata if instruction INSN immediately followed the MAX_VR4130_NOPS instructions described by HISTORY .
static int
nops_for_vr4130 (const struct mips_cl_insn *history,
		 const struct mips_cl_insn *insn)
{
  int i, j, reg;
  if (insn != 0
      && ((insn->insn_mo->pinfo & (INSN_WRITE_HI | INSN_WRITE_LO)) == 0
	  || strcmp (insn->insn_mo->name, "mtlo") == 0
	  || strcmp (insn->insn_mo->name, "mthi") == 0))
    return 0;
  for (i = 0; i < MAX_VR4130_NOPS; i++)
    if (!history[i].noreorder_p && MF_HILO_INSN (history[i].insn_mo->pinfo))
      {
	if (mips_opts.mips16)
	  reg = mips16_to_32_reg_map[MIPS16_EXTRACT_OPERAND (RX, history[i])];
	else
	  reg = EXTRACT_OPERAND (RD, history[i]);
	if (insn != NULL && insn_uses_reg (insn, reg, MIPS_GR_REG))
	  return 0;
	for (j = 0; j < i; j++)
	  if (insn_uses_reg (&history[j], reg, MIPS_GR_REG))
	    return 0;
	return MAX_VR4130_NOPS - i;
      }
  return 0;
}
static int nops_for_vr4130 ( const struct mips_cl_insn * history , const struct mips_cl_insn * insn ) { int i , j , reg ; if ( insn != 0 && ( ( insn -> insn_mo -> pinfo & ( INSN_WRITE_HI | INSN_WRITE_LO ) ) == 0 || strcmp ( insn -> insn_mo -> name , " " ) == 0 || strcmp ( insn -> insn_mo -> name , " " ) == 0 ) ) return 0 ; for ( i = 0 ; i < MAX_VR4130_NOPS ; i ++ ) if ( ! history [ i ] . noreorder_p && MF_HILO_INSN ( history [ i ] . insn_mo -> pinfo ) ) { if ( mips_opts . mips16 ) reg = mips16_to_32_reg_map [ MIPS16_EXTRACT_OPERAND ( RX , history [ i ] ) ] ; else reg = EXTRACT_OPERAND ( RD , history [ i ] ) ; if ( insn != NULL && insn_uses_reg ( insn , reg , MIPS_GR_REG ) ) return 0 ; for ( j = 0 ; j < i ; j ++ ) if ( insn_uses_reg ( & history [ j ] , reg , MIPS_GR_REG ) ) return 0 ; return MAX_VR4130_NOPS - i ; } return 0 ; }
Return the number of nops that would be needed to work around the
VR4130 mflo/mfhi errata if instruction INSN immediately followed
the MAX_VR4130_NOPS instructions described by HISTORY.
Return the number of nops that would be needed to work around the VR4130 mflo / mfhi errata if instruction INSN immediately followed the MAX_VR4130_NOPS instructions described by HISTORY .
/* Check if the instruction writes to HI or LO.  MTHI and MTLO
     are not affected by the errata.  */ /* Search for the first MFLO or MFHI.  */ /* Extract the destination register.  */ /* No nops are needed if INSN reads that register.  */ /* ...or if any of the intervening instructions do.  */