Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/src/microsoft/compiler/dxil_dump_decls.h
4564 views
1
/*
2
* Copyright © Microsoft Corporation
3
*
4
* Permission is hereby granted, free of charge, to any person obtaining a
5
* copy of this software and associated documentation files (the "Software"),
6
* to deal in the Software without restriction, including without limitation
7
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
* and/or sell copies of the Software, and to permit persons to whom the
9
* Software is furnished to do so, subject to the following conditions:
10
*
11
* The above copyright notice and this permission notice (including the next
12
* paragraph) shall be included in all copies or substantial portions of the
13
* Software.
14
*
15
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21
* IN THE SOFTWARE.
22
*/
23
24
#ifndef DIXL_DUMP_DECL
25
#error This header can only be included from dxil_dump.c
26
#endif
27
28
#include "dxil_module.h"
29
30
static void
31
dump_metadata(struct dxil_dumper *buf, struct dxil_module *m);
32
static void
33
dump_shader_info(struct dxil_dumper *buf, struct dxil_shader_info *info);
34
static const char *
35
dump_shader_string(enum dxil_shader_kind kind);
36
static void
37
dump_features(struct _mesa_string_buffer *buf, struct dxil_features *feat);
38
static void
39
dump_types(struct dxil_dumper *buf, struct list_head *list);
40
static void
41
dump_gvars(struct dxil_dumper *buf, struct list_head *list);
42
static void
43
dump_constants(struct dxil_dumper *buf, struct list_head *list);
44
static void
45
dump_funcs(struct dxil_dumper *buf, struct list_head *list);
46
static void
47
dump_attr_set_list(struct dxil_dumper *buf, struct list_head *list);
48
static void
49
dump_instrs(struct dxil_dumper *buf, struct list_head *list);
50
static void
51
dump_mdnodes(struct dxil_dumper *buf, struct list_head *list);
52
static void
53
dump_mdnode(struct dxil_dumper *d, const struct dxil_mdnode *node);
54
static void
55
dump_named_nodes(struct dxil_dumper *d, struct list_head *list);
56
static void
57
dump_type(struct dxil_dumper *buf, const struct dxil_type *type);
58
static void
59
dump_instr_binop(struct dxil_dumper *d, struct dxil_instr_binop *binop);
60
static void
61
dump_instr_cmp(struct dxil_dumper *d, struct dxil_instr_cmp *cmp);
62
static void
63
dump_instr_select(struct dxil_dumper *d, struct dxil_instr_select *select);
64
static void
65
dump_instr_cast(struct dxil_dumper *d, struct dxil_instr_cast *cast);
66
static void
67
dump_instr_call(struct dxil_dumper *d, struct dxil_instr_call *call);
68
static void
69
dump_instr_ret(struct dxil_dumper *d, struct dxil_instr_ret *ret);
70
static void
71
dump_instr_extractval(struct dxil_dumper *d, struct dxil_instr_extractval *ret);
72
static void
73
dump_instr_branch(struct dxil_dumper *d, struct dxil_instr_br *br);
74
static void
75
dump_instr_phi(struct dxil_dumper *d, struct dxil_instr_phi *phi);
76
static void
77
dump_instr_alloca(struct dxil_dumper *d, struct dxil_instr_alloca *alloca);
78
static void
79
dump_instr_gep(struct dxil_dumper *d, struct dxil_instr_gep *gep);
80
static void
81
dump_instr_load(struct dxil_dumper *d, struct dxil_instr_load *store);
82
static void
83
dump_instr_store(struct dxil_dumper *d, struct dxil_instr_store *store);
84
static void
85
dump_instr_atomicrmw(struct dxil_dumper *d, struct dxil_instr_atomicrmw *rmw);
86
87
static void
88
dump_instr_print_operands(struct dxil_dumper *d, int num,
89
const struct dxil_value *val[]);
90
91
static void dump_io_signatures(struct _mesa_string_buffer *buf,
92
struct dxil_module *m);
93
static void
94
dump_io_signature(struct _mesa_string_buffer *buf, unsigned num,
95
struct dxil_signature_record *io);
96
97
static const char *component_type_as_string(uint32_t type);
98
99
static void dump_psv(struct _mesa_string_buffer *buf,
100
struct dxil_module *m);
101
static void dump_psv_io(struct _mesa_string_buffer *buf, struct dxil_module *m,
102
unsigned num, struct dxil_psv_signature_element *io);
103
104
static void
105
dump_value(struct dxil_dumper *d, const struct dxil_value *val);
106
107
static const char *binop_strings[DXIL_BINOP_INSTR_COUNT] = {
108
[DXIL_BINOP_ADD] = "add",
109
[DXIL_BINOP_SUB] = "sub",
110
[DXIL_BINOP_MUL] = "mul",
111
[DXIL_BINOP_UDIV] = "udiv",
112
[DXIL_BINOP_SDIV] = "sdiv",
113
[DXIL_BINOP_UREM] = "urem",
114
[DXIL_BINOP_SREM] = "srem",
115
[DXIL_BINOP_SHL] = "shl",
116
[DXIL_BINOP_LSHR] = "lshr",
117
[DXIL_BINOP_ASHR] = "ashr",
118
[DXIL_BINOP_AND] = "and",
119
[DXIL_BINOP_OR] = "or",
120
[DXIL_BINOP_XOR]= "xor"
121
};
122
123
static const char *pred_strings[DXIL_CMP_INSTR_COUNT] = {
124
[DXIL_FCMP_FALSE] = "FALSE",
125
[DXIL_FCMP_OEQ] = "ord-fEQ",
126
[DXIL_FCMP_OGT] = "ord-fGT",
127
[DXIL_FCMP_OGE] = "ord-fGE",
128
[DXIL_FCMP_OLT] = "ord-fLT",
129
[DXIL_FCMP_OLE] = "ord-fLE",
130
[DXIL_FCMP_ONE] = "ord-fNE",
131
[DXIL_FCMP_ORD] = "ord-fRD",
132
[DXIL_FCMP_UNO] = "unord-fNO",
133
[DXIL_FCMP_UEQ] = "unord-fEQ",
134
[DXIL_FCMP_UGT] = "unord-fGT",
135
[DXIL_FCMP_UGE] = "unord-fGE",
136
[DXIL_FCMP_ULT] = "unord-fLT",
137
[DXIL_FCMP_ULE] = "unord-fLE",
138
[DXIL_FCMP_UNE] = "unord-fNE",
139
[DXIL_FCMP_TRUE] = "TRUE",
140
[DXIL_ICMP_EQ] = "iEQ",
141
[DXIL_ICMP_NE] = "iNE",
142
[DXIL_ICMP_UGT] = "uiGT",
143
[DXIL_ICMP_UGE] = "uiGE",
144
[DXIL_ICMP_ULT] = "uiLT",
145
[DXIL_ICMP_ULE] = "uiLE",
146
[DXIL_ICMP_SGT] = "iGT",
147
[DXIL_ICMP_SGE] = "iGE",
148
[DXIL_ICMP_SLT] = "iLT",
149
[DXIL_ICMP_SLE] = "iLE"
150
};
151
152
static const char *cast_opcode_strings[DXIL_CAST_INSTR_COUNT] = {
153
[DXIL_CAST_TRUNC] = "trunc",
154
[DXIL_CAST_ZEXT] = "zext",
155
[DXIL_CAST_SEXT] = "sext",
156
[DXIL_CAST_FPTOUI] = "ftoui",
157
[DXIL_CAST_FPTOSI] = "ftoi",
158
[DXIL_CAST_UITOFP] = "uitof",
159
[DXIL_CAST_SITOFP] = "itof",
160
[DXIL_CAST_FPTRUNC] = "ftrunc",
161
[DXIL_CAST_FPEXT] = "fext",
162
[DXIL_CAST_PTRTOINT] = "ptrtoint",
163
[DXIL_CAST_INTTOPTR] = "inttoptr",
164
[DXIL_CAST_BITCAST] = "bitcast",
165
[DXIL_CAST_ADDRSPACECAST] = "addrspacecast",
166
};
167
168
static const char *dxil_type_strings[DXIL_PROG_SIG_COMP_TYPE_COUNT] = {
169
[DXIL_PROG_SIG_COMP_TYPE_UNKNOWN] = "unknown",
170
[DXIL_PROG_SIG_COMP_TYPE_UINT32] = "uint32",
171
[DXIL_PROG_SIG_COMP_TYPE_SINT32] = "int32",
172
[DXIL_PROG_SIG_COMP_TYPE_FLOAT32] = "float32",
173
[DXIL_PROG_SIG_COMP_TYPE_UINT16] = "uint16",
174
[DXIL_PROG_SIG_COMP_TYPE_SINT16] = "int16",
175
[DXIL_PROG_SIG_COMP_TYPE_FLOAT16] = "float16",
176
[DXIL_PROG_SIG_COMP_TYPE_UINT64] = "uint64",
177
[DXIL_PROG_SIG_COMP_TYPE_SINT64] = "int64",
178
[DXIL_PROG_SIG_COMP_TYPE_FLOAT64] = "float64"
179
};
180
181