xref: /aosp_15_r20/external/mesa3d/src/freedreno/common/disasm.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright © 2012 Rob Clark <[email protected]>
3  * SPDX-License-Identifier: MIT
4  */
5 
6 #ifndef DISASM_H_
7 #define DISASM_H_
8 
9 #include <stdbool.h>
10 #include <stdint.h>
11 #include <stdio.h>
12 
13 #include "compiler/shader_enums.h"
14 
15 /* bitmask of debug flags */
16 enum debug_t {
17    PRINT_RAW = 0x1, /* dump raw hexdump */
18    PRINT_VERBOSE = 0x2,
19    PRINT_STATS = 0x4,
20    EXPAND_REPEAT = 0x8,
21 };
22 
23 struct shader_stats {
24    /* instructions counts rpnN, and instlen does not */
25    int instructions, instlen;
26    int nops;
27    int ss, sy;
28    int constlen;
29    int halfreg;
30    int fullreg;
31    uint16_t sstall;
32    uint16_t mov_count;
33    uint16_t cov_count;
34    uint16_t last_baryf;
35    uint16_t instrs_per_cat[8];
36 };
37 
38 int disasm_a2xx(uint32_t *dwords, int sizedwords, int level,
39                 gl_shader_stage type);
40 int disasm_a3xx(uint32_t *dwords, int sizedwords, int level, FILE *out,
41                 unsigned gpu_id);
42 int disasm_a3xx_stat(uint32_t *dwords, int sizedwords, int level, FILE *out,
43                      unsigned gpu_id, struct shader_stats *stats);
44 int try_disasm_a3xx(uint32_t *dwords, int sizedwords, int level, FILE *out,
45                     unsigned gpu_id);
46 
47 void disasm_a2xx_set_debug(enum debug_t debug);
48 void disasm_a3xx_set_debug(enum debug_t debug);
49 
50 #endif /* DISASM_H_ */
51