nir: make intrinsic order in nir_print consistent

Make it consistent with nir_intrinsics.py, the unlabelled indices just
before it and the intrinsic builders.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6587>
This commit is contained in:
Rhys Perry
2020-09-14 19:51:41 +01:00
committed by Marge Bot
parent fb0385b57c
commit 313db572b7
3 changed files with 10 additions and 3 deletions

View File

@@ -1832,6 +1832,9 @@ typedef struct {
/** the number of constant indices used by the intrinsic */
uint8_t num_indices;
/** list of indices */
uint8_t indices[NIR_INTRINSIC_MAX_CONST_INDEX];
/** indicates the usage of intr->const_index[n] */
uint8_t index_map[NIR_INTRINSIC_NUM_INDEX_FLAGS];

View File

@@ -42,6 +42,11 @@ const nir_intrinsic_info nir_intrinsic_infos[nir_num_intrinsics] = {
.bit_size_src = ${opcode.bit_size_src},
.num_indices = ${opcode.num_indices},
% if opcode.indices:
.indices = {
% for i in range(len(opcode.indices)):
NIR_INTRINSIC_${opcode.indices[i].name.upper()},
% endfor
},
.index_map = {
% for i in range(len(opcode.indices)):
[NIR_INTRINSIC_${opcode.indices[i].name.upper()}] = ${i + 1},

View File

@@ -824,9 +824,8 @@ print_intrinsic_instr(nir_intrinsic_instr *instr, print_state *state)
fprintf(fp, ")");
for (unsigned idx = 1; idx < NIR_INTRINSIC_NUM_INDEX_FLAGS; idx++) {
if (!info->index_map[idx])
continue;
for (unsigned i = 0; i < info->num_indices; i++) {
unsigned idx = info->indices[i];
fprintf(fp, " /*");
switch (idx) {
case NIR_INTRINSIC_WRITE_MASK: {