Path: blob/21.2-virgl/src/amd/compiler/aco_opcodes_cpp.py
4550 views
1template = """\2/*3* Copyright (c) 2018 Valve Corporation4*5* Permission is hereby granted, free of charge, to any person obtaining a6* copy of this software and associated documentation files (the "Software"),7* to deal in the Software without restriction, including without limitation8* the rights to use, copy, modify, merge, publish, distribute, sublicense,9* and/or sell copies of the Software, and to permit persons to whom the10* Software is furnished to do so, subject to the following conditions:11*12* The above copyright notice and this permission notice (including the next13* paragraph) shall be included in all copies or substantial portions of the14* Software.15*16* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR17* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,18* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL19* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER20* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING21* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS22* IN THE SOFTWARE.23*24* This file was generated by aco_opcodes_cpp.py25*/2627#include "aco_ir.h"2829namespace aco {3031<%32opcode_names = sorted(opcodes.keys())33can_use_input_modifiers = "".join([opcodes[name].input_mod for name in reversed(opcode_names)])34can_use_output_modifiers = "".join([opcodes[name].output_mod for name in reversed(opcode_names)])35is_atomic = "".join([opcodes[name].is_atomic for name in reversed(opcode_names)])36%>3738extern const aco::Info instr_info = {39.opcode_gfx7 = {40% for name in opcode_names:41${opcodes[name].opcode_gfx7},42% endfor43},44.opcode_gfx9 = {45% for name in opcode_names:46${opcodes[name].opcode_gfx9},47% endfor48},49.opcode_gfx10 = {50% for name in opcode_names:51${opcodes[name].opcode_gfx10},52% endfor53},54.can_use_input_modifiers = std::bitset<${len(opcode_names)}>("${can_use_input_modifiers}"),55.can_use_output_modifiers = std::bitset<${len(opcode_names)}>("${can_use_output_modifiers}"),56.is_atomic = std::bitset<${len(opcode_names)}>("${is_atomic}"),57.name = {58% for name in opcode_names:59"${name}",60% endfor61},62.format = {63% for name in opcode_names:64aco::Format::${str(opcodes[name].format.name)},65% endfor66},67.operand_size = {68% for name in opcode_names:69${opcodes[name].operand_size},70% endfor71},72.definition_size = {73% for name in opcode_names:74${opcodes[name].definition_size},75% endfor76},77.classes = {78% for name in opcode_names:79(instr_class)${opcodes[name].cls.value},80% endfor81},82};8384}85"""8687from aco_opcodes import opcodes88from mako.template import Template8990print(Template(template).render(opcodes=opcodes))919293