diff options
author | Richard Henderson <rth@redhat.com> | 2011-11-08 01:23:52 +0000 |
---|---|---|
committer | Richard Henderson <rth@redhat.com> | 2011-11-08 01:23:52 +0000 |
commit | 15ab458bcaaae986aca9c414af294d5827016666 (patch) | |
tree | a03b1cf9544525333b1e1d6c2bb0ba80946692a3 | |
parent | 7427b5024d16b576cf488a04c7ba95e73c7151cb (diff) |
Fix last change to is_tm_pure.
* trans-mem.c (is_tm_pure): Expand get_attrs_for logic inline
before using flags_from_decl_or_type.
(diagnose_tm_1): Ignore ECF_TM_BUILTIN functions.
No changes to ChangeLog.tm-merge.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/transactional-memory@181144 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog.tm | 6 | ||||
-rw-r--r-- | gcc/trans-mem.c | 30 |
2 files changed, 34 insertions, 2 deletions
diff --git a/gcc/ChangeLog.tm b/gcc/ChangeLog.tm index ea5abc3e305..259574ea04e 100644 --- a/gcc/ChangeLog.tm +++ b/gcc/ChangeLog.tm @@ -1,3 +1,9 @@ +2011-11-07 Richard Henderson <rth@redhat.com> + + * trans-mem.c (is_tm_pure): Expand get_attrs_for logic inline + before using flags_from_decl_or_type. + (diagnose_tm_1): Ignore ECF_TM_BUILTIN functions. + 2011-11-06 Aldy Hernandez <aldyh@redhat.com> * tree-cfg.c (verify_gimple_transaction): Verify body. Move down. diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c index c7e53afbe6a..8b47e2519fc 100644 --- a/gcc/trans-mem.c +++ b/gcc/trans-mem.c @@ -172,7 +172,31 @@ get_attrs_for (const_tree x) bool is_tm_pure (const_tree x) { - unsigned flags = flags_from_decl_or_type (x); + unsigned flags; + + switch (TREE_CODE (x)) + { + case FUNCTION_DECL: + case FUNCTION_TYPE: + case METHOD_TYPE: + break; + + default: + if (TYPE_P (x)) + return false; + x = TREE_TYPE (x); + if (TREE_CODE (x) != POINTER_TYPE) + return false; + /* FALLTHRU */ + + case POINTER_TYPE: + x = TREE_TYPE (x); + if (TREE_CODE (x) != FUNCTION_TYPE && TREE_CODE (x) != METHOD_TYPE) + return false; + break; + } + + flags = flags_from_decl_or_type (x); return (flags & ECF_TM_PURE) != 0; } @@ -604,7 +628,9 @@ diagnose_tm_1 (gimple_stmt_iterator *gsi, bool *handled_ops_p, } else if (direct_call_p) { - if (replacement) + if (flags_from_decl_or_type (fn) & ECF_TM_BUILTIN) + is_safe = true; + else if (replacement) { /* ??? At present we've been considering replacements merely transaction_callable, and therefore might |