diff mbox

[lto] : Handle *tm regparm attribute

Message ID CAFULd4YkkX0PJXvFwn5iPhkNF5T=U8DK4BV4Kz3iXVxA-mNcOA@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Nov. 30, 2011, 11:02 a.m. UTC
Hello!

Attached patch handles "*tm regparm" attribute, to avoid "*tm regparm"
attribute ignored warnings in lto compile on non-x86 targets.

2011-11-30  Uros Bizjak  <ubizjak@gmail.com>

	* lto-lang.c (lto_attribute_table): Handle *tm regparm.
	(ignore_attribute): New.

Tested on alphaev68-pc-linux-gnu and x86_64-pc-linux-gnu {,-m32}.

OK for mainline?

Uros.

Comments

Jan Hubicka Nov. 30, 2011, 5:03 p.m. UTC | #1
> Hello!
> 
> Attached patch handles "*tm regparm" attribute, to avoid "*tm regparm"
> attribute ignored warnings in lto compile on non-x86 targets.
> 
> 2011-11-30  Uros Bizjak  <ubizjak@gmail.com>
> 
> 	* lto-lang.c (lto_attribute_table): Handle *tm regparm.
> 	(ignore_attribute): New.
> 
> Tested on alphaev68-pc-linux-gnu and x86_64-pc-linux-gnu {,-m32}.
> 
> OK for mainline?

Won't similar change be needed for other tm attributes?  Perhaps we could just
silence the warning with in_lto_p predicate.

Honza
Richard Biener Dec. 1, 2011, 3:33 p.m. UTC | #2
On Wed, Nov 30, 2011 at 6:03 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
>> Hello!
>>
>> Attached patch handles "*tm regparm" attribute, to avoid "*tm regparm"
>> attribute ignored warnings in lto compile on non-x86 targets.
>>
>> 2011-11-30  Uros Bizjak  <ubizjak@gmail.com>
>>
>>       * lto-lang.c (lto_attribute_table): Handle *tm regparm.
>>       (ignore_attribute): New.
>>
>> Tested on alphaev68-pc-linux-gnu and x86_64-pc-linux-gnu {,-m32}.
>>
>> OK for mainline?
>
> Won't similar change be needed for other tm attributes?  Perhaps we could just
> silence the warning with in_lto_p predicate.

Doesn't it need to be handled as well, not just ignored?

Richard.

> Honza
Jan Hubicka Dec. 1, 2011, 3:43 p.m. UTC | #3
> On Wed, Nov 30, 2011 at 6:03 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
> >> Hello!
> >>
> >> Attached patch handles "*tm regparm" attribute, to avoid "*tm regparm"
> >> attribute ignored warnings in lto compile on non-x86 targets.
> >>
> >> 2011-11-30  Uros Bizjak  <ubizjak@gmail.com>
> >>
> >>       * lto-lang.c (lto_attribute_table): Handle *tm regparm.
> >>       (ignore_attribute): New.
> >>
> >> Tested on alphaev68-pc-linux-gnu and x86_64-pc-linux-gnu {,-m32}.
> >>
> >> OK for mainline?
> >
> > Won't similar change be needed for other tm attributes?  Perhaps we could just
> > silence the warning with in_lto_p predicate.
> 
> Doesn't it need to be handled as well, not just ignored?
I would expect stuff to be handled at parsing time and thus streamed into IL.

Honza
Uros Bizjak Dec. 1, 2011, 4:19 p.m. UTC | #4
2011/12/1 Jan Hubicka <hubicka@ucw.cz>:

>> >> Attached patch handles "*tm regparm" attribute, to avoid "*tm regparm"
>> >> attribute ignored warnings in lto compile on non-x86 targets.
>> >>
>> >> 2011-11-30  Uros Bizjak  <ubizjak@gmail.com>
>> >>
>> >>       * lto-lang.c (lto_attribute_table): Handle *tm regparm.
>> >>       (ignore_attribute): New.
>> >>
>> >> Tested on alphaev68-pc-linux-gnu and x86_64-pc-linux-gnu {,-m32}.
>> >>
>> >> OK for mainline?
>> >
>> > Won't similar change be needed for other tm attributes?  Perhaps we could just
>> > silence the warning with in_lto_p predicate.
>>
>> Doesn't it need to be handled as well, not just ignored?
> I would expect stuff to be handled at parsing time and thus streamed into IL.

