Mercurial > hg > CbC > CbC_gcc
comparison gcc/tree-sra.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* Scalar Replacement of Aggregates (SRA) converts some structure | 1 /* Scalar Replacement of Aggregates (SRA) converts some structure |
2 references into scalar references, exposing them to the scalar | 2 references into scalar references, exposing them to the scalar |
3 optimizers. | 3 optimizers. |
4 Copyright (C) 2008-2017 Free Software Foundation, Inc. | 4 Copyright (C) 2008-2018 Free Software Foundation, Inc. |
5 Contributed by Martin Jambor <mjambor@suse.cz> | 5 Contributed by Martin Jambor <mjambor@suse.cz> |
6 | 6 |
7 This file is part of GCC. | 7 This file is part of GCC. |
8 | 8 |
9 GCC is free software; you can redistribute it and/or modify it under | 9 GCC is free software; you can redistribute it and/or modify it under |
95 #include "gimple-walk.h" | 95 #include "gimple-walk.h" |
96 #include "tree-cfg.h" | 96 #include "tree-cfg.h" |
97 #include "tree-dfa.h" | 97 #include "tree-dfa.h" |
98 #include "tree-ssa.h" | 98 #include "tree-ssa.h" |
99 #include "symbol-summary.h" | 99 #include "symbol-summary.h" |
100 #include "ipa-param-manipulation.h" | |
100 #include "ipa-prop.h" | 101 #include "ipa-prop.h" |
101 #include "params.h" | 102 #include "params.h" |
102 #include "dbgcnt.h" | 103 #include "dbgcnt.h" |
103 #include "tree-inline.h" | 104 #include "tree-inline.h" |
104 #include "ipa-fnsummary.h" | 105 #include "ipa-fnsummary.h" |
863 | 864 |
864 static struct access * | 865 static struct access * |
865 create_access (tree expr, gimple *stmt, bool write) | 866 create_access (tree expr, gimple *stmt, bool write) |
866 { | 867 { |
867 struct access *access; | 868 struct access *access; |
869 poly_int64 poffset, psize, pmax_size; | |
868 HOST_WIDE_INT offset, size, max_size; | 870 HOST_WIDE_INT offset, size, max_size; |
869 tree base = expr; | 871 tree base = expr; |
870 bool reverse, ptr, unscalarizable_region = false; | 872 bool reverse, ptr, unscalarizable_region = false; |
871 | 873 |
872 base = get_ref_base_and_extent (expr, &offset, &size, &max_size, &reverse); | 874 base = get_ref_base_and_extent (expr, &poffset, &psize, &pmax_size, |
875 &reverse); | |
876 if (!poffset.is_constant (&offset) | |
877 || !psize.is_constant (&size) | |
878 || !pmax_size.is_constant (&max_size)) | |
879 { | |
880 disqualify_candidate (base, "Encountered a polynomial-sized access."); | |
881 return NULL; | |
882 } | |
873 | 883 |
874 if (sra_mode == SRA_MODE_EARLY_IPA | 884 if (sra_mode == SRA_MODE_EARLY_IPA |
875 && TREE_CODE (base) == MEM_REF) | 885 && TREE_CODE (base) == MEM_REF) |
876 { | 886 { |
877 base = get_ssa_base_param (TREE_OPERAND (base, 0)); | 887 base = get_ssa_base_param (TREE_OPERAND (base, 0)); |
1138 } | 1148 } |
1139 | 1149 |
1140 return false; | 1150 return false; |
1141 } | 1151 } |
1142 | 1152 |
1153 /* Return true if REF contains a VIEW_CONVERT_EXPR or a MEM_REF that performs | |
1154 type conversion or a COMPONENT_REF with a bit-field field declaration. */ | |
1155 | |
1156 static bool | |
1157 contains_vce_or_bfcref_p (const_tree ref) | |
1158 { | |
1159 while (handled_component_p (ref)) | |
1160 { | |
1161 if (TREE_CODE (ref) == VIEW_CONVERT_EXPR | |
1162 || (TREE_CODE (ref) == COMPONENT_REF | |
1163 && DECL_BIT_FIELD (TREE_OPERAND (ref, 1)))) | |
1164 return true; | |
1165 ref = TREE_OPERAND (ref, 0); | |
1166 } | |
1167 | |
1168 if (TREE_CODE (ref) != MEM_REF | |
1169 || TREE_CODE (TREE_OPERAND (ref, 0)) != ADDR_EXPR) | |
1170 return false; | |
1171 | |
1172 tree mem = TREE_OPERAND (TREE_OPERAND (ref, 0), 0); | |
1173 if (TYPE_MAIN_VARIANT (TREE_TYPE (ref)) | |
1174 != TYPE_MAIN_VARIANT (TREE_TYPE (mem))) | |
1175 return true; | |
1176 | |
1177 return false; | |
1178 } | |
1179 | |
1143 /* Search the given tree for a declaration by skipping handled components and | 1180 /* Search the given tree for a declaration by skipping handled components and |
1144 exclude it from the candidates. */ | 1181 exclude it from the candidates. */ |
1145 | 1182 |
1146 static void | 1183 static void |
1147 disqualify_base_of_expr (tree t, const char *reason) | 1184 disqualify_base_of_expr (tree t, const char *reason) |
1336 if (racc) | 1373 if (racc) |
1337 { | 1374 { |
1338 racc->grp_assignment_read = 1; | 1375 racc->grp_assignment_read = 1; |
1339 if (should_scalarize_away_bitmap && !gimple_has_volatile_ops (stmt) | 1376 if (should_scalarize_away_bitmap && !gimple_has_volatile_ops (stmt) |
1340 && !is_gimple_reg_type (racc->type)) | 1377 && !is_gimple_reg_type (racc->type)) |
1341 bitmap_set_bit (should_scalarize_away_bitmap, DECL_UID (racc->base)); | 1378 { |
1379 if (contains_vce_or_bfcref_p (rhs)) | |
1380 bitmap_set_bit (cannot_scalarize_away_bitmap, | |
1381 DECL_UID (racc->base)); | |
1382 else | |
1383 bitmap_set_bit (should_scalarize_away_bitmap, | |
1384 DECL_UID (racc->base)); | |
1385 } | |
1342 if (storage_order_barrier_p (lhs)) | 1386 if (storage_order_barrier_p (lhs)) |
1343 racc->grp_unscalarizable_region = 1; | 1387 racc->grp_unscalarizable_region = 1; |
1344 } | 1388 } |
1345 | 1389 |
1346 if (lacc && racc | 1390 if (lacc && racc |
1424 { | 1468 { |
1425 gimple *stmt = gsi_stmt (gsi); | 1469 gimple *stmt = gsi_stmt (gsi); |
1426 tree t; | 1470 tree t; |
1427 unsigned i; | 1471 unsigned i; |
1428 | 1472 |
1429 if (final_bbs && stmt_can_throw_external (stmt)) | 1473 if (final_bbs && stmt_can_throw_external (cfun, stmt)) |
1430 bitmap_set_bit (final_bbs, bb->index); | 1474 bitmap_set_bit (final_bbs, bb->index); |
1431 switch (gimple_code (stmt)) | 1475 switch (gimple_code (stmt)) |
1432 { | 1476 { |
1433 case GIMPLE_RETURN: | 1477 case GIMPLE_RETURN: |
1434 t = gimple_return_retval (as_a <greturn *> (stmt)); | 1478 t = gimple_return_retval (as_a <greturn *> (stmt)); |
1452 tree dest = gimple_call_fndecl (stmt); | 1496 tree dest = gimple_call_fndecl (stmt); |
1453 int flags = gimple_call_flags (stmt); | 1497 int flags = gimple_call_flags (stmt); |
1454 | 1498 |
1455 if (dest) | 1499 if (dest) |
1456 { | 1500 { |
1457 if (DECL_BUILT_IN_CLASS (dest) == BUILT_IN_NORMAL | 1501 if (fndecl_built_in_p (dest, BUILT_IN_APPLY_ARGS)) |
1458 && DECL_FUNCTION_CODE (dest) == BUILT_IN_APPLY_ARGS) | |
1459 encountered_apply_args = true; | 1502 encountered_apply_args = true; |
1460 if (recursive_call_p (current_function_decl, dest)) | 1503 if (recursive_call_p (current_function_decl, dest)) |
1461 { | 1504 { |
1462 encountered_recursive_call = true; | 1505 encountered_recursive_call = true; |
1463 if (!callsite_arguments_match_p (stmt)) | 1506 if (!callsite_arguments_match_p (stmt)) |
1660 be non-NULL and is used to insert new statements either before or below | 1703 be non-NULL and is used to insert new statements either before or below |
1661 the current one as specified by INSERT_AFTER. This function is not capable | 1704 the current one as specified by INSERT_AFTER. This function is not capable |
1662 of handling bitfields. */ | 1705 of handling bitfields. */ |
1663 | 1706 |
1664 tree | 1707 tree |
1665 build_ref_for_offset (location_t loc, tree base, HOST_WIDE_INT offset, | 1708 build_ref_for_offset (location_t loc, tree base, poly_int64 offset, |
1666 bool reverse, tree exp_type, gimple_stmt_iterator *gsi, | 1709 bool reverse, tree exp_type, gimple_stmt_iterator *gsi, |
1667 bool insert_after) | 1710 bool insert_after) |
1668 { | 1711 { |
1669 tree prev_base = base; | 1712 tree prev_base = base; |
1670 tree off; | 1713 tree off; |
1671 tree mem_ref; | 1714 tree mem_ref; |
1672 HOST_WIDE_INT base_offset; | 1715 poly_int64 base_offset; |
1673 unsigned HOST_WIDE_INT misalign; | 1716 unsigned HOST_WIDE_INT misalign; |
1674 unsigned int align; | 1717 unsigned int align; |
1675 | 1718 |
1676 /* Preserve address-space information. */ | 1719 /* Preserve address-space information. */ |
1677 addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (base)); | 1720 addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (base)); |
1678 if (as != TYPE_ADDR_SPACE (exp_type)) | 1721 if (as != TYPE_ADDR_SPACE (exp_type)) |
1679 exp_type = build_qualified_type (exp_type, | 1722 exp_type = build_qualified_type (exp_type, |
1680 TYPE_QUALS (exp_type) | 1723 TYPE_QUALS (exp_type) |
1681 | ENCODE_QUAL_ADDR_SPACE (as)); | 1724 | ENCODE_QUAL_ADDR_SPACE (as)); |
1682 | 1725 |
1683 gcc_checking_assert (offset % BITS_PER_UNIT == 0); | 1726 poly_int64 byte_offset = exact_div (offset, BITS_PER_UNIT); |
1684 get_object_alignment_1 (base, &align, &misalign); | 1727 get_object_alignment_1 (base, &align, &misalign); |
1685 base = get_addr_base_and_unit_offset (base, &base_offset); | 1728 base = get_addr_base_and_unit_offset (base, &base_offset); |
1686 | 1729 |
1687 /* get_addr_base_and_unit_offset returns NULL for references with a variable | 1730 /* get_addr_base_and_unit_offset returns NULL for references with a variable |
1688 offset such as array[var_index]. */ | 1731 offset such as array[var_index]. */ |
1700 if (insert_after) | 1743 if (insert_after) |
1701 gsi_insert_after (gsi, stmt, GSI_NEW_STMT); | 1744 gsi_insert_after (gsi, stmt, GSI_NEW_STMT); |
1702 else | 1745 else |
1703 gsi_insert_before (gsi, stmt, GSI_SAME_STMT); | 1746 gsi_insert_before (gsi, stmt, GSI_SAME_STMT); |
1704 | 1747 |
1705 off = build_int_cst (reference_alias_ptr_type (prev_base), | 1748 off = build_int_cst (reference_alias_ptr_type (prev_base), byte_offset); |
1706 offset / BITS_PER_UNIT); | |
1707 base = tmp; | 1749 base = tmp; |
1708 } | 1750 } |
1709 else if (TREE_CODE (base) == MEM_REF) | 1751 else if (TREE_CODE (base) == MEM_REF) |
1710 { | 1752 { |
1711 off = build_int_cst (TREE_TYPE (TREE_OPERAND (base, 1)), | 1753 off = build_int_cst (TREE_TYPE (TREE_OPERAND (base, 1)), |
1712 base_offset + offset / BITS_PER_UNIT); | 1754 base_offset + byte_offset); |
1713 off = int_const_binop (PLUS_EXPR, TREE_OPERAND (base, 1), off); | 1755 off = int_const_binop (PLUS_EXPR, TREE_OPERAND (base, 1), off); |
1714 base = unshare_expr (TREE_OPERAND (base, 0)); | 1756 base = unshare_expr (TREE_OPERAND (base, 0)); |
1715 } | 1757 } |
1716 else | 1758 else |
1717 { | 1759 { |
1718 off = build_int_cst (reference_alias_ptr_type (prev_base), | 1760 off = build_int_cst (reference_alias_ptr_type (prev_base), |
1719 base_offset + offset / BITS_PER_UNIT); | 1761 base_offset + byte_offset); |
1720 base = build_fold_addr_expr (unshare_expr (base)); | 1762 base = build_fold_addr_expr (unshare_expr (base)); |
1721 } | 1763 } |
1722 | 1764 |
1723 misalign = (misalign + offset) & (align - 1); | 1765 unsigned int align_bound = known_alignment (misalign + offset); |
1724 if (misalign != 0) | 1766 if (align_bound != 0) |
1725 align = least_bit_hwi (misalign); | 1767 align = MIN (align, align_bound); |
1726 if (align != TYPE_ALIGN (exp_type)) | 1768 if (align != TYPE_ALIGN (exp_type)) |
1727 exp_type = build_aligned_type (exp_type, align); | 1769 exp_type = build_aligned_type (exp_type, align); |
1728 | 1770 |
1729 mem_ref = fold_build2_loc (loc, MEM_REF, exp_type, base, off); | 1771 mem_ref = fold_build2_loc (loc, MEM_REF, exp_type, base, off); |
1730 REF_REVERSE_STORAGE_ORDER (mem_ref) = reverse; | 1772 REF_REVERSE_STORAGE_ORDER (mem_ref) = reverse; |
1775 | 1817 |
1776 static tree | 1818 static tree |
1777 build_debug_ref_for_model (location_t loc, tree base, HOST_WIDE_INT offset, | 1819 build_debug_ref_for_model (location_t loc, tree base, HOST_WIDE_INT offset, |
1778 struct access *model) | 1820 struct access *model) |
1779 { | 1821 { |
1780 HOST_WIDE_INT base_offset; | 1822 poly_int64 base_offset; |
1781 tree off; | 1823 tree off; |
1782 | 1824 |
1783 if (TREE_CODE (model->expr) == COMPONENT_REF | 1825 if (TREE_CODE (model->expr) == COMPONENT_REF |
1784 && DECL_BIT_FIELD (TREE_OPERAND (model->expr, 1))) | 1826 && DECL_BIT_FIELD (TREE_OPERAND (model->expr, 1))) |
1785 return NULL_TREE; | 1827 return NULL_TREE; |
2475 DECL_UID (root->base))) | 2517 DECL_UID (root->base))) |
2476 { | 2518 { |
2477 gcc_checking_assert (!root->grp_scalar_read | 2519 gcc_checking_assert (!root->grp_scalar_read |
2478 && !root->grp_assignment_read); | 2520 && !root->grp_assignment_read); |
2479 sth_created = true; | 2521 sth_created = true; |
2480 if (MAY_HAVE_DEBUG_STMTS) | 2522 if (MAY_HAVE_DEBUG_BIND_STMTS) |
2481 { | 2523 { |
2482 root->grp_to_be_debug_replaced = 1; | 2524 root->grp_to_be_debug_replaced = 1; |
2483 root->replacement_decl = create_access_replacement (root); | 2525 root->replacement_decl = create_access_replacement (root); |
2484 } | 2526 } |
2485 } | 2527 } |
3046 return it or NULL if it cannot be found. */ | 3088 return it or NULL if it cannot be found. */ |
3047 | 3089 |
3048 static struct access * | 3090 static struct access * |
3049 get_access_for_expr (tree expr) | 3091 get_access_for_expr (tree expr) |
3050 { | 3092 { |
3051 HOST_WIDE_INT offset, size, max_size; | 3093 poly_int64 poffset, psize, pmax_size; |
3094 HOST_WIDE_INT offset, max_size; | |
3052 tree base; | 3095 tree base; |
3053 bool reverse; | 3096 bool reverse; |
3054 | 3097 |
3055 /* FIXME: This should not be necessary but Ada produces V_C_Es with a type of | 3098 /* FIXME: This should not be necessary but Ada produces V_C_Es with a type of |
3056 a different size than the size of its argument and we need the latter | 3099 a different size than the size of its argument and we need the latter |
3057 one. */ | 3100 one. */ |
3058 if (TREE_CODE (expr) == VIEW_CONVERT_EXPR) | 3101 if (TREE_CODE (expr) == VIEW_CONVERT_EXPR) |
3059 expr = TREE_OPERAND (expr, 0); | 3102 expr = TREE_OPERAND (expr, 0); |
3060 | 3103 |
3061 base = get_ref_base_and_extent (expr, &offset, &size, &max_size, &reverse); | 3104 base = get_ref_base_and_extent (expr, &poffset, &psize, &pmax_size, |
3062 if (max_size == -1 || !DECL_P (base)) | 3105 &reverse); |
3106 if (!known_size_p (pmax_size) | |
3107 || !pmax_size.is_constant (&max_size) | |
3108 || !poffset.is_constant (&offset) | |
3109 || !DECL_P (base)) | |
3063 return NULL; | 3110 return NULL; |
3064 | 3111 |
3065 if (!bitmap_bit_p (candidate_bitmap, DECL_UID (base))) | 3112 if (!bitmap_bit_p (candidate_bitmap, DECL_UID (base))) |
3066 return NULL; | 3113 return NULL; |
3067 | 3114 |
3411 gcc_checking_assert (!racc->grp_to_be_replaced | 3458 gcc_checking_assert (!racc->grp_to_be_replaced |
3412 && !racc->grp_to_be_debug_replaced); | 3459 && !racc->grp_to_be_debug_replaced); |
3413 if (!racc->replacement_decl) | 3460 if (!racc->replacement_decl) |
3414 racc->replacement_decl = create_access_replacement (racc); | 3461 racc->replacement_decl = create_access_replacement (racc); |
3415 return get_or_create_ssa_default_def (cfun, racc->replacement_decl); | 3462 return get_or_create_ssa_default_def (cfun, racc->replacement_decl); |
3416 } | |
3417 | |
3418 /* Return true if REF has an VIEW_CONVERT_EXPR or a COMPONENT_REF with a | |
3419 bit-field field declaration somewhere in it. */ | |
3420 | |
3421 static inline bool | |
3422 contains_vce_or_bfcref_p (const_tree ref) | |
3423 { | |
3424 while (handled_component_p (ref)) | |
3425 { | |
3426 if (TREE_CODE (ref) == VIEW_CONVERT_EXPR | |
3427 || (TREE_CODE (ref) == COMPONENT_REF | |
3428 && DECL_BIT_FIELD (TREE_OPERAND (ref, 1)))) | |
3429 return true; | |
3430 ref = TREE_OPERAND (ref, 0); | |
3431 } | |
3432 | |
3433 return false; | |
3434 } | 3463 } |
3435 | 3464 |
3436 /* Examine both sides of the assignment statement pointed to by STMT, replace | 3465 /* Examine both sides of the assignment statement pointed to by STMT, replace |
3437 them with a scalare replacement if there is one and generate copying of | 3466 them with a scalare replacement if there is one and generate copying of |
3438 replacements if scalarized aggregates have been used in the assignment. GSI | 3467 replacements if scalarized aggregates have been used in the assignment. GSI |
4450 | 4479 |
4451 static struct access * | 4480 static struct access * |
4452 splice_param_accesses (tree parm, bool *ro_grp) | 4481 splice_param_accesses (tree parm, bool *ro_grp) |
4453 { | 4482 { |
4454 int i, j, access_count, group_count; | 4483 int i, j, access_count, group_count; |
4455 int agg_size, total_size = 0; | 4484 int total_size = 0; |
4456 struct access *access, *res, **prev_acc_ptr = &res; | 4485 struct access *access, *res, **prev_acc_ptr = &res; |
4457 vec<access_p> *access_vec; | 4486 vec<access_p> *access_vec; |
4458 | 4487 |
4459 access_vec = get_base_access_vector (parm); | 4488 access_vec = get_base_access_vector (parm); |
4460 if (!access_vec) | 4489 if (!access_vec) |
4517 prev_acc_ptr = &access->next_grp; | 4546 prev_acc_ptr = &access->next_grp; |
4518 total_size += access->size; | 4547 total_size += access->size; |
4519 i = j; | 4548 i = j; |
4520 } | 4549 } |
4521 | 4550 |
4522 if (POINTER_TYPE_P (TREE_TYPE (parm))) | |
4523 agg_size = tree_to_uhwi (TYPE_SIZE (TREE_TYPE (TREE_TYPE (parm)))); | |
4524 else | |
4525 agg_size = tree_to_uhwi (TYPE_SIZE (TREE_TYPE (parm))); | |
4526 if (total_size >= agg_size) | |
4527 return NULL; | |
4528 | |
4529 gcc_assert (group_count > 0); | 4551 gcc_assert (group_count > 0); |
4530 return res; | 4552 return res; |
4531 } | 4553 } |
4532 | 4554 |
4533 /* Decide whether parameters with representative accesses given by REPR should | 4555 /* Decide whether parameters with representative accesses given by REPR should |
4534 be reduced into components. */ | 4556 be reduced into components. */ |
4535 | 4557 |
4536 static int | 4558 static int |
4537 decide_one_param_reduction (struct access *repr) | 4559 decide_one_param_reduction (struct access *repr) |
4538 { | 4560 { |
4539 int total_size, cur_parm_size, agg_size, new_param_count, parm_size_limit; | 4561 HOST_WIDE_INT total_size, cur_parm_size; |
4540 bool by_ref; | 4562 bool by_ref; |
4541 tree parm; | 4563 tree parm; |
4542 | 4564 |
4543 parm = repr->base; | 4565 parm = repr->base; |
4544 cur_parm_size = tree_to_uhwi (TYPE_SIZE (TREE_TYPE (parm))); | 4566 cur_parm_size = tree_to_uhwi (TYPE_SIZE (TREE_TYPE (parm))); |
4545 gcc_assert (cur_parm_size > 0); | 4567 gcc_assert (cur_parm_size > 0); |
4546 | 4568 |
4547 if (POINTER_TYPE_P (TREE_TYPE (parm))) | 4569 if (POINTER_TYPE_P (TREE_TYPE (parm))) |
4548 { | 4570 by_ref = true; |
4549 by_ref = true; | |
4550 agg_size = tree_to_uhwi (TYPE_SIZE (TREE_TYPE (TREE_TYPE (parm)))); | |
4551 } | |
4552 else | 4571 else |
4553 { | 4572 by_ref = false; |
4554 by_ref = false; | |
4555 agg_size = cur_parm_size; | |
4556 } | |
4557 | 4573 |
4558 if (dump_file) | 4574 if (dump_file) |
4559 { | 4575 { |
4560 struct access *acc; | 4576 struct access *acc; |
4561 fprintf (dump_file, "Evaluating PARAM group sizes for "); | 4577 fprintf (dump_file, "Evaluating PARAM group sizes for "); |
4564 for (acc = repr; acc; acc = acc->next_grp) | 4580 for (acc = repr; acc; acc = acc->next_grp) |
4565 dump_access (dump_file, acc, true); | 4581 dump_access (dump_file, acc, true); |
4566 } | 4582 } |
4567 | 4583 |
4568 total_size = 0; | 4584 total_size = 0; |
4569 new_param_count = 0; | 4585 int new_param_count = 0; |
4570 | 4586 |
4571 for (; repr; repr = repr->next_grp) | 4587 for (; repr; repr = repr->next_grp) |
4572 { | 4588 { |
4573 gcc_assert (parm == repr->base); | 4589 gcc_assert (parm == repr->base); |
4574 | 4590 |
4592 new_param_count++; | 4608 new_param_count++; |
4593 } | 4609 } |
4594 | 4610 |
4595 gcc_assert (new_param_count > 0); | 4611 gcc_assert (new_param_count > 0); |
4596 | 4612 |
4597 if (optimize_function_for_size_p (cfun)) | 4613 if (!by_ref) |
4598 parm_size_limit = cur_parm_size; | 4614 { |
4615 if (total_size >= cur_parm_size) | |
4616 return 0; | |
4617 } | |
4599 else | 4618 else |
4600 parm_size_limit = (PARAM_VALUE (PARAM_IPA_SRA_PTR_GROWTH_FACTOR) | 4619 { |
4601 * cur_parm_size); | 4620 int parm_num_limit; |
4602 | 4621 if (optimize_function_for_size_p (cfun)) |
4603 if (total_size < agg_size | 4622 parm_num_limit = 1; |
4604 && total_size <= parm_size_limit) | 4623 else |
4605 { | 4624 parm_num_limit = PARAM_VALUE (PARAM_IPA_SRA_PTR_GROWTH_FACTOR); |
4606 if (dump_file) | 4625 |
4607 fprintf (dump_file, " ....will be split into %i components\n", | 4626 if (new_param_count > parm_num_limit |
4608 new_param_count); | 4627 || total_size > (parm_num_limit * cur_parm_size)) |
4609 return new_param_count; | 4628 return 0; |
4610 } | 4629 } |
4611 else | 4630 |
4612 return 0; | 4631 if (dump_file) |
4632 fprintf (dump_file, " ....will be split into %i components\n", | |
4633 new_param_count); | |
4634 return new_param_count; | |
4613 } | 4635 } |
4614 | 4636 |
4615 /* The order of the following enums is important, we need to do extra work for | 4637 /* The order of the following enums is important, we need to do extra work for |
4616 UNUSED_PARAMS, BY_VAL_ACCESSES and UNMODIF_BY_REF_ACCESSES. */ | 4638 UNUSED_PARAMS, BY_VAL_ACCESSES and UNMODIF_BY_REF_ACCESSES. */ |
4617 enum ipa_splicing_result { NO_GOOD_ACCESS, UNUSED_PARAMS, BY_VAL_ACCESSES, | 4639 enum ipa_splicing_result { NO_GOOD_ACCESS, UNUSED_PARAMS, BY_VAL_ACCESSES, |
5254 | 5276 |
5255 pop_cfun (); | 5277 pop_cfun (); |
5256 } | 5278 } |
5257 | 5279 |
5258 for (cs = node->callers; cs; cs = cs->next_caller) | 5280 for (cs = node->callers; cs; cs = cs->next_caller) |
5259 if (bitmap_set_bit (recomputed_callers, cs->caller->uid) | 5281 if (bitmap_set_bit (recomputed_callers, cs->caller->get_uid ()) |
5260 && gimple_in_ssa_p (DECL_STRUCT_FUNCTION (cs->caller->decl))) | 5282 && gimple_in_ssa_p (DECL_STRUCT_FUNCTION (cs->caller->decl))) |
5261 compute_fn_summary (cs->caller, true); | 5283 compute_fn_summary (cs->caller, true); |
5262 BITMAP_FREE (recomputed_callers); | 5284 BITMAP_FREE (recomputed_callers); |
5263 | 5285 |
5264 return true; | 5286 return true; |
5373 tree arg = gimple_call_arg (call_stmt, i); | 5395 tree arg = gimple_call_arg (call_stmt, i); |
5374 if (is_gimple_reg (arg)) | 5396 if (is_gimple_reg (arg)) |
5375 continue; | 5397 continue; |
5376 | 5398 |
5377 tree offset; | 5399 tree offset; |
5378 HOST_WIDE_INT bitsize, bitpos; | 5400 poly_int64 bitsize, bitpos; |
5379 machine_mode mode; | 5401 machine_mode mode; |
5380 int unsignedp, reversep, volatilep = 0; | 5402 int unsignedp, reversep, volatilep = 0; |
5381 get_inner_reference (arg, &bitsize, &bitpos, &offset, &mode, | 5403 get_inner_reference (arg, &bitsize, &bitpos, &offset, &mode, |
5382 &unsignedp, &reversep, &volatilep); | 5404 &unsignedp, &reversep, &volatilep); |
5383 if (bitpos % BITS_PER_UNIT) | 5405 if (!multiple_p (bitpos, BITS_PER_UNIT)) |
5384 { | 5406 { |
5385 iscc->bad_arg_alignment = true; | 5407 iscc->bad_arg_alignment = true; |
5386 return true; | 5408 return true; |
5387 } | 5409 } |
5388 } | 5410 } |
5433 fprintf (dump_file, "Function is a virtual method.\n"); | 5455 fprintf (dump_file, "Function is a virtual method.\n"); |
5434 return false; | 5456 return false; |
5435 } | 5457 } |
5436 | 5458 |
5437 if ((DECL_ONE_ONLY (node->decl) || DECL_EXTERNAL (node->decl)) | 5459 if ((DECL_ONE_ONLY (node->decl) || DECL_EXTERNAL (node->decl)) |
5460 && ipa_fn_summaries->get (node) | |
5438 && ipa_fn_summaries->get (node)->size >= MAX_INLINE_INSNS_AUTO) | 5461 && ipa_fn_summaries->get (node)->size >= MAX_INLINE_INSNS_AUTO) |
5439 { | 5462 { |
5440 if (dump_file) | 5463 if (dump_file) |
5441 fprintf (dump_file, "Function too big to be made truly local.\n"); | 5464 fprintf (dump_file, "Function too big to be made truly local.\n"); |
5442 return false; | 5465 return false; |