IR print visitor: Print expressions a little better
authorIan Romanick <ian.d.romanick@intel.com>
Sat, 27 Mar 2010 00:42:10 +0000 (17:42 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Sat, 27 Mar 2010 00:42:10 +0000 (17:42 -0700)
ir_print_visitor.cpp

index 0e89f10c3f32642d5508f4e18a20c4ccf01ae7e1..6d0f797807c7caee1b1a90d2590730f3bc5d0a59 100644 (file)
@@ -88,9 +88,20 @@ void ir_print_visitor::visit(ir_expression *ir)
 {
    printf("(expression ");
 
-   printf("(FINISHME: operator) ");
+   const char *str;
+   char buf[256];
+
+   switch (ir->operation) {
+   case ir_unop_f2i: str = "f2i"; break;
+   case ir_unop_i2f: str = "i2f"; break;
+   case ir_unop_u2f: str = "u2f"; break;
+   default:
+      snprintf(buf, sizeof(buf), "operator %u", ir->operation);
+      str = buf;
+      break;
+   }
 
-   printf("(");
+   printf("(%s) (", str);
    if (ir->operands[0])
       ir->operands[0]->accept(this);
    printf(") ");