Add -Wnodiscard option so that warning about discarded instructions

can be suppressed.
Allow ``<insn-spec> { <nmemonic> | <model> }'' in instruction file.
This commit is contained in:
Andrew Cagney 1997-10-09 08:35:33 +00:00
parent 8d2e72a1c8
commit 8782bfcfc4
4 changed files with 1638 additions and 1011 deletions

View file

@ -1,7 +1,40 @@
Wed Oct 8 13:10:16 1997 Andrew Cagney <cagney@b1.cygnus.com>
* gen.c (insn_list_insert): Missing \n in warning.
* ld-insn.c (load_insn_table): Only notify of discarded
instrctions when warn.discard enabled.
* igen.h: Add option.warn.discard, default enabled.
* igen.c (main): Add -Wnodiscard option.
* ld-insn.c (record_type): For old record type, check the number
of fields is correct.
(load_insn_table): Allow insn assembler and insn model records to
appear in any order.
(parse_insn_model_record): Rename from parse_insn_model_records.
Parse only one record.
(parse_insn_mnemonic_record): Rename from
parse_insn_mnemonic_records. Parse only one record.
Tue Sep 23 15:52:06 1997 Felix Lee <flee@yin.cygnus.com>
* gen-itable.c (gen_itable_h): [nr_itable_* + 1] to avoid
illegal zero-sized array.
(itable_print_set): likewise, avoid empty initializers.
Mon Sep 22 18:49:07 1997 Felix Lee <flee@cygnus.com>
* configure.in: i386-windows is a cross, so don't expect
libiberty to be there.
* configure: updated.
Fri Sep 19 10:36:30 1997 Andrew Cagney <cagney@b1.cygnus.com>
* igen.c (print_function_name): Put the format name after the
function / instruction name, not before.
(print_itrace): Better format trace code.
Tue Sep 16 11:01:07 1997 Andrew Cagney <cagney@b1.cygnus.com>

View file

