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 2 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, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 /* Instruction decode table:
23 <options>:<first>:<last>:<force-first>:<force-last>:<force-expand>:<special>...
30 The instruction decode table contains rules that dictate how igen
31 is going to firstly break down the opcode table and secondly
33 The table that follows is used by gen to construct a decision tree
34 that can identify each possible instruction. Gen then outputs this
35 decision tree as (according to config) a table or switch statement
36 as the function idecode.
38 In parallel to this, as mentioned above, WITH_EXPANDED_SEMANTICS
39 determines of the semantic functions themselves should be expanded
45 Range of bits (within the instruction) that should be searched for
46 an instruction field. Within such ranges, gen looks for opcodes
47 (constants), registers (strings) and reserved bits (slash) and
48 according to the rules that follows includes or excludes them from
49 a possible instruction field.
54 If an instruction field was found, enlarge the field size so that
55 it is forced to at least include bits starting from <force_first>
56 (<force_last>). To stop this occuring, use <force_first> = <last>
57 + 1 and <force_last> = <first> - 1.
61 Treat `/' fields as a constant instead of variable when looking for
66 Treat any contained register (string) fields as constant when
67 determining the instruction field. For the instruction decode (and
68 controled by IDECODE_EXPAND_SEMANTICS) this forces the expansion of
69 what would otherwize be non constant bits of an instruction.
73 Should this table be expanded using a switch statement (val 1) and
74 if so, should it be padded with entries so as to force the compiler
75 to generate a jump table (val 2). Or a branch table (val 3).
82 Special rule to fine tune how specific (or groups) of instructions
83 are expanded. The applicability of the rule is determined by
85 <special_mask> != 0 && (instruction> & <special_mask>) == <special_value>
87 Where <instruction> is obtained by looking only at constant fields
88 with in an instructions spec. When determining an expansion, the
89 rule is only considered when a node contains a single instruction.
90 <special_rule> can be any of:
92 0: for this instruction, expand by earlier rules
93 1: expand bits <force_low> .. <force_hi> only
94 2: boolean expansion of only zero/non-zero cases
95 3: boolean expansion of equality of special constant
105 } decode_special_type;
116 typedef struct _decode_table decode_table;
117 struct _decode_table {
118 decode_special_type type;
125 char *force_expansion;
126 unsigned special_mask;
127 unsigned special_value;
128 unsigned special_constant;
133 extern decode_table *load_decode_table
137 extern void dump_decode_rule