This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Add "address_taken" flag into cgraph node
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 10 May 2009 12:12:43 -0700
- Subject: Re: Add "address_taken" flag into cgraph node
- References: <20090510151235.GE22531@kam.mff.cuni.cz>
On Sun, May 10, 2009 at 8:12 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
> Hi,
> this patch adds code to callgraph to track if function has address taken.
> I want to decompose current "needed" flag into individual reasons why function is
> needed, i.e.
> 1) function is externally visible (there is externally_visible flag for that)
> 2) function has address taken
> 3) function is needed for some other reason, such as used attribute
>
> The patch also improves oridering produced by cgraph_postorder in a way
> that functions with addresses taken are ordered first. ?This makes it
> possible for early optimizer to see thorough previously indirect calls
> that folded into direct. ?It improves local-pure-const analysis
> noticeably (about 300 new const/pures/nothrows are found in early pass
> and no new ones are found at IPA pass that is what I hoped for given
> that tramp3d has acyclic cgraph). ?This also makes it possible to handle
> indirect inlining in early inliner.
>
> Bootstrapped/regtested x86_64-linux, will commit it shortly.
>
> ? ? ? ?* cgraphbuild.c (record_reference): Use cgraph_mark_address_taken_node.
> ? ? ? ?* cgraph.c (cgraph_mark_address_taken_node): New function.
> ? ? ? ?(dump_cgraph_node): Dump new flag.
> ? ? ? ?* cgraph.h (struct cgraph_node): Add address_taken.
> ? ? ? ?(cgraph_mark_address_taken_node): New function.
> ? ? ? ?* cp/decl2.c (cxx_callgraph_analyze_expr): Use
> ? ? ? ?cgraph_mark_address_taken.
> ? ? ? ?* ipa.c (cgraph_postorder): Prioritize functions with address taken
> ? ? ? ?since new direct calls can be born.
This may have caused:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40095
--
H.J.