From f08d2b1c0f6a1cb8e77e37806e97b7bbfae95b0a Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Wed, 29 Jan 2014 16:13:54 -0500 Subject: [PATCH] freedreno/a3xx: remove useless reg tracking in disasm-a3xx Not really used for anything anymore. So strip it out and avoid conflicting symbols with upcoming new-compiler. Signed-off-by: Rob Clark --- .../drivers/freedreno/a3xx/disasm-a3xx.c | 174 ------------------ 1 file changed, 174 deletions(-) diff --git a/src/gallium/drivers/freedreno/a3xx/disasm-a3xx.c b/src/gallium/drivers/freedreno/a3xx/disasm-a3xx.c index d9bc4992376..2d5ae62a64a 100644 --- a/src/gallium/drivers/freedreno/a3xx/disasm-a3xx.c +++ b/src/gallium/drivers/freedreno/a3xx/disasm-a3xx.c @@ -107,189 +107,21 @@ static void print_reg(reg_t reg, bool full, bool r, bool c, bool im, } } -/* Tracking for registers used, read-before-write (input), and - * write-after-read (output.. but not 100%).. - */ - -#define MAX_REG 4096 - -typedef struct { - uint8_t full[MAX_REG/8]; - uint8_t half[MAX_REG/8]; -} regmask_t; - -static void regmask_set(regmask_t *regmask, unsigned num, bool full, unsigned val) -{ - unsigned i = num / 8; - unsigned j = num % 8; - assert(num < MAX_REG); - if (full) { - regmask->full[i] = (regmask->full[i] & ~(1 << j)) | (val << j); - } else { - regmask->half[i] = (regmask->half[i] & ~(1 << j)) | (val << j); - } -} - -static unsigned regmask_get(regmask_t *regmask, unsigned num, bool full) -{ - unsigned i = num / 8; - unsigned j = num % 8; - assert(num < MAX_REG); - if (full) { - return (regmask->full[i] >> j) & 0x1; - } else { - return (regmask->half[i] >> j) & 0x1; - } -} - -static unsigned regidx(reg_t reg) -{ - return (4 * reg.num) + reg.comp; -} - -static struct { - regmask_t used; - regmask_t rbw; /* read before write */ - regmask_t war; /* write after read */ - regmask_t cnst; /* used consts */ -} regs; - -static void print_regs(regmask_t *regmask, bool full) -{ - int num, max = 0, cnt = 0; - int first, last; - - void print_sequence(void) - { - if (first != MAX_REG) { - if (first == last) { - printf(" %d", first); - } else { - printf(" %d-%d", first, last); - } - } - } - - first = last = MAX_REG; - - for (num = 0; num < MAX_REG; num++) { - if (regmask_get(regmask, num, full)) { - if (num != (last + 1)) { - print_sequence(); - first = num; - } - last = num; - max = num; - cnt++; - } - } - - print_sequence(); - - printf(" (cnt=%d, max=%d)", cnt, max); -} - -static void print_reg_stats(int level) -{ - printf("%sRegister Stats:\n", levels[level]); - printf("%s- used (half):", levels[level]); - print_regs(®s.used, false); - printf("\n"); - printf("%s- used (full):", levels[level]); - print_regs(®s.used, true); - printf("\n"); - printf("%s- input (half):", levels[level]); - print_regs(®s.rbw, false); - printf("\n"); - printf("%s- input (full):", levels[level]); - print_regs(®s.rbw, true); - printf("\n"); - printf("%s- const (half):", levels[level]); - print_regs(®s.cnst, false); - printf("\n"); - printf("%s- const (full):", levels[level]); - print_regs(®s.cnst, true); - printf("\n"); - printf("%s- output (half):", levels[level]); - print_regs(®s.war, false); - printf(" (estimated)\n"); - printf("%s- output (full):", levels[level]); - print_regs(®s.war, true); - printf(" (estimated)\n"); -} - -/* we have to process the dst register after src to avoid tripping up - * the read-before-write detection - */ -static unsigned last_dst; -static bool last_dst_full; -static bool last_dst_valid = false; /* current instruction repeat flag: */ static unsigned repeat; -static void process_reg_dst(void) -{ - int i; - - if (!last_dst_valid) - return; - - for (i = 0; i <= repeat; i++) { - unsigned dst = last_dst + i; - - regmask_set(®s.war, dst, last_dst_full, 1); - regmask_set(®s.used, dst, last_dst_full, 1); - } - - last_dst_valid = false; -} - static void print_reg_dst(reg_t reg, bool full, bool addr_rel) { - /* presumably the special registers a0.c and p0.c don't count.. */ - if (!(addr_rel || reg_special(reg))) { - last_dst = regidx(reg); - last_dst_full = full; - last_dst_valid = true; - } print_reg(reg, full, false, false, false, false, false, addr_rel); } static void print_reg_src(reg_t reg, bool full, bool r, bool c, bool im, bool neg, bool abs, bool addr_rel) { - /* presumably the special registers a0.c and p0.c don't count.. */ - if (!(addr_rel || c || im || reg_special(reg))) { - int i, num = regidx(reg); - for (i = 0; i <= repeat; i++) { - unsigned src = num + i; - - if (!regmask_get(®s.used, src, full)) - regmask_set(®s.rbw, src, full, 1); - - regmask_set(®s.war, src, full, 0); - regmask_set(®s.used, src, full, 1); - - if (!r) - break; - } - } else if (c) { - int i, num = regidx(reg); - for (i = 0; i <= repeat; i++) { - unsigned src = num + i; - - regmask_set(®s.cnst, src, full, 1); - - if (!r) - break; - } - } - print_reg(reg, full, r, c, im, neg, abs, addr_rel); } - static void print_instr_cat0(instr_t *instr) { instr_cat0_t *cat0 = &instr->cat0; @@ -978,8 +810,6 @@ static void print_instr(uint32_t *dwords, int level, int n) } printf("\n"); - - process_reg_dst(); } int disasm_a3xx(uint32_t *dwords, int sizedwords, int level, enum shader_t type) @@ -988,12 +818,8 @@ int disasm_a3xx(uint32_t *dwords, int sizedwords, int level, enum shader_t type) assert((sizedwords % 2) == 0); - memset(®s, 0, sizeof(regs)); - for (i = 0; i < sizedwords; i += 2) print_instr(&dwords[i], level, i/2); - print_reg_stats(level); - return 0; } -- 2.30.2