i965: Move compiler debugging output to stderr.
authorEric Anholt <eric@anholt.net>
Mon, 23 Dec 2013 07:29:31 +0000 (23:29 -0800)
committerEric Anholt <eric@anholt.net>
Sun, 23 Feb 2014 03:23:21 +0000 (19:23 -0800)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
24 files changed:
src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp
src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
src/mesa/drivers/dri/i965/brw_cfg.cpp
src/mesa/drivers/dri/i965/brw_clip.c
src/mesa/drivers/dri/i965/brw_eu_compact.c
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
src/mesa/drivers/dri/i965/brw_fs_generator.cpp
src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
src/mesa/drivers/dri/i965/brw_gs.c
src/mesa/drivers/dri/i965/brw_program.c
src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
src/mesa/drivers/dri/i965/brw_sf.c
src/mesa/drivers/dri/i965/brw_shader.cpp
src/mesa/drivers/dri/i965/brw_vec4.cpp
src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
src/mesa/drivers/dri/i965/brw_vs.c
src/mesa/drivers/dri/i965/gen8_fs_generator.cpp
src/mesa/drivers/dri/i965/gen8_generator.cpp
src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp

index 39a15edfd8f2ea68dab318a1cca968d9cdd06861..acdc9c7a7b470dd9a0ff09463389d0ef70259610 100644 (file)
@@ -629,7 +629,7 @@ public:
                           const brw_blorp_blit_prog_key *key);
 
    const GLuint *compile(struct brw_context *brw, GLuint *program_size,
-                         FILE *dump_file = stdout);
+                         FILE *dump_file = stderr);
 
    brw_blorp_prog_data prog_data;
 
