Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/src/amd/compiler/aco_opcodes_cpp.py
4550 views
1
2
template = """\
3
/*
4
* Copyright (c) 2018 Valve Corporation
5
*
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:
12
*
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
15
* Software.
16
*
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
23
* IN THE SOFTWARE.
24
*
25
* This file was generated by aco_opcodes_cpp.py
26
*/
27
28
#include "aco_ir.h"
29
30
namespace aco {
31
32
<%
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)])
37
%>
38
39
extern const aco::Info instr_info = {
40
.opcode_gfx7 = {
41
% for name in opcode_names:
42
${opcodes[name].opcode_gfx7},
43
% endfor
44
},
45
.opcode_gfx9 = {
46
% for name in opcode_names:
47
${opcodes[name].opcode_gfx9},
48
% endfor
49
},
50
.opcode_gfx10 = {
51
% for name in opcode_names:
52
${opcodes[name].opcode_gfx10},
53
% endfor
54
},
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}"),
58
.name = {
59
% for name in opcode_names:
60
"${name}",
61
% endfor
62
},
63
.format = {
64
% for name in opcode_names:
65
aco::Format::${str(opcodes[name].format.name)},
66
% endfor
67
},
68
.operand_size = {
69
% for name in opcode_names:
70
${opcodes[name].operand_size},
71
% endfor
72
},
73
.definition_size = {
74
% for name in opcode_names:
75
${opcodes[name].definition_size},
76
% endfor
77
},
78
.classes = {
79
% for name in opcode_names:
80
(instr_class)${opcodes[name].cls.value},
81
% endfor
82
},
83
};
84
85
}
86
"""
87
88
from aco_opcodes import opcodes
89
from mako.template import Template
90
91
print(Template(template).render(opcodes=opcodes))
92
93