aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.h
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2016-12-24 14:30:18 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2016-12-24 14:30:18 +0000
commite7960be786ae786c6fc2ec48480bfb279c6d99e2 (patch)
treec7c60297d704befab04918f7214aaabe3e997af7 /gcc/tree.h
parent284a35df5d759e4ed0c7e03b5354dbfafddd67df (diff)
downloadgcc-e7960be786ae786c6fc2ec48480bfb279c6d99e2.zip
gcc-e7960be786ae786c6fc2ec48480bfb279c6d99e2.tar.gz
gcc-e7960be786ae786c6fc2ec48480bfb279c6d99e2.tar.bz2
Make it cheaper to test whether an SSA name is a virtual operand
virtual_operand_p handled SSA names by looking at the flags of the underlying variable. This seems to be a relatively common source of cache misses, mainly because virtual_operand_p is the first thing tested by is_gimple_reg. This patch caches the information in the SSA name itself. Several flags seem to be free so the patch arbitrarily uses public_flag. Tested on aarch64-linux-gnu and x86_64-linux-gnu. It improves compile time by a small (<1%) but reproducable amount on the tests I've tried. gcc/ * tree-core.h (tree_base): Document the meaning of public_flag for SSA names. * tree.h (SSA_NAME_IS_VIRTUAL_OPERAND): New macro. (SET_SSA_NAME_VAR_OR_IDENTIFIER): Record whether the variable is a virtual operand. * gimple-expr.h (virtual_operand_p): Use SSA_NAME_IS_VIRTUAL_OPERAND. From-SVN: r243916
Diffstat (limited to 'gcc/tree.h')
-rw-r--r--gcc/tree.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/tree.h b/gcc/tree.h
index e319202..2dec19e 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1665,6 +1665,11 @@ extern void protected_set_expr_location (tree, location_t);
/* SSA_NAME accessors. */
+/* Whether SSA_NAME NODE is a virtual operand. This simply caches the
+ information in the underlying SSA_NAME_VAR for efficiency. */
+#define SSA_NAME_IS_VIRTUAL_OPERAND(NODE) \
+ SSA_NAME_CHECK (NODE)->base.public_flag
+
/* Returns the IDENTIFIER_NODE giving the SSA name a name or NULL_TREE
if there is no name associated with it. */
#define SSA_NAME_IDENTIFIER(NODE) \
@@ -1683,7 +1688,16 @@ extern void protected_set_expr_location (tree, location_t);
? NULL_TREE : (NODE)->ssa_name.var)
#define SET_SSA_NAME_VAR_OR_IDENTIFIER(NODE,VAR) \
- do { SSA_NAME_CHECK (NODE)->ssa_name.var = (VAR); } while (0)
+ do \
+ { \
+ tree var_ = (VAR); \
+ SSA_NAME_CHECK (NODE)->ssa_name.var = var_; \
+ SSA_NAME_IS_VIRTUAL_OPERAND (NODE) \
+ = (var_ \
+ && TREE_CODE (var_) == VAR_DECL \
+ && VAR_DECL_IS_VIRTUAL_OPERAND (var_)); \
+ } \
+ while (0)
/* Returns the statement which defines this SSA name. */
#define SSA_NAME_DEF_STMT(NODE) SSA_NAME_CHECK (NODE)->ssa_name.def_stmt