diff options
Diffstat (limited to 'gcc/ada/gcc-interface/trans.c')
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 46 |
1 files changed, 14 insertions, 32 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 52a5ea9..eebe2a9 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -2654,7 +2654,7 @@ establish_gnat_vms_condition_handler (void) on the C++ optimization of the same name. The main difference is that we disregard any semantical considerations when applying it here, the counterpart being that we don't try to apply it to semantically loaded - return types, i.e. types with the TREE_ADDRESSABLE flag set. + return types, i.e. types with the TYPE_BY_REFERENCE_P flag set. We consider a function body of the following GENERIC form: @@ -3012,7 +3012,7 @@ finalize_nrv (tree fndecl, bitmap nrv, VEC(tree,gc) *other, Node_Id gnat_ret) /* We shouldn't be applying the optimization to return types that we aren't allowed to manipulate freely. */ - gcc_assert (!TREE_ADDRESSABLE (TREE_TYPE (TREE_TYPE (fndecl)))); + gcc_assert (!TYPE_IS_BY_REFERENCE_P (TREE_TYPE (TREE_TYPE (fndecl)))); /* Prune the candidates that are referenced by other return values. */ data.nrv = nrv; @@ -3656,8 +3656,8 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, parameters. 2. There is no target and this is not an object declaration, and the - return type is by-reference or has variable size, because in these - cases the gimplifier cannot create the temporary. + return type has variable size, because in these cases the gimplifier + cannot create the temporary. 3. There is a target and it is a slice or an array with fixed size, and the return type has variable size, because the gimplifier @@ -3669,8 +3669,7 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, && ((!gnu_target && TYPE_CI_CO_LIST (gnu_subprog_type)) || (!gnu_target && Nkind (Parent (gnat_node)) != N_Object_Declaration - && (TREE_ADDRESSABLE (gnu_result_type) - || TREE_CODE (TYPE_SIZE (gnu_result_type)) != INTEGER_CST)) + && TREE_CODE (TYPE_SIZE (gnu_result_type)) != INTEGER_CST) || (gnu_target && (TREE_CODE (gnu_target) == ARRAY_RANGE_REF || (TREE_CODE (TREE_TYPE (gnu_target)) == ARRAY_TYPE @@ -3740,7 +3739,7 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, ; /* If the type is passed by reference, a copy is not allowed. */ - else if (TREE_ADDRESSABLE (gnu_formal_type)) + else if (TYPE_IS_BY_REFERENCE_P (gnu_formal_type)) post_error ("misaligned actual cannot be passed by reference", gnat_actual); @@ -6786,12 +6785,12 @@ gnat_to_gnu (Node_Id gnat_node) : NULL_TREE; tree gnu_target_desig_type = TREE_TYPE (gnu_target_type); - if ((TYPE_DUMMY_P (gnu_target_desig_type) + if ((TYPE_IS_DUMMY_P (gnu_target_desig_type) || get_alias_set (gnu_target_desig_type) != 0) && (!POINTER_TYPE_P (gnu_source_type) - || (TYPE_DUMMY_P (gnu_source_desig_type) - != TYPE_DUMMY_P (gnu_target_desig_type)) - || (TYPE_DUMMY_P (gnu_source_desig_type) + || (TYPE_IS_DUMMY_P (gnu_source_desig_type) + != TYPE_IS_DUMMY_P (gnu_target_desig_type)) + || (TYPE_IS_DUMMY_P (gnu_source_desig_type) && gnu_source_desig_type != gnu_target_desig_type) || !alias_sets_conflict_p (get_alias_set (gnu_source_desig_type), @@ -6820,12 +6819,12 @@ gnat_to_gnu (Node_Id gnat_node) tree gnu_target_array_type = TREE_TYPE (TREE_TYPE (TYPE_FIELDS (gnu_target_type))); - if ((TYPE_DUMMY_P (gnu_target_array_type) + if ((TYPE_IS_DUMMY_P (gnu_target_array_type) || get_alias_set (gnu_target_array_type) != 0) && (!TYPE_IS_FAT_POINTER_P (gnu_source_type) - || (TYPE_DUMMY_P (gnu_source_array_type) - != TYPE_DUMMY_P (gnu_target_array_type)) - || (TYPE_DUMMY_P (gnu_source_array_type) + || (TYPE_IS_DUMMY_P (gnu_source_array_type) + != TYPE_IS_DUMMY_P (gnu_target_array_type)) + || (TYPE_IS_DUMMY_P (gnu_source_array_type) && gnu_source_array_type != gnu_target_array_type) || !alias_sets_conflict_p (get_alias_set (gnu_source_array_type), @@ -7334,23 +7333,6 @@ gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p, return GS_ALL_DONE; } - /* Otherwise, if we are taking the address of a non-constant CONSTRUCTOR - or of a call, explicitly create the local temporary. That's required - if the type is passed by reference. */ - if (TREE_CODE (op) == CONSTRUCTOR || TREE_CODE (op) == CALL_EXPR) - { - tree mod, new_var = create_tmp_var_raw (TREE_TYPE (op), "C"); - TREE_ADDRESSABLE (new_var) = 1; - gimple_add_tmp_var (new_var); - - mod = build2 (INIT_EXPR, TREE_TYPE (new_var), new_var, op); - gimplify_and_add (mod, pre_p); - - TREE_OPERAND (expr, 0) = new_var; - recompute_tree_invariant_for_addr_expr (expr); - return GS_ALL_DONE; - } - return GS_UNHANDLED; case VIEW_CONVERT_EXPR: |