aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-22 18:37:16 +0000
committeraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-22 18:37:16 +0000
commitea0e88d1e2658f33c84769c883246c1e686827f8 (patch)
treed9c627efeb62217e0942238cce58b0177ffc0e93
parentd387a10addf1181f5247772c1fce9a688955b583 (diff)
* opts.c (finish_options): Do not fail for -fgnu-tm.
* gimple-streamer-out.c (output_gimple_stmt): Handle GIMPLE_TRANSACTION. * gimple-streamer-in.c (input_gimple_stmt): Same. * lto-cgraph.c (input_overwrite_node): Read tm_clone bit. (lto_output_node): Write tm_clone bit. lto/ * lto-lang.c (lto_attribute_table): Handle transaction_pure. (handle_transaction_pure_attribute): New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181629 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/gimple-streamer-in.c4
-rw-r--r--gcc/gimple-streamer-out.c5
-rw-r--r--gcc/lto-cgraph.c2
-rw-r--r--gcc/lto/ChangeLog5
-rw-r--r--gcc/lto/lto-lang.c17
-rw-r--r--gcc/opts.c2
-rw-r--r--gcc/testsuite/gcc.dg/lto/trans-mem-1_0.c11
-rw-r--r--gcc/testsuite/gcc.dg/lto/trans-mem-1_1.c7
-rw-r--r--gcc/testsuite/gcc.dg/lto/trans-mem-2_0.c19
-rw-r--r--gcc/testsuite/gcc.dg/lto/trans-mem-2_1.c4
11 files changed, 82 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 875d5483711..ba48cc1f2cb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2011-11-21 Aldy Hernandez <aldyh@redhat.com>
+
+ * opts.c (finish_options): Do not fail for -fgnu-tm.
+ * gimple-streamer-out.c (output_gimple_stmt): Handle GIMPLE_TRANSACTION.
+ * gimple-streamer-in.c (input_gimple_stmt): Same.
+ * lto-cgraph.c (input_overwrite_node): Read tm_clone bit.
+ (lto_output_node): Write tm_clone bit.
+
2011-11-22 Ian Lance Taylor <iant@google.com>
* doc/install.texi (Configuration): Correct doc of
diff --git a/gcc/gimple-streamer-in.c b/gcc/gimple-streamer-in.c
index 862c5b08e3a..1facb3296f6 100644
--- a/gcc/gimple-streamer-in.c
+++ b/gcc/gimple-streamer-in.c
@@ -238,6 +238,10 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
case GIMPLE_PREDICT:
break;
+ case GIMPLE_TRANSACTION:
+ gimple_transaction_set_label (stmt, stream_read_tree (ib, data_in));
+ break;
+
default:
internal_error ("bytecode stream: unknown GIMPLE statement tag %s",
lto_tag_name (tag));
diff --git a/gcc/gimple-streamer-out.c b/gcc/gimple-streamer-out.c
index 78ed2815dde..a7e73fa8db2 100644
--- a/gcc/gimple-streamer-out.c
+++ b/gcc/gimple-streamer-out.c
@@ -151,6 +151,11 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
case GIMPLE_PREDICT:
break;
+ case GIMPLE_TRANSACTION:
+ gcc_assert (gimple_transaction_body (stmt) == NULL);
+ stream_write_tree (ob, gimple_transaction_label (stmt), true);
+ break;
+
default:
gcc_unreachable ();
}
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 98ae19b4aab..44a204977c0 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -522,6 +522,7 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
bp_pack_value (&bp, node->frequency, 2);
bp_pack_value (&bp, node->only_called_at_startup, 1);
bp_pack_value (&bp, node->only_called_at_exit, 1);
+ bp_pack_value (&bp, node->tm_clone, 1);
bp_pack_value (&bp, node->thunk.thunk_p && !boundary_p, 1);
bp_pack_enum (&bp, ld_plugin_symbol_resolution,
LDPR_NUM_KNOWN, node->resolution);
@@ -928,6 +929,7 @@ input_overwrite_node (struct lto_file_decl_data *file_data,
node->frequency = (enum node_frequency)bp_unpack_value (bp, 2);
node->only_called_at_startup = bp_unpack_value (bp, 1);
node->only_called_at_exit = bp_unpack_value (bp, 1);
+ node->tm_clone = bp_unpack_value (bp, 1);
node->thunk.thunk_p = bp_unpack_value (bp, 1);
node->resolution = bp_unpack_enum (bp, ld_plugin_symbol_resolution,
LDPR_NUM_KNOWN);
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index d8bbd9ca8dd..af849540ea8 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,8 @@
+2011-11-21 Aldy Hernandez <aldyh@redhat.com>
+
+ * lto-lang.c (lto_attribute_table): Handle transaction_pure.
+ (handle_transaction_pure_attribute): New.
+
2011-11-03 Richard Guenther <rguenther@suse.de>
PR lto/44965
diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c
index c702b9a2d24..2536f26ebf0 100644
--- a/gcc/lto/lto-lang.c
+++ b/gcc/lto/lto-lang.c
@@ -46,6 +46,7 @@ static tree handle_nonnull_attribute (tree *, tree, tree, int, bool *);
static tree handle_nothrow_attribute (tree *, tree, tree, int, bool *);
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_format_attribute (tree *, tree, tree, int, bool *);
static tree handle_format_arg_attribute (tree *, tree, tree, int, bool *);
@@ -75,6 +76,8 @@ const struct attribute_spec lto_attribute_table[] =
handle_sentinel_attribute, false },
{ "type generic", 0, 0, false, true, true,
handle_type_generic_attribute, false },
+ { "transaction_pure", 0, 0, false, true, true,
+ handle_transaction_pure_attribute, false },
{ NULL, 0, 0, false, false, false, NULL, false }
};
@@ -402,6 +405,20 @@ handle_type_generic_attribute (tree *node, tree ARG_UNUSED (name),
return NULL_TREE;
}
+/* Handle a "transaction_pure" attribute. */
+
+static tree
+handle_transaction_pure_attribute (tree *node, tree ARG_UNUSED (name),
+ tree ARG_UNUSED (args),
+ int ARG_UNUSED (flags),
+ bool * ARG_UNUSED (no_add_attrs))
+{
+ /* Ensure we have a function type. */
+ gcc_assert (TREE_CODE (*node) == FUNCTION_TYPE);
+
+ return NULL_TREE;
+}
+
/* Handle a "format" attribute; arguments as in
struct attribute_spec.handler. */
diff --git a/gcc/opts.c b/gcc/opts.c
index 9fdb22631d0..3153fe50274 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -784,8 +784,6 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
#endif
if (!opts->x_flag_fat_lto_objects && !HAVE_LTO_PLUGIN)
error_at (loc, "-fno-fat-lto-objects are supported only with linker plugin.");
- if (opts->x_flag_tm)
- error_at (loc, "LTO is currently not supported with transactional memory");
}
if ((opts->x_flag_lto_partition_balanced != 0) + (opts->x_flag_lto_partition_1to1 != 0)
+ (opts->x_flag_lto_partition_none != 0) >= 1)
diff --git a/gcc/testsuite/gcc.dg/lto/trans-mem-1_0.c b/gcc/testsuite/gcc.dg/lto/trans-mem-1_0.c
new file mode 100644
index 00000000000..aedf06379ce
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/trans-mem-1_0.c
@@ -0,0 +1,11 @@
+/* { dg-lto-options {{-flto -fgnu-tm}} } */
+
+int i;
+
+main()
+{
+ __transaction_atomic
+ {
+ i = 0;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/lto/trans-mem-1_1.c b/gcc/testsuite/gcc.dg/lto/trans-mem-1_1.c
new file mode 100644
index 00000000000..948effacc4d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/trans-mem-1_1.c
@@ -0,0 +1,7 @@
+#define dummy(func) \
+ __attribute__((noinline,noclone,used)) void func() { asm (""); }
+
+dummy(_ITM_beginTransaction)
+dummy(_ITM_commitTransaction)
+dummy(_ITM_WU4)
+dummy(_ITM_WU8)
diff --git a/gcc/testsuite/gcc.dg/lto/trans-mem-2_0.c b/gcc/testsuite/gcc.dg/lto/trans-mem-2_0.c
new file mode 100644
index 00000000000..f7e8d04bf7e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/trans-mem-2_0.c
@@ -0,0 +1,19 @@
+/* { dg-lto-options {{-flto -fgnu-tm}} } */
+
+extern void foobar() __attribute__((transaction_callable));
+
+#define dummy(func) \
+ __attribute__((noinline,noclone,used)) void func() { asm (""); }
+
+dummy(_ITM_beginTransaction)
+dummy(_ITM_commitTransaction)
+dummy(_ITM_WU4)
+dummy(_ITM_WU8)
+
+main()
+{
+ __transaction_relaxed
+ {
+ foobar();
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/lto/trans-mem-2_1.c b/gcc/testsuite/gcc.dg/lto/trans-mem-2_1.c
new file mode 100644
index 00000000000..fb6918d6584
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/trans-mem-2_1.c
@@ -0,0 +1,4 @@
+__attribute__((transaction_callable,noinline))
+void foobar()
+{
+}