From: Jeff Law <law@redhat.com>
To: Ilya Enkovich <enkovich.gnu@gmail.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH, Pointer Bounds Checker 9/x] Cgraph extension
Date: Wed, 23 Jul 2014 13:47:00 -0000 [thread overview]
Message-ID: <53CF3267.8080309@redhat.com> (raw)
In-Reply-To: <20140416140313.GC41722@msticlxl57.ims.intel.com>
On 04/16/14 08:03, Ilya Enkovich wrote:
> Hi,
>
> This patch introduces changes in call graph for Pointer Bounds Checker.
>
> New fields instrumented_version, instrumentation_clone and orig_decl are added for cgraph_node:
> - instrumentation_clone field is 1 for nodes created for instrumented version of functions
> - instrumented_version points to instrumented/original node
> - orig_decl holds original function declaration for instrumented nodes in case original node is removed
>
> IPA_REF_CHKP reference type is introduced for nodes to reference instrumented function versions from originals. It is used to have proper reachability analysis.
>
> When original function bodies are not needed anymore, functions are transformed into thunks having call edge to the instrumented function. Therefore new field appeared in cgraph_thunk_info to mark such thunks.
>
> Does it look OK?
>
> Bootstrapped and tested on linux-x86_64.
>
> Thanks,
> Ilya
> --
> gcc/
>
> 2014-04-16 Ilya Enkovich <ilya.enkovich@intel.com>
>
> * cgraph.h (cgraph_thunk_info): Add add_pointer_bounds_args
> field.
> (cgraph_node): Add instrumented_version, orig_decl and
> instrumentation_clone fields.
> (symtab_alias_target): Allow IPA_REF_CHKP reference.
> * cgraph.c (cgraph_remove_node): Fix instrumented_version
> of the referenced node if any.
> (dump_cgraph_node): Dump instrumentation_clone and
> instrumented_version fields.
> (verify_cgraph_node): Check correctness of IPA_REF_CHKP
> references and instrumentation thunks.
> * cgraphbuild.c (rebuild_cgraph_edges): Rebuild IPA_REF_CHKP
> reference.
> (cgraph_rebuild_references): Likewise.
> * cgraphunit.c (assemble_thunks_and_aliases): Skip thunks
> calling instrumneted function version.
> * ipa-ref.h (ipa_ref_use): Add IPA_REF_CHKP.
> (ipa_ref): increase size of use field.
> * ipa-ref.c (ipa_ref_use_name): Add element for IPA_REF_CHKP.
> * lto-cgraph.c (lto_output_node): Output instrumentation_clone,
> thunk.add_pointer_bounds_args and orig_decl field.
> (lto_output_ref): Adjust to new ipa_ref::use field size.
> (input_overwrite_node): Read instrumentation_clone field.
> (input_node): Read thunk.add_pointer_bounds_args and orig_decl
> fields.
> (input_ref): Adjust to new ipa_ref::use field size.
> (input_cgraph_1): Compute instrumented_version fields and restore
> IDENTIFIER_TRANSPARENT_ALIAS chains.
> * lto-streamer.h (LTO_minor_version): Change minor version from
> 0 to 1.
> * ipa.c (symtab_remove_unreachable_nodes): Consider instrumented
> clone as address taken if the original one is address taken.
> (cgraph_externally_visible_p): Mark instrumented 'main' as
> externally visible.
> (function_and_variable_visibility): Filter instrumentation
> thunks.
>
>
> diff --git a/gcc/cgraph.c b/gcc/cgraph.c
> index be3661a..6210c68 100644
> --- a/gcc/cgraph.c
> +++ b/gcc/cgraph.c
> @@ -2850,7 +2861,9 @@ verify_cgraph_node (struct cgraph_node *node)
> }
> for (i = 0; ipa_ref_list_reference_iterate (&node->ref_list,
> i, ref); i++)
> - if (ref->use != IPA_REF_ALIAS)
> + if (ref->use == IPA_REF_CHKP)
> + ;
> + else if (ref->use != IPA_REF_ALIAS)
> {
> error ("Alias has non-alias reference");
> error_found = true;
Is there any checking you can/should be doing here? And I'm asking
because I'm pretty sure there's something you ought to be checking here :-)
There's a general desire for key datastructures to sanity check them as
much as possible.
> + /* If instrumentation_clone is 1 then instrumented_version points
> + to the original function used to make instrumented version.
> + Otherwise points to instrumented version of the function. */
> + struct cgraph_node *instrumented_version;
> + /* If instrumentation_clone is 1 then orig_decl is the original
> + function declaration. */
> + tree orig_decl;
So I don't see anything which checks these two invariants.
Mostly it looks good. I do want to look at it again once the
verification stuff is beefed up.
Jeff
next prev parent reply other threads:[~2014-07-23 13:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-16 14:16 Ilya Enkovich
2014-05-06 12:14 ` Ilya Enkovich
2014-06-27 8:12 ` Ilya Enkovich
2014-07-23 13:47 ` Jeff Law [this message]
2014-07-24 9:59 ` Ilya Enkovich
2014-07-24 12:05 ` Jan Hubicka
2014-07-24 13:19 ` Ilya Enkovich
2014-07-24 13:52 ` Jan Hubicka
2014-07-25 11:20 ` Ilya Enkovich
2014-09-03 19:32 ` Jeff Law
2014-09-15 7:51 ` Ilya Enkovich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53CF3267.8080309@redhat.com \
--to=law@redhat.com \
--cc=enkovich.gnu@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).