Commit 609ef4bb authored by Michael Beck's avatar Michael Beck
Browse files

used irtools

[r6279]
parent d55996ea
......@@ -24,6 +24,7 @@
#include "irnode_t.h"
#include "irprog_t.h"
#include "irgwalk.h"
#include "irtools.h"
#include "array.h"
#include "obst.h"
......@@ -205,17 +206,10 @@ void *get_firm_walk_link(void *thing)
}
}
/** Set link field of a ir node to NULL */
static
void fw_clear_link(ir_node * node, void * env)
{
set_irn_link(node, NULL);
}
/** Fill maps of type and entity.
* This function will be called by the firm walk initializer
* to collect all types and entities of program's firm ir.
* All types will be colleced in the hash table type_map
* All types will be collected in the hash table type_map
* and all entity are stored in entity_map. The mode of an
* type will be collected as well.
*
......@@ -362,7 +356,7 @@ void firm_walk_init(firm_walk_flags flags)
type_walk_irg(irg, fw_collect_tore, NULL, NULL);
irg_walk_graph(irg, fw_clear_link, fw_collect_irn, NULL);
irg_walk_graph(irg, firm_clear_link, fw_collect_irn, NULL);
}
}
......
......@@ -29,7 +29,7 @@
#include "irgmod.h"
#include "irgwalk.h"
#include "irflag_t.h"
#include "irtools.h"
/* Return the current state of the interprocedural view. */
ip_view_state get_irp_ip_view_state(void) {
......@@ -99,11 +99,6 @@ static void caller_init(int arr_length, entity ** free_methods) {
}
}
static INLINE void clear_link(ir_node * node, void * env) {
set_irn_link(node, NULL);
}
/*
static INLINE ir_node * tail(ir_node * node) {
ir_node * link;
......@@ -167,7 +162,7 @@ static void collect_phicallproj(void) {
link(start, get_irg_frame(irg));
link(start, get_irg_globals(irg));
/* walk */
irg_walk_graph(irg, clear_link, (irg_walk_func *) collect_phicallproj_walker, &end);
irg_walk_graph(irg, firm_clear_link, (irg_walk_func *) collect_phicallproj_walker, &end);
}
}
......@@ -888,7 +883,7 @@ void cg_destruct(void) {
if (get_irp_ip_view_state() != ip_view_no) {
for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
ir_graph * irg = get_irp_irg(i);
irg_walk_graph(irg, destruct_walker, clear_link, NULL);
irg_walk_graph(irg, destruct_walker, firm_clear_link, NULL);
set_irg_frame (irg, skip_Id(get_irg_frame(irg)));
set_irg_globals (irg, skip_Id(get_irg_globals(irg)));
......
......@@ -28,11 +28,7 @@
#include "irflag_t.h"
#include "ircons.h"
#include "typewalk.h"
static void clear_link(ir_node * node, void * env) {
set_irn_link(node, NULL);
}
#include "irtools.h"
/* Call-Operationen an die "link"-Liste von "call_head" anhngen. */
static void collect_call(ir_node * node, ir_node * head) {
......@@ -82,7 +78,7 @@ void gc_irgs(int n_keep, entity ** keep_arr) {
ir_graph * irg = get_entity_irg(marked[i]);
ir_node * node = get_irg_end(irg);
/* collect calls */
irg_walk_graph(irg, clear_link, (irg_walk_func *) collect_call, node);
irg_walk_graph(irg, firm_clear_link, (irg_walk_func *) collect_call, node);
/* iterate calls */
for (node = get_irn_link(node); node; node = get_irn_link(node)) {
int i;
......@@ -92,10 +88,10 @@ void gc_irgs(int n_keep, entity ** keep_arr) {
if (get_entity_irg(ent) && get_entity_link(ent) != MARK) {
set_entity_link(ent, MARK);
ARR_APP1(entity *, marked, ent);
if (get_opt_dead_method_elimination_verbose() && get_firm_verbosity() > 2) {
printf("dead method elimination: method %s can be called from Call %ld: kept alive.\n",
get_entity_ld_name(ent), get_irn_node_nr(node));
}
if (get_opt_dead_method_elimination_verbose() && get_firm_verbosity() > 2) {
printf("dead method elimination: method %s can be called from Call %ld: kept alive.\n",
get_entity_ld_name(ent), get_irn_node_nr(node));
}
}
}
}
......
......@@ -14,16 +14,17 @@
# include "config.h"
#endif
# include "irvrfy.h"
# include "irflag_t.h"
# include "irgwalk.h"
# include "irnode_t.h"
# include "irgraph_t.h"
# include "irgmod.h"
# include "array.h"
# include "ircons.h"
# include "irhooks.h"
# include "iredges_t.h"
#include "irvrfy.h"
#include "irflag_t.h"
#include "irgwalk.h"
#include "irnode_t.h"
#include "irgraph_t.h"
#include "irgmod.h"
#include "array.h"
#include "ircons.h"
#include "irhooks.h"
#include "iredges_t.h"
#include "irtools.h"
/* Turns a node into a "useless" Tuple. The Tuple just forms a tuple
from several inputs.
......@@ -92,11 +93,6 @@ exchange (ir_node *old, ir_node *nw)
/* Functionality for collect_phis */
/*--------------------------------------------------------------------*/
static void
clear_link (ir_node *n, void *env) {
set_irn_link(n, NULL);
}
static void
collect (ir_node *n, void *env) {
ir_node *pred;
......@@ -120,7 +116,7 @@ void collect_phiprojs(ir_graph *irg) {
rem = current_ir_graph;
current_ir_graph = irg;
irg_walk(get_irg_end(current_ir_graph), clear_link, collect, NULL);
irg_walk(get_irg_end(current_ir_graph), firm_clear_link, collect, NULL);
current_ir_graph = rem;
}
......
......@@ -18,6 +18,7 @@
#include "irprintf.h"
#include "irdump.h"
#include "dags.h"
#include "irtools.h"
enum dag_counting_options_t {
FIRMSTAT_COPY_CONSTANTS = 0x00000001, /**< if set, constants will be treated as they are in
......@@ -27,14 +28,6 @@ enum dag_counting_options_t {
FIRMSTAT_ARGS_ARE_ROOTS = 0x00000008, /**< arguments (Proj(Proj(Start)) are roots */
};
/**
* walker for clearing node links
*/
static void clear_links(ir_node *node, void *env)
{
set_irn_link(node, NULL);
}
typedef struct _dag_entry_t dag_entry_t;
/**
......@@ -264,7 +257,7 @@ void count_dags_in_graph(graph_entry_t *global, graph_entry_t *graph)
return;
/* first step, clear the links */
irg_walk_graph(graph->irg, clear_links, NULL, NULL);
irg_walk_graph(graph->irg, firm_clear_link, NULL, NULL);
obstack_init(&root_env.obst);
root_env.num_of_dags = 0;
......
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