inserted in BB. */
tree recip_def;
- /* If non-NULL, the MODIFY_EXPR for a reciprocal computation that
+ /* If non-NULL, the GIMPLE_MODIFY_STMT for a reciprocal computation that
was inserted in BB. */
tree recip_def_stmt;
static inline bool
is_division_by (tree use_stmt, tree def)
{
- return TREE_CODE (use_stmt) == MODIFY_EXPR
- && TREE_CODE (TREE_OPERAND (use_stmt, 1)) == RDIV_EXPR
- && TREE_OPERAND (TREE_OPERAND (use_stmt, 1), 1) == def;
-}
-
-/* Return the LHS of a RDIV_EXPR that computes a reciprocal in type TYPE. */
-static tree
-get_constant_one (tree type)
-{
- tree scalar, cst;
- int i;
-
- gcc_assert (FLOAT_TYPE_P (type));
- switch (TREE_CODE (type))
- {
- case REAL_TYPE:
- return build_real (type, dconst1);
-
- case VECTOR_TYPE:
- scalar = build_real (TREE_TYPE (type), dconst1);
-
- /* Create 'vect_cst_ = {cst,cst,...,cst}' */
- cst = NULL_TREE;
- for (i = TYPE_VECTOR_SUBPARTS (type); --i >= 0; )
- cst = tree_cons (NULL_TREE, scalar, cst);
-
- return build_vector (type, cst);
-
- default:
- /* Complex operations have been split already. */
- gcc_unreachable ();
- }
+ return TREE_CODE (use_stmt) == GIMPLE_MODIFY_STMT
+ && TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 1)) == RDIV_EXPR
+ && TREE_OPERAND (GIMPLE_STMT_OPERAND (use_stmt, 1), 1) == def;
}
/* Walk the subset of the dominator tree rooted at OCC, setting the
/* Make a variable with the replacement and substitute it. */
type = TREE_TYPE (def);
recip_def = make_rename_temp (type, "reciptmp");
- new_stmt = build2 (MODIFY_EXPR, void_type_node, recip_def,
- fold_build2 (RDIV_EXPR, type, get_constant_one (type),
+ new_stmt = build2 (GIMPLE_MODIFY_STMT, void_type_node, recip_def,
+ fold_build2 (RDIV_EXPR, type, build_one_cst (type),
def));
if (occ->recip_def && use_stmt != occ->recip_def_stmt)
{
- TREE_SET_CODE (TREE_OPERAND (use_stmt, 1), MULT_EXPR);
+ TREE_SET_CODE (GIMPLE_STMT_OPERAND (use_stmt, 1), MULT_EXPR);
SET_USE (use_p, occ->recip_def);
fold_stmt_inplace (use_stmt);
update_stmt (use_stmt);
#endif
for (arg = DECL_ARGUMENTS (cfun->decl); arg; arg = TREE_CHAIN (arg))
- if (default_def (arg)
+ if (gimple_default_def (cfun, arg)
&& FLOAT_TYPE_P (TREE_TYPE (arg))
&& is_gimple_reg (arg))
- execute_cse_reciprocals_1 (NULL, default_def (arg));
+ execute_cse_reciprocals_1 (NULL, gimple_default_def (cfun, arg));
FOR_EACH_BB (bb)
{
for (bsi = bsi_after_labels (bb); !bsi_end_p (bsi); bsi_next (&bsi))
{
tree stmt = bsi_stmt (bsi);
- if (TREE_CODE (stmt) == MODIFY_EXPR
+ if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
&& (def = SINGLE_SSA_TREE_OPERAND (stmt, SSA_OP_DEF)) != NULL
&& FLOAT_TYPE_P (TREE_TYPE (def))
&& TREE_CODE (def) == SSA_NAME)