Commit 87d0e522 authored by Matthias Braun's avatar Matthias Braun
Browse files

use a hook to dump vrp info instead of polluting irdump.c

parent 127d1184
......@@ -38,6 +38,7 @@
#include "irop.h"
#include "pdeq.h"
#include "irnodemap.h"
#include "irhooks.h"
#include "bitset.h"
#include "debug.h"
......@@ -525,6 +526,29 @@ static void vrp_first_pass(ir_node *n, void *e)
}
}
static void dump_vrp_info(void *ctx, FILE *F, const ir_node *node)
{
vrp_attr *vrp;
(void) ctx;
if (!mode_is_int(get_irn_mode(node)))
return;
vrp = vrp_get_info(node);
if (vrp == NULL)
return;
fprintf(F, "vrp range type: %d\n", (int) vrp->range_type);
if (vrp->range_type == VRP_RANGE || vrp->range_type == VRP_ANTIRANGE) {
ir_fprintf(F, "vrp range bottom: %T\n",vrp->range_bottom);
ir_fprintf(F, "vrp range top: %T\n", vrp->range_top);
}
ir_fprintf(F, "vrp bits set: %T\n", vrp->bits_set);
ir_fprintf(F, "vrp bits not set: %T\n", vrp->bits_not_set);
}
static hook_entry_t dump_hook;
void set_vrp_data(ir_graph *irg)
{
ir_node *succ, *node;
......@@ -542,6 +566,11 @@ void set_vrp_data(ir_graph *irg)
obstack_init(&irg->vrp.obst);
info = &irg->vrp;
if (dump_hook.hook._hook_node_info == NULL) {
dump_hook.hook._hook_node_info = dump_vrp_info;
register_hook(hook_node_info, &dump_hook);
}
env = obstack_alloc(&irg->vrp.obst, sizeof(*env));
env->workqueue = new_waitq();
env->info = info;
......
......@@ -1031,23 +1031,6 @@ void dump_node_label(FILE *F, ir_node *n)
}
}
void dump_vrp_info(FILE *F, ir_node *n)
{
vrp_attr *vrp = vrp_get_info(n);
if (n == NULL) {
return;
}
fprintf(F, "range_type: %d\n", (int) vrp->range_type);
if (vrp->range_type == VRP_RANGE || vrp->range_type ==
VRP_ANTIRANGE) {
ir_fprintf(F, "range_bottom: %F\n",vrp->range_bottom);
ir_fprintf(F, "range_top: %F\n", vrp->range_top);
}
ir_fprintf(F, "bits_set: %T\n", vrp->bits_set);
ir_fprintf(F, "bits_not_set: %T\n", vrp->bits_not_set);
}
/**
* Dumps the attributes of a node n into the file F.
* Currently this is only the color of a node.
......
......@@ -157,8 +157,6 @@ void dump_node_opcode(FILE *out, ir_node *n);
void dump_node_label(FILE *out, ir_node *n);
void dump_vrp_info(FILE *out, ir_node *n);
/** Writes vcg representation with title "PRINT_TYPEID(tp)" to file F. */
void dump_type_node(FILE *out, ir_type *tp);
......
......@@ -39,7 +39,6 @@
#include "trouts.h"
#include "irgwalk.h"
#include "tv_t.h"
#include "vrp.h"
#include "irprintf.h"
#include "error.h"
......@@ -62,7 +61,6 @@ void dump_irnode_to_file(FILE *F, ir_node *n)
{
char comma;
ir_graph *irg;
vrp_attr *vrp_info;
dump_node_opcode(F, n);
fprintf(F, " %ld\n", get_irn_node_nr(n));
......@@ -303,11 +301,6 @@ void dump_irnode_to_file(FILE *F, ir_node *n)
break;
}
vrp_info = vrp_get_info(n);
if (vrp_info) {
dump_vrp_info(F, n);
}
if (get_irg_typeinfo_state(get_irn_irg(n)) == ir_typeinfo_consistent ||
get_irg_typeinfo_state(get_irn_irg(n)) == ir_typeinfo_inconsistent )
if (get_irn_typeinfo_type(n) != firm_none_type)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment