1 /*BEGIN_LEGAL
2 
3 Copyright (c) 2018 Intel Corporation
4 
5   Licensed under the Apache License, Version 2.0 (the "License");
6   you may not use this file except in compliance with the License.
7   You may obtain a copy of the License at
8 
9       http://www.apache.org/licenses/LICENSE-2.0
10 
11   Unless required by applicable law or agreed to in writing, software
12   distributed under the License is distributed on an "AS IS" BASIS,
13   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   See the License for the specific language governing permissions and
15   limitations under the License.
16 
17 END_LEGAL */
18 /// @file xed-tables.H
19 ///
20 
21 #if !defined(XED_TABLES_H)
22 # define XED_TABLES_H
23 
24 
25 #if !defined(XED_MAX_INST_TABLE_NODES)
26 # error "Need to include the generated definition for XED_MAX_INST_TABLE_NODES"
27 #endif
28 
29 
30 #if !defined(XED_GLOBAL_EXTERN)
31 # error "Need to define XED_GLOBAL_EXTERN"
32 #endif
33 
34 // Some things are "extern const" because they are filled in where they are
35 // declared in some generated *.c file.
36 
37 /**************************************************************************/
38 /* stuff needed for the decoder */
39 #if defined(XED_DECODER)
40 
41 XED_DLL_EXPORT extern
42 const xed_inst_t       xed_inst_table[XED_MAX_INST_TABLE_NODES];
43 XED_DLL_EXPORT extern
44 const xed_operand_t    xed_operand[XED_MAX_OPERAND_TABLE_NODES];
45 XED_DLL_EXPORT extern
46 const xed_uint16_t     xed_operand_sequences[XED_MAX_OPERAND_SEQUENCES];
47 XED_DLL_EXPORT extern
48 const xed_iform_info_t xed_iform_db[XED_IFORM_LAST];
49 
50 extern const xed_attribute_enum_t xed_attributes_table[XED_MAX_ATTRIBUTE_COUNT];
51 extern const xed_operand_convert_enum_t
52  xed_operand_convert[XED_MAX_CONVERT_PATTERNS][XED_MAX_DECORATIONS_PER_OPERAND];
53 
54 extern const xed_uint32_t xed_iform_first_per_iclass_table[XED_ICLASS_LAST];
55 extern const xed_uint32_t xed_iform_max_per_iclass_table[XED_ICLASS_LAST];
56 
57 #endif
58 /**************************************************************************/
59 
60 
61 
62 
63 
64 /**************************************************************************/
65 /* stuff needed for the encoder */
66 #if defined(XED_ENCODER)
67 #include "xed-encode-tables.h"
68 #endif
69 
70 /**************************************************************************/
71 
72 
73 /* more miscellaneous stuff */
74 
75 /* names for each over-ridden iclass.  Even entries are Intel. The subsquent odd
76    entry is the ATTY SYSV name. */
77 XED_DLL_EXPORT extern
78 char const* const xed_iclass_string[XED_ICLASS_NAME_STR_MAX];
79 
80 // the high level reg class for each register.
81 XED_GLOBAL_EXTERN xed_reg_class_enum_t xed_reg_class_array[XED_REG_LAST];
82 // for just the GPR types: refines to REG8,16,32,64
83 XED_GLOBAL_EXTERN xed_reg_class_enum_t xed_gpr_reg_class_array[XED_REG_LAST];
84 
85 // the width in bits for each register.
86 // 2nd index 0=32b and 1=64b
87 XED_GLOBAL_EXTERN xed_uint_t xed_reg_width_bits[XED_REG_LAST][2];
88 
89 // map each register to the largest enclosing register (for nested
90 // registers) or back to itself if there is no outer nesting.
91 XED_GLOBAL_EXTERN xed_reg_enum_t xed_largest_enclosing_register_array[XED_REG_LAST];
92 XED_GLOBAL_EXTERN xed_reg_enum_t xed_largest_enclosing_register_array_32[XED_REG_LAST];
93 
94 // OC2 width codes. The 2nd index is the effective operand size (1,2, or 3)
95 XED_GLOBAL_EXTERN xed_uint16_t xed_width_bits[XED_OPERAND_WIDTH_LAST][4];
96 
97 // the default type of the operand elements
98 XED_GLOBAL_EXTERN
99 xed_operand_element_type_enum_t xed_operand_type_table[XED_OPERAND_WIDTH_LAST];
100 
101 // the xtype -> dtype, # bits per element map
102 extern const xed_operand_type_info_t xed_operand_xtype_info[XED_OPERAND_XTYPE_LAST];
103 
104 
105 // number of elements per operand
106 XED_GLOBAL_EXTERN
107 xed_uint32_t xed_operand_element_width[XED_OPERAND_WIDTH_LAST];
108 
109 // Returns 1 if the corresponding value in xed_width_bits is a multiple of
110 // 8 bits
111 XED_GLOBAL_EXTERN xed_uint8_t xed_width_is_bytes[XED_OPERAND_WIDTH_LAST][4];
112 
113 // FIXME: Could make the flags info  decoder-only.
114 // Flags tables. The top table points to the flag-actions. The
115 // complex table points to the simple flags table entries.
116 
117 extern const xed_simple_flag_t
118 xed_flags_simple_table[XED_MAX_REQUIRED_SIMPLE_FLAGS_ENTRIES];
119 extern const xed_complex_flag_t
120 xed_flags_complex_table[XED_MAX_REQUIRED_COMPLEX_FLAGS_ENTRIES];
121 extern const xed_flag_action_t
122 xed_flag_action_table[XED_MAX_GLOBAL_FLAG_ACTIONS];
123 
124 #endif
125