summaryrefslogtreecommitdiffstats
path: root/gcc/cp/except.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/except.c')
-rw-r--r--gcc/cp/except.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index e529685c992..670a66f1611 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -173,6 +173,9 @@ do_get_exception_ptr (void)
{
/* Declare void* __cxa_get_exception_ptr (void *) throw(). */
fn = declare_nothrow_library_fn (fn, ptr_type_node, ptr_type_node);
+
+ if (flag_tm)
+ apply_tm_attr (fn, get_identifier ("transaction_pure"));
}
return cp_build_function_call_nary (fn, tf_warning_or_error,
@@ -192,6 +195,17 @@ do_begin_catch (void)
{
/* Declare void* __cxa_begin_catch (void *) throw(). */
fn = declare_nothrow_library_fn (fn, ptr_type_node, ptr_type_node);
+
+ /* Create its transactional-memory equivalent. */
+ if (flag_tm)
+ {
+ tree fn2 = get_identifier ("_ITM_cxa_begin_catch");
+ if (!get_global_value_if_present (fn2, &fn2))
+ fn2 = declare_nothrow_library_fn (fn2, ptr_type_node,
+ ptr_type_node);
+ apply_tm_attr (fn2, get_identifier ("transaction_pure"));
+ record_tm_replacement (fn, fn2);
+ }
}
return cp_build_function_call_nary (fn, tf_warning_or_error,
@@ -231,6 +245,19 @@ do_end_catch (tree type)
fn = push_void_library_fn (fn, void_list_node);
/* This can throw if the destructor for the exception throws. */
TREE_NOTHROW (fn) = 0;
+
+ /* Create its transactional-memory equivalent. */
+ if (flag_tm)
+ {
+ tree fn2 = get_identifier ("_ITM_cxa_end_catch");
+ if (!get_global_value_if_present (fn2, &fn2))
+ {
+ fn2 = push_void_library_fn (fn2, void_list_node);
+ TREE_NOTHROW (fn2) = 0;
+ }
+ apply_tm_attr (fn2, get_identifier ("transaction_pure"));
+ record_tm_replacement (fn, fn2);
+ }
}
cleanup = cp_build_function_call_vec (fn, NULL, tf_warning_or_error);
@@ -581,6 +608,16 @@ do_allocate_exception (tree type)
{
/* Declare void *__cxa_allocate_exception(size_t) throw(). */
fn = declare_nothrow_library_fn (fn, ptr_type_node, size_type_node);
+
+ if (flag_tm)
+ {
+ tree fn2 = get_identifier ("_ITM_cxa_allocate_exception");
+ if (!get_global_value_if_present (fn2, &fn2))
+ fn2 = declare_nothrow_library_fn (fn2, ptr_type_node,
+ size_type_node);
+ apply_tm_attr (fn2, get_identifier ("transaction_pure"));
+ record_tm_replacement (fn, fn2);
+ }
}
return cp_build_function_call_nary (fn, tf_warning_or_error,
@@ -712,6 +749,15 @@ build_throw (tree exp)
ptr_type_node, ptr_type_node,
cleanup_type, NULL_TREE);
fn = push_throw_library_fn (fn, tmp);
+
+ if (flag_tm)
+ {
+ tree fn2 = get_identifier ("_ITM_cxa_throw");
+ if (!get_global_value_if_present (fn2, &fn2))
+ fn2 = push_throw_library_fn (fn2, tmp);
+ apply_tm_attr (fn2, get_identifier ("transaction_pure"));
+ record_tm_replacement (fn, fn2);
+ }
}
/* [except.throw]
@@ -831,6 +877,9 @@ build_throw (tree exp)
(fn, build_function_type_list (void_type_node, NULL_TREE));
}
+ if (flag_tm)
+ apply_tm_attr (fn, get_identifier ("transaction_pure"));
+
/* ??? Indicate that this function call allows exceptions of the type
of the enclosing catch block (if known). */
exp = cp_build_function_call_vec (fn, NULL, tf_warning_or_error);
OpenPOWER on IntegriCloud