2 ## Copyright(c) 2020-2021 Qualcomm Innovation Center, Inc. All Rights Reserved.
4 ## This program is free software; you can redistribute it and/or modify
5 ## it under the terms of the GNU General Public License as published by
6 ## the Free Software Foundation; either version 2 of the License, or
7 ## (at your option) any later version.
9 ## This program is distributed in the hope that it will be useful,
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ## GNU General Public License for more details.
14 ## You should have received a copy of the GNU General Public License
15 ## along with this program; if not, see <http://www.gnu.org/licenses/>.
18 hexagon_ss = ss.source_set()
20 hex_common_py = 'hex_common.py'
21 attribs_def = meson.current_source_dir() / 'attribs_def.h.inc'
22 gen_tcg_h = meson.current_source_dir() / 'gen_tcg.h'
23 gen_tcg_hvx_h = meson.current_source_dir() / 'gen_tcg_hvx.h'
27 # We use a C program to create semantics_generated.pyinc
29 gen_semantics = executable(
32 native: true, build_by_default: false)
34 semantics_generated = custom_target(
35 'semantics_generated.pyinc',
36 output: 'semantics_generated.pyinc',
37 command: [gen_semantics, '@OUTPUT@'],
39 hexagon_ss.add(semantics_generated)
43 # We use Python scripts to generate the following files
44 # shortcode_generated.h.inc
45 # helper_protos_generated.h.inc
46 # tcg_funcs_generated.c.inc
47 # tcg_func_table_generated.c.inc
48 # helper_funcs_generated.c.inc
49 # printinsn_generated.h.inc
50 # op_regs_generated.h.inc
51 # op_attribs_generated.h.inc
52 # opcodes_def_generated.h.inc
54 shortcode_generated = custom_target(
55 'shortcode_generated.h.inc',
56 output: 'shortcode_generated.h.inc',
57 depends: [semantics_generated],
58 depend_files: [hex_common_py, attribs_def],
59 command: [python, files('gen_shortcode.py'), semantics_generated, attribs_def, '@OUTPUT@'],
61 hexagon_ss.add(shortcode_generated)
63 helper_protos_generated = custom_target(
64 'helper_protos_generated.h.inc',
65 output: 'helper_protos_generated.h.inc',
66 depends: [semantics_generated],
67 depend_files: [hex_common_py, attribs_def, gen_tcg_h, gen_tcg_hvx_h],
68 command: [python, files('gen_helper_protos.py'), semantics_generated, attribs_def, gen_tcg_h, gen_tcg_hvx_h, '@OUTPUT@'],
70 hexagon_ss.add(helper_protos_generated)
72 tcg_funcs_generated = custom_target(
73 'tcg_funcs_generated.c.inc',
74 output: 'tcg_funcs_generated.c.inc',
75 depends: [semantics_generated],
76 depend_files: [hex_common_py, attribs_def, gen_tcg_h, gen_tcg_hvx_h],
77 command: [python, files('gen_tcg_funcs.py'), semantics_generated, attribs_def, gen_tcg_h, gen_tcg_hvx_h, '@OUTPUT@'],
79 hexagon_ss.add(tcg_funcs_generated)
81 tcg_func_table_generated = custom_target(
82 'tcg_func_table_generated.c.inc',
83 output: 'tcg_func_table_generated.c.inc',
84 depends: [semantics_generated],
85 depend_files: [hex_common_py, attribs_def],
86 command: [python, files('gen_tcg_func_table.py'), semantics_generated, attribs_def, '@OUTPUT@'],
88 hexagon_ss.add(tcg_func_table_generated)
90 helper_funcs_generated = custom_target(
91 'helper_funcs_generated.c.inc',
92 output: 'helper_funcs_generated.c.inc',
93 depends: [semantics_generated],
94 depend_files: [hex_common_py, attribs_def, gen_tcg_h, gen_tcg_hvx_h],
95 command: [python, files('gen_helper_funcs.py'), semantics_generated, attribs_def, gen_tcg_h, gen_tcg_hvx_h, '@OUTPUT@'],
97 hexagon_ss.add(helper_funcs_generated)
99 printinsn_generated = custom_target(
100 'printinsn_generated.h.inc',
101 output: 'printinsn_generated.h.inc',
102 depends: [semantics_generated],
103 depend_files: [hex_common_py, attribs_def],
104 command: [python, files('gen_printinsn.py'), semantics_generated, attribs_def, '@OUTPUT@'],
106 hexagon_ss.add(printinsn_generated)
108 op_regs_generated = custom_target(
109 'op_regs_generated.h.inc',
110 output: 'op_regs_generated.h.inc',
111 depends: [semantics_generated],
112 depend_files: [hex_common_py, attribs_def],
113 command: [python, files('gen_op_regs.py'), semantics_generated, attribs_def, '@OUTPUT@'],
115 hexagon_ss.add(op_regs_generated)
117 op_attribs_generated = custom_target(
118 'op_attribs_generated.h.inc',
119 output: 'op_attribs_generated.h.inc',
120 depends: [semantics_generated],
121 depend_files: [hex_common_py, attribs_def],
122 command: [python, files('gen_op_attribs.py'), semantics_generated, attribs_def, '@OUTPUT@'],
124 hexagon_ss.add(op_attribs_generated)
126 opcodes_def_generated = custom_target(
127 'opcodes_def_generated.h.inc',
128 output: 'opcodes_def_generated.h.inc',
129 depends: [semantics_generated],
130 depend_files: [hex_common_py, attribs_def],
131 command: [python, files('gen_opcodes_def.py'), semantics_generated, attribs_def, '@OUTPUT@'],
133 hexagon_ss.add(opcodes_def_generated)
137 # We use a C program to create iset.py which is imported into dectree.py
138 # to create the decode tree
140 gen_dectree_import = executable(
141 'gen_dectree_import',
142 'gen_dectree_import.c', opcodes_def_generated, op_regs_generated,
143 native: true, build_by_default: false)
145 iset_py = custom_target(
148 command: [gen_dectree_import, '@OUTPUT@'],
150 hexagon_ss.add(iset_py)
154 # We use the dectree.py script to generate the decode tree header file
156 dectree_generated = custom_target(
157 'dectree_generated.h.inc',
158 output: 'dectree_generated.h.inc',
160 env: {'PYTHONPATH': meson.current_build_dir()},
161 command: [python, files('dectree.py'), '@OUTPUT@'],
163 hexagon_ss.add(dectree_generated)
165 hexagon_ss.add(files(
178 'mmvec/decode_ext_mmvec.c',
179 'mmvec/system_ext_mmvec.c',
182 target_arch += {'hexagon': hexagon_ss}