Commit 2232b14b authored by Andreas Zwinkau's avatar Andreas Zwinkau
Browse files

Merge branch 'opt_manage'

This is a merge, because it should be considered as a single commit
and libFirm might be broken between the various commits of the branch.
However, there are so many changes, that i do not want to squash
them all into one mega-commit.
parents dfe697d7 ac384815
......@@ -58,6 +58,11 @@ FIRM_API void local_optimize_graph(ir_graph *irg);
*/
FIRM_API int optimize_graph_df(ir_graph *irg);
/**
* Transforms unreachable blocks and nodes in there into Bad nodes
*/
FIRM_API void remove_unreachable_blocks(ir_graph *irg);
/**
* Removes all Bad nodes from a graph.
*
......
......@@ -316,8 +316,6 @@ typedef enum {
outs_inconsistent /**< Outs have been computed, memory is still allocated,
but the graph has been changed since. */
} irg_outs_state;
FIRM_API irg_outs_state get_irg_outs_state(const ir_graph *irg);
FIRM_API void set_irg_outs_inconsistent(ir_graph *irg);
/** state: extended basic block state. */
typedef enum {
......@@ -328,24 +326,6 @@ typedef enum {
FIRM_API irg_extblk_info_state get_irg_extblk_state(const ir_graph *irg);
FIRM_API void set_irg_extblk_inconsistent(ir_graph *irg);
/** state: dom_state
* Signals the state of the dominator / post dominator information.
*/
typedef enum {
dom_none, /**< dominator are not computed, no memory is allocated */
dom_consistent, /**< dominator information is computed and correct */
dom_inconsistent /**< dominator information is computed but the graph has been changed since */
} irg_dom_state;
/** returns the dominator state of an IR graph. */
FIRM_API irg_dom_state get_irg_dom_state(const ir_graph *irg);
/** returns the post dominator state of an IR graph. */
FIRM_API irg_dom_state get_irg_postdom_state(const ir_graph *irg);
/** sets the dominator and post dominator state of an IR graph to inconsistent. */
FIRM_API void set_irg_doms_inconsistent(ir_graph *irg);
/** state: loopinfo_state
* Loop information describes the loops within the control and
* data flow of the procedure.
......@@ -501,7 +481,6 @@ typedef enum {
IR_GRAPH_STATE_KEEP_MUX = 1U << 0, /**< should perform no further optimisations on Mux nodes */
IR_GRAPH_STATE_ARCH_DEP = 1U << 1, /**< should not construct more nodes which irarch potentially breaks down */
IR_GRAPH_STATE_BCONV_ALLOWED = 1U << 2, /**< Conv(mode_b) to Iu is allowed as set command */
IR_GRAPH_STATE_BAD_BLOCK = 1U << 3, /**< a node may have Bad in its block input */
/**
* There are normalisations where there is no "best" representative.
* In this case we first normalise into 1 direction (!NORMALISATION2) and
......@@ -514,6 +493,19 @@ typedef enum {
* Set IMPLICIT_BITFIELD_MASKING, if the lowering phase must insert masking operations.
*/
IR_GRAPH_STATE_IMPLICIT_BITFIELD_MASKING = 1U << 5,
IR_GRAPH_STATE_NO_CRITICAL_EDGES = 1U << 6,
IR_GRAPH_STATE_NO_BAD_BLOCKS = 1U << 7,
IR_GRAPH_STATE_NO_UNREACHABLE_BLOCKS = 1U << 8,
IR_GRAPH_STATE_ONE_RETURN = 1U << 9,
IR_GRAPH_STATE_CONSISTENT_DOMINANCE = 1U << 10,
IR_GRAPH_STATE_CONSISTENT_POSTDOMINANCE = 1U << 11,
IR_GRAPH_STATE_CONSISTENT_OUT_EDGES = 1U << 12,
IR_GRAPH_STATE_CONSISTENT_OUTS = 1U << 13,
IR_GRAPH_STATE_CONSISTENT_LOOPINFO = 1U << 14,
IR_GRAPH_STATE_CONSISTENT_ENTITY_USAGE = 1U << 15,
IR_GRAPH_STATE_VALID_EXTENDED_BLOCKS = 1U << 16,
IR_GRAPH_STATE_BROKEN_FOR_VERIFIER = 1U << 17,
} ir_graph_state_t;
ENUM_BITSET(ir_graph_state_t)
......
......@@ -170,19 +170,11 @@ FIRM_API ir_alias_relation get_alias_relation_ex(
*/
FIRM_API void mem_disambig_term(void);
FIRM_API ir_entity_usage_computed_state get_irg_entity_usage_state(const ir_graph *irg);
FIRM_API void set_irg_entity_usage_state(ir_graph *irg,
ir_entity_usage_computed_state state);
/**
* Assure that the entity usage flags have been computed for the given graph.
*
* This analysis computes the entity usage state for all local variables.
*
* Note that this is a conservative estimation that by no Firm transformation
* can be invalidated, so it's only recomputed if manually triggered by calling
* set_irg_entity_usage_state(irg, ir_entity_usage_not_computed).
* Even then the information is not cleaned from the variables, call
* assure_irg_entity_usage_computed() again for recomputation.
*/
......
......@@ -291,6 +291,12 @@ FIRM_API size_t get_irp_n_asms(void);
/** Return the global asm include at position pos. */
FIRM_API ident *get_irp_asm(size_t pos);
/** Return whether optimization dump vcg graphs */
FIRM_API int get_irp_optimization_dumps(void);
/** Enable vcg dumping of optimization */
FIRM_API void enable_irp_optimization_dumps(void);
#include "end.h"
#endif
......@@ -384,7 +384,7 @@ void dom_tree_walk_irg(ir_graph *irg, irg_walk_func *pre,
/* The root of the dominator tree should be the Start block. */
ir_node *root = get_irg_start_block(irg);
assert(irg->dom_state == dom_consistent
assert(is_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE)
&& "The dominators of the irg must be consistent");
assert(root && "The start block of the graph is NULL?");
assert(get_dom_info(root)->idom == NULL
......@@ -396,10 +396,10 @@ void dom_tree_walk_irg(ir_graph *irg, irg_walk_func *pre,
void postdom_tree_walk_irg(ir_graph *irg, irg_walk_func *pre,
irg_walk_func *post, void *env)
{
/* The root of the dominator tree should be the End block. */
/* The root of the post dominator tree should be the End block. */
ir_node *root = get_irg_end_block(irg);
assert(irg->pdom_state == dom_consistent
assert(is_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_POSTDOMINANCE)
&& "The dominators of the irg must be consistent");
assert(root && "The end block of the graph is NULL?");
assert(get_pdom_info(root)->idom == NULL
......@@ -640,9 +640,7 @@ static void count_and_init_blocks_dom(ir_node *bl, void *env)
set_Block_dom_depth(bl, -1);
}
/* Computes the dominator trees. Sets a flag in irg to "dom_consistent".
If the control flow of the graph is changed this flag must be set to
"dom_inconsistent". */
/* Computes the dominator trees. */
void compute_doms(ir_graph *irg)
{
ir_graph *rem = current_ir_graph;
......@@ -653,7 +651,6 @@ void compute_doms(ir_graph *irg)
/* Update graph state */
assert(get_irg_phase_state(irg) != phase_building);
irg->dom_state = dom_consistent;
/* Count the number of blocks in the graph. */
n_blocks = 0;
......@@ -766,15 +763,16 @@ void compute_doms(ir_graph *irg)
/* Do a walk over the tree and assign the tree pre orders. */
{
unsigned tree_pre_order = 0;
dom_tree_walk_irg(irg, assign_tree_dom_pre_order,
dom_tree_walk(get_irg_start_block(irg), assign_tree_dom_pre_order,
assign_tree_dom_pre_order_max, &tree_pre_order);
}
current_ir_graph = rem;
set_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE);
}
void assure_doms(ir_graph *irg)
{
if (get_irg_dom_state(irg) != dom_consistent)
if (! is_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE))
compute_doms(irg);
}
......@@ -782,15 +780,13 @@ void free_dom(ir_graph *irg)
{
/* Update graph state */
assert(get_irg_phase_state(irg) != phase_building);
irg->dom_state = dom_none;
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE);
/* With the implementation right now there is nothing to free,
but better call it anyways... */
}
/* Computes the post dominator trees. Sets a flag in irg to "dom_consistent".
If the control flow of the graph is changed this flag must be set to
"dom_inconsistent". */
/* Computes the post dominator trees. */
void compute_postdoms(ir_graph *irg)
{
ir_graph *rem = current_ir_graph;
......@@ -801,7 +797,6 @@ void compute_postdoms(ir_graph *irg)
/* Update graph state */
assert(get_irg_phase_state(irg) != phase_building);
irg->pdom_state = dom_consistent;
/* Count the number of blocks in the graph. */
n_blocks = 0;
......@@ -881,15 +876,16 @@ void compute_postdoms(ir_graph *irg)
/* Do a walk over the tree and assign the tree pre orders. */
{
unsigned tree_pre_order = 0;
postdom_tree_walk_irg(irg, assign_tree_postdom_pre_order,
postdom_tree_walk(get_irg_end_block(irg), assign_tree_postdom_pre_order,
assign_tree_postdom_pre_order_max, &tree_pre_order);
}
current_ir_graph = rem;
set_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_POSTDOMINANCE);
}
void assure_postdoms(ir_graph *irg)
{
if (get_irg_postdom_state(irg) != dom_consistent)
if (! is_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_POSTDOMINANCE))
compute_postdoms(irg);
}
......@@ -897,7 +893,7 @@ void free_postdom(ir_graph *irg)
{
/* Update graph state */
assert(get_irg_phase_state(irg) != phase_building);
irg->pdom_state = dom_none;
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_POSTDOMINANCE);
/* With the implementation right now there is nothing to free,
but better call it anyways... */
......
......@@ -1041,22 +1041,12 @@ static void analyse_irg_entity_usage(ir_graph *irg)
/* now computed */
irg->entity_usage_state = ir_entity_usage_computed;
}
ir_entity_usage_computed_state get_irg_entity_usage_state(const ir_graph *irg)
{
return irg->entity_usage_state;
}
void set_irg_entity_usage_state(ir_graph *irg, ir_entity_usage_computed_state state)
{
irg->entity_usage_state = state;
set_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_ENTITY_USAGE);
}
void assure_irg_entity_usage_computed(ir_graph *irg)
{
if (irg->entity_usage_state != ir_entity_usage_not_computed)
if (is_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_ENTITY_USAGE))
return;
analyse_irg_entity_usage(irg);
......
......@@ -231,8 +231,9 @@ void irg_out_walk(ir_node *node, irg_walk_func *pre, irg_walk_func *post,
void *env)
{
assert(node);
if (get_irg_outs_state(current_ir_graph) != outs_none) {
inc_irg_visited (current_ir_graph);
ir_graph *irg = get_irn_irg(node);
if (is_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS)) {
inc_irg_visited (irg);
irg_out_walk_2(node, pre, post, env);
}
}
......@@ -450,8 +451,7 @@ void compute_irg_outs(ir_graph *irg)
/* Update graph state */
assert(get_irg_phase_state(current_ir_graph) != phase_building);
if (current_ir_graph->outs_state != outs_none)
free_irg_outs(current_ir_graph);
free_irg_outs(current_ir_graph);
/* This first iteration counts the overall number of out edges and the
number of out edges for each node. */
......@@ -470,13 +470,13 @@ void compute_irg_outs(ir_graph *irg)
/* Check how much memory we have used */
assert (end == (irg->outs + n_out_edges));
current_ir_graph->outs_state = outs_consistent;
set_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
current_ir_graph = rem;
}
void assure_irg_outs(ir_graph *irg)
{
if (get_irg_outs_state(irg) != outs_consistent)
if (! is_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS))
compute_irg_outs(irg);
}
......@@ -497,7 +497,6 @@ void free_irp_outs(void)
void free_irg_outs(ir_graph *irg)
{
/* current_ir_graph->outs_state = outs_none; */
irg->outs_state = outs_none;
if (irg->outs) {
#ifdef DEBUG_libfirm
......
......@@ -263,7 +263,7 @@ int be_remove_empty_blocks(ir_graph *irg)
if (blocks_removed) {
/* invalidate analysis info */
set_irg_doms_inconsistent(irg);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE);
set_irg_extblk_inconsistent(irg);
}
return blocks_removed;
......
......@@ -422,7 +422,7 @@ void be_transform_graph(ir_graph *irg, arch_pretrans_nodes *func)
free_irg_outs(irg);
free_trouts();
free_loop_information(irg);
set_irg_doms_inconsistent(irg);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE);
be_liveness_invalidate(be_get_irg_liveness(irg));
/* Hack for now, something is buggy with invalidate liveness... */
......
......@@ -2319,7 +2319,7 @@ void dump_ir_graph_file(FILE *out, ir_graph *irg)
/* dump the out edges in a separate walk */
if ((flags & ir_dump_flag_out_edges)
&& (get_irg_outs_state(irg) != outs_none)) {
&& (is_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS))) {
irg_out_walk(get_irg_start(irg), dump_out_edge, NULL, out);
}
......@@ -2374,7 +2374,7 @@ static void dump_block_to_cfg(ir_node *block, void *env)
/* Dump dominator/postdominator edge */
if (ir_get_dump_flags() & ir_dump_flag_dominance) {
if (get_irg_dom_state(current_ir_graph) == dom_consistent && get_Block_idom(block)) {
if (is_irg_state(get_irn_irg(block), IR_GRAPH_STATE_CONSISTENT_DOMINANCE) && get_Block_idom(block)) {
ir_node *pred = get_Block_idom(block);
fprintf(F, "edge: { sourcename: \"");
PRINT_NODEID(block);
......@@ -2382,7 +2382,7 @@ static void dump_block_to_cfg(ir_node *block, void *env)
PRINT_NODEID(pred);
fprintf(F, "\" " DOMINATOR_EDGE_ATTR "}\n");
}
if (get_irg_postdom_state(current_ir_graph) == dom_consistent && get_Block_ipostdom(block)) {
if (is_irg_state(get_irn_irg(block), IR_GRAPH_STATE_CONSISTENT_POSTDOMINANCE) && get_Block_ipostdom(block)) {
ir_node *pred = get_Block_ipostdom(block);
fprintf(F, "edge: { sourcename: \"");
PRINT_NODEID(block);
......
......@@ -138,12 +138,12 @@ void dump_irnode_to_file(FILE *F, ir_node *n)
fprintf(F, " Label: %lu\n", get_entity_label(get_Block_entity(n)));
fprintf(F, " block visited: %lu\n", get_Block_block_visited(n));
fprintf(F, " block marked: %u\n", get_Block_mark(n));
if (get_irg_dom_state(get_irn_irg(n)) == dom_consistent) {
if (is_irg_state(get_irn_irg(n), IR_GRAPH_STATE_CONSISTENT_DOMINANCE)) {
fprintf(F, " dom depth %d\n", get_Block_dom_depth(n));
fprintf(F, " domtree pre num %u\n", get_Block_dom_tree_pre_num(n));
fprintf(F, " max subtree pre num %u\n", get_Block_dom_max_subtree_pre_num(n));
}
if (get_irg_postdom_state(get_irn_irg(n)) == dom_consistent) {
if (is_irg_state(get_irn_irg(n), IR_GRAPH_STATE_CONSISTENT_POSTDOMINANCE)) {
fprintf(F, " pdom depth %d\n", get_Block_postdom_depth(n));
fprintf(F, " pdomtree pre num %u\n", get_Block_pdom_tree_pre_num(n));
fprintf(F, " max pdomsubtree pre num %u\n", get_Block_pdom_max_subtree_pre_num(n));
......
......@@ -114,7 +114,8 @@ void exchange(ir_node *old, ir_node *nw)
}
/* update irg flags */
set_irg_outs_inconsistent(irg);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_LOOPINFO);
set_irg_loopinfo_inconsistent(irg);
}
......
......@@ -78,7 +78,7 @@ static inline void do_local_optimize(ir_node *n)
if (get_opt_global_cse())
set_irg_pinned(irg, op_pin_state_floats);
set_irg_doms_inconsistent(irg);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE);
/* Clean the value_table in irg for the CSE. */
new_identities(irg);
......@@ -203,10 +203,10 @@ int optimize_graph_df(ir_graph *irg)
/* The following enables unreachable code elimination (=Blocks may be
* Bad). */
set_irg_state(irg, IR_GRAPH_STATE_BAD_BLOCK);
clear_irg_state(irg, IR_GRAPH_STATE_NO_UNREACHABLE_BLOCKS);
/* invalidate info */
set_irg_doms_inconsistent(irg);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE);
ir_reserve_resources(irg, IR_RESOURCE_IRN_LINK);
......@@ -230,7 +230,7 @@ int optimize_graph_df(ir_graph *irg)
compute_doms(irg);
irg_block_walk_graph(irg, NULL, find_unreachable_blocks, waitq);
}
set_irg_doms_inconsistent(irg);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE);
del_pdeq(waitq);
......@@ -248,7 +248,7 @@ int optimize_graph_df(ir_graph *irg)
end = get_irg_end(irg);
remove_End_Bads_and_doublets(end);
clear_irg_state(irg, IR_GRAPH_STATE_BAD_BLOCK);
set_irg_state(irg, IR_GRAPH_STATE_NO_UNREACHABLE_BLOCKS);
current_ir_graph = rem;
return changed;
......
......@@ -186,9 +186,6 @@ ir_graph *new_r_ir_graph(ir_entity *ent, int n_loc)
res->additional_properties = mtp_property_inherited; /* inherited from type */
res->irg_pinned_state = op_pin_state_pinned;
res->outs_state = outs_none;
res->dom_state = dom_none;
res->pdom_state = dom_none;
res->typeinfo_state = ir_typeinfo_none;
set_irp_typeinfo_inconsistent(); /* there is a new graph with typeinfo_none. */
res->callee_info_state = irg_callee_info_none;
......@@ -197,7 +194,6 @@ ir_graph *new_r_ir_graph(ir_entity *ent, int n_loc)
res->extblk_state = ir_extblk_info_none;
res->execfreq_state = exec_freq_none;
res->fp_model = fp_model_precise;
res->entity_usage_state = ir_entity_usage_not_computed;
res->mem_disambig_opt = aa_opt_inherited;
/*-- Type information for the procedure of the graph --*/
......@@ -445,8 +441,7 @@ void free_ir_graph(ir_graph *irg)
edges_deactivate(irg);
hook_free_graph(irg);
if (irg->outs_state != outs_none)
free_irg_outs(irg);
free_irg_outs(irg);
if (irg->frame_type)
free_type(irg->frame_type);
del_identities(irg);
......@@ -653,16 +648,6 @@ op_pin_state (get_irg_pinned)(const ir_graph *irg)
return _get_irg_pinned(irg);
}
irg_outs_state (get_irg_outs_state)(const ir_graph *irg)
{
return _get_irg_outs_state(irg);
}
void (set_irg_outs_inconsistent)(ir_graph *irg)
{
_set_irg_outs_inconsistent(irg);
}
irg_extblk_info_state (get_irg_extblk_state)(const ir_graph *irg)
{
return _get_irg_extblk_state(irg);
......@@ -673,21 +658,6 @@ void (set_irg_extblk_inconsistent)(ir_graph *irg)
_set_irg_extblk_inconsistent(irg);
}
irg_dom_state (get_irg_dom_state)(const ir_graph *irg)
{
return _get_irg_dom_state(irg);
}
irg_dom_state (get_irg_postdom_state)(const ir_graph *irg)
{
return _get_irg_postdom_state(irg);
}
void (set_irg_doms_inconsistent)(ir_graph *irg)
{
_set_irg_doms_inconsistent(irg);
}
irg_loopinfo_state (get_irg_loopinfo_state)(const ir_graph *irg)
{
return _get_irg_loopinfo_state(irg);
......
......@@ -240,17 +240,6 @@ static inline op_pin_state _get_irg_pinned(const ir_graph *irg)
return irg->irg_pinned_state;
}
static inline irg_outs_state _get_irg_outs_state(const ir_graph *irg)
{
return irg->outs_state;
}
static inline void _set_irg_outs_inconsistent(ir_graph *irg)
{
if (irg->outs_state == outs_consistent)
irg->outs_state = outs_inconsistent;
}
static inline irg_extblk_info_state _get_irg_extblk_state(const ir_graph *irg)
{
return irg->extblk_state;
......@@ -262,24 +251,6 @@ static inline void _set_irg_extblk_inconsistent(ir_graph *irg)
irg->extblk_state = ir_extblk_info_invalid;
}
static inline irg_dom_state _get_irg_dom_state(const ir_graph *irg)
{
return irg->dom_state;
}
static inline irg_dom_state _get_irg_postdom_state(const ir_graph *irg)
{
return irg->pdom_state;
}
static inline void _set_irg_doms_inconsistent(ir_graph *irg)
{
if (irg->dom_state != dom_none)
irg->dom_state = dom_inconsistent;
if (irg->pdom_state != dom_none)
irg->pdom_state = dom_inconsistent;
}
static inline irg_loopinfo_state _get_irg_loopinfo_state(const ir_graph *irg)
{
return irg->loopinfo_state;
......@@ -293,6 +264,7 @@ static inline void _set_irg_loopinfo_state(ir_graph *irg, irg_loopinfo_state s)
static inline void _set_irg_loopinfo_inconsistent(ir_graph *irg)
{
irg->loopinfo_state = (irg_loopinfo_state) (irg->loopinfo_state & ~loopinfo_valid);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_LOOPINFO);
}
static inline void _set_irg_pinned(ir_graph *irg, op_pin_state p)
......@@ -531,13 +503,8 @@ static inline ir_phase *irg_get_phase(const ir_graph *irg, ir_phase_id id)
#define get_irg_phase_state(irg) _get_irg_phase_state(irg)
#define set_irg_phase_state(irg, state) _set_irg_phase_state(irg, state)
#define get_irg_pinned(irg) _get_irg_pinned(irg)
#define get_irg_outs_state(irg) _get_irg_outs_state(irg)
#define set_irg_outs_inconsistent(irg) _set_irg_outs_inconsistent(irg)
#define get_irg_extblk_state(irg) _get_irg_extblk_state(irg)
#define set_irg_extblk_inconsistent(irg) _set_irg_extblk_inconsistent(irg)
#define get_irg_dom_state(irg) _get_irg_dom_state(irg)
#define get_irg_postdom_state(irg) _get_irg_postdom_state(irg)
#define set_irg_doms_inconsistent(irg) _set_irg_doms_inconsistent(irg)
#define get_irg_loopinfo_state(irg) _get_irg_loopinfo_state(irg)
#define set_irg_loopinfo_state(irg, s) _set_irg_loopinfo_state(irg, s)
#define set_irg_loopinfo_inconsistent(irg) _set_irg_loopinfo_inconsistent(irg)
......
......@@ -253,7 +253,7 @@ void set_irn_in(ir_node *node, int arity, ir_node **in)
memcpy((*pOld_in) + 1, in, sizeof(ir_node *) * arity);
/* update irg flags */
set_irg_outs_inconsistent(irg);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
set_irg_loopinfo_inconsistent(irg);
}
......@@ -279,7 +279,7 @@ void set_irn_n(ir_node *node, int n, ir_node *in)
node->in[n + 1] = in;
/* update irg flags */
set_irg_outs_inconsistent(irg);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
set_irg_loopinfo_inconsistent(irg);
}
......@@ -727,7 +727,7 @@ void set_End_keepalives(ir_node *end, int n, ir_node *in[])
}
/* update irg flags */
set_irg_outs_inconsistent(irg);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
}
/* Set new keep-alives from old keep-alives, skipping irn */
......@@ -765,7 +765,7 @@ found:
ARR_RESIZE(ir_node *, end->in, (n - 1) + 1 + END_KEEPALIVE_OFFSET);
/* update irg flags */
set_irg_outs_inconsistent(irg);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
}
/* remove Bads, NoMems and doublets from the keep-alive set */
......@@ -808,7 +808,7 @@ void remove_End_Bads_and_doublets(ir_node *end)
pset_new_destroy(&keeps);
if (changed) {
set_irg_outs_inconsistent(irg);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS);
}
}
......
......@@ -4598,7 +4598,7 @@ static ir_node *transform_node_Proj(ir_node *proj)
static bool is_block_unreachable(const ir_node *block)
{
const ir_graph *irg = get_irn_irg(block);
if (!is_irg_state(irg, IR_GRAPH_STATE_BAD_BLOCK))
if (is_irg_state(irg, IR_GRAPH_STATE_NO_UNREACHABLE_BLOCKS))
return false;
return get_Block_dom_depth(block) < 0;
}
......@@ -4610,7 +4610,9 @@ static ir_node *transform_node_Block(ir_node *block)
ir_node *bad = NULL;
int i;
if (!is_irg_state(irg, IR_GRAPH_STATE_BAD_BLOCK))
if (is_irg_state(irg, IR_GRAPH_STATE_NO_BAD_BLOCKS))
return block;
if (is_irg_state(irg, IR_GRAPH_STATE_NO_UNREACHABLE_BLOCKS))
return block;
for (i = 0; i < arity; ++i) {
......@@ -6730,7 +6732,7 @@ ir_node *optimize_in_place(ir_node *n)
/* FIXME: Maybe we could also test whether optimizing the node can
change the control graph. */
set_irg_doms_inconsistent(irg);
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE);
return optimize_in_place_2(n);
} /* optimize_in_place */
......
......@@ -140,6 +140,20 @@ static inline ir_label_t _get_irp_next_label_nr(void)
return ++irp->last_label_nr;
}
/** Whether optimizations should dump irgs */
static inline int _get_irp_optimization_dumps(void)
{
assert(irp);
return irp->optimization_dumps;
}
/** Set optimizations to dump irgs */
static inline void _enable_irp_optimization_dumps(void)
{
assert(irp);
irp->optimization_dumps = 1;
}