View | Details | Raw Unified | Return to bug 25539
Collapse All | Expand All

(-)a/gas/config/tc-mips.c (-3 / +37 lines)
Lines 812-817 static int mips_debug = 0; Link Here
812
   fill a branch delay slot.  */
812
   fill a branch delay slot.  */
813
static struct mips_cl_insn history[1 + MAX_NOPS + MAX_LLSC_RANGE];
813
static struct mips_cl_insn history[1 + MAX_NOPS + MAX_LLSC_RANGE];
814
814
815
/* The maximum number of LABELS detect for the same address.  */
816
#define MAX_LABELS_SAME 10
817
815
/* Arrays of operands for each instruction.  */
818
/* Arrays of operands for each instruction.  */
816
#define MAX_OPERANDS 6
819
#define MAX_OPERANDS 6
817
struct mips_operand_array
820
struct mips_operand_array
Lines 6901-6906 fix_loongson2f (struct mips_cl_insn * ip) Link Here
6901
    fix_loongson2f_jump (ip);
6904
    fix_loongson2f_jump (ip);
6902
}
6905
}
6903
6906
6907
static bfd_boolean
6908
has_label_name(const char *arr[], size_t len ,const char *s)
6909
{
6910
  unsigned long i;
6911
  for (i = 0; i < len; i++)
6912
    {
6913
      if(!arr[i])
6914
	return FALSE;
6915
      if(streq(arr[i], s))
6916
	return TRUE;
6917
    }
6918
  return FALSE;
6919
}
6904
/* Fix loongson3 llsc errata: Insert sync before ll/lld. */
6920
/* Fix loongson3 llsc errata: Insert sync before ll/lld. */
6905
6921
6906
static void
6922
static void
Lines 6915-6923 fix_loongson3_llsc (struct mips_cl_insn * ip) Link Here
6915
      && S_IS_LOCAL (seg_info (now_seg)->label_list->label)
6931
      && S_IS_LOCAL (seg_info (now_seg)->label_list->label)
6916
      && (strcmp (ip->insn_mo->name, "sync") != 0))
6932
      && (strcmp (ip->insn_mo->name, "sync") != 0))
6917
    {
6933
    {
6934
      unsigned long i;
6935
6936
      valueT label_value;
6937
      const char *label_names[MAX_LABELS_SAME];
6918
      const char *label_name = S_GET_NAME (seg_info (now_seg)->label_list->label);
6938
      const char *label_name = S_GET_NAME (seg_info (now_seg)->label_list->label);
6939
      label_names[0] = label_name;
6940
      struct insn_label_list *llist = seg_info (now_seg)->label_list;
6941
      label_value = S_GET_VALUE(llist->label);
6942
      for (i = 1; i < MAX_LABELS_SAME; i++)
6943
        {
6944
	  llist = llist->next;
6945
	  if (!llist)
6946
	    break;
6947
	  if (S_GET_VALUE(llist->label) == label_value)
6948
	    label_names[i] = S_GET_NAME(llist->label);
6949
	  else
6950
	    break;
6951
        }
6952
      for (; i < MAX_LABELS_SAME; i++)
6953
	label_names[i] = NULL;
6954
6919
      unsigned long lookback = ARRAY_SIZE (history);
6955
      unsigned long lookback = ARRAY_SIZE (history);
6920
      unsigned long i;
6921
6956
6922
      for (i = 0; i < lookback; i++)
6957
      for (i = 0; i < lookback; i++)
6923
	{
6958
	{
Lines 6938-6944 fix_loongson3_llsc (struct mips_cl_insn * ip) Link Here
6938
6973
6939
		  if (delayed_branch_p (&history[j]))
6974
		  if (delayed_branch_p (&history[j]))
6940
		    {
6975
		    {
6941
		      if (streq (history[j].target, label_name))
6976
		      if (has_label_name (label_names, MAX_LABELS_SAME, history[j].target))
6942
			{
6977
			{
6943
			  add_fixed_insn (&sync_insn);
6978
			  add_fixed_insn (&sync_insn);
6944
			  insert_into_history (0, 1, &sync_insn);
6979
			  insert_into_history (0, 1, &sync_insn);
6945
- 

Return to bug 25539