[PATCH v3] RISC-V: Gate opcode tables by enum rather than string

Andreas Schwab schwab@suse.de
Thu Aug 29 09:42:00 GMT 2019


On Aug 29 2019, Maxim Blinov <maxim.blinov@embecosm.com> wrote:

> diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
> index 12047d7210..8974254bfc 100644
> --- a/gas/config/tc-riscv.c
> +++ b/gas/config/tc-riscv.c
> @@ -121,15 +121,28 @@ riscv_subset_supports (const char *feature)
>  }
>  
>  static bfd_boolean
> -riscv_multi_subset_supports (const char *features[])
> +riscv_multi_subset_supports (enum riscv_insn_class insn_class)
>  {
> -  unsigned i = 0;
> -  bfd_boolean supported = TRUE;
> +  switch (insn_class)
> +    {
> +    case INSN_CLASS_I: return riscv_subset_supports ("i");
> +    case INSN_CLASS_C: return riscv_subset_supports ("c");
> +    case INSN_CLASS_A: return riscv_subset_supports ("a");
> +    case INSN_CLASS_M: return riscv_subset_supports ("m");
> +    case INSN_CLASS_F: return riscv_subset_supports ("f");
> +    case INSN_CLASS_D: return riscv_subset_supports ("d");
> +    case INSN_CLASS_D_AND_C:
> +      return riscv_subset_supports ("d") && riscv_subset_supports ("c");
> +
> +    case INSN_CLASS_F_AND_C: return riscv_subset_supports ("i");
> +      return riscv_subset_supports ("f") && riscv_subset_supports ("c");

The last line is unreachable.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



More information about the Binutils mailing list