[MIPS][LS2][4/5] Scheduling and tuning

Richard Sandiford rdsandiford@googlemail.com
Thu Jun 12 17:49:00 GMT 2008


Maxim Kuvyrkov <maxim@codesourcery.com> writes:
> +(define_insn_reservation "ls2_ghost" 0
> +  (and (eq_attr "cpu" "loongson_2e,loongson_2f")
> +       (eq_attr "type" "ghost"))
> +  "nothing")

This should be dead code because:

;; Ghost instructions produce no real code and introduce no hazards.
;; They exist purely to express an effect on dataflow.
(define_insn_reservation "ghost" 0
  (eq_attr "type" "ghost")
  "nothing")

in mips.md should (by design) trump it.  Let's just remove it.

> +;; Reservation for everything else.  Normally, this reservation
> +;; will only be used to handle cases like compiling
> +;; for non-loongson CPU with -mtune=loongson2?.
> +;;
> +;; !!! This is not a good thing to depend upon the fact that
> +;; DFA will check reservations in the same order as they appear
> +;; in the file, but it seems to work for the time being.
> +;; Anyway, we already use this DFA property heavily with generic.md.
> +(define_insn_reservation "ls2_unknown" 1
> +  (eq_attr "cpu" "loongson_2e,loongson_2f")
> +  "ls2_alu1_core+ls2_alu2_core+ls2_falu1_core+ls2_falu2_core+ls2_mem")

I disagree that it's a bad idea.  (And as you say, we deliberately
rely on this for legacy schedulers.)  Let's just tone it down to:

;; Reservation for everything else.  Normally, this reservation
;; will only be used to handle cases like compiling for non-Loongson
;; CPUs with -mtune=loongson2?.
;;
;; This reservation depends upon the fact that DFA will check
;; reservations in the same order as they appear in the file.

> @@ -10143,7 +10331,20 @@ mips_variable_issue (FILE *file ATTRIBUT
>        vr4130_last_insn = insn;
>        if (TUNE_74K)
>  	mips_74k_agen_init (insn);
> +      else if (TUNE_LOONGSON_2EF)
> +	mips_ls2_variable_issue (insn);
>      }
> +
> +  if (recog_memoized (insn) >= 0)
> +    /* Instructions of type 'multi' should all be split before
> +       second scheduling pass.  */
> +    {
> +      bool multi_p;
> +
> +      multi_p = (get_attr_type (insn) == TYPE_MULTI);
> +      gcc_assert (!multi_p || !reload_completed);
> +    }
> +

Simplify this "if" statement to:

  /* Instructions of type 'multi' should all be split before
     second scheduling pass.  */
  gcc_assert (!reload_completed
	      || recog_memoized (insn) < 0
	      || get_attr_type (insn) != TYPE_MULTI);

OK with those changes, thanks.

Richard



More information about the Gcc-patches mailing list