diff options
Diffstat (limited to 'gcc/ipa-hello-world.c')
-rw-r--r-- | gcc/ipa-hello-world.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/gcc/ipa-hello-world.c b/gcc/ipa-hello-world.c index 2513a344574..20c122f3a16 100644 --- a/gcc/ipa-hello-world.c +++ b/gcc/ipa-hello-world.c @@ -112,6 +112,7 @@ void count_access_for_types_in_expr(const_tree expr, const record_set &non_escap void count_access_for_type_in_component_ref(const_tree component_ref, const record_set &non_escaping_records, field_access_counter &counter, const enum access_code access) { + log("types in component_ref\n"); gcc_assert(component_ref); enum tree_code tree_code_component_ref = TREE_CODE(component_ref); const bool is_component_ref = COMPONENT_REF == tree_code_component_ref; @@ -120,6 +121,7 @@ count_access_for_type_in_component_ref(const_tree component_ref, const record_se const_tree _struct = TREE_OPERAND(component_ref, 0); gcc_assert(_struct); + log ("going in recursion\n"); count_access_for_types_in_expr(_struct, non_escaping_records, counter, READ_ACCESS); const_tree tree_type_struct = TREE_TYPE(_struct); gcc_assert(tree_type_struct); @@ -135,7 +137,7 @@ count_access_for_type_in_component_ref(const_tree component_ref, const record_se gcc_assert(is_record_type); //FIXME: Future proofing or making things more difficult to read? - const bool in_set = + bool in_set = #if __cplusplus > 201703L non_escaping_records.contains(tree_type_struct) #else @@ -143,8 +145,18 @@ count_access_for_type_in_component_ref(const_tree component_ref, const record_se #endif ; + in_set |= +#if __cplusplus > 201703L + non_escaping_records.contains(TYPE_MAIN_VARIANT(tree_type_struct)) +#else + non_escaping_records.find(TYPE_MAIN_VARIANT(tree_type_struct)) != non_escaping_records.end() +#endif + ; + + log("%s is in non_escaping_records ? %s\n", get_type_name(tree_type_struct), in_set ? "true" : "false"); log("access is %s\n", access == READ_ACCESS ? "read_access" : "write_access"); + log("%s is escaping %s\n", get_type_name(tree_type_struct), in_set ? "true" : "false"); if (!in_set) return; const_tree field = TREE_OPERAND(component_ref, 1); @@ -216,6 +228,7 @@ count_access_for_type_in_array_expr(const_tree expr, const record_set &non_escap void count_access_for_types_in_expr(const_tree expr, const record_set &non_escaping_records, field_access_counter &counter, const enum access_code access) { + log("types in expr\n"); gcc_assert(expr); enum tree_code tree_code_expr = TREE_CODE(expr); switch (tree_code_expr) @@ -256,6 +269,7 @@ count_access_for_types_in_rhs(gimple *stmt, const record_set &non_escaping_recor const bool is_assign = GIMPLE_ASSIGN == gimple_code_stmt; gcc_assert(is_assign); + log("types in rhs\n"); const enum gimple_rhs_class gimple_rhs_class_stmt = gimple_assign_rhs_class(stmt); switch (gimple_rhs_class_stmt) { @@ -435,12 +449,15 @@ count_access_for_types_in_linking_unit(const record_set &non_escaping_records) bool _calculate_non_escaping_records(const_tree const &type, escaping_info *info, record_set *non_escaping_records) { + gcc_assert(info); + log("NOW: %s is escaping %s\n", get_type_name(type), info->is_escaping ? "true" : "false"); if (info->is_escaping) return true; gcc_assert(non_escaping_records); enum tree_code tree_code_type = TREE_CODE(type); const bool is_record_type = RECORD_TYPE == tree_code_type; + log("NOW: %s is record %s\n", get_type_name(type), is_record_type ? "true" : "false"); if (!is_record_type) return true; non_escaping_records->insert(type); |