static bool init_dont_simulate_again (void) { basic_block bb; block_stmt_iterator bsi; tree phi; bool saw_a_complex_op = false; FOR_EACH_BB (bb) { for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) DONT_SIMULATE_AGAIN (phi) = !is_complex_reg (PHI_RESULT (phi)); for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi)) { tree orig_stmt, stmt, rhs = NULL; bool dsa; orig_stmt = stmt = bsi_stmt (bsi); /* Most control-altering statements must be initially simulated, else we won't cover the entire cfg. */ dsa = !stmt_ends_bb_p (stmt); switch (TREE_CODE (stmt)) { case RETURN_EXPR: /* We don't care what the lattice value of <retval> is, since it's never used as an input to another computation. */ dsa = true; stmt = TREE_OPERAND (stmt, 0); if (!stmt || TREE_CODE (stmt) != GIMPLE_MODIFY_STMT) break; /* FALLTHRU */ case GIMPLE_MODIFY_STMT: dsa = !is_complex_reg (GIMPLE_STMT_OPERAND (stmt, 0)); rhs = GIMPLE_STMT_OPERAND (stmt, 1); break; case COND_EXPR: rhs = TREE_OPERAND (stmt, 0); break; default: break; } if (rhs) switch (TREE_CODE (rhs)) { case EQ_EXPR: case NE_EXPR: rhs = TREE_OPERAND (rhs, 0); /* FALLTHRU */ case PLUS_EXPR: case MINUS_EXPR: case MULT_EXPR: case TRUNC_DIV_EXPR: case CEIL_DIV_EXPR: case FLOOR_DIV_EXPR: case ROUND_DIV_EXPR: case RDIV_EXPR: case NEGATE_EXPR: case CONJ_EXPR: if (TREE_CODE (TREE_TYPE (rhs)) == COMPLEX_TYPE) saw_a_complex_op = true; break; case REALPART_EXPR: case IMAGPART_EXPR: /* The total store transformation performed during gimplification creates such uninitialized loads and we need to lower the statement to be able to fix things up. */ if (TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME && ssa_undefined_value_p (TREE_OPERAND (rhs, 0))) saw_a_complex_op = true; break; default: break; } DONT_SIMULATE_AGAIN (orig_stmt) = dsa; } } return saw_a_complex_op; }
static bool init_dont_simulate_again (void) { basic_block bb; gimple_stmt_iterator gsi; gimple phi; bool saw_a_complex_op = false; FOR_EACH_BB (bb) { for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { phi = gsi_stmt (gsi); prop_set_simulate_again (phi, is_complex_reg (gimple_phi_result (phi))); } for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { gimple stmt; tree op0, op1; bool sim_again_p; stmt = gsi_stmt (gsi); op0 = op1 = NULL_TREE; /* Most control-altering statements must be initially simulated, else we won't cover the entire cfg. */ sim_again_p = stmt_ends_bb_p (stmt); switch (gimple_code (stmt)) { case GIMPLE_CALL: if (gimple_call_lhs (stmt)) sim_again_p = is_complex_reg (gimple_call_lhs (stmt)); break; case GIMPLE_ASSIGN: sim_again_p = is_complex_reg (gimple_assign_lhs (stmt)); if (gimple_assign_rhs_code (stmt) == REALPART_EXPR || gimple_assign_rhs_code (stmt) == IMAGPART_EXPR) op0 = TREE_OPERAND (gimple_assign_rhs1 (stmt), 0); else op0 = gimple_assign_rhs1 (stmt); if (gimple_num_ops (stmt) > 2) op1 = gimple_assign_rhs2 (stmt); break; case GIMPLE_COND: op0 = gimple_cond_lhs (stmt); op1 = gimple_cond_rhs (stmt); break; default: break; } if (op0 || op1) switch (gimple_expr_code (stmt)) { case EQ_EXPR: case NE_EXPR: case PLUS_EXPR: case MINUS_EXPR: case MULT_EXPR: case TRUNC_DIV_EXPR: case CEIL_DIV_EXPR: case FLOOR_DIV_EXPR: case ROUND_DIV_EXPR: case RDIV_EXPR: if (TREE_CODE (TREE_TYPE (op0)) == COMPLEX_TYPE || TREE_CODE (TREE_TYPE (op1)) == COMPLEX_TYPE) saw_a_complex_op = true; break; case NEGATE_EXPR: case CONJ_EXPR: if (TREE_CODE (TREE_TYPE (op0)) == COMPLEX_TYPE) saw_a_complex_op = true; break; case REALPART_EXPR: case IMAGPART_EXPR: /* The total store transformation performed during gimplification creates such uninitialized loads and we need to lower the statement to be able to fix things up. */ if (TREE_CODE (op0) == SSA_NAME && ssa_undefined_value_p (op0)) saw_a_complex_op = true; break; default: break; } prop_set_simulate_again (stmt, sim_again_p); } } return saw_a_complex_op; }