Commit cff3ccfb authored by Götz Lindenmaier's avatar Götz Lindenmaier
Browse files

Added static to many static routines

fixed error in set_irn_in: backedge array was not updated

[r566]
parent 3c21abab
......@@ -525,7 +525,8 @@ static void construct_call(ir_node * call) {
/* Operationen verschieben */
move_phis(post_block, pre_block);
move_nodes(post_block, pre_block, call);
/* @@@ GL Wer setzt die Laenge des PostBlock cgfpred array auf 1? */
/* @@@ GL Wer setzt die Laenge des PostBlock cgfpred array auf 1?
GL: na, dieser Befehl... generiert neuen array. */
set_irn_in(post_block, 1, &jmp);
/* Wiederverwendete Daten initialisieren. */
......
......@@ -1318,8 +1318,8 @@ get_r_value_internal (ir_node *block, int pos, ir_mode *mode)
#if USE_EXPLICIT_PHI_IN_STACK
/* Just dummies */
static INLINE Phi_in_stack * new_Phi_in_stack() { return NULL; }
static INLINE void free_Phi_in_stack(Phi_in_stack *s) { }
INLINE Phi_in_stack * new_Phi_in_stack() { return NULL; }
INLINE void free_Phi_in_stack(Phi_in_stack *s) { }
#endif
static INLINE ir_node *
......
......@@ -101,10 +101,10 @@ static INLINE bool dump_const_local_set() {
}
/* A global variable to record output of the Bad node. */
int Bad_dumped;
static int Bad_dumped;
void dump_ir_blocks_nodes (ir_node *n, void *env);
void dump_whole_node (ir_node *n, void* env);
static void dump_ir_blocks_nodes (ir_node *n, void *env);
static void dump_whole_node(ir_node *n, void* env);
/*******************************************************************/
/* routines to dump information about a single node */
......@@ -112,7 +112,7 @@ void dump_whole_node (ir_node *n, void* env);
INLINE void
static INLINE void
dump_node_opcode (ir_node *n)
{
assert(n && n->op);
......@@ -146,7 +146,7 @@ dump_node_opcode (ir_node *n)
}
}
INLINE void
static INLINE void
dump_node_mode (ir_node *n)
{
switch (n->op->code) {
......@@ -173,12 +173,12 @@ dump_node_mode (ir_node *n)
}
}
void dump_node_loop_info(ir_node *n) {
static void dump_node_loop_info(ir_node *n) {
// if (get_irn_loop(n))
// xfprintf(F, "\n in loop %d", get_loop_depth(get_irn_loop(n)));
}
INLINE void
static INLINE void
dump_node_nodeattr (ir_node *n)
{
switch (n->op->code) {
......@@ -205,7 +205,7 @@ dump_node_nodeattr (ir_node *n)
} /* end switch */
}
INLINE void
static INLINE void
dump_node_vcgattr (ir_node *n)
{
switch (n->op->code) {
......@@ -234,7 +234,7 @@ dump_node_vcgattr (ir_node *n)
}
}
bool pred_in_wrong_graph(ir_node *n, int pos, pmap *irgmap) {
static bool pred_in_wrong_graph(ir_node *n, int pos, pmap *irgmap) {
ir_node *block = (is_Block(n)) ? n : get_nodes_Block(n);
if (irgmap &&
......@@ -257,7 +257,7 @@ bool is_constlike_node(ir_node *n) {
}
void dump_const_node_local(ir_node *n, pmap *irgmap) {
static void dump_const_node_local(ir_node *n, pmap *irgmap) {
int i;
if (!dump_const_local_set()) return;
/* Use visited flag to avoid outputting nodes twice.
......@@ -292,7 +292,7 @@ void dump_const_node_local(ir_node *n, pmap *irgmap) {
}
}
void
static void
dump_node (ir_node *n, pmap * map) {
if (dump_const_local_set() && is_constlike_node(n)) return;
......@@ -312,7 +312,7 @@ dump_node (ir_node *n, pmap * map) {
dump_const_node_local(n, map);
}
void
static void
dump_ir_node (ir_node *n)
{
/* dump this node */
......@@ -507,7 +507,7 @@ dump_ir_node (ir_node *n)
/* dump the edge to the block this node belongs to */
void
static void
dump_ir_block_edge(ir_node *n) {
if (dump_const_local_set() && is_constlike_node(n)) return;
if (is_no_Block(n)) {
......@@ -519,7 +519,7 @@ dump_ir_block_edge(ir_node *n) {
}
}
void print_edge_vcgattr(ir_node *from, int to) {
static void print_edge_vcgattr(ir_node *from, int to) {
assert(from);
if (is_backedge(from, to)) xfprintf (F, BACK_EDGE_ATTR);
......@@ -606,7 +606,7 @@ void print_edge_vcgattr(ir_node *from, int to) {
}
/* dump edges to our inputs */
void
static void
dump_ir_data_edges(ir_node *n) {
int i, visited = get_irn_visited(n);
......@@ -635,7 +635,7 @@ dump_ir_data_edges(ir_node *n) {
}
/* dump out edges */
void
static void
dump_out_edge (ir_node *n, void* env) {
int i;
for (i = 0; i < get_irn_n_outs(n); i++) {
......@@ -688,7 +688,7 @@ void dump_loop_info(ir_graph *irg) {
/* dumps the edges between nodes and their type or entity attributes. */
void dump_node2type_edges (ir_node *n, void *env)
static void dump_node2type_edges (ir_node *n, void *env)
{
assert(n);
......@@ -735,7 +735,7 @@ void dump_node2type_edges (ir_node *n, void *env)
}
void dump_const_expression(ir_node *value) {
static void dump_const_expression(ir_node *value) {
ir_graph *rem = current_ir_graph;
int rem_dump_const_local = dump_const_local;
dump_const_local = 0;
......@@ -747,7 +747,7 @@ void dump_const_expression(ir_node *value) {
}
void print_type_info(type *tp) {
static void print_type_info(type *tp) {
if (get_type_state(tp) == layout_undefined) {
xfprintf(F, "state: layout_undefined\n");
} else {
......@@ -759,7 +759,7 @@ void print_type_info(type *tp) {
}
void print_typespecific_info(type *tp) {
static void print_typespecific_info(type *tp) {
switch (get_type_tpop_code(tp)) {
case tpo_class:
{
......@@ -794,7 +794,7 @@ void print_typespecific_info(type *tp) {
} /* switch type */
}
void print_type_node(type *tp) {
static void print_type_node(type *tp) {
xfprintf (F, "node: {title: \"%p\" ", tp);
xfprintf (F, "label: \"%I %I\"", get_type_tpop_nameid(tp), get_type_ident(tp));
xfprintf (F, "info1: \"");
......@@ -805,7 +805,7 @@ void print_type_node(type *tp) {
}
/* dumps a type or entity and it's edges. */
void
static void
dump_type_info (type_or_ent *tore, void *env) {
int i = 0; /* to shutup gcc */
......@@ -960,7 +960,7 @@ dump_type_info (type_or_ent *tore, void *env) {
/* open and close vcg file */
/************************************************************************/
void vcg_open (ir_graph *irg, char *suffix) {
static void vcg_open (ir_graph *irg, char *suffix) {
char *fname; /* filename to put the vcg information in */
const char *cp;
ident *id;
......@@ -1019,7 +1019,7 @@ void vcg_open (ir_graph *irg, char *suffix) {
xfprintf (F, "\n"); /* a separator */
}
void vcg_open_name (const char *name) {
static void vcg_open_name (const char *name) {
char *fname; /* filename to put the vcg information in */
int len;
char label[4];
......@@ -1070,7 +1070,7 @@ void vcg_open_name (const char *name) {
xfprintf (F, "\n"); /* a separator */
}
void
static void
vcg_close () {
xfprintf (F, "}\n"); /* print footer */
fclose (F); /* close vcg file */
......@@ -1080,12 +1080,12 @@ vcg_close () {
/* routines to dump a graph, blocks as conventional nodes. */
/************************************************************************/
int node_floats(ir_node *n) {
static int node_floats(ir_node *n) {
return ((get_op_pinned(get_irn_op(n)) == floats) &&
(get_irg_pinned(current_ir_graph) == floats));
}
void
static void
dump_whole_node (ir_node *n, void* env) {
dump_node(n, NULL);
if (!node_floats(n)) dump_ir_block_edge(n);
......@@ -1119,7 +1119,7 @@ dump_ir_graph (ir_graph *irg)
/* the following routines dump the nodes as attached to the blocks. */
/***********************************************************************/
void
static void
dump_ir_blocks_nodes (ir_node *n, void *env) {
ir_node *block = (ir_node *)env;
......@@ -1131,7 +1131,7 @@ dump_ir_blocks_nodes (ir_node *n, void *env) {
Bad_dumped = 1;
}
void
static void
dump_ir_block (ir_node *block, void *env) {
ir_graph *irg = (ir_graph *)env;
......@@ -1164,7 +1164,7 @@ dump_ir_block (ir_node *block, void *env) {
}
void
static void
dump_blockless_nodes (ir_node *n, void *env) {
if (is_no_Block(n) && get_irn_op(get_nodes_Block(n)) == op_Bad) {
dump_node(n, NULL);
......@@ -1180,7 +1180,7 @@ dump_blockless_nodes (ir_node *n, void *env) {
}
}
void dump_ir_block_graph_2 (ir_graph *irg)
static void dump_ir_block_graph_2 (ir_graph *irg)
{
Bad_dumped = 0;
/* walk over the blocks in the graph */
......@@ -1217,7 +1217,7 @@ dump_ir_block_graph (ir_graph *irg)
/***********************************************************************/
void
static void
dump_block_to_cfg (ir_node *block, void *env) {
int i;
ir_node *pred;
......@@ -1474,7 +1474,7 @@ static void dump_cg_ir_block(ir_node * block, void * env) {
xfprintf(F, "}\n\n");
}
void d_cg_block_graph(ir_graph *irg, ir_node **arr, pmap *irgmap) {
static void d_cg_block_graph(ir_graph *irg, ir_node **arr, pmap *irgmap) {
int i;
xfprintf(F, "graph: { title: \"%p\" label: \"%I\" status:clustered color:white \n",
......
......@@ -59,12 +59,12 @@ exchange (ir_node *old, ir_node *nw)
/* Functionality for collect_phis */
/**********************************************************************/
void
static void
clear_link (ir_node *n, void *env) {
set_irn_link(n, NULL);
}
void
static void
collect (ir_node *n, void *env) {
ir_node *pred;
if (get_irn_op(n) == op_Phi) {
......@@ -100,7 +100,7 @@ void collect_phiprojs(ir_graph *irg) {
/* Moves node and all predecessors of node from from_bl to to_bl.
Does not move predecessors of Phi nodes (or block nodes). */
void move (ir_node *node, ir_node *from_bl, ir_node *to_bl) {
static void move (ir_node *node, ir_node *from_bl, ir_node *to_bl) {
int i;
ir_node *proj, *pred;
......
......@@ -39,11 +39,11 @@ void add_identities (pset *value_table, ir_node *node);
/* apply optimizations of iropt to all nodes. */
/********************************************************************/
void init_link (ir_node *n, void *env) {
static void init_link (ir_node *n, void *env) {
set_irn_link(n, NULL);
}
void
static void
optimize_in_place_wrapper (ir_node *n, void *env) {
int i;
ir_node *optimized;
......@@ -89,14 +89,14 @@ local_optimize_graph (ir_graph *irg) {
/********************************************************************/
/* Remeber the new node in the old node by using a field all nodes have. */
INLINE void
static INLINE void
set_new_node (ir_node *old, ir_node *new)
{
old->link = new;
}
/* Get this new node, before the old node is forgotton.*/
INLINE ir_node *
static INLINE ir_node *
get_new_node (ir_node * n)
{
return n->link;
......@@ -108,7 +108,7 @@ get_new_node (ir_node * n)
Remembering the arity is useful, as it saves a lot of pointer
accesses. This function is called for all Phi and Block nodes
in a Block. */
INLINE int
static INLINE int
compute_new_arity(ir_node *b) {
int i, res;
int irg_v, block_v;
......@@ -308,7 +308,7 @@ copy_graph () {
in current_ir_graph and fixes the environment.
Then fixes the fields in current_ir_graph containing nodes of the
graph. */
void
static void
copy_graph_env () {
ir_node *old_end;
/* Not all nodes remembered in current_ir_graph might be reachable
......@@ -942,7 +942,7 @@ place_floats_early (ir_node *n)
Start, Call and end at pinned nodes as Store, Call. Place_early
places all floating nodes reachable from its argument through floating
nodes and adds all beginnings at pinned nodes to the worklist. */
INLINE void place_early () {
static INLINE void place_early () {
assert(worklist);
inc_irg_visited(current_ir_graph);
......@@ -996,7 +996,7 @@ consumer_dom_dca (ir_node *dca, ir_node *consumer, ir_node *producer)
return dca;
}
INLINE int get_irn_loop_depth(ir_node *n) {
static INLINE int get_irn_loop_depth(ir_node *n) {
return get_loop_depth(get_irn_loop(n));
}
......@@ -1096,7 +1096,7 @@ place_floats_late (ir_node *n)
}
}
INLINE void place_late() {
static INLINE void place_late() {
assert(worklist);
inc_irg_visited(current_ir_graph);
......@@ -1190,7 +1190,7 @@ static void collect_nodes(ir_node *n, void *env) {
}
/* Returns true if pred is pred of block */
int is_pred_of(ir_node *pred, ir_node *b) {
static int is_pred_of(ir_node *pred, ir_node *b) {
int i;
for (i = 0; i < get_Block_n_cfgpreds(b); i++) {
ir_node *b_pred = get_nodes_Block(get_Block_cfgpred(b, i));
......@@ -1199,7 +1199,7 @@ int is_pred_of(ir_node *pred, ir_node *b) {
return 0;
}
int test_whether_dispensable(ir_node *b, int pos) {
static int test_whether_dispensable(ir_node *b, int pos) {
int i, j, n_preds = 1;
int dispensable = 1;
ir_node *cfop = get_Block_cfgpred(b, pos);
......@@ -1247,7 +1247,7 @@ int test_whether_dispensable(ir_node *b, int pos) {
return n_preds;
}
void optimize_blocks(ir_node *b, void *env) {
static void optimize_blocks(ir_node *b, void *env) {
int i, j, k, max_preds, n_preds;
ir_node *pred, *phi;
ir_node **in;
......@@ -1301,7 +1301,7 @@ void optimize_blocks(ir_node *b, void *env) {
if (get_nodes_Block(phi_pred) == pred)
exchange (phi_pred, new_Bad());
#if 0
/* @@@ hier brauche ich schleifeninformation!!! Wenn keine Rueckwaertskante
/* @@@ hier brauche ich Schleifeninformation!!! Wenn keine Rueckwaertskante
dann darfs auch keine Verwendung geben. */
if (get_nodes_Block(phi_pred) == pred) {
/* remove the Phi as it might be kept alive. Further there
......@@ -1316,7 +1316,7 @@ void optimize_blocks(ir_node *b, void *env) {
}
/* Fix the node */
set_irn_in(phi, n_preds, in);
clear_backedges (phi);
//clear_backedges (phi);
phi = get_irn_link(phi);
}
......@@ -1341,7 +1341,7 @@ void optimize_blocks(ir_node *b, void *env) {
< get_irg_block_visited(current_ir_graph)) {
/* It's an empty block and not yet visited. */
for (j = 0; j < get_Block_n_cfgpreds(pred); j++) {
/* @@@ Hier brauche ich schleifeninformation!!! Kontrllflusskante
/* @@@ Hier brauche ich Schleifeninformation!!! Kontrollflusskante
muss Rueckwaertskante sein! (An allen vier in[n_preds] = phi
Anweisungen.) Trotzdem tuts bisher!! */
in[n_preds] = phi;
......@@ -1405,8 +1405,6 @@ void optimize_blocks(ir_node *b, void *env) {
free(in);
}
#include "irdump.h"
void optimize_cf(ir_graph *irg) {
int i;
ir_node **in;
......@@ -1414,7 +1412,6 @@ void optimize_cf(ir_graph *irg) {
ir_graph *rem = current_ir_graph;
current_ir_graph = irg;
/* Handle graph state */
assert(get_irg_phase_state(irg) != phase_building);
if (get_irg_outs_state(current_ir_graph) == outs_consistent)
......
......@@ -395,11 +395,13 @@ set_irg_n_loc (ir_graph *irg, int n_loc)
#endif
}
irg_phase_state get_irg_phase_state (ir_graph *irg) {
irg_phase_state
get_irg_phase_state (ir_graph *irg) {
return irg->phase_state;
}
void set_irg_phase_low(ir_graph *irg) {
void
set_irg_phase_low(ir_graph *irg) {
irg->phase_state = phase_low;
}
......@@ -408,19 +410,23 @@ get_irg_pinned (ir_graph *irg) {
return irg->pinned;
}
irg_outs_state get_irg_outs_state(ir_graph *irg) {
irg_outs_state
get_irg_outs_state(ir_graph *irg) {
return irg->outs_state;
}
void set_irg_outs_inconsistent(ir_graph *irg) {
void
set_irg_outs_inconsistent(ir_graph *irg) {
irg->outs_state = outs_inconsistent;
}
irg_dom_state get_irg_dom_state(ir_graph *irg) {
irg_dom_state
get_irg_dom_state(ir_graph *irg) {
return irg->dom_state;
}
void set_irg_dom_inconsistent(ir_graph *irg) {
void
set_irg_dom_inconsistent(ir_graph *irg) {
irg->dom_state = dom_inconsistent;
}
......
......@@ -14,7 +14,7 @@
#include "irnode_t.h"
#include "irgraph_t.h"
#include "ident_t.h"
#include "xp_help.h"
#include "irmode_t.h"
#include "typegmod_t.h"
#include "array.h"
......@@ -248,7 +248,7 @@ set_irn_in (ir_node *node, int arity, ir_node **in) {
*arr = NEW_ARR_D(ir_node *, current_ir_graph->obst, arity + 1);
(*arr)[0] = block;
}
//fix_backedges(current_ir_graph->obst, node);
fix_backedges(current_ir_graph->obst, node);
memcpy((*arr) + 1, in, sizeof(ir_node *) * arity);
}
......@@ -633,6 +633,14 @@ void set_Block_cg_cfgpred_arr(ir_node * node, int arity, ir_node ** in) {
node->attr.block.in_cg = NEW_ARR_D(ir_node *, current_ir_graph->obst, arity + 1);
node->attr.block.in_cg[0] = NULL;
node->attr.block.cg_backedge = new_backedge_arr(current_ir_graph->obst, arity);
{
/* Fix backedge array. fix_backedges operates depending on
interprocedural_view. */
bool ipv = interprocedural_view;
interprocedural_view = true;
fix_backedges(current_ir_graph->obst, node);
interprocedural_view = ipv;
}
}
memcpy(node->attr.block.in_cg + 1, in, sizeof(ir_node *) * arity);
}
......
......@@ -253,7 +253,7 @@ computed_value (ir_node *n)
/* returns 1 if the a and b are pointers to different locations. */
bool
static bool
different_identity (ir_node *a, ir_node *b)
{
assert (get_irn_mode (a) == mode_P
......
......@@ -26,8 +26,6 @@
tarval *computed_value (ir_node *n);
ir_node *optimize (ir_node *n);
ir_node *optimize_in_place (ir_node *n);
# endif /* _IROPT_H_ */
......@@ -19,7 +19,9 @@ ir_node *equivalent_node (ir_node *n);
/* For cse */
pset *new_identities (void);
void del_identities (pset *value_table);
void add_identity (pset *value_table, ir_node *node);
void add_identities (pset *value_table, ir_node *node);
ir_node *optimize (ir_node *n);
ir_node *optimize_in_place_2 (ir_node *n);
......
......@@ -163,7 +163,7 @@ void set_irp_type(int pos, type *typ) {
}
#ifdef DEBUG_libfirm
static int get_irp_new_node_nr() {
int get_irp_new_node_nr() {
assert(irp);
irp->max_node_nr = irp->max_node_nr + 1;
return irp->max_node_nr - 1;
......
......@@ -495,7 +495,7 @@ irn_vrfy (ir_node *n)
/* Verify the whole graph. */
/*******************************************************************/
void
static void
vrfy_wrap (ir_node *node, void *env) {
irn_vrfy(node);
}
......
Supports Markdown
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