* [PATCH] Add printing functions to tree-affine.c
@ 2007-08-11 19:22 Andrew Pinski
2007-08-14 15:54 ` Diego Novillo
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Pinski @ 2007-08-11 19:22 UTC (permalink / raw)
To: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 449 bytes --]
Hi,
While working on iv-opts and tree-affine, I found it was hard to
quickly print out aff_tree and get useful information out. This patch
adds two functions to tree-affine.c to print out an aff_tree*.
OK? Bootstrapped and tested on i386-apple-darwin8.10 with no regressions.
Thanks,
Andrew Pinski
ChangeLog:
* tree-affine.h (print_aff): New prototype.
(debug_aff): Likewise.
* tree-affine.c (print_aff): New function.
(debug_aff): Likewise.
[-- Attachment #2: adddebugaffine.diff.txt --]
[-- Type: text/plain, Size: 1746 bytes --]
Index: tree-affine.c
===================================================================
--- tree-affine.c (revision 127349)
+++ tree-affine.c (working copy)
@@ -719,3 +719,44 @@ aff_combination_constant_multiple_p (aff
gcc_assert (mult_set);
return true;
}
+
+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 elments = {\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}");
+}
+
+void
+debug_aff (aff_tree *val)
+{
+ print_aff (stderr, val);
+ fprintf (stderr, "\n");
+}
Index: tree-affine.h
===================================================================
--- tree-affine.h (revision 127349)
+++ tree-affine.h (working copy)
@@ -74,3 +74,7 @@ bool aff_combination_constant_multiple_p
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 *file, aff_tree *val);
+void debug_aff (aff_tree *val);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Add printing functions to tree-affine.c
2007-08-11 19:22 [PATCH] Add printing functions to tree-affine.c Andrew Pinski
@ 2007-08-14 15:54 ` Diego Novillo
0 siblings, 0 replies; 2+ messages in thread
From: Diego Novillo @ 2007-08-14 15:54 UTC (permalink / raw)
To: Andrew Pinski; +Cc: GCC Patches
On 8/11/07 1:22 PM, Andrew Pinski wrote:
> +/* Debugging functions. */
> +void print_aff (FILE *file, aff_tree *val);
> +void debug_aff (aff_tree *val);
No need to specify argument names here.
> +
> +void
> +print_aff (FILE *file, aff_tree *val)
Needs comment.
> +void
> +debug_aff (aff_tree *val)
Likewise.
> + fprintf (file, "\n elments = {\n");
s/elments/elements/
OK with those changes.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-08-14 15:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-11 19:22 [PATCH] Add printing functions to tree-affine.c Andrew Pinski
2007-08-14 15:54 ` Diego Novillo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).