+2019-10-30 Martin Liska <mliska@suse.cz>
+
+ * ipa-icf-gimple.c (func_checker::compare_ssa_name): Use
+ const_tree as function argument.
+ (func_checker::compare_decl): Likewise.
+ (func_checker::operand_equal_p): Likewise.
+ (func_checker::compare_variable_decl): Likewise.
+ (func_checker::parse_labels): Likewise.
+ * ipa-icf-gimple.h: Likewise.
+
2019-10-30 Martin Liska <mliska@suse.cz>
* ipa-icf-gimple.c (func_checker::compatible_types_p):
/* Verifies that trees T1 and T2 are equivalent from perspective of ICF. */
bool
-func_checker::compare_ssa_name (tree t1, tree t2)
+func_checker::compare_ssa_name (const_tree t1, const_tree t2)
{
gcc_assert (TREE_CODE (t1) == SSA_NAME);
gcc_assert (TREE_CODE (t2) == SSA_NAME);
come from functions FUNC1 and FUNC2. */
bool
-func_checker::compare_decl (tree t1, tree t2)
+func_checker::compare_decl (const_tree t1, const_tree t2)
{
if (!auto_var_in_fn_p (t1, m_source_func_decl)
|| !auto_var_in_fn_p (t2, m_target_func_decl))
return return_false ();
bool existed_p;
- tree &slot = m_decl_map.get_or_insert (t1, &existed_p);
+ const_tree &slot = m_decl_map.get_or_insert (t1, &existed_p);
if (existed_p)
return return_with_debug (slot == t2);
else
if (TREE_CODE (t1) != TREE_CODE (t2))
return return_false ();
- tree tree1 = (tree)const_cast<tree> (t1);
- tree tree2 = (tree)const_cast<tree> (t2);
-
switch (TREE_CODE (t1))
{
case FUNCTION_DECL:
before we start comparing bodies. */
return true;
case VAR_DECL:
- return return_with_debug (compare_variable_decl (tree1, tree2));
+ return return_with_debug (compare_variable_decl (t1, t2));
case LABEL_DECL:
{
- int *bb1 = m_label_bb_map.get (tree1);
- int *bb2 = m_label_bb_map.get (tree2);
+ int *bb1 = m_label_bb_map.get (t1);
+ int *bb2 = m_label_bb_map.get (t2);
/* Labels can point to another function (non-local GOTOs). */
return return_with_debug (bb1 != NULL && bb2 != NULL && *bb1 == *bb2);
}
case PARM_DECL:
case RESULT_DECL:
case CONST_DECL:
- return compare_decl (tree1, tree2);
+ return compare_decl (t1, t2);
case SSA_NAME:
- return compare_ssa_name (tree1, tree2);
+ return compare_ssa_name (t1, t2);
default:
break;
}
/* Verifies that trees T1 and T2 do correspond. */
bool
-func_checker::compare_variable_decl (tree t1, tree t2)
+func_checker::compare_variable_decl (const_tree t1, const_tree t2)
{
bool ret = false;
return return_false_with_msg ("DECL_HARD_REGISTER are different");
if (DECL_HARD_REGISTER (t1)
- && DECL_ASSEMBLER_NAME (t1) != DECL_ASSEMBLER_NAME (t2))
+ && DECL_ASSEMBLER_NAME_RAW (t1) != DECL_ASSEMBLER_NAME_RAW (t2))
return return_false_with_msg ("HARD REGISTERS are different");
/* Symbol table variables are known to match before we start comparing
if (glabel *label_stmt = dyn_cast <glabel *> (stmt))
{
- tree t = gimple_label_label (label_stmt);
+ const_tree t = gimple_label_label (label_stmt);
gcc_assert (TREE_CODE (t) == LABEL_DECL);
m_label_bb_map.put (t, bb->bb->index);
bool compare_bb (sem_bb *bb1, sem_bb *bb2);
/* Verifies that trees T1 and T2 are equivalent from perspective of ICF. */
- bool compare_ssa_name (tree t1, tree t2);
+ bool compare_ssa_name (const_tree t1, const_tree t2);
/* Verification function for edges E1 and E2. */
bool compare_edge (edge e1, edge e2);
bool compare_gimple_asm (const gasm *s1, const gasm *s2);
/* Verification function for declaration trees T1 and T2. */
- bool compare_decl (tree t1, tree t2);
+ bool compare_decl (const_tree t1, const_tree t2);
/* Verifies that tree labels T1 and T2 correspond. */
bool compare_tree_ssa_label (tree t1, tree t2);
bool compare_function_decl (tree t1, tree t2);
/* Verifies that trees T1 and T2 do correspond. */
- bool compare_variable_decl (tree t1, tree t2);
+ bool compare_variable_decl (const_tree t1, const_tree t2);
/* Compare loop information for basic blocks BB1 and BB2. */
bool compare_loops (basic_block bb1, basic_block bb2);
hash_map <edge, edge> m_edge_map;
/* Source to target declaration map. */
- hash_map <tree, tree> m_decl_map;
+ hash_map <const_tree, const_tree> m_decl_map;
/* Label to basic block index mapping. */
- hash_map <tree, int> m_label_bb_map;
+ hash_map <const_tree, int> m_label_bb_map;
/* Flag if ignore labels in comparison. */
bool m_ignore_labels;