IR print visitor: Remove most of the newlines from the printed output

This makes it a lot easier to read... if you have a really wide display.
This commit is contained in:
Ian Romanick
2010-03-25 18:29:25 -07:00
parent d7388f389d
commit d14642739e
2 changed files with 21 additions and 26 deletions

View File

@@ -652,6 +652,7 @@ main(int argc, char **argv)
ir_print_visitor v; ir_print_visitor v;
((ir_instruction *)iter.get())->accept(& v); ((ir_instruction *)iter.get())->accept(& v);
printf("\n");
} }
} }

View File

@@ -28,16 +28,12 @@ static void
print_type(const glsl_type *t) print_type(const glsl_type *t)
{ {
if (t->base_type == GLSL_TYPE_ARRAY) { if (t->base_type == GLSL_TYPE_ARRAY) {
printf("array\n"); printf("array (");
printf(" (");
print_type(t->fields.array); print_type(t->fields.array);
printf(")\n"); printf(") (%u))", t->length);
printf(" (%u)\n", t->length);
printf(")");
} else if (t->base_type == GLSL_TYPE_STRUCT) { } else if (t->base_type == GLSL_TYPE_STRUCT) {
printf("struct (%s %u\n", t->name ? t->name : "@", t->length); printf("struct (%s %u ", t->name ? t->name : "@", t->length);
printf(" (FINISHME: structure fields go here)\n"); printf("(FINISHME: structure fields go here) ");
printf(")"); printf(")");
} else { } else {
printf("%s", t->name); printf("%s", t->name);
@@ -63,14 +59,14 @@ void ir_print_visitor::visit(ir_variable *ir)
printf("("); printf("(");
print_type(ir->type); print_type(ir->type);
printf(") "); printf(") ");
printf("(%s))\n", ir->name); printf("(%s)) ", ir->name);
} }
} }
void ir_print_visitor::visit(ir_label *ir) void ir_print_visitor::visit(ir_label *ir)
{ {
printf("(label %s)\n", ir->label); printf("\n(label %s)", ir->label);
} }
@@ -125,19 +121,19 @@ void ir_print_visitor::visit(ir_dereference *ir)
for (unsigned i = 0; i < ir->selector.swizzle.num_components; i++) { for (unsigned i = 0; i < ir->selector.swizzle.num_components; i++) {
printf("%c", "xyzw"[swiz[i]]); printf("%c", "xyzw"[swiz[i]]);
} }
printf("))\n"); printf(")) ");
break; break;
} }
case ir_dereference::ir_reference_array: case ir_dereference::ir_reference_array:
printf("(array_ref "); printf("(array_ref ");
ir->var->accept(this); ir->var->accept(this);
ir->selector.array_index->accept(this); ir->selector.array_index->accept(this);
printf(")\n"); printf(") ");
break; break;
case ir_dereference::ir_reference_record: case ir_dereference::ir_reference_record:
printf("(record_ref "); printf("(record_ref ");
ir->var->accept(this); ir->var->accept(this);
printf("(%s))\n", ir->selector.field); printf("(%s)) ", ir->selector.field);
break; break;
} }
@@ -147,22 +143,21 @@ void ir_print_visitor::visit(ir_dereference *ir)
void ir_print_visitor::visit(ir_assignment *ir) void ir_print_visitor::visit(ir_assignment *ir)
{ {
printf("(assign\n"); printf("(assign (");
printf(" (");
if (ir->condition) if (ir->condition)
ir->condition->accept(this); ir->condition->accept(this);
else else
printf("true"); printf("true");
printf(")\n");
printf(" ("); printf(") (");
ir->lhs->accept(this); ir->lhs->accept(this);
printf(")\n");
printf(" ("); printf(") (");
ir->rhs->accept(this); ir->rhs->accept(this);
printf(")\n"); printf(") ");
} }
@@ -170,12 +165,11 @@ void ir_print_visitor::visit(ir_constant *ir)
{ {
(void) ir; (void) ir;
printf("(constant\n"); printf("(constant (");
printf(" (");
print_type(ir->type); print_type(ir->type);
printf(")\n"); printf(") ");
printf(" (FINISHME: value goes here)\n"); printf("(FINISHME: value goes here)");
printf(")\n"); printf(") ");
} }
@@ -200,5 +194,5 @@ ir_print_visitor::visit(ir_return *ir)
value->accept(this); value->accept(this);
} }
printf(")\n"); printf(")");
} }