66ad61a...
by
David Malcolm <email address hidden>
tree-ssa-forwprop.c: Use gassign
gcc/ChangeLog.gimple-classes:
* tree-ssa-forwprop.c (get_prop_dest_stmt): Capture result of
gimple_assign_ssa_name_copy_p as new local "use_assign", using in
place of "use_stmt" for typesafety.
(remove_prop_source_from_use): Add checked cast.
(rhs_to_tree): Strengthen param "stmt" from gimple to gassign *.
(forward_propagate_into_comparison): Strengthen local "stmt" from
gimple to gassign *.
(forward_propagate_into_cond): Likewise.
(combine_cond_exprs): Likewise. Replace local bool "changed" with
gimple "changed_stmt", adding assignments to "changed_stmt" in
place of those to "changed". Replace is_gimple_assign with a
dyn_cast, using it to strenghten local "def_stmt" from gimple to
gassign *.
(tidy_after_forward_propagate_addr): Add checked cast.
(forward_propagate_addr_expr_1): Strengthen local "use_stmt" from
gimple to gassign *.
(forward_propagate_addr_expr): Introduce local "use_assign", using
it in place of "use_stmt" for typesafety.
(forward_propagate_comparison): Strengthen local "stmt" from
gimple to gassign *. Replace is_gimple_assign with a dyn_cast,
using it to introduce local "use_assign", using it in place of
"use_stmt" for typesafety.
(simplify_conversion_from_bitmask): Strengthen local "stmt" from
gimple to gassign *. Replace is_gimple_assign with a dyn_cast,
using it to introduce local "rhs_def_assign", using it in place of
"rhs_def_stmt" for typesafety.
(simplify_not_neg_expr): Strengthen local "stmt" from gimple to
gassign *. Replace is_gimple_assign with a dyn_cast,
using it to strengthen local "rhs_def_stmt" from gimple to
gassign *.
(simplify_gimple_switch): Add checked cast.
(constant_pointer_difference): Replace is_gimple_assign with a
dyn_cast, using it to strengthen local "stmt" from gimple to
gassign *.
(simplify_builtin_call): Capture result of gimple_assign_single_p
as new local "assign_stmt1", using it in place of "stmt1" for
typesafety.
(truth_valued_ssa_name): Add checked cast.
(lookup_logical_inverted_value): Replace is_gimple_assign with a
dyn_cast, using it to strengthen local "def" from gimple to
gassign *.
(simplify_bitwise_binary_boolean): Likewise for local
"op0_def_stmt". Strengthen local "stmt" from gimple to gassign *.
(simplify_bitwise_binary): Strengthen local "stmt" from gimple to
gassign *.
(simplify_rotate): Likewise.
(associate_pointerplus_align): Likewise, also for local "def_stmt"
via various is_gimple_assign becoming dyn_casts.
(associate_pointerplus_diff): Likewise, also for local "minus".
(combine_conversions): Likewise.
(simplify_vce): Likewise.
(simplify_bitfield_ref): Likewise.
(simplify_permutation): Likewise.
(simplify_vector_constructor): Likewise.
(simplify_mult): Likewise.
(fold_all_stmts): Capture result of gimple_assign_single_p as new
local "assign_stmt", using it in place of "stmt" for typesafety.
(pass_forwprop::execute): Within case GIMPLE_ASSIGN add new
local "assign_stmt" and use it in place of "stmt" for typesafety.
b0ba00c...
by
David Malcolm <email address hidden>
tree-outof-ssa.c: Use gassign
gcc/ChangeLog.gimple-classes:
* tree-outof-ssa.c (ssa_is_replaceable_p): Rename param "stmt" to
"gs", replacing is_gimple_assign with a dyn_cast, using it to
reintroduce "stmt" as a gassign * for typesafety. Remove
redundant is_gimple_call (stmt) test, since we've already checked
for a GIMPLE_ASSIGN.
c93192e...
by
David Malcolm <email address hidden>
ubsan.c: Use gassign
gcc/ChangeLog.gimple-classes:
* ubsan.c (ubsan_expand_null_ifn): Rename local "stmt" to
"ubsan_null_call" and strengthen from gimple to gcall *.
Eliminate local gimple "g" in favor of new locals
"assign_stmt", "builtin_call", "cond_stmt", "and_stmt".
(instrument_null): Strengthen local "stmt" from gimple to
gassign *.
(instrument_si_overflow): Likewise.
(instrument_bool_enum_load): Likewise. Eliminate local gimple
"g" in favor of new locals "assign_stmt", "cond_stmt",
"call_stmt".
(instrument_nonnull_arg): Strengthen local "stmt" from gimple to
gcall *. Eliminate local gimple "g" in favor of new locals
"assign_stmt", "cond_stmt", "call_stmt".
(instrument_object_size): Strengthen locals "stmt" and "def_stmt"
from gimple to gassign *.
ac65df1...
by
David Malcolm <email address hidden>
tsan.c: Use gassign
gcc/ChangeLog.gimple-classes:
* tsan.c (is_vptr_store): Add checked cast.
(instrument_gimple): Replace is_gimple_assign with a dyn_cast,
introducing local "assign_stmt", using in place of "stmt" for
typesafety.
a913c5c...
by
David Malcolm <email address hidden>
asan.c: Use gassign and gcall
gcc/ChangeLog.gimple-classes:
* asan.c (asan_expand_check_ifn): Eliminate local gimple "g",
breaking it up into new locals "builtin_call", "stmt1",
"last_stmt", "stmt2", "cond_stmt", "assign_stmt", "last_assign",
"assign_and", "len_minus_one", "calc_last_byte", "t_ne_zero",
"library_call".
c983310...
by
David Malcolm <email address hidden>
get_gimple_for_ssa_name returns a gassign *
Users of get_gimple_for_ssa_name call gimple_assign_ accessors on
the result.
This commit changes the return value of get_gimple_for_ssa_name
from gimple to gassign * and uses that within cfgexpand.c and expr.c
for typesafety.
Rationale:
The "SA.values" bitmap is written to by
tree-out-of-ssa.c:remove_ssa_form
which gets "values" from find_replaceable_exprs (map).
tree-ssa-ter.c:732:find_replaceable_exprs (var_map map)
gets the bitmap from field "replaceable_expressions" within the
temp_expr_table_p.
Bits in the "replaceable_expressions" bitmap are set by
tree-ssa-ter.c:mark_replaceable
which is called by
tree-ssa-ter.c:find_replaceable_in_bb
on "use".
"mark_replaceable" can only be called if "same_root_var" is true, which is
only set if gimple_assign_single_p (def_stmt) holds, which implies that
"def_stmt" is a GIMPLE_ASSIGN.
This in turn implies that SSA_NAME_DEF_STMT (use) is a GIMPLE_ASSIGN.
Hence the only ssa-name-defining stmts that can have their bit set
within SA.values are assignments.
Hence get_gimple_for_ssa_name can only return GIMPLE_ASSIGN statements,
hence we can have it return a gassign *, rather than a plain gimple,
and propagate that type knowledge to its callsites.
gcc/ChangeLog.gimple-classes:
* tree-outof-ssa.h (get_gimple_for_ssa_name): Strengthen return
type from gimple to gassign *, adding a checked cast, since the
only ssa-name-defining statements that TER flags are assignments.
* cfgexpand.c (expand_call_stmt): Strengthen local "def" from
gimple to gassign *, removing checked casts.
(expand_debug_expr): Likewise for local "g".
(expand_gimple_basic_block): Likewise for local "def".
* expr.c (get_def_for_expr): Strengthen return type and local
"def_stmt" from gimple to gassign *.
(get_def_for_expr_class): Likewise.
(optimize_bitfield_assignment_op): Likewise for locals "srcstmt"
and "op0stmt". Remove redundant is_gimple_assign check.
(store_field): Strengthen local "nop_def" from gimple to
gassign *.
(expand_cond_expr_using_cmove): Likewise for local "srcstmt".
(expand_expr_real_2): Likewise for locals "def", "def0", "def2".
(stmt_is_replaceable_p): Add a checked cast.
(expand_expr_real_1): Introduce local "assign_stmt", using it in
place of "g" within if clause for typesafety. Strengthen local
"def_stmt" from gimple to gassign *.
(do_store_flag): Likewise for local "srcstmt".
7d84d66...
by
David Malcolm <email address hidden>
tree-ssa.c: Use gassign
gcc/ChangeLog.gimple-classes:
* tree-ssa.c (ssa_undefined_value_p): Replace is_gimple_assign
with a dyn_cast, introducing local gassign * "def_assign" and
using it in place of "def_stmt" for typesafety.
(execute_update_addresses_taken): In two places, capture the
result of gimple_assign_single_p as a local gassign *
"assign_stmt", using them in place of "stmt" for typesafety.
93d36fb...
by
David Malcolm <email address hidden>
tree-stdarg.c: Use gassign
gcc/ChangeLog.gimple-classes:
* tree-stdarg.c (va_list_counter_bump): Replace is_gimple_assign
with a dyn_cast, introducing local gassign * "assign_stmt" and
using it in place of "stmt" for typesafety. Tighten the scope of
"stmt". Introduce another local "assign_stmt" via an as_a, again
using it in place of "stmt".
(check_all_va_list_escapes): Replace is_gimple_assign with a
dyn_cast, introducing local gassign * "assign_stmt" and using it
in place of "stmt".
(pass_stdarg::execute): Likewise.
17b30da...
by
David Malcolm <email address hidden>
vtable-verify.c: Use gassign
gcc/ChangeLog.gimple-classes:
* vtable-verify.c (is_vtable_assignment_stmt): Change return type
from bool to gassign * so that this can be used as a dynamic
casting function. Introduce local gassign * "assign_stmt" once we
know we have a GIMPLE_ASSIGN. Update return statements
appropriately.
(var_is_used_for_virtual_call_p): Replace is_gimple_assign with a
dyn_cast, using it to introduce local gassign * "assign_stmt2",
using it in place of "stmt2" for typesafety.
(verify_bb_vtables): Capture result of is_vtable_assignment_stmt
as new local gassign * "assign_stmt", using it in place of "stmt"
for typesafety.
abcbb99...
by
David Malcolm <email address hidden>
value-prof.c: Use gassign
gcc/ChangeLog.gimple-classes:
* value-prof.c (gimple_divmod_values_to_profile): Rename gimple
param "stmt" to "gs", reintroducing "stmt" as a local gassign * by
replacing a check against GIMPLE_ASSIGN with a dyn_cast.