This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 2/6] Andes nds32: machine description of nds32 porting (2).
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Chung-Ju Wu <jasonwucj at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 9 Jul 2013 23:27:05 +0000
- Subject: Re: [PATCH 2/6] Andes nds32: machine description of nds32 porting (2).
- References: <CADj25HOO04tn85ZfL2adeHUo8EL7mGwFf8yB4CadofGCNVszVQ at mail dot gmail dot com>
On Mon, 8 Jul 2013, Chung-Ju Wu wrote:
> +/* This is used to identify used ISA when doing code generation.
> + Initialize it with macro TARGET_DEFAULT_ISA,
> + which is defined in nds32-isa-xxx.h file.
> + User can specify it by using '-misa=X' option. */
> +enum nds32_isa nds32_selected_isa = TARGET_DEFAULT_ISA;
Rather than using global state, put this in the gcc_options structure
using a Variable entry in your .opt file.
> + warning (0, "For the option -misr-vector-size=X, the valid X "
> + "must be: 4 or 16");
The diagnostics in this function should all not start with a capital
letter. Invalid arguments to an option should be errors, not warnings.
Since you have a location passed to this function, use error_at rather
than the legacy functions that implicitly use input_location.
> + case OPT_misa_:
> + /* Check valid ISA: v2 v3 v3m. */
> + if (strcmp (arg, "v2") == 0)
Use Enum in the .opt file and get all the conversion from strings to
integer values, and errors for unknown values, done automatically.
--
Joseph S. Myers
joseph@codesourcery.com