@ -491,8 +491,9 @@ print_itrace (lf *file,
lf_indent_suppress (file);
lf_printf (file, "#if defined (WITH_TRACE)\n");
lf_printf (file, "/* trace the instructions execution if enabled */\n");
lf_printf (file, "if (TRACE_%s_P (CPU)) {\n", phase);
lf_indent (file, +2);
lf_printf (file, "if (TRACE_%s_P (CPU))\n", phase);
lf_printf (file, " {\n");
lf_indent (file, +4);
if (insn->mnemonics != NULL)
{
insn_mnemonic_entry *assembler = insn->mnemonics;
@ -541,8 +542,8 @@ print_itrace (lf *file,
lf_printf (file, "itable[MY_INDEX].name);\n");
lf_indent (file, -indent);
}
lf_indent (file, -2);
lf_printf (file, "}\n");
lf_indent (file, -4);
lf_printf (file, " }\n");
lf_indent_suppress (file);
lf_printf (file, "#endif\n");
}
@ -989,6 +990,8 @@ main (int argc,
printf ("\n");
printf (" -Werror\n");
printf ("\t Make warnings errors\n");
printf (" -Wnodiscard\n");
printf ("\t Suppress warnings about discarded instructions\n");
printf ("\n");
printf (" -G [!]<gen-option>\n");
printf ("\t Any of the following options:\n");
@ -1186,6 +1189,10 @@ main (int argc,
{
if (strcmp (optarg, "error") == 0)
options.warning = error;
else if (strcmp (optarg, "nodiscard") == 0)
options.warn.discard = 0;
else if (strcmp (optarg, "discard") == 0)
options.warn.discard = 1;
else
error (NULL, "Unknown -W argument `%s'\n", optarg);
break;

View file

@ -18,127 +18,180 @@
*/
/* What does the instruction look like - bit ordering, size, widths or offesets */
extern int hi_bit_nr;
extern int insn_bit_size;
extern int insn_specifying_widths;
/* what should global names be prefixed with? */
extern const char *global_name_prefix;
extern const char *global_uname_prefix;
/* generation options: */
enum {
generate_with_direct_access = 0x1,
generate_with_icache = 0x2,
generate_with_semantic_icache = 0x4,
generate_with_insn_in_icache = 0x8,
generate_with_semantic_returning_modified_nia_only = 0x010,
generate_with_semantic_conditional_issue = 0x020,
generate_with_idecode_slot_verification = 0x040,
generate_with_semantic_delayed_branch = 0x080,
generate_with_semantic_zero_r0 = 0x100
};
/* code-generation options: */
typedef enum {
/* Transfer control to an instructions semantic code using the the
standard call/return mechanism */
generate_calls = 0x1000,
generate_calls,
/* Transfer control to an instructions semantic code using
(computed) goto's instead of the more conventional call/return
mechanism */
generate_jumps = 0x2000,
generate_jumps,
} igen_code;
extern int code;
extern int icache_size;
/* Instruction expansion?
Should the semantic code for each instruction, when the oportunity
arrises, be expanded according to the variable opcode files that
the instruction decode process renders constant */
extern int generate_expanded_instructions;
/* SMP?
Should the generated code include SMP support (>0) and if so, for
how many processors? */
extern int generate_smp;
/* Misc junk */
/* Function header definitions */
/* Cache functions: */
extern int print_icache_function_formal
(lf *file);
extern int print_icache_function_actual
(lf *file);
extern int print_icache_function_type
(lf *file);
extern int print_semantic_function_formal
(lf *file);
extern int print_semantic_function_actual
(lf *file);
extern int print_semantic_function_type
(lf *file);
extern void print_my_defines
(lf *file,
insn_bits *expanded_bits,
table_entry *file_entry);
extern void print_itrace
(lf *file,
table_entry *file_entry,
int idecode);
typedef enum {
function_name_prefix_semantics,
function_name_prefix_idecode,
function_name_prefix_itable,
function_name_prefix_icache,
function_name_prefix_none
} lf_function_name_prefixes;
nia_is_cia_plus_one,
nia_is_void,
nia_is_invalid,
} igen_nia;
extern int print_function_name
(lf *file,
const char *basename,
insn_bits *expanded_bits,
lf_function_name_prefixes prefix);
typedef struct _igen_gen_options igen_gen_options;
struct _igen_gen_options {
int direct_access;
int semantic_icache;
int insn_in_icache;
int conditional_issue;
int slot_verification;
int delayed_branch;
/* If zeroing a register, which one? */
int zero_reg;
int zero_reg_nr;
/* should multiple simulators be generated? */
int multi_sim;
/* should the simulator support multi word instructions and if so,
what is the max nr of words. */
int multi_word;
/* SMP? Should the generated code include SMP support (>0) and if
so, for how many processors? */
int smp;
/* how should the next instruction address be computed? */
igen_nia nia;
/* nr of instructions in the decoded instruction cache */
int icache;
int icache_size;
/* see above */
igen_code code;
};
typedef struct _igen_trace_options igen_trace_options;
struct _igen_trace_options {
int rule_selection;
int rule_rejection;
int entries;
int combine;
};
typedef struct _igen_prefix_name {
char *name;
char *uname;
} igen_prefix_name;
typedef struct _igen_prefix_options {
igen_prefix_name global;
igen_prefix_name engine;
igen_prefix_name icache;
igen_prefix_name idecode;
igen_prefix_name itable;
igen_prefix_name semantics;
igen_prefix_name support;
} igen_prefix_options;
typedef struct _igen_decode_options igen_decode_options ;
struct _igen_decode_options {
/* Combine tables? Should the generator make a second pass through
each generated table looking for any sub-entries that contain the
same instructions. Those entries being merged into a single
table */
int combine;
/* Instruction expansion? Should the semantic code for each
instruction, when the oportunity arrises, be expanded according
to the variable opcode files that the instruction decode process
renders constant */
int duplicate;
/* Treat reserved fields as constant (zero) instead of ignoring
their value when determining decode tables */
int zero_reserved;
/* Convert any padded switch rules into goto_switch */
int switch_as_goto;
/* Force all tables to be generated with this lookup mechanism */
char *overriding_gen;
};
typedef struct _igen_warn_options igen_warn_options;
struct _igen_warn_options {
int discard;
};
typedef struct _igen_options igen_options;
struct _igen_options {
/* What does the instruction look like - bit ordering, size, widths or
offesets */
int hi_bit_nr;
int insn_bit_size;
int insn_specifying_widths;
/* what should global names be prefixed with? */
igen_prefix_options prefix;
/* See above for options and flags */
igen_gen_options gen;
/* See above for trace options */
igen_trace_options trace;
/* See above for decode options */
igen_decode_options decode;
/* Filter set to be used on the flag field of the instruction table */
filter *flags_filter;
/* See above for warn options */
igen_warn_options warn;
/* Be more picky about the input */
error_func (*warning);
/* Model (processor) set - like flags_filter. Used to select the
specific ISA within a processor family. */
filter *model_filter;
/* Format name set */
filter *format_name_filter;
};
extern igen_options options;
/* default options - hopefully backward compatible */ \
#define INIT_OPTIONS(OPTIONS) \
do { \
memset (&(OPTIONS), 0, sizeof (OPTIONS)); \
memset (&(OPTIONS).warn, -1, sizeof ((OPTIONS).warn)); \
(OPTIONS).hi_bit_nr = 0; \
(OPTIONS).insn_bit_size = default_insn_bit_size; \
(OPTIONS).insn_specifying_widths = 0; \
(OPTIONS).prefix.global.name = ""; \
(OPTIONS).prefix.global.uname = ""; \
(OPTIONS).prefix.engine = (OPTIONS).prefix.global; \
(OPTIONS).prefix.icache = (OPTIONS).prefix.global; \
(OPTIONS).prefix.idecode = (OPTIONS).prefix.global; \
(OPTIONS).prefix.itable = (OPTIONS).prefix.global; \
(OPTIONS).prefix.semantics = (OPTIONS).prefix.global; \
(OPTIONS).prefix.support = (OPTIONS).prefix.global; \
(OPTIONS).gen.code = generate_calls; \
(OPTIONS).gen.icache_size = 1024; \
(OPTIONS).warning = warning; \
} while (0)

File diff suppressed because it is too large Load diff