Re: [ia64 PATCH] Fix up ia64 attribute handling (PR target/61137)

2014-11-21 Thread Andreas Schwab
Jakub Jelinek ja...@redhat.com writes:

 The following untested patch fixes that (tested on small-addr-1.c with
 a cross-compiler), I don't have ia64 hw nor spare cycles to test this
 though, so I'm just offering the patch as is if anyone wants to test it.
 Perhaps better testsuite coverage wouldn't hurt (test the model (small)
 attribute also in C++, perhaps test the common_object attribute on VMS?).

 2014-11-20  Jakub Jelinek  ja...@redhat.com

   PR target/61137
   * config/ia64/ia64.c (ia64_attribute_takes_identifier_p): New function.
   (TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P): Redefine to it.

Looks good.

http://gcc.gnu.org/ml/gcc-testresults/2014-11/msg02276.html

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
And now for something completely different.


Re: [ia64 PATCH] Fix up ia64 attribute handling (PR target/61137)

2014-11-21 Thread Richard Biener
On Fri, Nov 21, 2014 at 12:01 PM, Andreas Schwab sch...@suse.de wrote:
 Jakub Jelinek ja...@redhat.com writes:

 The following untested patch fixes that (tested on small-addr-1.c with
 a cross-compiler), I don't have ia64 hw nor spare cycles to test this
 though, so I'm just offering the patch as is if anyone wants to test it.
 Perhaps better testsuite coverage wouldn't hurt (test the model (small)
 attribute also in C++, perhaps test the common_object attribute on VMS?).

 2014-11-20  Jakub Jelinek  ja...@redhat.com

   PR target/61137
   * config/ia64/ia64.c (ia64_attribute_takes_identifier_p): New function.
   (TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P): Redefine to it.

 Looks good.

 http://gcc.gnu.org/ml/gcc-testresults/2014-11/msg02276.html

Ok.

Thanks,
Richard.

 Andreas.

 --
 Andreas Schwab, sch...@linux-m68k.org
 GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
 And now for something completely different.


[ia64 PATCH] Fix up ia64 attribute handling (PR target/61137)

2014-11-20 Thread Jakub Jelinek
Hi!

Seems the gcc.target/ia64/small-addr-1.c testcase is failing on ia64 since
r210262 but clearly has been failing for much longer if compiled with C++
(just there is insufficient testsuite coverage).
The problem is that for the model attribute (and apparently common_object on
VMS too), the argument of that attribute is supposed to be an identifier
rather than expression (for common_object either an identifier or string),
and these days one has to tell the frontends about that in order not to
get the argument parsed as an expression.

The following untested patch fixes that (tested on small-addr-1.c with
a cross-compiler), I don't have ia64 hw nor spare cycles to test this
though, so I'm just offering the patch as is if anyone wants to test it.
Perhaps better testsuite coverage wouldn't hurt (test the model (small)
attribute also in C++, perhaps test the common_object attribute on VMS?).

2014-11-20  Jakub Jelinek  ja...@redhat.com

PR target/61137
* config/ia64/ia64.c (ia64_attribute_takes_identifier_p): New function.
(TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P): Redefine to it.

--- gcc/config/ia64/ia64.c.jj   2014-11-11 00:06:23.0 +0100
+++ gcc/config/ia64/ia64.c  2014-11-20 11:51:59.729478773 +0100
@@ -324,6 +324,7 @@ static bool ia64_vms_valid_pointer_mode
 static tree ia64_vms_common_object_attribute (tree *, tree, tree, int, bool *)
  ATTRIBUTE_UNUSED;
 
+static bool ia64_attribute_takes_identifier_p (const_tree);
 static tree ia64_handle_model_attribute (tree *, tree, tree, int, bool *);
 static tree ia64_handle_version_id_attribute (tree *, tree, tree, int, bool *);
 static void ia64_encode_section_info (tree, rtx, int);
@@ -669,8 +670,26 @@ static const struct attribute_spec ia64_
 #undef TARGET_VECTORIZE_VEC_PERM_CONST_OK
 #define TARGET_VECTORIZE_VEC_PERM_CONST_OK ia64_vectorize_vec_perm_const_ok
 
+#undef TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P
+#define TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P ia64_attribute_takes_identifier_p
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
+/* Returns TRUE iff the target attribute indicated by ATTR_ID takes a plain
+   identifier as an argument, so the front end shouldn't look it up.  */
+
+static bool
+ia64_attribute_takes_identifier_p (const_tree attr_id)
+{
+  if (is_attribute_p (model, attr_id))
+return true;
+#if TARGET_ABI_OPEN_VMS
+  if (is_attribute_p (common_object, attr_id))
+return true;
+#endif
+  return false;
+}
+
 typedef enum
   {
 ADDR_AREA_NORMAL,  /* normal address area */

Jakub