/* Instruction decode table:
- <options>:<first>:<last>:<force-first>:<force-last>:<force-expand>:<special>...
-
-
+ <decode-rule> ::=
+ { <option> }
+ ":" [ <first> ]
+ ":" [ <last> ]
+ ":" [ <force-first> ]
+ ":" [ <force-last> ]
+ ":" [ <constant-field-names> ]
+ ":" [ <word-nr> ]
+ ":" [ <format-names> ]
+ ":" [ <model-names> ]
+ ":" [ <constant> ]
+ ":" [ <path> { "," <path> } ]
+ { ":" <special-mask>
+ ":" [ "!" ] <special-value>
+ ":" <word-nr> }
+ <nl>
+ ;
+
+
+ <path> ::= <int> "," <int> ;;
+
+ <option> ::=
+ <reserved-options>
+ | <code-options>
+ | <optimize-options>
+ | <decode-options>
+ | <constant>
+ | <search-options>
+ ;
+
+ <reserved-options> ::= "zero-reserved" ;
+ <gen-options> ::= "array" | "switch" | "padded-switch" | "goto-switch" ;
+ <optimize-options> ::= "duplicate" | "combine"
+ <decode-options> ::= "normal" | "boolean" ;
+ <search-options> ::= "constants" | "variables" | "mixed"
Ignore the below:
(<force_last>). To stop this occuring, use <force_first> = <last>
+ 1 and <force_last> = <first> - 1.
- <force_slash>
+ <force_reserved>
- Treat `/' fields as a constant instead of variable when looking for
- an instruction field.
+ Treat `/' (reserved) fields as a constant (zero) instead of
+ variable when looking for an instruction field.
<force_expansion>
typedef enum {
normal_decode_rule,
- expand_forced_rule,
boolean_rule,
- nr_decode_rules
} decode_special_type;
+
typedef enum {
invalid_gen,
array_gen,
switch_gen,
padded_switch_gen,
goto_switch_gen,
- nr_decode_gen_types,
} decode_gen_type;
+enum {
+ decode_cond_mask_field,
+ decode_cond_value_field,
+ decode_cond_word_nr_field,
+ nr_decode_cond_fields,
+};
+
+typedef struct _decode_path decode_path;
+struct _decode_path {
+ int opcode_nr;
+ decode_path *parent;
+};
+
+typedef struct _decode_path_list decode_path_list;
+struct _decode_path_list {
+ decode_path *path;
+ decode_path_list *next;
+};
+
+
+typedef struct _decode_cond decode_cond;
+struct _decode_cond {
+ int word_nr;
+ int mask[max_insn_bit_size];
+ int value[max_insn_bit_size];
+ int is_equal;
+ decode_cond *next;
+};
+
+typedef enum {
+ decode_find_mixed,
+ decode_find_constants,
+ decode_find_strings,
+} decode_search_type;
+
+enum {
+ decode_options_field,
+ decode_first_field,
+ decode_last_field,
+ decode_force_first_field,
+ decode_force_last_field,
+ decode_constant_field_names_field,
+ decode_word_nr_field,
+ decode_format_names_field,
+ decode_model_names_field,
+ decode_paths_field,
+ nr_decode_fields,
+ min_nr_decode_fields = decode_last_field + 1,
+};
+
+
typedef struct _decode_table decode_table;
struct _decode_table {
+ line_ref *line;
decode_special_type type;
decode_gen_type gen;
+ decode_search_type search;
int first;
int last;
int force_first;
int force_last;
- int force_slash;
- char *force_expansion;
- unsigned special_mask;
- unsigned special_value;
- unsigned special_constant;
+ filter *constant_field_names;
+ int word_nr;
+ /* if a boolean */
+ unsigned constant;
+ /* options */
+ int with_zero_reserved;
+ int with_duplicates;
+ int with_combine;
+ /* conditions on the rule being applied */
+ decode_path_list *paths;
+ filter *format_names;
+ filter *model_names;
+ decode_cond *conditions;
decode_table *next;
};
-extern void force_decode_gen_type
-(const char *type);
-
extern decode_table *load_decode_table
-(char *file_name,
- int hi_bit_nr);
+(char *file_name);
+
+extern int decode_table_max_word_nr
+(decode_table *rule);
extern void dump_decode_rule
-(decode_table *rule,
- int indent);
+(lf *file,
+ char *prefix,
+ decode_table *rule,
+ char *suffix);