@@ -2255,7 +2255,7 @@ brw_blorp_blit_params::get_wm_prog(struct brw_context *brw,
                          &prog_offset, prog_data)) {
       brw_blorp_blit_program prog(brw, &this->wm_prog_key);
       GLuint program_size;
-      const GLuint *program = prog.compile(brw, &program_size, stdout);
+      const GLuint *program = prog.compile(brw, &program_size, stderr);
       brw_upload_cache(&brw->cache, BRW_BLORP_BLIT_PROG,
                        &this->wm_prog_key, sizeof(this->wm_prog_key),
                        program, program_size,
index 5b652add1e4f382ab74f47b02efb43b67193d1ea..38969d8a920ad9fa1ee1933acd2cb23405107dbb 100644 (file)
@@ -42,9 +42,9 @@ brw_blorp_eu_emitter::get_program(unsigned *program_size, FILE *dump_file)
    const unsigned *res;
 
    if (unlikely(INTEL_DEBUG & DEBUG_BLORP)) {
-      printf("Native code for BLORP blit:\n");
+      fprintf(stderr, "Native code for BLORP blit:\n");
       res = generator.generate_assembly(NULL, &insts, program_size, dump_file);
-      printf("\n");
+      fprintf(stderr, "\n");
    } else {
       res = generator.generate_assembly(NULL, &insts, program_size);
    }
index 9159df5978c932e0b1a74de127091ac95fca1c3d..76f82997fbe0b02badcc226fd8d33d34b6617278 100644 (file)
@@ -486,9 +486,9 @@ brw_blorp_const_color_program::compile(struct brw_context *brw,
                 false /* header present */);
 
    if (unlikely(INTEL_DEBUG & DEBUG_BLORP)) {
-      printf("Native code for BLORP clear:\n");
-      brw_dump_compile(&func, stdout, 0, func.next_insn_offset);
-      printf("\n");
+      fprintf(stderr, "Native code for BLORP clear:\n");
+      brw_dump_compile(&func, stderr, 0, func.next_insn_offset);
+      fprintf(stderr, "\n");
    }
    return brw_get_program(&func, program_size);
 }
index 32ba4a4cdcc5b0a8e1791b065fbdf26bd4b1dcd2..53281c6faa0dfa0aa2d372dd5662e926748917e1 100644 (file)
@@ -71,7 +71,7 @@ bblock_t::dump(backend_visitor *v)
    for (backend_instruction *inst = (backend_instruction *)this->start;
        inst != this->end->next;
        inst = (backend_instruction *) inst->next) {
-      printf("%5d: ", ip);
+      fprintf(stderr, "%5d: ", ip);
       v->dump_instruction(inst);
       ip++;
    }
@@ -297,18 +297,20 @@ cfg_t::dump(backend_visitor *v)
 {
    for (int b = 0; b < this->num_blocks; b++) {
         bblock_t *block = this->blocks[b];
-      printf("START B%d", b);
+      fprintf(stderr, "START B%d", b);
       foreach_list(node, &block->parents) {
          bblock_link *link = (bblock_link *)node;
-         printf(" <-B%d", link->block->block_num);
+         fprintf(stderr, " <-B%d",
+                 link->block->block_num);
       }
-      printf("\n");
+      fprintf(stderr, "\n");
       block->dump(v);
-      printf("END B%d", b);
+      fprintf(stderr, "END B%d", b);
       foreach_list(node, &block->children) {
          bblock_link *link = (bblock_link *)node;
-         printf(" ->B%d", link->block->block_num);
+         fprintf(stderr, " ->B%d",
+                 link->block->block_num);
       }
-      printf("\n");
+      fprintf(stderr, "\n");
    }
 }
index 3a4442f7be7de8ad19c924afc445bca61acc56f2..c32bf5c0e7cb8b0bdc496fc0767361b7dde81458 100644 (file)
@@ -118,11 +118,11 @@ static void compile_clip_prog( struct brw_context *brw,
    program = brw_get_program(&c.func, &program_size);
 
    if (unlikely(INTEL_DEBUG & DEBUG_CLIP)) {
-      printf("clip:\n");
+      fprintf(stderr, "clip:\n");
       for (i = 0; i < program_size / sizeof(struct brw_instruction); i++)
-        brw_disasm(stdout, &((struct brw_instruction *)program)[i],
+        brw_disasm(stderr, &((struct brw_instruction *)program)[i],
                    brw->gen);
-      printf("\n");
+      fprintf(stderr, "\n");
    }
 
    brw_upload_cache(&brw->cache,
index fa43444d5d13c8f3af4137b609a0c3a75bde9368..f619045e120129e1ba0e2b953672482505b52de3 100644 (file)
@@ -785,8 +785,8 @@ brw_compact_instructions(struct brw_compile *p)
    p->nr_insn = p->next_insn_offset / 16;
 
    if (0) {
-      fprintf(stdout, "dumping compacted program\n");
-      brw_dump_compile(p, stdout, 0, p->next_insn_offset);
+      fprintf(stderr, "dumping compacted program\n");
+      brw_dump_compile(p, stderr, 0, p->next_insn_offset);
 
       int cmp = 0;
       for (offset = 0; offset < p->next_insn_offset;) {
index 109c7dc3719a88814020f522aee8dd570c2bbee2..27cf0f6f2f18c72100b680affc49e280cbf5b338 100644 (file)
@@ -2987,11 +2987,11 @@ fs_visitor::dump_instructions()
    foreach_list(node, &this->instructions) {
       backend_instruction *inst = (backend_instruction *)node;
       max_pressure = MAX2(max_pressure, regs_live_at_ip[ip]);
-      printf("{%3d} %4d: ", regs_live_at_ip[ip], ip);
+      fprintf(stderr, "{%3d} %4d: ", regs_live_at_ip[ip], ip);
       dump_instruction(inst);
       ++ip;
    }
-   printf("Maximum %3d registers live at once.\n", max_pressure);
+   fprintf(stderr, "Maximum %3d registers live at once.\n", max_pressure);
 }
 
 void
@@ -3000,174 +3000,175 @@ fs_visitor::dump_instruction(backend_instruction *be_inst)
    fs_inst *inst = (fs_inst *)be_inst;
 
    if (inst->predicate) {
-      printf("(%cf0.%d) ",
+      fprintf(stderr, "(%cf0.%d) ",
              inst->predicate_inverse ? '-' : '+',
              inst->flag_subreg);
    }
 
-   printf("%s", brw_instruction_name(inst->opcode));
+   fprintf(stderr, "%s", brw_instruction_name(inst->opcode));
    if (inst->saturate)
-      printf(".sat");
+      fprintf(stderr, ".sat");
    if (inst->conditional_mod) {
-      printf("%s", conditional_modifier[inst->conditional_mod]);
+      fprintf(stderr, "%s", conditional_modifier[inst->conditional_mod]);
       if (!inst->predicate &&
           (brw->gen < 5 || (inst->opcode != BRW_OPCODE_SEL &&
                               inst->opcode != BRW_OPCODE_IF &&
                               inst->opcode != BRW_OPCODE_WHILE))) {
-         printf(".f0.%d", inst->flag_subreg);
+         fprintf(stderr, ".f0.%d", inst->flag_subreg);
       }
    }
-   printf(" ");
+   fprintf(stderr, " ");
 
 
    switch (inst->dst.file) {
    case GRF:
-      printf("vgrf%d", inst->dst.reg);
+      fprintf(stderr, "vgrf%d", inst->dst.reg);
       if (virtual_grf_sizes[inst->dst.reg] != 1 ||
           inst->dst.subreg_offset)
-         printf("+%d.%d", inst->dst.reg_offset, inst->dst.subreg_offset);
+         fprintf(stderr, "+%d.%d",
+                 inst->dst.reg_offset, inst->dst.subreg_offset);
       break;
    case MRF:
-      printf("m%d", inst->dst.reg);
+      fprintf(stderr, "m%d", inst->dst.reg);
       break;
    case BAD_FILE:
-      printf("(null)");
+      fprintf(stderr, "(null)");
       break;
    case UNIFORM:
-      printf("***u%d***", inst->dst.reg);
+      fprintf(stderr, "***u%d***", inst->dst.reg);
       break;
    case HW_REG:
       if (inst->dst.fixed_hw_reg.file == BRW_ARCHITECTURE_REGISTER_FILE) {
          switch (inst->dst.fixed_hw_reg.nr) {
          case BRW_ARF_NULL:
-            printf("null");
+            fprintf(stderr, "null");
             break;
          case BRW_ARF_ADDRESS:
-            printf("a0.%d", inst->dst.fixed_hw_reg.subnr);
+            fprintf(stderr, "a0.%d", inst->dst.fixed_hw_reg.subnr);
             break;
          case BRW_ARF_ACCUMULATOR:
-            printf("acc%d", inst->dst.fixed_hw_reg.subnr);
+            fprintf(stderr, "acc%d", inst->dst.fixed_hw_reg.subnr);
             break;
          case BRW_ARF_FLAG:
-            printf("f%d.%d", inst->dst.fixed_hw_reg.nr & 0xf,
+            fprintf(stderr, "f%d.%d", inst->dst.fixed_hw_reg.nr & 0xf,
                              inst->dst.fixed_hw_reg.subnr);
             break;
          default:
-            printf("arf%d.%d", inst->dst.fixed_hw_reg.nr & 0xf,
+            fprintf(stderr, "arf%d.%d", inst->dst.fixed_hw_reg.nr & 0xf,
                                inst->dst.fixed_hw_reg.subnr);
             break;
          }
       } else {
-         printf("hw_reg%d", inst->dst.fixed_hw_reg.nr);
+         fprintf(stderr, "hw_reg%d", inst->dst.fixed_hw_reg.nr);
       }
       if (inst->dst.fixed_hw_reg.subnr)
-         printf("+%d", inst->dst.fixed_hw_reg.subnr);
+         fprintf(stderr, "+%d", inst->dst.fixed_hw_reg.subnr);
       break;
    default:
-      printf("???");
+      fprintf(stderr, "???");
       break;
    }
-   printf(":%s, ", reg_encoding[inst->dst.type]);
+   fprintf(stderr, ":%s, ", reg_encoding[inst->dst.type]);
 
    for (int i = 0; i < 3 && inst->src[i].file != BAD_FILE; i++) {
       if (inst->src[i].negate)
-         printf("-");
+         fprintf(stderr, "-");
       if (inst->src[i].abs)
-         printf("|");
+         fprintf(stderr, "|");
       switch (inst->src[i].file) {
       case GRF:
-         printf("vgrf%d", inst->src[i].reg);
+         fprintf(stderr, "vgrf%d", inst->src[i].reg);
          if (virtual_grf_sizes[inst->src[i].reg] != 1 ||
              inst->src[i].subreg_offset)
-            printf("+%d.%d", inst->src[i].reg_offset,
-                   inst->src[i].subreg_offset);
+            fprintf(stderr, "+%d.%d", inst->src[i].reg_offset,
+                    inst->src[i].subreg_offset);
          break;
       case MRF:
-         printf("***m%d***", inst->src[i].reg);
+         fprintf(stderr, "***m%d***", inst->src[i].reg);
          break;
       case UNIFORM:
-         printf("u%d", inst->src[i].reg);
+         fprintf(stderr, "u%d", inst->src[i].reg);
          if (virtual_grf_sizes[inst->src[i].reg] != 1 ||
              inst->src[i].subreg_offset)
-            printf("+%d.%d", inst->src[i].reg_offset,
-                   inst->src[i].subreg_offset);
+            fprintf(stderr, "+%d.%d", inst->src[i].reg_offset,
+                    inst->src[i].subreg_offset);
          break;
       case BAD_FILE:
-         printf("(null)");
+         fprintf(stderr, "(null)");
          break;
       case IMM:
          switch (inst->src[i].type) {
          case BRW_REGISTER_TYPE_F:
-            printf("%ff", inst->src[i].imm.f);
+            fprintf(stderr, "%ff", inst->src[i].imm.f);
             break;
          case BRW_REGISTER_TYPE_D:
-            printf("%dd", inst->src[i].imm.i);
+            fprintf(stderr, "%dd", inst->src[i].imm.i);
             break;
          case BRW_REGISTER_TYPE_UD:
-            printf("%uu", inst->src[i].imm.u);
+            fprintf(stderr, "%uu", inst->src[i].imm.u);
             break;
          default:
-            printf("???");
+            fprintf(stderr, "???");
             break;
          }
          break;
       case HW_REG:
          if (inst->src[i].fixed_hw_reg.negate)
-            printf("-");
+            fprintf(stderr, "-");
          if (inst->src[i].fixed_hw_reg.abs)
-            printf("|");
+            fprintf(stderr, "|");
          if (inst->src[i].fixed_hw_reg.file == BRW_ARCHITECTURE_REGISTER_FILE) {
             switch (inst->src[i].fixed_hw_reg.nr) {
             case BRW_ARF_NULL:
-               printf("null");
+               fprintf(stderr, "null");
                break;
             case BRW_ARF_ADDRESS:
-               printf("a0.%d", inst->src[i].fixed_hw_reg.subnr);
+               fprintf(stderr, "a0.%d", inst->src[i].fixed_hw_reg.subnr);
                break;
             case BRW_ARF_ACCUMULATOR:
-               printf("acc%d", inst->src[i].fixed_hw_reg.subnr);
+               fprintf(stderr, "acc%d", inst->src[i].fixed_hw_reg.subnr);
                break;
             case BRW_ARF_FLAG:
-               printf("f%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf,
+               fprintf(stderr, "f%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf,
                                 inst->src[i].fixed_hw_reg.subnr);
                break;
             default:
-               printf("arf%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf,
+               fprintf(stderr, "arf%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf,
                                   inst->src[i].fixed_hw_reg.subnr);
                break;
             }
          } else {
-            printf("hw_reg%d", inst->src[i].fixed_hw_reg.nr);
+            fprintf(stderr, "hw_reg%d", inst->src[i].fixed_hw_reg.nr);
          }
          if (inst->src[i].fixed_hw_reg.subnr)
-            printf("+%d", inst->src[i].fixed_hw_reg.subnr);
+            fprintf(stderr, "+%d", inst->src[i].fixed_hw_reg.subnr);
          if (inst->src[i].fixed_hw_reg.abs)
-            printf("|");
+            fprintf(stderr, "|");
          break;
       default:
-         printf("???");
+         fprintf(stderr, "???");
          break;
       }
       if (inst->src[i].abs)
-         printf("|");
+         fprintf(stderr, "|");
 
       if (inst->src[i].file != IMM) {
-         printf(":%s", brw_reg_type_letters(inst->src[i].type));
+         fprintf(stderr, ":%s", brw_reg_type_letters(inst->src[i].type));
       }
 
       if (i < 2 && inst->src[i + 1].file != BAD_FILE)
-         printf(", ");
+         fprintf(stderr, ", ");
    }
 
-   printf(" ");
+   fprintf(stderr, " ");
 
    if (inst->force_uncompressed)
-      printf("1sthalf ");
+      fprintf(stderr, "1sthalf ");
 
    if (inst->force_sechalf)
-      printf("2ndhalf ");
+      fprintf(stderr, "2ndhalf ");
 
-   printf("\n");
+   fprintf(stderr, "\n");
 }
 
 /**
index e154441279cbf762e3993828c89470569c83003b..ae5bc566606de58fbdc02e6d9a8f6a7b5548f067 100644 (file)
@@ -307,8 +307,8 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
    case ir_binop_logic_and:
    case ir_binop_logic_xor:
    case ir_binop_logic_or:
-      ir->print();
-      printf("\n");
+      ir->fprint(stderr);
+      fprintf(stderr, "\n");
       assert(!"not reached: expression operates on scalars only");
       break;
    case ir_binop_all_equal:
index a145923396d64cd61cca886c853d96fc2ec6b18a..2816d3c14ee4adf87fa988b76171cfab35a2e469 100644 (file)
@@ -250,26 +250,26 @@ fs_copy_prop_dataflow::dump_block_data() const
 {
    for (int b = 0; b < cfg->num_blocks; b++) {
       bblock_t *block = cfg->blocks[b];
-      printf("Block %d [%d, %d] (parents ", block->block_num,
+      fprintf(stderr, "Block %d [%d, %d] (parents ", block->block_num,
              block->start_ip, block->end_ip);
       foreach_list(block_node, &block->parents) {
          bblock_t *parent = ((bblock_link *) block_node)->block;
-         printf("%d ", parent->block_num);
+         fprintf(stderr, "%d ", parent->block_num);
       }
-      printf("):\n");
-      printf("       livein = 0x");
+      fprintf(stderr, "):\n");
+      fprintf(stderr, "       livein = 0x");
       for (int i = 0; i < bitset_words; i++)
-         printf("%08x", bd[b].livein[i]);
-      printf(", liveout = 0x");
+         fprintf(stderr, "%08x", bd[b].livein[i]);
+      fprintf(stderr, ", liveout = 0x");
       for (int i = 0; i < bitset_words; i++)
-         printf("%08x", bd[b].liveout[i]);
-      printf(",\n       copy   = 0x");
+         fprintf(stderr, "%08x", bd[b].liveout[i]);
+      fprintf(stderr, ",\n       copy   = 0x");
       for (int i = 0; i < bitset_words; i++)
-         printf("%08x", bd[b].copy[i]);
-      printf(", kill    = 0x");
+         fprintf(stderr, "%08x", bd[b].copy[i]);
+      fprintf(stderr, ", kill    = 0x");
       for (int i = 0; i < bitset_words; i++)
-         printf("%08x", bd[b].kill[i]);
-      printf("\n");
+         fprintf(stderr, "%08x", bd[b].kill[i]);
+      fprintf(stderr, "\n");
    }
 }
 
index 104c0693b81d885c80419af1e27005aefc93e5c8..748a2e2db12b3ebc5180d01288ef519e8f95eb83 100644 (file)
@@ -1326,15 +1326,17 @@ fs_generator::generate_code(exec_list *instructions, FILE *dump_file)
 
    if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
       if (prog) {
-         printf("Native code for %s fragment shader %d (SIMD%d dispatch):\n",
-                prog->Label ? prog->Label : "unnamed",
-                prog->Name, dispatch_width);
+         fprintf(stderr,
+                 "Native code for %s fragment shader %d (SIMD%d dispatch):\n",
+                 prog->Label ? prog->Label : "unnamed",
+                 prog->Name, dispatch_width);
       } else if (fp) {
-         printf("Native code for fragment program %d (SIMD%d dispatch):\n",
-                fp->Base.Id, dispatch_width);
+         fprintf(stderr,
+                 "Native code for fragment program %d (SIMD%d dispatch):\n",
+                 fp->Base.Id, dispatch_width);
       } else {
-         printf("Native code for blorp program (SIMD%d dispatch):\n",
-                dispatch_width);
+         fprintf(stderr, "Native code for blorp program (SIMD%d dispatch):\n",
+                 dispatch_width);
       }
    }
 
@@ -1352,38 +1354,39 @@ fs_generator::generate_code(exec_list *instructions, FILE *dump_file)
            bblock_t *block = link->block;
 
            if (block->start == inst) {
-              printf("   START B%d", block->block_num);
+              fprintf(stderr, "   START B%d", block->block_num);
               foreach_list(predecessor_node, &block->parents) {
                  bblock_link *predecessor_link =
                     (bblock_link *)predecessor_node;
                  bblock_t *predecessor_block = predecessor_link->block;
-                 printf(" <-B%d", predecessor_block->block_num);
+                 fprintf(stderr, " <-B%d", predecessor_block->block_num);
               }
-              printf("\n");
+              fprintf(stderr, "\n");
            }
         }
 
         if (last_annotation_ir != inst->ir) {
            last_annotation_ir = inst->ir;
            if (last_annotation_ir) {
-              printf("   ");
+              fprintf(stderr, "   ");
                if (prog)
-                  ((ir_instruction *)inst->ir)->print();
+                  ((ir_instruction *)inst->ir)->fprint(stderr);
                else {
                   const prog_instruction *fpi;
                   fpi = (const prog_instruction *)inst->ir;
-                  printf("%d: ", (int)(fpi - (fp ? fp->Base.Instructions : 0)));
-                  _mesa_fprint_instruction_opt(stdout,
+                  fprintf(stderr, "%d: ",
+                          (int)(fpi - (fp ? fp->Base.Instructions : 0)));
+                  _mesa_fprint_instruction_opt(stderr,
                                                fpi,
                                                0, PROG_PRINT_DEBUG, NULL);
                }
-              printf("\n");
+              fprintf(stderr, "\n");
            }
         }
         if (last_annotation_string != inst->annotation) {
            last_annotation_string = inst->annotation;
            if (last_annotation_string)
-              printf("   %s\n", last_annotation_string);
+              fprintf(stderr, "   %s\n", last_annotation_string);
         }
       }
 
@@ -1801,7 +1804,7 @@ fs_generator::generate_code(exec_list *instructions, FILE *dump_file)
       }
 
       if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
-        brw_dump_compile(p, stdout,
+        brw_dump_compile(p, stderr,
                          last_native_insn_offset, p->next_insn_offset);
 
         foreach_list(node, &cfg->block_list) {
@@ -1809,14 +1812,14 @@ fs_generator::generate_code(exec_list *instructions, FILE *dump_file)
            bblock_t *block = link->block;
 
            if (block->end == inst) {
-              printf("   END B%d", block->block_num);
+              fprintf(stderr, "   END B%d", block->block_num);
               foreach_list(successor_node, &block->children) {
                  bblock_link *successor_link =
                     (bblock_link *)successor_node;
                  bblock_t *successor_block = successor_link->block;
-                 printf(" ->B%d", successor_block->block_num);
+                 fprintf(stderr, " ->B%d", successor_block->block_num);
               }
-              printf("\n");
+              fprintf(stderr, "\n");
            }
         }
       }
@@ -1825,7 +1828,7 @@ fs_generator::generate_code(exec_list *instructions, FILE *dump_file)
    }
 
    if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
-      printf("\n");
+      fprintf(stderr, "\n");
    }
 
    brw_set_uip_jip(p);
index ff7aa80551268ab79a4b7cbc13523214418404c9..78dcc3e2d84dc134e13f890bd28d6c4fe7c91cbd 100644 (file)
@@ -318,7 +318,7 @@ ir_vector_splitting_visitor::visit_leave(ir_assignment *ir)
         elem = 3;
         break;
       default:
-        ir->print();
+        ir->fprint(stderr);
         assert(!"not reached: non-channelwise dereference of LHS.");
       }
 
@@ -347,9 +347,9 @@ brw_do_vector_splitting(exec_list *instructions)
       variable_entry *entry = (variable_entry *)node;
 
       if (debug) {
-        printf("vector %s@%p: decl %d, whole_access %d\n",
-               entry->var->name, (void *) entry->var, entry->declaration,
-               entry->whole_vector_access);
+        fprintf(stderr, "vector %s@%p: decl %d, whole_access %d\n",
+                 entry->var->name, (void *) entry->var, entry->declaration,
+                 entry->whole_vector_access);
       }
 
       if (!entry->declaration || entry->whole_vector_access) {
index 9b090be7bde62831187f8fb98af892a0e866dd41..6dcdd28bcac5fd62b492ee447637c17dc72194ca 100644 (file)
@@ -349,8 +349,8 @@ fs_visitor::visit(ir_expression *ir)
       ir->operands[operand]->accept(this);
       if (this->result.file == BAD_FILE) {
         fail("Failed to get tree for expression operand:\n");
-        ir->operands[operand]->print();
-         printf("\n");
+        ir->operands[operand]->fprint(stderr);
+         fprintf(stderr, "\n");
       }
       assert(this->result.is_valid_3src());
       op[operand] = this->result;
index 3e1ed730b60598695f8e3b9b8b31d8943eee83b5..bd5bf14cde18da37a17bbbaa31d8459a89246ccc 100644 (file)
@@ -135,11 +135,11 @@ static void compile_ff_gs_prog(struct brw_context *brw,
    if (unlikely(INTEL_DEBUG & DEBUG_GS)) {
       int i;
 
-      printf("gs:\n");
+      fprintf(stderr, "gs:\n");
       for (i = 0; i < program_size / sizeof(struct brw_instruction); i++)
-        brw_disasm(stdout, &((struct brw_instruction *)program)[i],
+        brw_disasm(stderr, &((struct brw_instruction *)program)[i],
                    brw->gen);
-      printf("\n");
+      fprintf(stderr, "\n");
     }
 
    brw_upload_cache(&brw->cache, BRW_FF_GS_PROG,
index 4a86e80208973177a6fb7f0f9b544cb2e91f02eb..447e95406cea85ae3f0e022dad644a5eae205c8a 100644 (file)
@@ -592,12 +592,13 @@ brw_dump_ir(struct brw_context *brw, const char *stage,
             struct gl_shader *shader, struct gl_program *prog)
 {
    if (shader_prog) {
-      printf("GLSL IR for native %s shader %d:\n", stage, shader_prog->Name);
-      _mesa_print_ir(stdout, shader->ir, NULL);
-      printf("\n\n");
+      fprintf(stderr,
+              "GLSL IR for native %s shader %d:\n", stage, shader_prog->Name);
+      _mesa_print_ir(stderr, shader->ir, NULL);
+      fprintf(stderr, "\n\n");
    } else {
-      printf("ARB_%s_program %d ir for native %s shader\n",
-             stage, prog->Id, stage);
+      fprintf(stderr, "ARB_%s_program %d ir for native %s shader\n",
+              stage, prog->Id, stage);
       _mesa_print_program(prog);
    }
 }
index a61bbab613b95b8176a730eaf890f5302d54863c..32f30ba33d94eb629880c929408e66a88aba8b62 100644 (file)
@@ -1320,7 +1320,7 @@ instruction_scheduler::schedule_instructions(backend_instruction *next_block_hea
       time = MAX2(time, chosen->unblocked_time);
 
       if (debug) {
-         printf("clock %4d, scheduled: ", time);
+         fprintf(stderr, "clock %4d, scheduled: ", time);
          bv->dump_instruction(chosen->inst);
       }
 
@@ -1336,7 +1336,7 @@ instruction_scheduler::schedule_instructions(backend_instruction *next_block_hea
                                      time + chosen->child_latency[i]);
 
          if (debug) {
-            printf("\tchild %d, %d parents: ", i, child->parent_count);
+            fprintf(stderr, "\tchild %d, %d parents: ", i, child->parent_count);
             bv->dump_instruction(child->inst);
          }
 
@@ -1344,7 +1344,7 @@ instruction_scheduler::schedule_instructions(backend_instruction *next_block_hea
         child->parent_count--;
         if (child->parent_count == 0) {
             if (debug) {
-               printf("\t\tnow available\n");
+               fprintf(stderr, "\t\tnow available\n");
             }
            instructions.push_head(child);
         }
@@ -1377,7 +1377,8 @@ instruction_scheduler::run(exec_list *all_instructions)
       (backend_instruction *)all_instructions->head;
 
    if (debug) {
-      printf("\nInstructions before scheduling (reg_alloc %d)\n", post_reg_alloc);
+      fprintf(stderr, "\nInstructions before scheduling (reg_alloc %d)\n",
+              post_reg_alloc);
       bv->dump_instructions();
    }
 
@@ -1411,7 +1412,8 @@ instruction_scheduler::run(exec_list *all_instructions)
    }
 
    if (debug) {
-      printf("\nInstructions after scheduling (reg_alloc %d)\n", post_reg_alloc);
+      fprintf(stderr, "\nInstructions after scheduling (reg_alloc %d)\n",
+              post_reg_alloc);
       bv->dump_instructions();
    }
 }
@@ -1429,7 +1431,7 @@ fs_visitor::schedule_instructions(instruction_scheduler_mode mode)
    sched.run(&instructions);
 
    if (unlikely(INTEL_DEBUG & DEBUG_WM) && mode == SCHEDULE_POST) {
-      printf("fs%d estimated execution time: %d cycles\n",
+      fprintf(stderr, "fs%d estimated execution time: %d cycles\n",
              dispatch_width, sched.time);
    }
 
@@ -1443,7 +1445,7 @@ vec4_visitor::opt_schedule_instructions()
    sched.run(&instructions);
 
    if (unlikely(debug_flag)) {
-      printf("vec4 estimated execution time: %d cycles\n", sched.time);
+      fprintf(stderr, "vec4 estimated execution time: %d cycles\n", sched.time);
    }
 
    invalidate_live_intervals();
index 29838f53a231f3280a5bba474467c78e719837f7..7714aaed9a26dace01dce8849307fab7826c17ed 100644 (file)
@@ -115,11 +115,11 @@ static void compile_sf_prog( struct brw_context *brw,
    program = brw_get_program(&c.func, &program_size);
 
    if (unlikely(INTEL_DEBUG & DEBUG_SF)) {
-      printf("sf:\n");
+      fprintf(stderr, "sf:\n");
       for (i = 0; i < program_size / sizeof(struct brw_instruction); i++)
-        brw_disasm(stdout, &((struct brw_instruction *)program)[i],
+        brw_disasm(stderr, &((struct brw_instruction *)program)[i],
                    brw->gen);
-      printf("\n");
+      fprintf(stderr, "\n");
    }
 
    brw_upload_cache(&brw->cache, BRW_SF_PROG,
index 48ad8ac12d6566532ff5747de2266123aed79930..643c140aa7cd64c4db0db1c546843fb6348dac56 100644 (file)
@@ -251,12 +251,12 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
       _mesa_reference_program(ctx, &prog, NULL);
 
       if (ctx->Shader.Flags & GLSL_DUMP) {
-         printf("\n");
-         printf("GLSL IR for linked %s program %d:\n",
-                _mesa_shader_stage_to_string(shader->base.Stage),
-                shProg->Name);
-         _mesa_print_ir(stdout, shader->base.ir, NULL);
-         printf("\n");
+         fprintf(stderr, "\n");
+         fprintf(stderr, "GLSL IR for linked %s program %d:\n",
+                 _mesa_shader_stage_to_string(shader->base.Stage),
+                 shProg->Name);
+         _mesa_print_ir(stderr, shader->base.ir, NULL);
+         fprintf(stderr, "\n");
       }
    }
 
@@ -266,12 +266,11 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
          if (!sh)
             continue;
 
-         printf("GLSL %s shader %d source for linked program %d:\n",
-                _mesa_shader_stage_to_string(sh->Stage),
-                i,
-                shProg->Name);
-         printf("%s", sh->Source);
-         printf("\n");
+         fprintf(stderr, "GLSL %s shader %d source for linked program %d:\n",
+                 _mesa_shader_stage_to_string(sh->Stage),
+                 i, shProg->Name);
+         fprintf(stderr, "%s", sh->Source);
+         fprintf(stderr, "\n");
       }
    }
 
@@ -668,7 +667,7 @@ backend_visitor::dump_instructions()
    int ip = 0;
    foreach_list(node, &this->instructions) {
       backend_instruction *inst = (backend_instruction *)node;
-      printf("%d: ", ip++);
+      fprintf(stderr, "%d: ", ip++);
       dump_instruction(inst);
    }
 }
index 8dda34813a8ef0c74e4ffc62dece691c928f4518..fcb7365c5d11decfd7771921782629cf9f510f2a 100644 (file)
@@ -1121,161 +1121,161 @@ vec4_visitor::dump_instruction(backend_instruction *be_inst)
 {
    vec4_instruction *inst = (vec4_instruction *)be_inst;
 
-   printf("%s", brw_instruction_name(inst->opcode));
+   fprintf(stderr, "%s", brw_instruction_name(inst->opcode));
    if (inst->conditional_mod) {
-      printf("%s", conditional_modifier[inst->conditional_mod]);
+      fprintf(stderr, "%s", conditional_modifier[inst->conditional_mod]);
    }
-   printf(" ");
+   fprintf(stderr, " ");
 
    switch (inst->dst.file) {
    case GRF:
-      printf("vgrf%d.%d", inst->dst.reg, inst->dst.reg_offset);
+      fprintf(stderr, "vgrf%d.%d", inst->dst.reg, inst->dst.reg_offset);
       break;
    case MRF:
-      printf("m%d", inst->dst.reg);
+      fprintf(stderr, "m%d", inst->dst.reg);
       break;
    case HW_REG:
       if (inst->dst.fixed_hw_reg.file == BRW_ARCHITECTURE_REGISTER_FILE) {
          switch (inst->dst.fixed_hw_reg.nr) {
          case BRW_ARF_NULL:
-            printf("null");
+            fprintf(stderr, "null");
             break;
          case BRW_ARF_ADDRESS:
-            printf("a0.%d", inst->dst.fixed_hw_reg.subnr);
+            fprintf(stderr, "a0.%d", inst->dst.fixed_hw_reg.subnr);
             break;
          case BRW_ARF_ACCUMULATOR:
-            printf("acc%d", inst->dst.fixed_hw_reg.subnr);
+            fprintf(stderr, "acc%d", inst->dst.fixed_hw_reg.subnr);
             break;
          case BRW_ARF_FLAG:
-            printf("f%d.%d", inst->dst.fixed_hw_reg.nr & 0xf,
+            fprintf(stderr, "f%d.%d", inst->dst.fixed_hw_reg.nr & 0xf,
                              inst->dst.fixed_hw_reg.subnr);
             break;
          default:
-            printf("arf%d.%d", inst->dst.fixed_hw_reg.nr & 0xf,
+            fprintf(stderr, "arf%d.%d", inst->dst.fixed_hw_reg.nr & 0xf,
                                inst->dst.fixed_hw_reg.subnr);
             break;
          }
       } else {
-         printf("hw_reg%d", inst->dst.fixed_hw_reg.nr);
+         fprintf(stderr, "hw_reg%d", inst->dst.fixed_hw_reg.nr);
       }
       if (inst->dst.fixed_hw_reg.subnr)
-         printf("+%d", inst->dst.fixed_hw_reg.subnr);
+         fprintf(stderr, "+%d", inst->dst.fixed_hw_reg.subnr);
       break;
    case BAD_FILE:
-      printf("(null)");
+      fprintf(stderr, "(null)");
       break;
    default:
-      printf("???");
+      fprintf(stderr, "???");
       break;
    }
    if (inst->dst.writemask != WRITEMASK_XYZW) {
-      printf(".");
+      fprintf(stderr, ".");
       if (inst->dst.writemask & 1)
-         printf("x");
+         fprintf(stderr, "x");
       if (inst->dst.writemask & 2)
-         printf("y");
+         fprintf(stderr, "y");
       if (inst->dst.writemask & 4)
-         printf("z");
+         fprintf(stderr, "z");
       if (inst->dst.writemask & 8)
-         printf("w");
+         fprintf(stderr, "w");
    }
-   printf(":%s, ", brw_reg_type_letters(inst->dst.type));
+   fprintf(stderr, ":%s, ", brw_reg_type_letters(inst->dst.type));
 
    for (int i = 0; i < 3 && inst->src[i].file != BAD_FILE; i++) {
       if (inst->src[i].negate)
-         printf("-");
+         fprintf(stderr, "-");
       if (inst->src[i].abs)
-         printf("|");
+         fprintf(stderr, "|");
       switch (inst->src[i].file) {
       case GRF:
-         printf("vgrf%d", inst->src[i].reg);
+         fprintf(stderr, "vgrf%d", inst->src[i].reg);
          break;
       case ATTR:
-         printf("attr%d", inst->src[i].reg);
+         fprintf(stderr, "attr%d", inst->src[i].reg);
          break;
       case UNIFORM:
-         printf("u%d", inst->src[i].reg);
+         fprintf(stderr, "u%d", inst->src[i].reg);
          break;
       case IMM:
          switch (inst->src[i].type) {
          case BRW_REGISTER_TYPE_F:
-            printf("%fF", inst->src[i].imm.f);
+            fprintf(stderr, "%fF", inst->src[i].imm.f);
             break;
          case BRW_REGISTER_TYPE_D:
-            printf("%dD", inst->src[i].imm.i);
+            fprintf(stderr, "%dD", inst->src[i].imm.i);
             break;
          case BRW_REGISTER_TYPE_UD:
-            printf("%uU", inst->src[i].imm.u);
+            fprintf(stderr, "%uU", inst->src[i].imm.u);
             break;
          default:
-            printf("???");
+            fprintf(stderr, "???");
             break;
          }
          break;
       case HW_REG:
          if (inst->src[i].fixed_hw_reg.negate)
-            printf("-");
+            fprintf(stderr, "-");
          if (inst->src[i].fixed_hw_reg.abs)
-            printf("|");
+            fprintf(stderr, "|");
          if (inst->src[i].fixed_hw_reg.file == BRW_ARCHITECTURE_REGISTER_FILE) {
             switch (inst->src[i].fixed_hw_reg.nr) {
             case BRW_ARF_NULL:
-               printf("null");
+               fprintf(stderr, "null");
                break;
             case BRW_ARF_ADDRESS:
-               printf("a0.%d", inst->src[i].fixed_hw_reg.subnr);
+               fprintf(stderr, "a0.%d", inst->src[i].fixed_hw_reg.subnr);
                break;
             case BRW_ARF_ACCUMULATOR:
-               printf("acc%d", inst->src[i].fixed_hw_reg.subnr);
+               fprintf(stderr, "acc%d", inst->src[i].fixed_hw_reg.subnr);
                break;
             case BRW_ARF_FLAG:
-               printf("f%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf,
+               fprintf(stderr, "f%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf,
                                 inst->src[i].fixed_hw_reg.subnr);
                break;
             default:
-               printf("arf%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf,
+               fprintf(stderr, "arf%d.%d", inst->src[i].fixed_hw_reg.nr & 0xf,
                                   inst->src[i].fixed_hw_reg.subnr);
                break;
             }
          } else {
-            printf("hw_reg%d", inst->src[i].fixed_hw_reg.nr);
+            fprintf(stderr, "hw_reg%d", inst->src[i].fixed_hw_reg.nr);
          }
          if (inst->src[i].fixed_hw_reg.subnr)
-            printf("+%d", inst->src[i].fixed_hw_reg.subnr);
+            fprintf(stderr, "+%d", inst->src[i].fixed_hw_reg.subnr);
          if (inst->src[i].fixed_hw_reg.abs)
-            printf("|");
+            fprintf(stderr, "|");
          break;
       case BAD_FILE:
-         printf("(null)");
+         fprintf(stderr, "(null)");
          break;
       default:
-         printf("???");
+         fprintf(stderr, "???");
          break;
       }
 
       if (virtual_grf_sizes[inst->src[i].reg] != 1)
-         printf(".%d", inst->src[i].reg_offset);
+         fprintf(stderr, ".%d", inst->src[i].reg_offset);
 
       if (inst->src[i].file != IMM) {
          static const char *chans[4] = {"x", "y", "z", "w"};
-         printf(".");
+         fprintf(stderr, ".");
          for (int c = 0; c < 4; c++) {
-            printf("%s", chans[BRW_GET_SWZ(inst->src[i].swizzle, c)]);
+            fprintf(stderr, "%s", chans[BRW_GET_SWZ(inst->src[i].swizzle, c)]);
          }
       }
 
       if (inst->src[i].abs)
-         printf("|");
+         fprintf(stderr, "|");
 
       if (inst->src[i].file != IMM) {
-         printf(":%s", reg_encoding[inst->src[i].type]);
+         fprintf(stderr, ":%s", reg_encoding[inst->src[i].type]);
       }
 
       if (i < 2 && inst->src[i + 1].file != BAD_FILE)
-         printf(", ");
+         fprintf(stderr, ", ");
    }
 
-   printf("\n");
+   fprintf(stderr, "\n");
 }
 
 
index 23c0542045b382e526a9ef58d53e7b7b7ff8e5c8..a74514f512c6b8e5069d1647ffe89b63dbdb2758 100644 (file)
@@ -1271,11 +1271,11 @@ vec4_generator::generate_code(exec_list *instructions)
 
    if (unlikely(debug_flag)) {
       if (shader_prog) {
-         printf("Native code for %s vertex shader %d:\n",
-                shader_prog->Label ? shader_prog->Label : "unnamed",
-                shader_prog->Name);
+         fprintf(stderr, "Native code for %s vertex shader %d:\n",
+                 shader_prog->Label ? shader_prog->Label : "unnamed",
+                 shader_prog->Name);
       } else {
-         printf("Native code for vertex program %d:\n", prog->Id);
+         fprintf(stderr, "Native code for vertex program %d:\n", prog->Id);
       }
    }
 
@@ -1287,23 +1287,23 @@ vec4_generator::generate_code(exec_list *instructions)
         if (last_annotation_ir != inst->ir) {
            last_annotation_ir = inst->ir;
            if (last_annotation_ir) {
-              printf("   ");
+              fprintf(stderr, "   ");
                if (shader_prog) {
-                  ((ir_instruction *) last_annotation_ir)->print();
+                  ((ir_instruction *) last_annotation_ir)->fprint(stderr);
                } else {
                   const prog_instruction *vpi;
                   vpi = (const prog_instruction *) inst->ir;
-                  printf("%d: ", (int)(vpi - prog->Instructions));
-                  _mesa_fprint_instruction_opt(stdout, vpi, 0,
+                  fprintf(stderr, "%d: ", (int)(vpi - prog->Instructions));
+                  _mesa_fprint_instruction_opt(stderr, vpi, 0,
                                                PROG_PRINT_DEBUG, NULL);
                }
-              printf("\n");
+              fprintf(stderr, "\n");
            }
         }
         if (last_annotation_string != inst->annotation) {
            last_annotation_string = inst->annotation;
            if (last_annotation_string)
-              printf("   %s\n", last_annotation_string);
+              fprintf(stderr, "   %s\n", last_annotation_string);
         }
       }
 
@@ -1336,7 +1336,7 @@ vec4_generator::generate_code(exec_list *instructions)
       }
 
       if (unlikely(debug_flag)) {
-        brw_dump_compile(p, stdout,
+        brw_dump_compile(p, stderr,
                          last_native_insn_offset, p->next_insn_offset);
       }
 
@@ -1344,7 +1344,7 @@ vec4_generator::generate_code(exec_list *instructions)
    }
 
    if (unlikely(debug_flag)) {
-      printf("\n");
+      fprintf(stderr, "\n");
    }
 
    brw_set_uip_jip(p);
@@ -1355,7 +1355,7 @@ vec4_generator::generate_code(exec_list *instructions)
     * case you're doing that.
     */
    if (0 && unlikely(debug_flag)) {
-      brw_dump_compile(p, stdout, 0, p->next_insn_offset);
+      brw_dump_compile(p, stderr, 0, p->next_insn_offset);
    }
 }
 
index 601b364b29521d06758e76f57028044e9e410143..a2f79228da0645ab6753ef2e0420236925e0c077 100644 (file)
@@ -1166,8 +1166,8 @@ vec4_visitor::visit(ir_expression *ir)
       this->result.file = BAD_FILE;
       ir->operands[operand]->accept(this);
       if (this->result.file == BAD_FILE) {
-        printf("Failed to get tree for expression operand:\n");
-        ir->operands[operand]->print();
+        fprintf(stderr, "Failed to get tree for expression operand:\n");
+        ir->operands[operand]->fprint(stderr);
         exit(1);
       }
       op[operand] = this->result;
index 3e319a650b81e177d7ad52d5e65fce41bb73bcf7..775901f56b0ee153786c0583714ab1f7fa5d2d03 100644 (file)
@@ -284,7 +284,7 @@ do_vs_prog(struct brw_context *brw,
    brw_compute_vue_map(brw, &prog_data.base.vue_map, outputs_written);
 
    if (0) {
-      _mesa_fprint_program_opt(stdout, &c.vp->program.Base, PROG_PRINT_DEBUG,
+      _mesa_fprint_program_opt(stderr, &c.vp->program.Base, PROG_PRINT_DEBUG,
                               true);
    }
 
index 96e532edf426b3051245a821dfd4bbb3819cb029..bb141485d6e166411c87fd31781e882054095df1 100644 (file)
@@ -838,15 +838,17 @@ gen8_fs_generator::generate_code(exec_list *instructions)
 
    if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
       if (prog) {
-         printf("Native code for %s fragment shader %d (SIMD%d dispatch):\n",
+         fprintf(stderr,
+                 "Native code for %s fragment shader %d (SIMD%d dispatch):\n",
                 shader_prog->Label ? shader_prog->Label : "unnamed",
                 shader_prog->Name, dispatch_width);
       } else if (fp) {
-         printf("Native code for fragment program %d (SIMD%d dispatch):\n",
-                prog->Id, dispatch_width);
+         fprintf(stderr,
+                 "Native code for fragment program %d (SIMD%d dispatch):\n",
+                 prog->Id, dispatch_width);
       } else {
-         printf("Native code for blorp program (SIMD%d dispatch):\n",
-                dispatch_width);
+         fprintf(stderr, "Native code for blorp program (SIMD%d dispatch):\n",
+                 dispatch_width);
       }
    }
 
@@ -864,38 +866,38 @@ gen8_fs_generator::generate_code(exec_list *instructions)
             bblock_t *block = link->block;
 
             if (block->start == ir) {
-               printf("   START B%d", block->block_num);
+               fprintf(stderr, "   START B%d", block->block_num);
                foreach_list(predecessor_node, &block->parents) {
                   bblock_link *predecessor_link =
                      (bblock_link *)predecessor_node;
                   bblock_t *predecessor_block = predecessor_link->block;
-                  printf(" <-B%d", predecessor_block->block_num);
+                  fprintf(stderr, " <-B%d", predecessor_block->block_num);
                }
-               printf("\n");
+               fprintf(stderr, "\n");
             }
          }
 
          if (last_annotation_ir != ir->ir) {
             last_annotation_ir = ir->ir;
             if (last_annotation_ir) {
-               printf("   ");
+               fprintf(stderr, "   ");
                if (prog) {
-                  ((ir_instruction *) ir->ir)->print();
+                  ((ir_instruction *) ir->ir)->fprint(stderr);
                } else if (prog) {
                   const prog_instruction *fpi;
                   fpi = (const prog_instruction *) ir->ir;
-                  printf("%d: ", (int)(fpi - prog->Instructions));
-                  _mesa_fprint_instruction_opt(stdout,
+                  fprintf(stderr, "%d: ", (int)(fpi - prog->Instructions));
+                  _mesa_fprint_instruction_opt(stderr,
                                                fpi,
                                                0, PROG_PRINT_DEBUG, NULL);
                }
-               printf("\n");
+               fprintf(stderr, "\n");
             }
          }
          if (last_annotation_string != ir->annotation) {
             last_annotation_string = ir->annotation;
             if (last_annotation_string)
-               printf("   %s\n", last_annotation_string);
+               fprintf(stderr, "   %s\n", last_annotation_string);
          }
       }
 
@@ -1239,21 +1241,21 @@ gen8_fs_generator::generate_code(exec_list *instructions)
       }
 
       if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
-         disassemble(stdout, last_native_inst_offset, next_inst_offset);
+         disassemble(stderr, last_native_inst_offset, next_inst_offset);
 
          foreach_list(node, &cfg->block_list) {
             bblock_link *link = (bblock_link *)node;
             bblock_t *block = link->block;
 
             if (block->end == ir) {
-               printf("   END B%d", block->block_num);
+               fprintf(stderr, "   END B%d", block->block_num);
                foreach_list(successor_node, &block->children) {
                   bblock_link *successor_link =
                      (bblock_link *)successor_node;
                   bblock_t *successor_block = successor_link->block;
-                  printf(" ->B%d", successor_block->block_num);
+                  fprintf(stderr, " ->B%d", successor_block->block_num);
                }
-               printf("\n");
+               fprintf(stderr, "\n");
             }
          }
       }
@@ -1262,7 +1264,7 @@ gen8_fs_generator::generate_code(exec_list *instructions)
    }
 
    if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
-      printf("\n");
+      fprintf(stderr, "\n");
    }
 
    patch_jump_targets();
index ca38af61072abd32cdcbb5f7438d8113c5bf4bcc..b082008703634e881d5f30d0413a42bfe3d83bbf 100644 (file)
@@ -626,16 +626,16 @@ gen8_generator::disassemble(FILE *out, int start, int end)
 
    for (int offset = start; offset < end; offset += 16) {
       gen8_instruction *inst = &store[offset / 16];
-      printf("0x%08x: ", offset);
+      fprintf(stderr, "0x%08x: ", offset);
 
       if (dump_hex) {
-         printf("0x%08x 0x%08x 0x%08x 0x%08x ",
-                ((uint32_t *) inst)[3],
-                ((uint32_t *) inst)[2],
-                ((uint32_t *) inst)[1],
-                ((uint32_t *) inst)[0]);
+         fprintf(stderr, "0x%08x 0x%08x 0x%08x 0x%08x ",
+                 ((uint32_t *) inst)[3],
+                 ((uint32_t *) inst)[2],
+                 ((uint32_t *) inst)[1],
+                 ((uint32_t *) inst)[0]);
       }
 
-      gen8_disassemble(stdout, inst, brw->gen);
+      gen8_disassemble(stderr, inst, brw->gen);
    }
 }
index 45393b536d7a0fab8806f10e2194342a0ba9206e..b854db542d03f19f0e5cde50d46f3e199f082e82 100644 (file)
@@ -801,11 +801,11 @@ gen8_vec4_generator::generate_code(exec_list *instructions)
 
    if (unlikely(debug_flag)) {
       if (shader_prog) {
-         printf("Native code for %s vertex shader %d:\n",
-                shader_prog->Label ? shader_prog->Label : "unnamed",
-                shader_prog->Name);
+         fprintf(stderr, "Native code for %s vertex shader %d:\n",
+                 shader_prog->Label ? shader_prog->Label : "unnamed",
+                 shader_prog->Name);
       } else {
-         printf("Native code for vertex program %d:\n", prog->Id);
+         fprintf(stderr, "Native code for vertex program %d:\n", prog->Id);
       }
    }
 
@@ -817,23 +817,23 @@ gen8_vec4_generator::generate_code(exec_list *instructions)
          if (last_annotation_ir != ir->ir) {
             last_annotation_ir = ir->ir;
             if (last_annotation_ir) {
-               printf("   ");
+               fprintf(stderr, "   ");
                if (shader_prog) {
-                  ((ir_instruction *) last_annotation_ir)->print();
+                  ((ir_instruction *) last_annotation_ir)->fprint(stderr);
                } else {
                   const prog_instruction *vpi;
                   vpi = (const prog_instruction *) ir->ir;
-                  printf("%d: ", (int)(vpi - prog->Instructions));
-                  _mesa_fprint_instruction_opt(stdout, vpi, 0,
+                  fprintf(stderr, "%d: ", (int)(vpi - prog->Instructions));
+                  _mesa_fprint_instruction_opt(stderr, vpi, 0,
                                                PROG_PRINT_DEBUG, NULL);
                }
-               printf("\n");
+               fprintf(stderr, "\n");
             }
          }
          if (last_annotation_string != ir->annotation) {
             last_annotation_string = ir->annotation;
             if (last_annotation_string)
-               printf("   %s\n", last_annotation_string);
+               fprintf(stderr, "   %s\n", last_annotation_string);
          }
       }
 
@@ -862,14 +862,14 @@ gen8_vec4_generator::generate_code(exec_list *instructions)
       }
 
       if (unlikely(debug_flag)) {
-         disassemble(stdout, last_native_inst_offset, next_inst_offset);
+         disassemble(stderr, last_native_inst_offset, next_inst_offset);
       }
 
       last_native_inst_offset = next_inst_offset;
    }
 
    if (unlikely(debug_flag)) {
-      printf("\n");
+      fprintf(stderr, "\n");
    }
 
    patch_jump_targets();
@@ -880,7 +880,7 @@ gen8_vec4_generator::generate_code(exec_list *instructions)
     * case you're doing that.
     */
    if (0 && unlikely(debug_flag)) {
-      disassemble(stdout, 0, next_inst_offset);
+      disassemble(stderr, 0, next_inst_offset);
    }
 }