It was needed for STABS, but is totally obsolete for DWARF. Tested on i586-suse-linux, applied on the mainline.
2012-03-07 Eric Botcazou <ebotca...@adacore.com> * gcc-interface/gigi.h (rest_of_type_decl_compilation): Delete. * gcc-interface/decl.c (defer_finalize_level): Likewise. (defer_finalize_list): Likewise. (gnat_to_gnu_entity): Delete references to above variables and do not call rest_of_type_decl_compilation. (rest_of_type_decl_compilation): Delete. (rest_of_type_decl_compilation_no_defer): Likewise. * gcc-interface/utils.c (rest_of_record_type_compilation): Do not call rest_of_type_decl_compilation. (create_type_decl): Likewise. (update_pointer_to): Likewise. -- Eric Botcazou
Index: gcc-interface/utils.c =================================================================== --- gcc-interface/utils.c (revision 185072) +++ gcc-interface/utils.c (working copy) @@ -1056,15 +1056,8 @@ rest_of_record_type_compilation (tree re TYPE_FIELDS (new_record_type) = nreverse (TYPE_FIELDS (new_record_type)); - /* We used to explicitly invoke rest_of_type_decl_compilation on the - parallel type for the sake of STABS. We don't do it any more, so - as to ensure that the parallel type be processed after the type - by the debug back-end and, thus, prevent it from interfering with - the processing of a recursive type. */ add_parallel_type (TYPE_STUB_DECL (record_type), new_record_type); } - - rest_of_type_decl_compilation (TYPE_STUB_DECL (record_type)); } /* Append PARALLEL_TYPE on the chain of parallel types for decl. */ @@ -1354,21 +1347,10 @@ create_type_decl (tree type_name, tree t if (!named) TYPE_STUB_DECL (type) = type_decl; - /* Pass the type declaration to the debug back-end unless this is an - UNCONSTRAINED_ARRAY_TYPE that the back-end does not support, or a - type for which debugging information was not requested, or else an - ENUMERAL_TYPE or RECORD_TYPE (except for fat pointers) which are - handled separately. And do not pass dummy types either. */ + /* Do not generate debug info for UNCONSTRAINED_ARRAY_TYPE that the + back-end doesn't support, and for others if we don't need to. */ if (code == UNCONSTRAINED_ARRAY_TYPE || !debug_info_p) DECL_IGNORED_P (type_decl) = 1; - else if (code != ENUMERAL_TYPE - && (code != RECORD_TYPE || TYPE_FAT_POINTER_P (type)) - && !((code == POINTER_TYPE || code == REFERENCE_TYPE) - && TYPE_IS_DUMMY_P (TREE_TYPE (type))) - && !(code == RECORD_TYPE - && TYPE_IS_DUMMY_P - (TREE_TYPE (TREE_TYPE (TYPE_FIELDS (type)))))) - rest_of_type_decl_compilation (type_decl); return type_decl; } @@ -3531,12 +3513,6 @@ update_pointer_to (tree old_type, tree n TREE_TYPE (TREE_OPERAND (TYPE_NULL_BOUNDS (t), 0)) = new_type; } - /* If we have adjusted named types, finalize them. This is necessary - since we had forced a DWARF typedef for them in gnat_pushdecl. */ - for (ptr = TYPE_POINTER_TO (old_type); ptr; ptr = TYPE_NEXT_PTR_TO (ptr)) - if (TYPE_NAME (ptr) && TREE_CODE (TYPE_NAME (ptr)) == TYPE_DECL) - rest_of_type_decl_compilation (TYPE_NAME (ptr)); - /* Chain REF and its variants at the end. */ new_ref = TYPE_REFERENCE_TO (new_type); if (new_ref) Index: gcc-interface/decl.c =================================================================== --- gcc-interface/decl.c (revision 185072) +++ gcc-interface/decl.c (working copy) @@ -97,11 +97,6 @@ static struct incomplete *defer_incomple end of the spec. */ static struct incomplete *defer_limited_with; -/* These variables are used to defer finalizing types. The element of the - list is the TYPE_DECL associated with the type. */ -static int defer_finalize_level = 0; -static VEC (tree,heap) *defer_finalize_list; - typedef struct subst_pair_d { tree discriminant; tree replacement; @@ -181,7 +176,6 @@ static tree get_rep_part (tree); static tree create_variant_part_from (tree, VEC(variant_desc,heap) *, tree, tree, VEC(subst_pair,heap) *); static void copy_and_substitute_in_size (tree, tree, VEC(subst_pair,heap) *); -static void rest_of_type_decl_compilation_no_defer (tree); /* The relevant constituents of a subprogram binding to a GCC builtin. Used to pass around calls performing profile compatibility checks. */ @@ -3880,10 +3874,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entit care of those situations. */ if (defer_incomplete_level == 0 && !is_from_limited_with) { - defer_finalize_level++; update_pointer_to (TYPE_MAIN_VARIANT (gnu_old_desig_type), gnat_to_gnu_type (gnat_desig_equiv)); - defer_finalize_level--; } else { @@ -5112,11 +5104,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entit /* Enumeration types have specific RM bounds. */ SET_TYPE_RM_MIN_VALUE (gnu_scalar_type, gnu_low_bound); SET_TYPE_RM_MAX_VALUE (gnu_scalar_type, gnu_high_bound); - - /* Write full debugging information. */ - rest_of_type_decl_compilation (gnu_decl); } - else { /* Floating-point types don't have specific RM bounds. */ @@ -5139,11 +5127,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entit p = defer_incomplete_list; defer_incomplete_list = NULL; - /* For finalization, however, all types must be complete so we - cannot do the same because deferred incomplete types may end up - referencing each other. Process them all recursively first. */ - defer_finalize_level++; - for (; p; p = next) { next = p->next; @@ -5153,23 +5136,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entit gnat_to_gnu_type (p->full_type)); free (p); } - - defer_finalize_level--; - } - - /* If all the deferred incomplete types have been processed, we can proceed - with the finalization of the deferred types. */ - if (defer_incomplete_level == 0 - && defer_finalize_level == 0 - && defer_finalize_list) - { - unsigned int i; - tree t; - - FOR_EACH_VEC_ELT (tree, defer_finalize_list, i, t) - rest_of_type_decl_compilation_no_defer (t); - - VEC_free (tree, heap, defer_finalize_list); } /* If we are not defining this type, see if it's on one of the lists of @@ -5290,45 +5256,6 @@ get_minimal_subprog_decl (Entity_Id gnat create_subprog_decl (gnu_entity_name, gnu_ext_name, void_ftype, NULL_TREE, false, true, true, true, attr_list, gnat_entity); } - -/* Wrap up compilation of DECL, a TYPE_DECL, possibly deferring it. - Every TYPE_DECL generated for a type definition must be passed - to this function once everything else has been done for it. */ - -void -rest_of_type_decl_compilation (tree decl) -{ - /* We need to defer finalizing the type if incomplete types - are being deferred or if they are being processed. */ - if (defer_incomplete_level != 0 || defer_finalize_level != 0) - VEC_safe_push (tree, heap, defer_finalize_list, decl); - else - rest_of_type_decl_compilation_no_defer (decl); -} - -/* Same as above but without deferring the compilation. This - function should not be invoked directly on a TYPE_DECL. */ - -static void -rest_of_type_decl_compilation_no_defer (tree decl) -{ - const int toplev = global_bindings_p (); - tree t = TREE_TYPE (decl); - - rest_of_decl_compilation (decl, toplev, 0); - - /* Now process all the variants. This is needed for STABS. */ - for (t = TYPE_MAIN_VARIANT (t); t; t = TYPE_NEXT_VARIANT (t)) - { - if (t == TREE_TYPE (decl)) - continue; - - if (!TYPE_STUB_DECL (t)) - TYPE_STUB_DECL (t) = create_type_stub_decl (DECL_NAME (decl), t); - - rest_of_type_compilation (t, toplev); - } -} /* Finalize the processing of From_With_Type incomplete types. */ Index: gcc-interface/gigi.h =================================================================== --- gcc-interface/gigi.h (revision 185072) +++ gcc-interface/gigi.h (working copy) @@ -51,9 +51,6 @@ extern tree gnat_to_gnu_field_decl (Enti the GCC type corresponding to that entity. */ extern tree gnat_to_gnu_type (Entity_Id gnat_entity); -/* Wrap up compilation of T, a TYPE_DECL, possibly deferring it. */ -extern void rest_of_type_decl_compilation (tree t); - /* Start a new statement group chained to the previous group. */ extern void start_stmt_group (void);