* SOFTWARE.
*/
-#define NOUVEAU_DEBUG 1
-
#include "nvc0_pc.h"
#include "nvc0_program.h"
+uint8_t
+nvc0_ir_reverse_cc(uint8_t cc)
+{
+ static const uint8_t cc_swapped[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };
+
+ return cc_swapped[cc & 7] | (cc & ~7);
+}
+
boolean
nvc0_insn_can_load(struct nv_instruction *nvi, int s,
struct nv_instruction *ld)
nvc0_print_function(pc->root[i]);
}
-#if NOUVEAU_DEBUG > 1
+#if NV50_DEBUG & NV50_DEBUG_PROG_CFLOW
static void
nv_do_print_cfgraph(struct nv_pc *pc, FILE *f, struct nv_basic_block *b)
{
{
unsigned i;
- NOUVEAU_DBG("nvc0_pc_print_binary(%u ops)\n", pc->emit_size / 8);
+ NV50_DBGMSG(SHADER, "nvc0_pc_print_binary(%u ops)\n", pc->emit_size / 8);
for (i = 0; i < pc->emit_size / 4; i += 2) {
debug_printf("0x%08x ", pc->emit[i + 0]);
uint32_t *code = pc->emit;
int n;
- NOUVEAU_DBG("emitting program: size = %u\n", pc->emit_size);
+ NV50_DBGMSG(SHADER, "emitting program: size = %u\n", pc->emit_size);
pc->emit_pos = 0;
for (n = 0; n < pc->num_blocks; ++n) {
pc->emit = code;
-#ifdef NOUVEAU_DEBUG
+#if NV50_DEBUG & NV50_DEBUG_SHADER
nvc0_pc_print_binary(pc);
-#else
- debug_printf("not printing binary\n");
#endif
+
return 0;
}
ret = nvc0_tgsi_to_nc(pc, ti);
if (ret)
goto out;
-#if NOUVEAU_DEBUG > 1
+#if NV50_DEBUG & NV50_DEBUG_PROG_IR
nvc0_print_program(pc);
#endif
ret = nvc0_pc_exec_pass0(pc);
if (ret)
goto out;
-#ifdef NOUVEAU_DEBUG
+#if NV50_DEBUG & NV50_DEBUG_PROG_IR
nvc0_print_program(pc);
#endif
ret = nvc0_pc_exec_pass1(pc);
if (ret)
goto out;
-#if NOUVEAU_DEBUG > 1
+#if NV50_DEBUG & NV50_DEBUG_PROG_CFLOW
nvc0_print_program(pc);
nv_print_cfgraph(pc, "nvc0_shader_cfgraph.dot", 0);
#endif
ti->prog->relocs = pc->reloc_entries;
ti->prog->num_relocs = pc->num_relocs;
- NOUVEAU_DBG("SHADER TRANSLATION - %s\n", ret ? "failure" : "success");
+ NV50_DBGMSG(SHADER, "SHADER TRANSLATION - %s\n", ret ? "failed" : "success");
out:
nv_pc_free_refs(pc);
if (nvi == b->phi) {
if (nvi->opcode != NV_OP_PHI)
- NOUVEAU_DBG("NOTE: b->phi points to non-PHI instruction\n");
+ NV50_DBGMSG(PROG_IR, "NOTE: b->phi points to non-PHI instruction\n");
assert(!nvi->prev);
if (!nvi->next || nvi->next->opcode != NV_OP_PHI)