diff options
author | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-22 17:43:43 -0300 |
---|---|---|
committer | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-22 17:43:43 -0300 |
commit | a926878ddbd5a98b272c22171ce58663fc04c3e0 (patch) | |
tree | 86af256e5d9a9c06263c00adc90e5fe348008c43 /gcc/tsan.c | |
parent | 542730f087133690b47e036dfd43eb0db8a650ce (diff) | |
parent | 07cbaed8ba7d1b6e4ab3a9f44175502a4e1ecdb1 (diff) | |
download | gcc-devel/autopar_devel.zip gcc-devel/autopar_devel.tar.gz gcc-devel/autopar_devel.tar.bz2 |
Merge branch 'autopar_rebase2' into autopar_develdevel/autopar_devel
Quickly commit changes in the rebase branch.
Diffstat (limited to 'gcc/tsan.c')
-rw-r--r-- | gcc/tsan.c | 33 |
1 files changed, 20 insertions, 13 deletions
@@ -52,25 +52,29 @@ along with GCC; see the file COPYING3. If not see void __tsan_read/writeX (void *addr); */ static tree -get_memory_access_decl (bool is_write, unsigned size) +get_memory_access_decl (bool is_write, unsigned size, bool volatilep) { enum built_in_function fcode; + int pos; if (size <= 1) - fcode = is_write ? BUILT_IN_TSAN_WRITE1 - : BUILT_IN_TSAN_READ1; + pos = 0; else if (size <= 3) - fcode = is_write ? BUILT_IN_TSAN_WRITE2 - : BUILT_IN_TSAN_READ2; + pos = 1; else if (size <= 7) - fcode = is_write ? BUILT_IN_TSAN_WRITE4 - : BUILT_IN_TSAN_READ4; + pos = 2; else if (size <= 15) - fcode = is_write ? BUILT_IN_TSAN_WRITE8 - : BUILT_IN_TSAN_READ8; + pos = 3; + else + pos = 4; + + if (param_tsan_distinguish_volatile && volatilep) + fcode = is_write ? BUILT_IN_TSAN_VOLATILE_WRITE1 + : BUILT_IN_TSAN_VOLATILE_READ1; else - fcode = is_write ? BUILT_IN_TSAN_WRITE16 - : BUILT_IN_TSAN_READ16; + fcode = is_write ? BUILT_IN_TSAN_WRITE1 + : BUILT_IN_TSAN_READ1; + fcode = (built_in_function)(fcode + pos); return builtin_decl_implicit (fcode); } @@ -204,7 +208,8 @@ instrument_expr (gimple_stmt_iterator gsi, tree expr, bool is_write) g = gimple_build_call (builtin_decl, 2, expr_ptr, size_int (size)); } else if (rhs == NULL) - g = gimple_build_call (get_memory_access_decl (is_write, size), + g = gimple_build_call (get_memory_access_decl (is_write, size, + TREE_THIS_VOLATILE (expr)), 1, expr_ptr); else { @@ -799,7 +804,9 @@ instrument_memory_accesses (bool *cfg_changed) func_exit_seen = true; } else - fentry_exit_instrument |= instrument_gimple (&gsi); + fentry_exit_instrument + |= (instrument_gimple (&gsi) + && param_tsan_instrument_func_entry_exit); } if (gimple_purge_dead_eh_edges (bb)) *cfg_changed = true; |