This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, 2/2] Handle recursive restrict in function parameter
- From: Richard Biener <rguenther at suse dot de>
- To: Tom de Vries <Tom_deVries at mentor dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, "gcc-patches at gnu dot org" <gcc-patches at gnu dot org>
- Date: Tue, 3 Nov 2015 16:08:13 +0100 (CET)
- Subject: Re: [PATCH, 2/2] Handle recursive restrict in function parameter
- Authentication-results: sourceware.org; auth=none
- References: <562E0CF5 dot 8000606 at mentor dot com> <CAFiYyc20gSLqPSyF9-_xYjN7-RPB2xqsfuM4j45XNU4fv-R8Eg at mail dot gmail dot com> <562E5381 dot 5 at mentor dot com> <562F26E2 dot 40906 at mentor dot com> <562F6D1A dot 4010001 at mentor dot com> <562F748D dot 5020507 at mentor dot com> <563653F5 dot 9090302 at mentor dot com> <563657D0 dot 1030203 at mentor dot com> <5638BAC4 dot 3050106 at mentor dot com>
On Tue, 3 Nov 2015, Tom de Vries wrote:
> On 01/11/15 19:20, Tom de Vries wrote:
> > On 01/11/15 19:03, Tom de Vries wrote:
> > > So, the new patch series is:
> > >
> > > 1 Rename make_restrict_var_constraints to make_param_constraints
> > > 2 Handle recursive restrict in function parameter
> > >
> > > I'll repost in reply to this message.
> > >
> >
> > This patch adds handling of all the restrict qualifiers in the type of a
> > function parameter.
> >
>
> And reposting an updated version, now that the toplevel parameter in
> make_param_constraints has been eliminated.
@@ -5195,6 +5197,8 @@ struct fieldoff
unsigned may_have_pointers : 1;
unsigned only_restrict_pointers : 1;
+
+ varinfo_t restrict_var;
};
store the varinfo ID here, 'unsigned int restrict_var' which ends
up not changing fieldoff size. get_varinfo (restrict_var) will get
you the varinfo_t.
@@ -5374,6 +5380,19 @@ push_fields_onto_fieldstack (tree type,
vec<fieldoff_s> *fieldstack,
= (!has_unknown_size
&& POINTER_TYPE_P (field_type)
&& TYPE_RESTRICT (field_type));
+ if (handle_param
+ && e.only_restrict_pointers
+ && !type_contains_placeholder_p (TREE_TYPE
(field_type)))
+ {
+ varinfo_t rvi;
+ tree heapvar = build_fake_var_decl (TREE_TYPE
(field_type));
+ DECL_EXTERNAL (heapvar) = 1;
+ rvi = create_variable_info_for_1 (heapvar,
"PARM_NOALIAS",
+ true, true);
+ rvi->is_restrict_var = 1;
+ insert_vi_for_tree (heapvar, rvi);
+ e.restrict_var = rvi;
+ }
hmm, can you delay this to the point we actually will use field-sensitive
stuff? That is, until create_variable_info_for_1 decided to use a
multi-field variable? Say, here:
+ if (handle_param
+ && newvi->only_restrict_pointers
+ && fo->restrict_var != NULL)
+ {
+ make_constraint_from (newvi, fo->restrict_var->id);
+ make_param_constraints (fo->restrict_var);
+ }
? Looks like then you don't need the new field at all.
Thanks,
Richard.