freedreno/ir2: Re-indent

clang-format -fallback-style=none --style=file -i src/freedreno/ir2/*.[ch]

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10293>
This commit is contained in:
Rob Clark 2021-04-16 11:34:25 -07:00 committed by Marge Bot
parent 2dbf09c2b4
commit d26a224ca9
2 changed files with 800 additions and 780 deletions

View File

@ -21,14 +21,14 @@
* SOFTWARE. * SOFTWARE.
*/ */
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "disasm.h" #include "disasm.h"
#include "instr-a2xx.h" #include "instr-a2xx.h"
@ -58,13 +58,20 @@ static enum debug_t debug;
*/ */
static const char chan_names[] = { static const char chan_names[] = {
'x', 'y', 'z', 'w', 'x',
'y',
'z',
'w',
/* these only apply to FETCH dst's: */ /* these only apply to FETCH dst's: */
'0', '1', '?', '_', '0',
'1',
'?',
'_',
}; };
static void print_srcreg(uint32_t num, uint32_t type, static void
uint32_t swiz, uint32_t negate, uint32_t abs) print_srcreg(uint32_t num, uint32_t type, uint32_t swiz, uint32_t negate,
uint32_t abs)
{ {
if (negate) if (negate)
printf("-"); printf("-");
@ -83,7 +90,8 @@ static void print_srcreg(uint32_t num, uint32_t type,
printf("|"); printf("|");
} }
static void print_dstreg(uint32_t num, uint32_t mask, uint32_t dst_exp) static void
print_dstreg(uint32_t num, uint32_t mask, uint32_t dst_exp)
{ {
printf("%s%u", dst_exp ? "export" : "R", num); printf("%s%u", dst_exp ? "export" : "R", num);
if (mask != 0xf) { if (mask != 0xf) {
@ -96,19 +104,26 @@ static void print_dstreg(uint32_t num, uint32_t mask, uint32_t dst_exp)
} }
} }
static void print_export_comment(uint32_t num, gl_shader_stage type) static void
print_export_comment(uint32_t num, gl_shader_stage type)
{ {
const char *name = NULL; const char *name = NULL;
switch (type) { switch (type) {
case MESA_SHADER_VERTEX: case MESA_SHADER_VERTEX:
switch (num) { switch (num) {
case 62: name = "gl_Position"; break; case 62:
case 63: name = "gl_PointSize"; break; name = "gl_Position";
break;
case 63:
name = "gl_PointSize";
break;
} }
break; break;
case MESA_SHADER_FRAGMENT: case MESA_SHADER_FRAGMENT:
switch (num) { switch (num) {
case 0: name = "gl_FragColor"; break; case 0:
name = "gl_FragColor";
break;
} }
break; break;
default: default:
@ -211,15 +226,16 @@ struct {
#undef INSTR #undef INSTR
}; };
static int disasm_alu(uint32_t *dwords, uint32_t alu_off, static int
int level, int sync, gl_shader_stage type) disasm_alu(uint32_t *dwords, uint32_t alu_off, int level, int sync,
gl_shader_stage type)
{ {
instr_alu_t *alu = (instr_alu_t *)dwords; instr_alu_t *alu = (instr_alu_t *)dwords;
printf("%s", levels[level]); printf("%s", levels[level]);
if (debug & PRINT_RAW) { if (debug & PRINT_RAW) {
printf("%02x: %08x %08x %08x\t", alu_off, printf("%02x: %08x %08x %08x\t", alu_off, dwords[0], dwords[1],
dwords[0], dwords[1], dwords[2]); dwords[2]);
} }
printf(" %sALU:\t", sync ? "(S)" : " "); printf(" %sALU:\t", sync ? "(S)" : " ");
@ -286,7 +302,6 @@ static int disasm_alu(uint32_t *dwords, uint32_t alu_off,
return 0; return 0;
} }
/* /*
* FETCH instructions: * FETCH instructions:
*/ */
@ -312,7 +327,8 @@ struct {
#undef TYPE #undef TYPE
}; };
static void print_fetch_dst(uint32_t dst_reg, uint32_t dst_swiz) static void
print_fetch_dst(uint32_t dst_reg, uint32_t dst_swiz)
{ {
int i; int i;
printf("\tR%u.", dst_reg); printf("\tR%u.", dst_reg);
@ -322,7 +338,8 @@ static void print_fetch_dst(uint32_t dst_reg, uint32_t dst_swiz)
} }
} }
static void print_fetch_vtx(instr_fetch_t *fetch) static void
print_fetch_vtx(instr_fetch_t *fetch)
{ {
instr_fetch_vtx_t *vtx = &fetch->vtx; instr_fetch_vtx_t *vtx = &fetch->vtx;
@ -358,7 +375,8 @@ static void print_fetch_vtx(instr_fetch_t *fetch)
} }
} }
static void print_fetch_tex(instr_fetch_t *fetch) static void
print_fetch_tex(instr_fetch_t *fetch)
{ {
static const char *filter[] = { static const char *filter[] = {
[TEX_FILTER_POINT] = "POINT", [TEX_FILTER_POINT] = "POINT",
@ -453,14 +471,15 @@ struct {
#undef INSTR #undef INSTR
}; };
static int disasm_fetch(uint32_t *dwords, uint32_t alu_off, int level, int sync) static int
disasm_fetch(uint32_t *dwords, uint32_t alu_off, int level, int sync)
{ {
instr_fetch_t *fetch = (instr_fetch_t *)dwords; instr_fetch_t *fetch = (instr_fetch_t *)dwords;
printf("%s", levels[level]); printf("%s", levels[level]);
if (debug & PRINT_RAW) { if (debug & PRINT_RAW) {
printf("%02x: %08x %08x %08x\t", alu_off, printf("%02x: %08x %08x %08x\t", alu_off, dwords[0], dwords[1],
dwords[0], dwords[1], dwords[2]); dwords[2]);
} }
printf(" %sFETCH:\t", sync ? "(S)" : " "); printf(" %sFETCH:\t", sync ? "(S)" : " ");
@ -475,33 +494,32 @@ static int disasm_fetch(uint32_t *dwords, uint32_t alu_off, int level, int sync)
* CF instructions: * CF instructions:
*/ */
static int cf_exec(instr_cf_t *cf) static int
cf_exec(instr_cf_t *cf)
{ {
return (cf->opc == EXEC) || return (cf->opc == EXEC) || (cf->opc == EXEC_END) ||
(cf->opc == EXEC_END) || (cf->opc == COND_EXEC) || (cf->opc == COND_EXEC_END) ||
(cf->opc == COND_EXEC) || (cf->opc == COND_PRED_EXEC) || (cf->opc == COND_PRED_EXEC_END) ||
(cf->opc == COND_EXEC_END) ||
(cf->opc == COND_PRED_EXEC) ||
(cf->opc == COND_PRED_EXEC_END) ||
(cf->opc == COND_EXEC_PRED_CLEAN) || (cf->opc == COND_EXEC_PRED_CLEAN) ||
(cf->opc == COND_EXEC_PRED_CLEAN_END); (cf->opc == COND_EXEC_PRED_CLEAN_END);
} }
static int cf_cond_exec(instr_cf_t *cf) static int
cf_cond_exec(instr_cf_t *cf)
{ {
return (cf->opc == COND_EXEC) || return (cf->opc == COND_EXEC) || (cf->opc == COND_EXEC_END) ||
(cf->opc == COND_EXEC_END) || (cf->opc == COND_PRED_EXEC) || (cf->opc == COND_PRED_EXEC_END) ||
(cf->opc == COND_PRED_EXEC) ||
(cf->opc == COND_PRED_EXEC_END) ||
(cf->opc == COND_EXEC_PRED_CLEAN) || (cf->opc == COND_EXEC_PRED_CLEAN) ||
(cf->opc == COND_EXEC_PRED_CLEAN_END); (cf->opc == COND_EXEC_PRED_CLEAN_END);
} }
static void print_cf_nop(instr_cf_t *cf) static void
print_cf_nop(instr_cf_t *cf)
{ {
} }
static void print_cf_exec(instr_cf_t *cf) static void
print_cf_exec(instr_cf_t *cf)
{ {
printf(" ADDR(0x%x) CNT(0x%x)", cf->exec.address, cf->exec.count); printf(" ADDR(0x%x) CNT(0x%x)", cf->exec.address, cf->exec.count);
if (cf->exec.yeild) if (cf->exec.yeild)
@ -516,14 +534,16 @@ static void print_cf_exec(instr_cf_t *cf)
printf(" COND(%d)", cf->exec.condition); printf(" COND(%d)", cf->exec.condition);
} }
static void print_cf_loop(instr_cf_t *cf) static void
print_cf_loop(instr_cf_t *cf)
{ {
printf(" ADDR(0x%x) LOOP_ID(%d)", cf->loop.address, cf->loop.loop_id); printf(" ADDR(0x%x) LOOP_ID(%d)", cf->loop.address, cf->loop.loop_id);
if (cf->loop.address_mode == ABSOLUTE_ADDR) if (cf->loop.address_mode == ABSOLUTE_ADDR)
printf(" ABSOLUTE_ADDR"); printf(" ABSOLUTE_ADDR");
} }
static void print_cf_jmp_call(instr_cf_t *cf) static void
print_cf_jmp_call(instr_cf_t *cf)
{ {
printf(" ADDR(0x%x) DIR(%d)", cf->jmp_call.address, cf->jmp_call.direction); printf(" ADDR(0x%x) DIR(%d)", cf->jmp_call.address, cf->jmp_call.direction);
if (cf->jmp_call.force_call) if (cf->jmp_call.force_call)
@ -536,7 +556,8 @@ static void print_cf_jmp_call(instr_cf_t *cf)
printf(" ABSOLUTE_ADDR"); printf(" ABSOLUTE_ADDR");
} }
static void print_cf_alloc(instr_cf_t *cf) static void
print_cf_alloc(instr_cf_t *cf)
{ {
static const char *bufname[] = { static const char *bufname[] = {
[SQ_NO_ALLOC] = "NO ALLOC", [SQ_NO_ALLOC] = "NO ALLOC",
@ -575,14 +596,14 @@ struct {
#undef INSTR #undef INSTR
}; };
static void print_cf(instr_cf_t *cf, int level) static void
print_cf(instr_cf_t *cf, int level)
{ {
printf("%s", levels[level]); printf("%s", levels[level]);
if (debug & PRINT_RAW) { if (debug & PRINT_RAW) {
uint16_t words[3]; uint16_t words[3];
memcpy(&words, cf, sizeof(words)); memcpy(&words, cf, sizeof(words));
printf(" %04x %04x %04x \t", printf(" %04x %04x %04x \t", words[0], words[1], words[2]);
words[0], words[1], words[2]);
} }
printf("%s", cf_instructions[cf->opc].name); printf("%s", cf_instructions[cf->opc].name);
cf_instructions[cf->opc].fxn(cf); cf_instructions[cf->opc].fxn(cf);
@ -596,7 +617,8 @@ static void print_cf(instr_cf_t *cf, int level)
* 2) ALU and FETCH instructions * 2) ALU and FETCH instructions
*/ */
int disasm_a2xx(uint32_t *dwords, int sizedwords, int level, gl_shader_stage type) int
disasm_a2xx(uint32_t *dwords, int sizedwords, int level, gl_shader_stage type)
{ {
instr_cf_t *cfs = (instr_cf_t *)dwords; instr_cf_t *cfs = (instr_cf_t *)dwords;
int idx, max_idx; int idx, max_idx;
@ -620,9 +642,11 @@ int disasm_a2xx(uint32_t *dwords, int sizedwords, int level, gl_shader_stage typ
for (i = 0; i < cf->exec.count; i++) { for (i = 0; i < cf->exec.count; i++) {
uint32_t alu_off = (cf->exec.address + i); uint32_t alu_off = (cf->exec.address + i);
if (sequence & 0x1) { if (sequence & 0x1) {
disasm_fetch(dwords + alu_off * 3, alu_off, level, sequence & 0x2); disasm_fetch(dwords + alu_off * 3, alu_off, level,
sequence & 0x2);
} else { } else {
disasm_alu(dwords + alu_off * 3, alu_off, level, sequence & 0x2, type); disasm_alu(dwords + alu_off * 3, alu_off, level, sequence & 0x2,
type);
} }
sequence >>= 2; sequence >>= 2;
} }
@ -632,7 +656,8 @@ int disasm_a2xx(uint32_t *dwords, int sizedwords, int level, gl_shader_stage typ
return 0; return 0;
} }
void disasm_a2xx_set_debug(enum debug_t d) void
disasm_a2xx_set_debug(enum debug_t d)
{ {
debug = d; debug = d;
} }

View File

@ -31,7 +31,6 @@
#include "adreno_pm4.xml.h" #include "adreno_pm4.xml.h"
#include "a2xx.xml.h" #include "a2xx.xml.h"
/* /*
* ALU instructions: * ALU instructions:
*/ */
@ -174,8 +173,6 @@ typedef struct PACKED {
uint8_t src1_sel : 1; uint8_t src1_sel : 1;
} instr_alu_t; } instr_alu_t;
/* /*
* CF instructions: * CF instructions:
*/ */
@ -266,8 +263,6 @@ typedef union PACKED {
}; };
} instr_cf_t; } instr_cf_t;
/* /*
* FETCH instructions: * FETCH instructions:
*/ */