#include "irgopt.h"
#include "irpass.h"
-/**
- * Returns non-zero, is a block is not reachable from Start.
- *
- * @param block the block to test
- */
static int is_Block_unreachable(ir_node *block)
{
- return is_Block_dead(block) || get_Block_dom_depth(block) < 0;
+ return get_Block_dom_depth(block) < 0;
}
/**
place_early() has already been finished on them.
We do not have any unfinished inputs! */
pred_block = get_nodes_block(pred);
- if ((!is_Block_dead(pred_block)) &&
- (get_Block_dom_depth(pred_block) > depth)) {
+ if (get_Block_dom_depth(pred_block) > depth) {
b = pred_block;
depth = get_Block_dom_depth(pred_block);
}
{
assert(block != NULL);
- /* we do not want to place nodes in dead blocks */
- if (is_Block_dead(block))
- return dca;
-
/* We found a first legal placement. */
- if (!dca) return block;
+ if (!dca)
+ return block;
/* Find a placement that is dominates both, dca and block. */
while (get_Block_dom_depth(block) > get_Block_dom_depth(dca))
for (i = 0; i < arity; i++) {
if (get_Phi_pred(consumer, i) == producer) {
ir_node *new_block = get_Block_cfgpred_block(phi_block, i);
+ if (is_Bad(new_block))
+ continue;
if (!is_Block_unreachable(new_block))
dca = calc_dom_dca(dca, new_block);
if (!is_Block(n) &&
(!is_cfop(n)) &&
(get_irn_mode(n) != mode_X)) {
+ ir_op *op;
/* Remember the early_blk placement of this block to move it
out of loop no further than the early_blk placement. */
early_blk = get_nodes_block(n);
place_floats_late(succ, worklist);
}
- if (! is_Block_dead(early_blk)) {
- /* do only move things that where not dead */
- ir_op *op = get_irn_op(n);
-
- /* We have to determine the final block of this node... except for
- constants and Projs */
- if ((get_irn_pinned(n) == op_pin_state_floats) &&
- (op != op_Const) &&
- (op != op_SymConst) &&
- (op != op_Proj))
- {
- /* deepest common ancestor in the dominator tree of all nodes'
- blocks depending on us; our final placement has to dominate
- DCA. */
- ir_node *dca = get_deepest_common_dom_ancestor(n, NULL);
- if (dca != NULL) {
- set_nodes_block(n, dca);
- move_out_of_loops(n, early_blk);
- if (get_irn_mode(n) == mode_T) {
- set_projs_block(n, get_nodes_block(n));
- }
+ /* do only move things that where not dead */
+ op = get_irn_op(n);
+
+ /* We have to determine the final block of this node... except for
+ constants and Projs */
+ if ((get_irn_pinned(n) == op_pin_state_floats) &&
+ (op != op_Const) &&
+ (op != op_SymConst) &&
+ (op != op_Proj))
+ {
+ /* deepest common ancestor in the dominator tree of all nodes'
+ blocks depending on us; our final placement has to dominate
+ DCA. */
+ ir_node *dca = get_deepest_common_dom_ancestor(n, NULL);
+ if (dca != NULL) {
+ set_nodes_block(n, dca);
+ move_out_of_loops(n, early_blk);
+ if (get_irn_mode(n) == mode_T) {
+ set_projs_block(n, get_nodes_block(n));
}
}
}
}
}
+/* Code Placement. */
void place_code(ir_graph *irg)
{
waitq *worklist;
- /* perform gcse which currently only works immediately before performing
- * code placement (we should fix this) */
- set_opt_global_cse(1);
- optimize_graph_df(irg);
- set_opt_global_cse(0);
-
remove_critical_cf_edges(irg);
/* Handle graph state */
*/
static void place_code_wrapper(ir_graph *irg)
{
+ set_opt_global_cse(1);
+ optimize_graph_df(irg);
place_code(irg);
+ set_opt_global_cse(0);
}
ir_graph_pass_t *place_code_pass(const char *name)