Please see the comment. This attribute is intended to be redefined by
the target-dependant handling, so my patch just prevents the warning
(the code is copied from c-family/c-common.c). x86 targets that
redefine the attribute handling work OK even without the patch,
hinting at the fact that redefinition works OK. We just need to
prevent warning for non-x86 targets.

Uros.
Richard Biener Dec. 1, 2011, 4:33 p.m. UTC | #5
On Thu, Dec 1, 2011 at 5:19 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
> 2011/12/1 Jan Hubicka <hubicka@ucw.cz>:
>
>>> >> Attached patch handles "*tm regparm" attribute, to avoid "*tm regparm"
>>> >> attribute ignored warnings in lto compile on non-x86 targets.
>>> >>
>>> >> 2011-11-30  Uros Bizjak  <ubizjak@gmail.com>
>>> >>
>>> >>       * lto-lang.c (lto_attribute_table): Handle *tm regparm.
>>> >>       (ignore_attribute): New.
>>> >>
>>> >> Tested on alphaev68-pc-linux-gnu and x86_64-pc-linux-gnu {,-m32}.
>>> >>
>>> >> OK for mainline?
>>> >
>>> > Won't similar change be needed for other tm attributes?  Perhaps we could just
>>> > silence the warning with in_lto_p predicate.
>>>
>>> Doesn't it need to be handled as well, not just ignored?
>> I would expect stuff to be handled at parsing time and thus streamed into IL.
>
> Please see the comment. This attribute is intended to be redefined by
> the target-dependant handling, so my patch just prevents the warning
> (the code is copied from c-family/c-common.c). x86 targets that
> redefine the attribute handling work OK even without the patch,
> hinting at the fact that redefinition works OK. We just need to
> prevent warning for non-x86 targets.

The patch is ok.

Thanks,
Richard.

> Uros.
diff mbox

Patch

Index: lto-lang.c
===================================================================
--- lto-lang.c	(revision 181835)
+++ lto-lang.c	(working copy)
@@ -47,6 +47,8 @@ 
 static tree handle_sentinel_attribute (tree *, tree, tree, int, bool *);
 static tree handle_type_generic_attribute (tree *, tree, tree, int, bool *);
 static tree handle_transaction_pure_attribute (tree *, tree, tree, int, bool *);
+static tree ignore_attribute (tree *, tree, tree, int, bool *);
+
 static tree handle_format_attribute (tree *, tree, tree, int, bool *);
 static tree handle_format_arg_attribute (tree *, tree, tree, int, bool *);
 
@@ -78,6 +80,10 @@ 
 			      handle_type_generic_attribute, false },
   { "transaction_pure",	      0, 0, false, true, true,
 			      handle_transaction_pure_attribute, false },
+  /* For internal use only.  The leading '*' both prevents its usage in
+     source code and signals that it may be overridden by machine tables.  */
+  { "*tm regparm",            0, 0, false, true, true,
+			      ignore_attribute, false },
   { NULL,                     0, 0, false, false, false, NULL, false }
 };
 
@@ -419,6 +425,18 @@ 
   return NULL_TREE;
 }
 
+/* Ignore the given attribute.  Used when this attribute may be usefully
+   overridden by the target, but is not used generically.  */
+
+static tree
+ignore_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name),
+		  tree ARG_UNUSED (args), int ARG_UNUSED (flags),
+		  bool *no_add_attrs)
+{
+  *no_add_attrs = true;
+  return NULL_TREE;
+}
+
 /* Handle a "format" attribute; arguments as in
    struct attribute_spec.handler.  */