GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA. */
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
return flag_tree_dom != 0;
}
-struct tree_opt_pass pass_dominator =
+struct gimple_opt_pass pass_dominator =
{
+ {
+ GIMPLE_PASS,
"dom", /* name */
gate_dominator, /* gate */
tree_ssa_dominator_optimize, /* execute */
TODO_dump_func
| TODO_update_ssa
| TODO_cleanup_cfg
- | TODO_verify_ssa, /* todo_flags_finish */
- 0 /* letter */
+ | TODO_verify_ssa /* todo_flags_finish */
+ }
};
(by depth), then use that.
Otherwise it doesn't matter which value we choose, just so
long as we canonicalize on one value. */
- if (TREE_INVARIANT (y))
+ if (is_gimple_min_invariant (y))
;
- else if (TREE_INVARIANT (x) || (loop_depth_of_name (x) <= loop_depth_of_name (y)))
+ else if (is_gimple_min_invariant (x)
+ || (loop_depth_of_name (x) <= loop_depth_of_name (y)))
prev_x = x, x = y, y = prev_x, prev_x = prev_y;
- else if (prev_x && TREE_INVARIANT (prev_x))
+ else if (prev_x && is_gimple_min_invariant (prev_x))
x = y, y = prev_x, prev_x = prev_y;
else if (prev_y && TREE_CODE (prev_y) != VALUE_HANDLE)
y = prev_y;
tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
tree new_stmt;
- /* FIXME: If the LHS of the assignment is a bitfield and the RHS
- is a constant, we need to adjust the constant to fit into the
- type of the LHS. If the LHS is a bitfield and the RHS is not
- a constant, then we can not record any equivalences for this
- statement since we would need to represent the widening or
- narrowing of RHS. This fixes gcc.c-torture/execute/921016-1.c
- and should not be necessary if GCC represented bitfields
- properly. */
- if (lhs_code == COMPONENT_REF
- && DECL_BIT_FIELD (TREE_OPERAND (lhs, 1)))
- {
- if (TREE_CONSTANT (rhs))
- rhs = widen_bitfield (rhs, TREE_OPERAND (lhs, 1), lhs);
- else
- rhs = NULL;
-
- /* If the value overflowed, then we can not use this equivalence. */
- if (rhs && ! is_gimple_min_invariant (rhs))
- rhs = NULL;
- }
-
- if (rhs)
- {
- /* Build a new statement with the RHS and LHS exchanged. */
- new_stmt = build_gimple_modify_stmt (rhs, lhs);
-
- create_ssa_artificial_load_stmt (new_stmt, stmt);
+ /* Build a new statement with the RHS and LHS exchanged. */
+ new_stmt = build_gimple_modify_stmt (rhs, lhs);
+ create_ssa_artificial_load_stmt (new_stmt, stmt, true);
- /* Finally enter the statement into the available expression
- table. */
- lookup_avail_expr (new_stmt, true);
- }
+ /* Finally enter the statement into the available expression
+ table. */
+ lookup_avail_expr (new_stmt, true);
}
}
return 0;
}
-struct tree_opt_pass pass_phi_only_cprop =
+struct gimple_opt_pass pass_phi_only_cprop =
{
+ {
+ GIMPLE_PASS,
"phicprop", /* name */
gate_dominator, /* gate */
eliminate_degenerate_phis, /* execute */
| TODO_ggc_collect
| TODO_verify_ssa
| TODO_verify_stmts
- | TODO_update_ssa, /* todo_flags_finish */
- 0 /* letter */
+ | TODO_update_ssa /* todo_flags_finish */
+ }
};