This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Apply conditional down cast to cgraph.h et.al.
- From: Lawrence Crowl <crowl at googlers dot com>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Diego Novillo <dnovillo at google dot com>, Marc Glisse <marc dot glisse at inria dot fr>, Jan Hubicka <hubicka at ucw dot cz>, Richard Biener <richard dot guenther at gmail dot com>
- Date: Fri, 2 Nov 2012 13:02:20 -0700
- Subject: Re: [patch] Apply conditional down cast to cgraph.h et.al.
- References: <CAGqM8fYQ3xO8cxNRH=C0+Or-8U8acdM6upqE4g1DD7GNvBKKkQ@mail.gmail.com> <CAGqM8fZS9psWTpP9bfsA12yaeFLX8wo_NoEYOvvDW+jodH732Q@mail.gmail.com> <CAGqM8fZS2EfmNs15hkwuyFRaZXFhguoz4b6ww=ZEcd+D=9Bm3g@mail.gmail.com> <6292002.hcGAAZDao9@polaris>
On 11/2/12, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> Index: gcc/ChangeLog
>>
>> 2012-10-31 Lawrence Crowl <crowl@google.com>
>>
>> * is-a.h: New.
>> (is_a <T> (U*)): New. Test for is-a relationship.
>> (as_a <T> (U*)): New. Treat as a derived type.
>> (dyn_cast <T> (U*)): New. Conditionally cast based on is_a.
>> * cgraph.h (varpool_node): Rename to varpool_node_for_decl.
>> Adjust callers to match.
>> (is_a_helper <cgraph_node>::test (symtab_node_def *)): New.
>> (is_a_helper <varpool_node>::test (symtab_node_def *)): New.
>> (symtab_node_def::try_function): New. Change most calls to
>> symtab_function_p with calls to dyn_cast <cgraph_node> (p).
>> (symtab_node_def::try_variable): New. Change most calls to
>> symtab_variable_p with calls to dyn_cast <varpool_node> (p).
>> (symtab_function_p): Remove. Change callers to use
>> is_a <cgraph_node> (p) instead.
>> (symtab_variable_p): Remove. Change callers to use
>> is_a <varpool_node> (p) instead.
>> * cgraph.c (cgraph_node_for_asm): Remove redundant call to
>> symtab_node_for_asm.
>> * cgraphunit.c (symbol_finalized_and_needed): New.
>> (symbol_finalized): New.
>> (cgraph_analyze_functions): Split complicated conditionals out into
>> above new functions.
>> * Makefile.in (CGRAPH_H): Add is-a.h as used by cgraph.h.
>
> The installed patch touches the ada/, cp/ and lto/ subdirectories without
> modifying their ChangeLog files. Please add the missing entries.
>
> [Some people, like me, do use these ChangeLogs to synchronize trees]
Done and committed.
Update ChangeLog files as requested for cgraph change to checked down cast.
Index: gcc/cp/ChangeLog
2012-10-31 Lawrence Crowl <crowl@google.com>
* decl2.c (var_finalized_p): Rename varpool_node to
varpool_node_for_decl.
(maybe_emit_vtables): Likewise.
Index: gcc/ada/ChangeLog
2012-10-31 Lawrence Crowl <crowl@google.com>
* gcc-interface/utils.c (gnat_write_global_declarations):
Rename varpool_node to varpool_node_for_decl.
Index: gcc/lto/ChangeLog
2012-10-31 Lawrence Crowl <crowl@google.com>
* lto.c (lto_wpa_write_files): Change symtab checking to a checked
down-cast via dyn_cast.
* lto-partition.c (add_symbol_to_partition_1): Likewise.
(undo_partition): Likewise.
(lto_balanced_map): Likewise.
(get_symbol_class): Likewise and via is_a.
(lto_balanced_map): Change symtab checking to is_a.
--
Lawrence Crowl