diff mbox

Fix LTO with returns_twice TM builtins (PR lto/51774)

Message ID 20120106163829.GS18937@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Jan. 6, 2012, 4:38 p.m. UTC
Hi!

Now that one of the TM builtins is returns_twice, the LTO FE needs to handle
it too.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2012-01-06  Jakub Jelinek  <jakub@redhat.com>

	PR lto/51774
	* lto-lang.c (handle_returns_twice_attribute): New function.
	(lto_attribute_table): Add returns_twice attribute.


	Jakub

Comments

Diego Novillo Jan. 6, 2012, 4:42 p.m. UTC | #1
On 12-01-06 11:38 , Jakub Jelinek wrote:
> Hi!
>
> Now that one of the TM builtins is returns_twice, the LTO FE needs to handle
> it too.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?
>
> 2012-01-06  Jakub Jelinek<jakub@redhat.com>
>
> 	PR lto/51774
> 	* lto-lang.c (handle_returns_twice_attribute): New function.
> 	(lto_attribute_table): Add returns_twice attribute.

OK.


Diego.
diff mbox

Patch

--- gcc/lto/lto-lang.c.jj	2011-12-02 01:52:27.000000000 +0100
+++ gcc/lto/lto-lang.c	2012-01-06 14:14:25.154067869 +0100
@@ -1,5 +1,5 @@ 
 /* Language-dependent hooks for LTO.
-   Copyright 2009, 2010 Free Software Foundation, Inc.
+   Copyright 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
    Contributed by CodeSourcery, Inc.
 
 This file is part of GCC.
@@ -47,6 +47,7 @@  static tree handle_nothrow_attribute (tr
 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 handle_returns_twice_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 *);
@@ -74,6 +75,8 @@  const struct attribute_spec lto_attribut
 			      handle_nonnull_attribute, false },
   { "nothrow",                0, 0, true,  false, false,
 			      handle_nothrow_attribute, false },
+  { "returns_twice",          0, 0, true,  false, false,
+			      handle_returns_twice_attribute, false },
   { "sentinel",               0, 1, false, true, true,
 			      handle_sentinel_attribute, false },
   { "type generic",           0, 0, false, true, true,
@@ -424,6 +427,21 @@  handle_transaction_pure_attribute (tree
 
   return NULL_TREE;
 }
+
+/* Handle a "returns_twice" attribute.  */
+
+static tree
+handle_returns_twice_attribute (tree *node, tree ARG_UNUSED (name),
+				tree ARG_UNUSED (args),
+				int ARG_UNUSED (flags),
+				bool * ARG_UNUSED (no_add_attrs))
+{
+  gcc_assert (TREE_CODE (*node) == FUNCTION_DECL);
+
+  DECL_IS_RETURNS_TWICE (*node) = 1;
+
+  return NULL_TREE;
+}
 
 /* Ignore the given attribute.  Used when this attribute may be usefully
    overridden by the target, but is not used generically.  */