Path: blob/21.2-virgl/src/microsoft/compiler/dxil_dump_decls.h
4564 views
/*1* Copyright © Microsoft Corporation2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21*/2223#ifndef DIXL_DUMP_DECL24#error This header can only be included from dxil_dump.c25#endif2627#include "dxil_module.h"2829static void30dump_metadata(struct dxil_dumper *buf, struct dxil_module *m);31static void32dump_shader_info(struct dxil_dumper *buf, struct dxil_shader_info *info);33static const char *34dump_shader_string(enum dxil_shader_kind kind);35static void36dump_features(struct _mesa_string_buffer *buf, struct dxil_features *feat);37static void38dump_types(struct dxil_dumper *buf, struct list_head *list);39static void40dump_gvars(struct dxil_dumper *buf, struct list_head *list);41static void42dump_constants(struct dxil_dumper *buf, struct list_head *list);43static void44dump_funcs(struct dxil_dumper *buf, struct list_head *list);45static void46dump_attr_set_list(struct dxil_dumper *buf, struct list_head *list);47static void48dump_instrs(struct dxil_dumper *buf, struct list_head *list);49static void50dump_mdnodes(struct dxil_dumper *buf, struct list_head *list);51static void52dump_mdnode(struct dxil_dumper *d, const struct dxil_mdnode *node);53static void54dump_named_nodes(struct dxil_dumper *d, struct list_head *list);55static void56dump_type(struct dxil_dumper *buf, const struct dxil_type *type);57static void58dump_instr_binop(struct dxil_dumper *d, struct dxil_instr_binop *binop);59static void60dump_instr_cmp(struct dxil_dumper *d, struct dxil_instr_cmp *cmp);61static void62dump_instr_select(struct dxil_dumper *d, struct dxil_instr_select *select);63static void64dump_instr_cast(struct dxil_dumper *d, struct dxil_instr_cast *cast);65static void66dump_instr_call(struct dxil_dumper *d, struct dxil_instr_call *call);67static void68dump_instr_ret(struct dxil_dumper *d, struct dxil_instr_ret *ret);69static void70dump_instr_extractval(struct dxil_dumper *d, struct dxil_instr_extractval *ret);71static void72dump_instr_branch(struct dxil_dumper *d, struct dxil_instr_br *br);73static void74dump_instr_phi(struct dxil_dumper *d, struct dxil_instr_phi *phi);75static void76dump_instr_alloca(struct dxil_dumper *d, struct dxil_instr_alloca *alloca);77static void78dump_instr_gep(struct dxil_dumper *d, struct dxil_instr_gep *gep);79static void80dump_instr_load(struct dxil_dumper *d, struct dxil_instr_load *store);81static void82dump_instr_store(struct dxil_dumper *d, struct dxil_instr_store *store);83static void84dump_instr_atomicrmw(struct dxil_dumper *d, struct dxil_instr_atomicrmw *rmw);8586static void87dump_instr_print_operands(struct dxil_dumper *d, int num,88const struct dxil_value *val[]);8990static void dump_io_signatures(struct _mesa_string_buffer *buf,91struct dxil_module *m);92static void93dump_io_signature(struct _mesa_string_buffer *buf, unsigned num,94struct dxil_signature_record *io);9596static const char *component_type_as_string(uint32_t type);9798static void dump_psv(struct _mesa_string_buffer *buf,99struct dxil_module *m);100static void dump_psv_io(struct _mesa_string_buffer *buf, struct dxil_module *m,101unsigned num, struct dxil_psv_signature_element *io);102103static void104dump_value(struct dxil_dumper *d, const struct dxil_value *val);105106static const char *binop_strings[DXIL_BINOP_INSTR_COUNT] = {107[DXIL_BINOP_ADD] = "add",108[DXIL_BINOP_SUB] = "sub",109[DXIL_BINOP_MUL] = "mul",110[DXIL_BINOP_UDIV] = "udiv",111[DXIL_BINOP_SDIV] = "sdiv",112[DXIL_BINOP_UREM] = "urem",113[DXIL_BINOP_SREM] = "srem",114[DXIL_BINOP_SHL] = "shl",115[DXIL_BINOP_LSHR] = "lshr",116[DXIL_BINOP_ASHR] = "ashr",117[DXIL_BINOP_AND] = "and",118[DXIL_BINOP_OR] = "or",119[DXIL_BINOP_XOR]= "xor"120};121122static const char *pred_strings[DXIL_CMP_INSTR_COUNT] = {123[DXIL_FCMP_FALSE] = "FALSE",124[DXIL_FCMP_OEQ] = "ord-fEQ",125[DXIL_FCMP_OGT] = "ord-fGT",126[DXIL_FCMP_OGE] = "ord-fGE",127[DXIL_FCMP_OLT] = "ord-fLT",128[DXIL_FCMP_OLE] = "ord-fLE",129[DXIL_FCMP_ONE] = "ord-fNE",130[DXIL_FCMP_ORD] = "ord-fRD",131[DXIL_FCMP_UNO] = "unord-fNO",132[DXIL_FCMP_UEQ] = "unord-fEQ",133[DXIL_FCMP_UGT] = "unord-fGT",134[DXIL_FCMP_UGE] = "unord-fGE",135[DXIL_FCMP_ULT] = "unord-fLT",136[DXIL_FCMP_ULE] = "unord-fLE",137[DXIL_FCMP_UNE] = "unord-fNE",138[DXIL_FCMP_TRUE] = "TRUE",139[DXIL_ICMP_EQ] = "iEQ",140[DXIL_ICMP_NE] = "iNE",141[DXIL_ICMP_UGT] = "uiGT",142[DXIL_ICMP_UGE] = "uiGE",143[DXIL_ICMP_ULT] = "uiLT",144[DXIL_ICMP_ULE] = "uiLE",145[DXIL_ICMP_SGT] = "iGT",146[DXIL_ICMP_SGE] = "iGE",147[DXIL_ICMP_SLT] = "iLT",148[DXIL_ICMP_SLE] = "iLE"149};150151static const char *cast_opcode_strings[DXIL_CAST_INSTR_COUNT] = {152[DXIL_CAST_TRUNC] = "trunc",153[DXIL_CAST_ZEXT] = "zext",154[DXIL_CAST_SEXT] = "sext",155[DXIL_CAST_FPTOUI] = "ftoui",156[DXIL_CAST_FPTOSI] = "ftoi",157[DXIL_CAST_UITOFP] = "uitof",158[DXIL_CAST_SITOFP] = "itof",159[DXIL_CAST_FPTRUNC] = "ftrunc",160[DXIL_CAST_FPEXT] = "fext",161[DXIL_CAST_PTRTOINT] = "ptrtoint",162[DXIL_CAST_INTTOPTR] = "inttoptr",163[DXIL_CAST_BITCAST] = "bitcast",164[DXIL_CAST_ADDRSPACECAST] = "addrspacecast",165};166167static const char *dxil_type_strings[DXIL_PROG_SIG_COMP_TYPE_COUNT] = {168[DXIL_PROG_SIG_COMP_TYPE_UNKNOWN] = "unknown",169[DXIL_PROG_SIG_COMP_TYPE_UINT32] = "uint32",170[DXIL_PROG_SIG_COMP_TYPE_SINT32] = "int32",171[DXIL_PROG_SIG_COMP_TYPE_FLOAT32] = "float32",172[DXIL_PROG_SIG_COMP_TYPE_UINT16] = "uint16",173[DXIL_PROG_SIG_COMP_TYPE_SINT16] = "int16",174[DXIL_PROG_SIG_COMP_TYPE_FLOAT16] = "float16",175[DXIL_PROG_SIG_COMP_TYPE_UINT64] = "uint64",176[DXIL_PROG_SIG_COMP_TYPE_SINT64] = "int64",177[DXIL_PROG_SIG_COMP_TYPE_FLOAT64] = "float64"178};179180181