diff options
author | Erick Ochoa <erick.ochoa@theobroma-systems.com> | 2020-03-18 12:57:04 +0100 |
---|---|---|
committer | Erick Ochoa <erick.ochoa@theobroma-systems.com> | 2020-04-28 23:35:49 +0200 |
commit | decef57e82b184a34da13c6bb6ea0a29ecd47312 (patch) | |
tree | b78a6c67b723455c0ba67c3a09bacf0c0cb056cd | |
parent | 088b053bd77492d1ff29d9a68ffb53fcf0f65f26 (diff) |
Fixes escaping parameters
-rw-r--r-- | gcc/ipa-hello-world.c | 29 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/ipa/ipa-ea-08-parameter-escapes-0.c | 7 |
2 files changed, 17 insertions, 19 deletions
diff --git a/gcc/ipa-hello-world.c b/gcc/ipa-hello-world.c index 813f2759d6b..a074c83bbd6 100644 --- a/gcc/ipa-hello-world.c +++ b/gcc/ipa-hello-world.c @@ -499,20 +499,16 @@ calculate_escaping_parameters(const cgraph_node *cnode, type_map &escape_map) gcc_assert (is_function_decl); bool is_escaping = is_function_escaping(cnode); - for (tree parm = DECL_ARGUMENTS (function); parm; parm = DECL_CHAIN(parm)) + function_args_iterator iter; + tree arg; + const_tree function_type = TREE_TYPE(function); + FOREACH_FUNCTION_ARGS (function_type, arg, iter) { - tree decl_name = DECL_NAME(parm); - gcc_assert(decl_name); - const char* identifier = IDENTIFIER_POINTER(decl_name); - gcc_assert(identifier); - tree tree_type = TREE_TYPE(parm); - gcc_assert(tree_type); - // void update_escaping_info (const_tree type, type_map &escape_map, bool is_escaping); - + const_tree main_type = TYPE_MAIN_VARIANT(arg); + log("parameter type %s is escaping %s\n", get_type_name(main_type), is_escaping ? "true" : "false"); escaping_reason reason = new_escaping_reason(); reason.parameter_is_visible = is_escaping; - update_escape_info(tree_type, escape_map, is_escaping, reason); - log("variable %s is escaping %s\n", identifier, is_escaping ? "true" : "false"); + update_escape_info(main_type, escape_map, is_escaping, reason); } } @@ -575,12 +571,15 @@ is_any_function_escaping(type_map &escape_map) not_defined_functions.add(cnode); } - FOR_EACH_DEFINED_FUNCTION(cnode) + +/* FOR_EACH_DEFINED_FUNCTION(cnode) { - gcc_assert(cnode); - cnode->get_untransformed_body(); - not_defined_functions.remove(cnode); + gcc_assert(cnode); + cnode->get_untransformed_body(); + not_defined_functions.remove(cnode); + calculate_escaping_types_from_function_signatures (cnode, escape_map); } +*/ not_defined_functions.traverse<type_map *, calculate_escaping_types_from_function_signatures> (&escape_map); } diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-ea-08-parameter-escapes-0.c b/gcc/testsuite/gcc.dg/ipa/ipa-ea-08-parameter-escapes-0.c index e4c78d3abd3..168a125d99b 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipa-ea-08-parameter-escapes-0.c +++ b/gcc/testsuite/gcc.dg/ipa/ipa-ea-08-parameter-escapes-0.c @@ -11,7 +11,7 @@ struct bstruct_s { _Bool a; _Bool b; _Bool c;}; struct bstruct_s bstruct; // This should not escape __attribute__((externally_visible)) void escaping(struct astruct_s cstruct) {} -void non_escaping(struct astruct_s dstruct) {} +void non_escaping(struct bstruct_s dstruct) {} int main() { @@ -23,6 +23,5 @@ int main() /* { dg-final { scan-wpa-ipa-dump "collected,astruct_s" "hello-world" } } */ /* { dg-final { scan-wpa-ipa-dump "variable bstruct is escaping false" "hello-world" } } */ /* { dg-final { scan-wpa-ipa-dump "collected,bstruct_s" "hello-world" } } */ -/* { dg-final { scan-wpa-ipa-dump "variable astruct is escaping false" "hello-world" } } */ -/* { dg-final { scan-wpa-ipa-dump "variable cstruct is escaping true" "hello-world" } } */ -/* { dg-final { scan-wpa-ipa-dump "variable dstruct is escaping false" "hello-world" } } */ +/* { dg-final { scan-wpa-ipa-dump "parameter type astruct_s is escaping true" "hello-world" } } */ +/* { dg-final { scan-wpa-ipa-dump "parameter type bstruct_s is escaping false" "hello-world" } } */ |