summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-03-09 21:44:34 -0800
committerIan Romanick <ian.d.romanick@intel.com>2010-03-09 21:44:34 -0800
commitfe10250355682bcfb87d1688151b93b08d0a4e3c (patch)
tree34eabbb2a5567290b87ebcbc2645882aedee54e3
parent6044ae79a013ba6067ffd968cee97c0d29b728c2 (diff)
IR print visitor: Add some support for printing types and constants
-rw-r--r--ir_print_visitor.cpp35
1 files changed, 33 insertions, 2 deletions
diff --git a/ir_print_visitor.cpp b/ir_print_visitor.cpp
index 365ff5933e..c09de83ffd 100644
--- a/ir_print_visitor.cpp
+++ b/ir_print_visitor.cpp
@@ -22,6 +22,28 @@
*/
#include <cstdio>
#include "ir_print_visitor.h"
+#include "glsl_types.h"
+
+static void
+print_type(const glsl_type *t)
+{
+ if (t->base_type == GLSL_TYPE_ARRAY) {
+ printf("array\n");
+ printf(" (");
+ print_type(t->fields.array);
+ printf(")\n");
+
+ printf(" (%u)\n", t->length);
+ printf(")");
+ } else if (t->base_type == GLSL_TYPE_STRUCT) {
+ printf("struct (%s %u\n", t->name ? t->name : "@", t->length);
+ printf(" (FINISHME: structure fields go here)\n");
+ printf(")");
+ } else {
+ printf("%s", t->name);
+ }
+}
+
void ir_print_visitor::visit(ir_variable *ir)
{
@@ -35,7 +57,10 @@ void ir_print_visitor::visit(ir_variable *ir)
printf(" (%s%s%s%s)\n",
cent, inv, mode[ir->mode], interp[ir->interpolation]);
- printf(" (FINISHME: type goes here)\n");
+ printf(" (");
+ print_type(ir->type);
+ printf(")\n");
+
printf(" (%s)\n", ir->name);
printf(")\n");
}
@@ -98,6 +123,12 @@ void ir_print_visitor::visit(ir_assignment *ir)
void ir_print_visitor::visit(ir_constant *ir)
{
- printf("%s:%d:\n", __func__, __LINE__);
(void) ir;
+
+ printf("(constant\n");
+ printf(" (");
+ print_type(ir->type);
+ printf(")\n");
+ printf(" (FINISHME: value goes here)\n");
+ printf(")\n");
}