xref: /aosp_15_r20/external/mesa3d/src/amd/compiler/aco_opcodes_h.py (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1
2template = """\
3/*
4 * Copyright (c) 2018 Valve Corporation
5 *
6 * SPDX-License-Identifier: MIT
7 *
8 * This file was generated by aco_opcodes_h.py
9 */
10
11#ifndef _ACO_OPCODES_
12#define _ACO_OPCODES_
13
14#include <stdint.h>
15
16namespace aco {
17
18enum class Format : uint16_t {
19% for e in Format:
20   ${e.name} = ${hex(e.value)},
21% endfor
22};
23
24enum class instr_class : uint8_t {
25% for name in InstrClass:
26   ${name.value},
27% endfor
28   count,
29};
30
31<% opcode_names = sorted(instructions.keys()) %>
32
33enum class aco_opcode : uint16_t {
34% for name in opcode_names:
35   ${name},
36% endfor
37   last_opcode = ${opcode_names[-1]},
38   num_opcodes = last_opcode + 1
39};
40
41}
42#endif /* _ACO_OPCODES_ */"""
43
44from aco_opcodes import instructions, InstrClass, Format
45from mako.template import Template
46
47print(Template(template).render(instructions=instructions, InstrClass=InstrClass, Format=Format))
48