4 * Copyright (c) 2018 Valve Corporation
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
33 opcode_names = sorted(opcodes.keys())
34 can_use_input_modifiers = "".join([opcodes[name].input_mod for name in reversed(opcode_names)])
35 can_use_output_modifiers = "".join([opcodes[name].output_mod for name in reversed(opcode_names)])
36 is_atomic = "".join([opcodes[name].is_atomic for name in reversed(opcode_names)])
39 extern const aco::Info instr_info = {
41 % for name in opcode_names:
42 ${opcodes[name].opcode_gfx7},
46 % for name in opcode_names:
47 ${opcodes[name].opcode_gfx9},
51 % for name in opcode_names:
52 ${opcodes[name].opcode_gfx10},
55 .can_use_input_modifiers = std::bitset<${len(opcode_names)}>("${can_use_input_modifiers}"),
56 .can_use_output_modifiers = std::bitset<${len(opcode_names)}>("${can_use_output_modifiers}"),
57 .is_atomic = std::bitset<${len(opcode_names)}>("${is_atomic}"),
59 % for name in opcode_names:
64 % for name in opcode_names:
65 aco::Format::${str(opcodes[name].format.name)},
73 from aco_opcodes
import opcodes
74 from mako
.template
import Template
76 print(Template(template
).render(opcodes
=opcodes
))