diff options
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/gimple-pretty-print.c | 5 | ||||
-rw-r--r-- | gcc/gimple.h | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tm/instrumented-mask.c | 16 | ||||
-rw-r--r-- | gcc/trans-mem.c | 10 |
5 files changed, 42 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c8593218276..7a4de2537e7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2013-02-27 Aldy Hernandez <aldyh@redhat.com> + + * trans-mem.c (expand_transaction): Do not set PR_INSTRUMENTEDCODE + if GTMA_HAS_NO_INSTRUMENTATION. + (generate_tm_state): Keep GTMA_HAS_NO_INSTRUMENTATION bit. + (ipa_tm_transform_transaction): Set GTMA_HAS_NO_INSTRUMENTATION. + * gimple.h (GTMA_HAS_NO_INSTRUMENTATION): Define. + * gimple-pretty-print.c (dump_gimple_transaction): Handle + GTMA_HAS_NO_INSTRUMENTATION. + +2013-02-25 Aldy Hernandez <aldyh@redhat.com> + 2013-03-08 Jakub Jelinek <jakub@redhat.com> * config/gnu-user.h (LIBTSAN_EARLY_SPEC): Don't link against diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c index e7e821ded46..8c24a57d6d6 100644 --- a/gcc/gimple-pretty-print.c +++ b/gcc/gimple-pretty-print.c @@ -1399,6 +1399,11 @@ dump_gimple_transaction (pretty_printer *buffer, gimple gs, int spc, int flags) pp_string (buffer, "GTMA_DOES_GO_IRREVOCABLE "); subcode &= ~GTMA_DOES_GO_IRREVOCABLE; } + if (subcode & GTMA_HAS_NO_INSTRUMENTATION) + { + pp_string (buffer, "GTMA_HAS_NO_INSTRUMENTATION "); + subcode &= ~GTMA_HAS_NO_INSTRUMENTATION; + } if (subcode) pp_printf (buffer, "0x%x ", subcode); pp_string (buffer, "]"); diff --git a/gcc/gimple.h b/gcc/gimple.h index 4bd6b3d71cc..1bbd7d76a11 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -661,6 +661,9 @@ struct GTY(()) gimple_statement_omp_atomic_store { tell the runtime that it should begin the transaction in serial-irrevocable mode. */ #define GTMA_DOES_GO_IRREVOCABLE (1u << 6) +/* The transaction contains no instrumentation code whatsover, most + likely because it is guaranteed to go irrevocable upon entry. */ +#define GTMA_HAS_NO_INSTRUMENTATION (1u << 7) struct GTY(()) gimple_statement_transaction { diff --git a/gcc/testsuite/gcc.dg/tm/instrumented-mask.c b/gcc/testsuite/gcc.dg/tm/instrumented-mask.c new file mode 100644 index 00000000000..6cfd3e47924 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tm/instrumented-mask.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-fgnu-tm -fdump-tree-tmmark" } */ + +/* If we're sure to go irrevocable, as in the case below, do not pass + PR_INSTRUMENTEDCODE to the run-time if there is nothing + instrumented within the transaction. */ + +int +main() +{ + __transaction_relaxed { __asm__(""); } + return 0; +} + +/* { dg-final { scan-tree-dump-times " instrumentedCode" 0 "tmmark" } } */ +/* { dg-final { cleanup-tree-dump "tmmark" } } */ diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c index 71eaa4464e0..b0f18b552bb 100644 --- a/gcc/trans-mem.c +++ b/gcc/trans-mem.c @@ -2602,7 +2602,7 @@ expand_transaction (struct tm_region *region, void *data ATTRIBUTE_UNUSED) flags |= PR_HASNOABORT; if ((subcode & GTMA_HAVE_STORE) == 0) flags |= PR_READONLY; - if (inst_edge) + if (inst_edge && !(subcode & GTMA_HAS_NO_INSTRUMENTATION)) flags |= PR_INSTRUMENTEDCODE; if (uninst_edge) flags |= PR_UNINSTRUMENTEDCODE; @@ -2806,7 +2806,8 @@ generate_tm_state (struct tm_region *region, void *data ATTRIBUTE_UNUSED) if (subcode & GTMA_DOES_GO_IRREVOCABLE) subcode &= (GTMA_DECLARATION_MASK | GTMA_DOES_GO_IRREVOCABLE - | GTMA_MAY_ENTER_IRREVOCABLE); + | GTMA_MAY_ENTER_IRREVOCABLE + | GTMA_HAS_NO_INSTRUMENTATION); else subcode &= GTMA_DECLARATION_MASK; gimple_transaction_set_subcode (region->transaction_stmt, subcode); @@ -5069,8 +5070,9 @@ ipa_tm_transform_transaction (struct cgraph_node *node) && bitmap_bit_p (d->irrevocable_blocks_normal, region->entry_block->index)) { - transaction_subcode_ior (region, GTMA_DOES_GO_IRREVOCABLE); - transaction_subcode_ior (region, GTMA_MAY_ENTER_IRREVOCABLE); + transaction_subcode_ior (region, GTMA_DOES_GO_IRREVOCABLE + | GTMA_MAY_ENTER_IRREVOCABLE + | GTMA_HAS_NO_INSTRUMENTATION); continue; } |