OSDN Git Service

2007-08-18 Andrew Pinski <pinskia@gmail.com>
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 18 Aug 2007 20:53:02 +0000 (20:53 +0000)
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 18 Aug 2007 20:53:02 +0000 (20:53 +0000)
        * tree-affine.h (print_aff): New prototype.
        (debug_aff): Likewise.
        * tree-affine.c (print_aff): New function.
        (debug_aff): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127615 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/tree-affine.c
gcc/tree-affine.h

index 0af10bd..2b1d5ca 100644 (file)
@@ -1,3 +1,10 @@
+2007-08-18  Andrew Pinski  <pinskia@gmail.com>
+
+       * tree-affine.h (print_aff): New prototype.
+       (debug_aff): Likewise.
+       * tree-affine.c (print_aff): New function.
+       (debug_aff): Likewise.
+
 2007-08-18  Paul Brook  <paul@codesourcery.com>
             Joseph Myers  <joseph@codesourcery.com>
 
index 0f19587..b6c47d6 100644 (file)
@@ -719,3 +719,48 @@ aff_combination_constant_multiple_p (aff_tree *val, aff_tree *div,
   gcc_assert (mult_set);
   return true;
 }
+
+/* Prints the affine VAL to the FILE. */
+
+void
+print_aff (FILE *file, aff_tree *val)
+{
+  unsigned i;
+  bool uns = TYPE_UNSIGNED (val->type);
+  if (POINTER_TYPE_P (val->type))
+    uns = false;
+  fprintf (file, "{\n  type = ");
+  print_generic_expr (file, val->type, TDF_VOPS|TDF_MEMSYMS);
+  fprintf (file, "\n  offset = ");
+  dump_double_int (file, val->offset, uns);
+  if (val->n > 0)
+    {
+      fprintf (file, "\n  elements = {\n");
+      for (i = 0; i < val->n; i++)
+       {
+         fprintf (file, "    [%d] = ", i);
+         print_generic_expr (file, val->elts[i].val, TDF_VOPS|TDF_MEMSYMS);
+         
+         fprintf (file, " * ");
+         dump_double_int (file, val->elts[i].coef, uns);
+         if (i != val->n - 1)
+           fprintf (file, ", \n");
+       }
+      fprintf (file, "\n  }");
+  }
+  if (val->rest)
+    {
+      fprintf (file, "\n  rest = ");
+      print_generic_expr (file, val->rest, TDF_VOPS|TDF_MEMSYMS);
+    }
+  fprintf (file, "\n}");
+}
+
+/* Prints the affine VAL to the standard error, used for debugging.  */
+
+void
+debug_aff (aff_tree *val)
+{
+  print_aff (stderr, val);
+  fprintf (stderr, "\n");
+}
index 5da34be..c7dafab 100644 (file)
@@ -74,3 +74,7 @@ bool aff_combination_constant_multiple_p (aff_tree *, aff_tree *, double_int *);
 void tree_to_aff_combination_expand (tree, tree, aff_tree *,
                                     struct pointer_map_t **);
 void free_affine_expand_cache (struct pointer_map_t **);
+
+/* Debugging functions.  */
+void print_aff (FILE *, aff_tree *);
+void debug_aff (aff_tree *);