summaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 698f56ea549..8314ecfc483 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -44,10 +44,8 @@ along with GCC; see the file COPYING3. If not see
#include "dominance.h"
#include "cfg.h"
#include "basic-block.h"
-#include "plugin-api.h"
#include "hard-reg-set.h"
#include "function.h"
-#include "ipa-ref.h"
#include "cgraph.h"
#include "intl.h"
#include "tree-ssa-alias.h"
@@ -159,6 +157,29 @@ function_version_hasher::equal (cgraph_function_version_info *n1,
static GTY(()) struct cgraph_function_version_info *
version_info_node = NULL;
+/* Return true if NODE's address can be compared. */
+
+bool
+symtab_node::address_can_be_compared_p ()
+{
+ /* Address of virtual tables and functions is never compared. */
+ if (DECL_VIRTUAL_P (decl))
+ return false;
+ /* Address of C++ cdtors is never compared. */
+ if (is_a <cgraph_node *> (this)
+ && (DECL_CXX_CONSTRUCTOR_P (decl)
+ || DECL_CXX_DESTRUCTOR_P (decl)))
+ return false;
+ /* Constant pool symbols addresses are never compared.
+ flag_merge_constants permits us to assume the same on readonly vars. */
+ if (is_a <varpool_node *> (this)
+ && (DECL_IN_CONSTANT_POOL (decl)
+ || (flag_merge_constants >= 2
+ && TREE_READONLY (decl) && !TREE_THIS_VOLATILE (decl))))
+ return false;
+ return true;
+}
+
/* Get the cgraph_function_version_info node corresponding to node. */
cgraph_function_version_info *
cgraph_node::function_version (void)