2019-09-17 13:22:17 +02:00
|
|
|
|
|
|
|
|
template = """\
|
2022-05-25 10:41:28 +02:00
|
|
|
/*
|
2019-09-17 13:22:17 +02:00
|
|
|
* Copyright (c) 2018 Valve Corporation
|
|
|
|
|
*
|
2024-04-08 09:02:30 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2019-09-17 13:22:17 +02:00
|
|
|
*
|
2021-06-09 17:54:53 +02:00
|
|
|
* This file was generated by aco_opcodes_cpp.py
|
2019-09-17 13:22:17 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "aco_ir.h"
|
|
|
|
|
|
|
|
|
|
namespace aco {
|
|
|
|
|
|
|
|
|
|
<%
|
2024-03-05 14:43:12 +00:00
|
|
|
opcode_names = sorted(instructions.keys())
|
|
|
|
|
can_use_input_modifiers = "".join([instructions[name].input_mod for name in reversed(opcode_names)])
|
|
|
|
|
can_use_output_modifiers = "".join([instructions[name].output_mod for name in reversed(opcode_names)])
|
|
|
|
|
is_atomic = "".join([instructions[name].is_atomic for name in reversed(opcode_names)])
|
2019-09-17 13:22:17 +02:00
|
|
|
%>
|
|
|
|
|
|
|
|
|
|
extern const aco::Info instr_info = {
|
2022-04-04 10:54:07 +02:00
|
|
|
{
|
2019-11-04 18:02:47 +01:00
|
|
|
% for name in opcode_names:
|
2024-02-15 16:24:07 +00:00
|
|
|
${instructions[name].op.gfx7},
|
2019-11-04 18:02:47 +01:00
|
|
|
% endfor
|
|
|
|
|
},
|
2022-04-04 10:54:07 +02:00
|
|
|
{
|
2019-09-17 13:22:17 +02:00
|
|
|
% for name in opcode_names:
|
2024-02-15 16:24:07 +00:00
|
|
|
${instructions[name].op.gfx9},
|
2019-09-17 13:22:17 +02:00
|
|
|
% endfor
|
|
|
|
|
},
|
2022-04-04 10:54:07 +02:00
|
|
|
{
|
2019-09-17 13:22:17 +02:00
|
|
|
% for name in opcode_names:
|
2024-02-15 16:24:07 +00:00
|
|
|
${instructions[name].op.gfx10},
|
2019-09-17 13:22:17 +02:00
|
|
|
% endfor
|
|
|
|
|
},
|
2022-06-16 18:15:16 +01:00
|
|
|
{
|
|
|
|
|
% for name in opcode_names:
|
2024-02-15 16:24:07 +00:00
|
|
|
${instructions[name].op.gfx11},
|
2022-06-16 18:15:16 +01:00
|
|
|
% endfor
|
|
|
|
|
},
|
2024-05-01 19:43:01 +01:00
|
|
|
{
|
|
|
|
|
% for name in opcode_names:
|
|
|
|
|
${instructions[name].op.gfx12},
|
|
|
|
|
% endfor
|
|
|
|
|
},
|
2022-04-04 10:54:07 +02:00
|
|
|
std::bitset<${len(opcode_names)}>("${can_use_input_modifiers}"),
|
|
|
|
|
std::bitset<${len(opcode_names)}>("${can_use_output_modifiers}"),
|
|
|
|
|
std::bitset<${len(opcode_names)}>("${is_atomic}"),
|
|
|
|
|
{
|
2019-09-17 13:22:17 +02:00
|
|
|
% for name in opcode_names:
|
|
|
|
|
"${name}",
|
|
|
|
|
% endfor
|
|
|
|
|
},
|
2022-04-04 10:54:07 +02:00
|
|
|
{
|
2019-09-17 13:22:17 +02:00
|
|
|
% for name in opcode_names:
|
2024-03-05 14:43:12 +00:00
|
|
|
aco::Format::${str(instructions[name].format.name)},
|
2019-09-17 13:22:17 +02:00
|
|
|
% endfor
|
|
|
|
|
},
|
2022-04-04 10:54:07 +02:00
|
|
|
{
|
2020-05-18 15:37:33 +01:00
|
|
|
% for name in opcode_names:
|
2024-03-05 14:43:12 +00:00
|
|
|
${instructions[name].operand_size},
|
2020-05-18 15:37:33 +01:00
|
|
|
% endfor
|
|
|
|
|
},
|
2022-04-04 10:54:07 +02:00
|
|
|
{
|
2021-02-03 14:47:24 +00:00
|
|
|
% for name in opcode_names:
|
2024-03-05 14:43:12 +00:00
|
|
|
instr_class::${instructions[name].cls.value},
|
2021-02-03 14:47:24 +00:00
|
|
|
% endfor
|
|
|
|
|
},
|
2023-11-10 13:09:12 +01:00
|
|
|
{
|
|
|
|
|
% for name in opcode_names:
|
2024-03-05 14:43:12 +00:00
|
|
|
${hex(instructions[name].definitions)},
|
2023-11-10 13:09:12 +01:00
|
|
|
% endfor
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
% for name in opcode_names:
|
2024-03-05 14:43:12 +00:00
|
|
|
${hex(instructions[name].operands)},
|
2023-11-10 13:09:12 +01:00
|
|
|
% endfor
|
|
|
|
|
},
|
2019-09-17 13:22:17 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
"""
|
|
|
|
|
|
2024-03-05 14:43:12 +00:00
|
|
|
from aco_opcodes import instructions
|
2019-09-17 13:22:17 +02:00
|
|
|
from mako.template import Template
|
|
|
|
|
|
2024-03-05 14:43:12 +00:00
|
|
|
print(Template(template).render(instructions=instructions))
|