Commit 384e2aae authored by Matthias Braun's avatar Matthias Braun
Browse files

fix a few errors and warnings in the new pass code; improve some comments

[r26367]
parent ddfcdcb1
...@@ -65,7 +65,7 @@ int optimize_graph_df(ir_graph *irg); ...@@ -65,7 +65,7 @@ int optimize_graph_df(ir_graph *irg);
* *
* @return the newly created ir_graph pass * @return the newly created ir_graph pass
*/ */
ir_graph_pass_t *optimize_graph_df_pass(const char *name, int verify, int dump); ir_graph_pass_t *optimize_graph_df_pass(const char *name);
/** Performs dead node elimination by copying the ir graph to a new obstack. /** Performs dead node elimination by copying the ir graph to a new obstack.
* *
......
...@@ -53,7 +53,7 @@ void optimize_cf(ir_graph *irg); ...@@ -53,7 +53,7 @@ void optimize_cf(ir_graph *irg);
* *
* @return the newly created ir_graph pass * @return the newly created ir_graph pass
*/ */
ir_graph_pass_t *optimize_cf_pass(const char *name, int verify, int dump); ir_graph_pass_t *optimize_cf_pass(const char *name);
/** /**
* Perform path-sensitive jump threading on the given graph. * Perform path-sensitive jump threading on the given graph.
......
...@@ -356,7 +356,7 @@ void dom_tree_walk_irg(ir_graph *irg, irg_walk_func *pre, ...@@ -356,7 +356,7 @@ void dom_tree_walk_irg(ir_graph *irg, irg_walk_func *pre,
/* The root of the dominator tree should be the Start block. */ /* The root of the dominator tree should be the Start block. */
ir_node *root = get_irg_start_block(irg); ir_node *root = get_irg_start_block(irg);
assert(irg->dom_state == dom_consistent assert(irg->dom_state == dom_consistent
&& "The dominators of the irg must be consistent"); && "The dominators of the irg must be consistent");
assert(root && "The start block of the graph is NULL?"); assert(root && "The start block of the graph is NULL?");
assert(get_dom_info(root)->idom == NULL assert(get_dom_info(root)->idom == NULL
......
...@@ -202,8 +202,7 @@ static int int_graph_wrapper(ir_graph *irg, void *context) { ...@@ -202,8 +202,7 @@ static int int_graph_wrapper(ir_graph *irg, void *context) {
/* Creates an ir_graph pass for running void function(ir_graph *irg). */ /* Creates an ir_graph pass for running void function(ir_graph *irg). */
ir_graph_pass_t *def_graph_pass_ret( ir_graph_pass_t *def_graph_pass_ret(
const char *name, int verify, int dump, const char *name, int (*function)(ir_graph *irg))
int (*function)(ir_graph *irg))
{ {
struct ir_graph_pass_t *pass = XMALLOCZ(ir_graph_pass_t); struct ir_graph_pass_t *pass = XMALLOCZ(ir_graph_pass_t);
......
...@@ -1591,8 +1591,10 @@ static int verify_node_Phi(ir_node *n, ir_graph *irg) { ...@@ -1591,8 +1591,10 @@ static int verify_node_Phi(ir_node *n, ir_graph *irg) {
int i; int i;
(void) irg; (void) irg;
/* a Phi node MUST have the same number of inputs as its block
* Exception is a phi with 0 inputs which is used when (re)constructing the
* SSA form */
if (! is_Bad(block) && get_irg_phase_state(get_irn_irg(n)) != phase_building && get_irn_arity(n) > 0) { if (! is_Bad(block) && get_irg_phase_state(get_irn_irg(n)) != phase_building && get_irn_arity(n) > 0) {
/* a Phi node MUST have the same number of inputs as its block */
ASSERT_AND_RET_DBG( ASSERT_AND_RET_DBG(
get_irn_arity(n) == get_irn_arity(block), get_irn_arity(n) == get_irn_arity(block),
"wrong number of inputs in Phi node", 0, "wrong number of inputs in Phi node", 0,
......
...@@ -173,6 +173,7 @@ struct pass_t { ...@@ -173,6 +173,7 @@ struct pass_t {
static int pass_wrapper(ir_prog *irp, void *context) static int pass_wrapper(ir_prog *irp, void *context)
{ {
struct pass_t *pass = context; struct pass_t *pass = context;
(void) irp; /* TODO: set current irp, or remove parameter */
lower_intrinsics(pass->list, pass->length, pass->part_block_used); lower_intrinsics(pass->list, pass->length, pass->part_block_used);
/* probably this pass should not run again */ /* probably this pass should not run again */
return 0; return 0;
......
...@@ -2303,5 +2303,5 @@ int optimize_load_store(ir_graph *irg) { ...@@ -2303,5 +2303,5 @@ int optimize_load_store(ir_graph *irg) {
ir_graph_pass_t *optimize_load_store_pass(const char *name) ir_graph_pass_t *optimize_load_store_pass(const char *name)
{ {
return def_graph_pass(name ? name : "ldst", optimize_load_store); return def_graph_pass_ret(name ? name : "ldst", optimize_load_store);
} /* optimize_load_store_pass */ } /* optimize_load_store_pass */
...@@ -2409,5 +2409,5 @@ end: ...@@ -2409,5 +2409,5 @@ end:
ir_graph_pass_t *opt_ldst_pass(const char *name) ir_graph_pass_t *opt_ldst_pass(const char *name)
{ {
return def_graph_pass(name ? name : "ldst_df", opt_ldst); return def_graph_pass_ret(name ? name : "ldst_df", opt_ldst);
} /* opt_ldst_pass */ } /* opt_ldst_pass */
...@@ -934,8 +934,8 @@ int optimize_reassociation(ir_graph *irg) ...@@ -934,8 +934,8 @@ int optimize_reassociation(ir_graph *irg)
} /* optimize_reassociation */ } /* optimize_reassociation */
/* create a pass for the reassociation */ /* create a pass for the reassociation */
ir_graph_pass_t *optimize_reassociation_pass(const char *name, int verify, int dump) { ir_graph_pass_t *optimize_reassociation_pass(const char *name) {
return def_graph_pass_ret(name ? name : "reassoc", verify, dump, optimize_reassociation); return def_graph_pass_ret(name ? name : "reassoc", optimize_reassociation);
} /* optimize_reassociation_pass */ } /* optimize_reassociation_pass */
/* Sets the default reassociation operation for an ir_op_ops. */ /* Sets the default reassociation operation for an ir_op_ops. */
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "ircons_t.h" #include "ircons_t.h"
#include "irnode_t.h" #include "irnode_t.h"
#include "irgmod.h" #include "irgmod.h"
#include "irtools.h"
#define set_bit(n) (returns[(n) >> 3] |= 1 << ((n) & 7)) #define set_bit(n) (returns[(n) >> 3] |= 1 << ((n) & 7))
#define get_bit(n) (returns[(n) >> 3] & (1 << ((n) & 7))) #define get_bit(n) (returns[(n) >> 3] & (1 << ((n) & 7)))
...@@ -167,9 +168,9 @@ void normalize_one_return(ir_graph *irg) { ...@@ -167,9 +168,9 @@ void normalize_one_return(ir_graph *irg) {
} }
/* Create a graph pass. */ /* Create a graph pass. */
ir_graph_pass_t *normalize_one_return_pass(const char *name, int verify, int dump) ir_graph_pass_t *normalize_one_return_pass(const char *name)
{ {
return def_graph_pass(name ? name : "one_ret", verify, dump, normalize_one_return); return def_graph_pass(name ? name : "one_ret", normalize_one_return);
} }
/** /**
......
...@@ -772,7 +772,8 @@ int scalar_replacement_opt(ir_graph *irg) { ...@@ -772,7 +772,8 @@ int scalar_replacement_opt(ir_graph *irg) {
} }
ir_graph_pass_t *scalar_replacement_opt_pass(const char *name) { ir_graph_pass_t *scalar_replacement_opt_pass(const char *name) {
return def_graph_pass(name ? name : "scalar_rep", scalar_replacement_opt); return def_graph_pass_ret(name ? name : "scalar_rep",
scalar_replacement_opt);
} }
void firm_init_scalar_replace(void) { void firm_init_scalar_replace(void) {
......
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