arm: Support pac_key_* register operand for MRS/MSR in Armv8.1-M Mainline
[binutils-gdb.git] / sim / ppc / ld-decode.h
blob4332dccb3aca9b60f7af8cfbff7c6a9d6eaa96f7
1 /* This file is part of the program psim.
3 Copyright (C) 1994,1995,1996, Andrew Cagney <cagney@highland.com.au>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, see <http://www.gnu.org/licenses/>.
20 /* Instruction decode table:
22 <options>:<first>:<last>:<force-first>:<force-last>:<force-expand>:<special>...
26 Ignore the below:
29 The instruction decode table contains rules that dictate how igen
30 is going to firstly break down the opcode table and secondly
32 The table that follows is used by gen to construct a decision tree
33 that can identify each possible instruction. Gen then outputs this
34 decision tree as (according to config) a table or switch statement
35 as the function idecode.
37 In parallel to this, as mentioned above, WITH_EXPANDED_SEMANTICS
38 determines of the semantic functions themselves should be expanded
39 in a similar way.
41 <first>
42 <last>
44 Range of bits (within the instruction) that should be searched for
45 an instruction field. Within such ranges, gen looks for opcodes
46 (constants), registers (strings) and reserved bits (slash) and
47 according to the rules that follows includes or excludes them from
48 a possible instruction field.
50 <force_first>
51 <force_last>
53 If an instruction field was found, enlarge the field size so that
54 it is forced to at least include bits starting from <force_first>
55 (<force_last>). To stop this occuring, use <force_first> = <last>
56 + 1 and <force_last> = <first> - 1.
58 <force_slash>
60 Treat `/' fields as a constant instead of variable when looking for
61 an instruction field.
63 <force_expansion>
65 Treat any contained register (string) fields as constant when
66 determining the instruction field. For the instruction decode (and
67 controled by IDECODE_EXPAND_SEMANTICS) this forces the expansion of
68 what would otherwize be non constant bits of an instruction.
70 <use_switch>
72 Should this table be expanded using a switch statement (val 1) and
73 if so, should it be padded with entries so as to force the compiler
74 to generate a jump table (val 2). Or a branch table (val 3).
76 <special_mask>
77 <special_value>
78 <special_rule>
79 <special_constant>
81 Special rule to fine tune how specific (or groups) of instructions
82 are expanded. The applicability of the rule is determined by
84 <special_mask> != 0 && (instruction> & <special_mask>) == <special_value>
86 Where <instruction> is obtained by looking only at constant fields
87 with in an instructions spec. When determining an expansion, the
88 rule is only considered when a node contains a single instruction.
89 <special_rule> can be any of:
91 0: for this instruction, expand by earlier rules
92 1: expand bits <force_low> .. <force_hi> only
93 2: boolean expansion of only zero/non-zero cases
94 3: boolean expansion of equality of special constant
99 typedef enum {
100 normal_decode_rule,
101 expand_forced_rule,
102 boolean_rule,
103 nr_decode_rules
104 } decode_special_type;
106 typedef enum {
107 invalid_gen,
108 array_gen,
109 switch_gen,
110 padded_switch_gen,
111 goto_switch_gen,
112 nr_decode_gen_types,
113 } decode_gen_type;
116 typedef struct _decode_table decode_table;
117 struct _decode_table {
118 decode_special_type type;
119 decode_gen_type gen;
120 int first;
121 int last;
122 int force_first;
123 int force_last;
124 int force_slash;
125 char *force_expansion;
126 unsigned special_mask;
127 unsigned special_value;
128 unsigned special_constant;
129 decode_table *next;
133 extern void force_decode_gen_type
134 (const char *type);
136 extern decode_table *load_decode_table
137 (const char *file_name,
138 int hi_bit_nr);
140 extern void dump_decode_rule
141 (decode_table *rule,
142 int indent);