diff options
author | Aldy Hernandez <aldyh@gcc.gnu.org> | 2011-11-08 11:13:41 +0000 |
---|---|---|
committer | Aldy Hernandez <aldyh@gcc.gnu.org> | 2011-11-08 11:13:41 +0000 |
commit | 0a35513e4e73ec9c6f24e791d344308ad3ed030d (patch) | |
tree | e07de8d0b6265f8d72388d335bd471022e753d57 /gcc/cp/except.c | |
parent | 287188ea072dd887a17dd56360531c3a22307e7c (diff) | |
download | gcc-0a35513e4e73ec9c6f24e791d344308ad3ed030d.zip gcc-0a35513e4e73ec9c6f24e791d344308ad3ed030d.tar.gz gcc-0a35513e4e73ec9c6f24e791d344308ad3ed030d.tar.bz2 |
Merge from transactional-memory branch.
From-SVN: r181154
Diffstat (limited to 'gcc/cp/except.c')
-rw-r--r-- | gcc/cp/except.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/gcc/cp/except.c b/gcc/cp/except.c index e529685..670a66f 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); |