[PATCH 2/6] Andes nds32: machine description of nds32 porting (2).
Joseph S. Myers
joseph@codesourcery.com
Tue Jul 9 23:44:00 GMT 2013
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
More information about the Gcc-patches
mailing list