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'
26 # We use a C program to create semantics_generated.pyinc
28 gen_semantics = executable(
31 native: true, build_by_default: false)
33 semantics_generated = custom_target(
34 'semantics_generated.pyinc',
35 output: 'semantics_generated.pyinc',
37 command: ['@INPUT@', '@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 input: 'gen_shortcode.py',
58 depends: [semantics_generated],
59 depend_files: [hex_common_py, attribs_def],
60 command: [python, '@INPUT@', semantics_generated, attribs_def, '@OUTPUT@'],
62 hexagon_ss.add(shortcode_generated)
64 helper_protos_generated = custom_target(
65 'helper_protos_generated.h.inc',
66 output: 'helper_protos_generated.h.inc',
67 input: 'gen_helper_protos.py',
68 depends: [semantics_generated],
69 depend_files: [hex_common_py, attribs_def, gen_tcg_h],
70 command: [python, '@INPUT@', semantics_generated, attribs_def, gen_tcg_h, '@OUTPUT@'],
72 hexagon_ss.add(helper_protos_generated)
74 tcg_funcs_generated = custom_target(
75 'tcg_funcs_generated.c.inc',
76 output: 'tcg_funcs_generated.c.inc',
77 input: 'gen_tcg_funcs.py',
78 depends: [semantics_generated],
79 depend_files: [hex_common_py, attribs_def, gen_tcg_h],
80 command: [python, '@INPUT@', semantics_generated, attribs_def, gen_tcg_h, '@OUTPUT@'],
82 hexagon_ss.add(tcg_funcs_generated)
84 tcg_func_table_generated = custom_target(
85 'tcg_func_table_generated.c.inc',
86 output: 'tcg_func_table_generated.c.inc',
87 input: 'gen_tcg_func_table.py',
88 depends: [semantics_generated],
89 depend_files: [hex_common_py, attribs_def],
90 command: [python, '@INPUT@', semantics_generated, attribs_def, '@OUTPUT@'],
92 hexagon_ss.add(tcg_func_table_generated)
94 helper_funcs_generated = custom_target(
95 'helper_funcs_generated.c.inc',
96 output: 'helper_funcs_generated.c.inc',
97 input: 'gen_helper_funcs.py',
98 depends: [semantics_generated],
99 depend_files: [hex_common_py, attribs_def, gen_tcg_h],
100 command: [python, '@INPUT@', semantics_generated, attribs_def, gen_tcg_h, '@OUTPUT@'],
102 hexagon_ss.add(helper_funcs_generated)
104 printinsn_generated = custom_target(
105 'printinsn_generated.h.inc',
106 output: 'printinsn_generated.h.inc',
107 input: 'gen_printinsn.py',
108 depends: [semantics_generated],
109 depend_files: [hex_common_py, attribs_def],
110 command: [python, '@INPUT@', semantics_generated, attribs_def, '@OUTPUT@'],
112 hexagon_ss.add(printinsn_generated)
114 op_regs_generated = custom_target(
115 'op_regs_generated.h.inc',
116 output: 'op_regs_generated.h.inc',
117 input: 'gen_op_regs.py',
118 depends: [semantics_generated],
119 depend_files: [hex_common_py, attribs_def],
120 command: [python, '@INPUT@', semantics_generated, attribs_def, '@OUTPUT@'],
122 hexagon_ss.add(op_regs_generated)
124 op_attribs_generated = custom_target(
125 'op_attribs_generated.h.inc',
126 output: 'op_attribs_generated.h.inc',
127 input: 'gen_op_attribs.py',
128 depends: [semantics_generated],
129 depend_files: [hex_common_py, attribs_def],
130 command: [python, '@INPUT@', semantics_generated, attribs_def, '@OUTPUT@'],
132 hexagon_ss.add(op_attribs_generated)
134 opcodes_def_generated = custom_target(
135 'opcodes_def_generated.h.inc',
136 output: 'opcodes_def_generated.h.inc',
137 input: 'gen_opcodes_def.py',
138 depends: [semantics_generated],
139 depend_files: [hex_common_py, attribs_def],
140 command: [python, '@INPUT@', semantics_generated, attribs_def, '@OUTPUT@'],
142 hexagon_ss.add(opcodes_def_generated)
146 # We use a C program to create iset.py which is imported into dectree.py
147 # to create the decode tree
149 gen_dectree_import = executable(
150 'gen_dectree_import',
151 'gen_dectree_import.c', opcodes_def_generated, op_regs_generated,
152 native: true, build_by_default: false)
154 iset_py = custom_target(
157 input: gen_dectree_import,
158 command: ['@INPUT@', '@OUTPUT@'],
160 hexagon_ss.add(iset_py)
164 # We use the dectree.py script to generate the decode tree header file
166 dectree_generated = custom_target(
167 'dectree_generated.h.inc',
168 output: 'dectree_generated.h.inc',
171 command: ['PYTHONPATH=' + meson.current_build_dir(), '@INPUT@', '@OUTPUT@'],
173 hexagon_ss.add(dectree_generated)
175 hexagon_ss.add(files(
191 target_arch += {'hexagon': hexagon_ss}