]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/ipa-ref.h
sh.c: Do not include algorithm.
[thirdparty/gcc.git] / gcc / ipa-ref.h
index 4ce5f8d2f5a8d096138b354a7c78777d1b712878..ed75c008599eb84081fbb3574497e6badb3e1238 100644 (file)
@@ -18,6 +18,9 @@ You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
+#ifndef GCC_IPA_REF_H
+#define GCC_IPA_REF_H
+
 struct cgraph_node;
 class varpool_node;
 class symtab_node;
@@ -29,18 +32,33 @@ enum GTY(()) ipa_ref_use
   IPA_REF_LOAD,
   IPA_REF_STORE,
   IPA_REF_ADDR,
-  IPA_REF_ALIAS
+  IPA_REF_ALIAS,
+  IPA_REF_CHKP
 };
 
 /* Record of reference in callgraph or varpool.  */
 struct GTY(()) ipa_ref
 {
+public:
+  /* Remove reference.  */
+  void remove_reference ();
+
+  /* Return true when execution of reference can lead to return from
+     function.  */
+  bool cannot_lead_to_return ();
+
+  /* Return reference list this reference is in.  */
+  struct ipa_ref_list * referring_ref_list (void);
+
+  /* Return reference list this reference is in.  */
+  struct ipa_ref_list * referred_ref_list (void);
+
   symtab_node *referring;
   symtab_node *referred;
   gimple stmt;
   unsigned int lto_stmt_uid;
   unsigned int referred_index;
-  ENUM_BITFIELD (ipa_ref_use) use:2;
+  ENUM_BITFIELD (ipa_ref_use) use:3;
   unsigned int speculative:1;
 };
 
@@ -51,6 +69,62 @@ typedef struct ipa_ref *ipa_ref_ptr;
 /* List of references.  This is stored in both callgraph and varpool nodes.  */
 struct GTY(()) ipa_ref_list
 {
+public:
+  /* Return first reference in list or NULL if empty.  */
+  struct ipa_ref *first_reference (void)
+  {
+    if (!vec_safe_length (references))
+      return NULL;
+    return &(*references)[0];
+  }
+
+  /* Return first referring ref in list or NULL if empty.  */
+  struct ipa_ref *first_referring (void)
+  {
+    if (!referring.length ())
+      return NULL;
+    return referring[0];
+  }
+
+  /* Return first referring alias.  */
+  struct ipa_ref *first_alias (void)
+  {
+    struct ipa_ref *r = first_referring ();
+
+    return r && r->use == IPA_REF_ALIAS ? r : NULL;
+  }
+
+  /* Return last referring alias.  */
+  struct ipa_ref *last_alias (void)
+  {
+    unsigned int i = 0;
+
+    for(i = 0; i < referring.length (); i++)
+      if (referring[i]->use != IPA_REF_ALIAS)
+       break;
+
+    return i == 0 ? NULL : referring[i - 1];
+  }
+
+  /* Return true if the symbol has an alias.  */
+  bool inline has_aliases_p (void)
+  {
+    return first_alias ();
+  }
+
+  /* Clear reference list.  */
+  void clear (void)
+  {
+    referring.create (0);
+    references = NULL;
+  }
+
+  /* Return number of references.  */
+  unsigned int nreferences (void)
+  {
+    return vec_safe_length (references);
+  }
+
   /* Store actual references in references vector.  */
   vec<ipa_ref_t, va_gc> *references;
   /* Referring is vector of pointers to references.  It must not live in GGC space
@@ -58,22 +132,4 @@ struct GTY(()) ipa_ref_list
   vec<ipa_ref_ptr>  GTY((skip)) referring;
 };
 
-struct ipa_ref * ipa_record_reference (symtab_node *,
-                                      symtab_node *,
-                                      enum ipa_ref_use, gimple);
-struct ipa_ref * ipa_maybe_record_reference (symtab_node *, tree,
-                                            enum ipa_ref_use, gimple);
-
-void ipa_remove_reference (struct ipa_ref *);
-void ipa_remove_all_references (struct ipa_ref_list *);
-void ipa_remove_all_referring (struct ipa_ref_list *);
-void ipa_dump_references (FILE *, struct ipa_ref_list *);
-void ipa_dump_referring (FILE *, struct ipa_ref_list *);
-void ipa_clone_references (symtab_node *, struct ipa_ref_list *);
-void ipa_clone_referring (symtab_node *, struct ipa_ref_list *);
-struct ipa_ref * ipa_clone_ref (struct ipa_ref *, symtab_node *, gimple);
-bool ipa_ref_cannot_lead_to_return (struct ipa_ref *);
-bool ipa_ref_has_aliases_p (struct ipa_ref_list *);
-struct ipa_ref * ipa_find_reference (symtab_node *, symtab_node *, gimple, unsigned int);
-void ipa_remove_stmt_references (symtab_node *, gimple);
-void ipa_clear_stmts_in_references (symtab_node *);
+#endif /* GCC_IPA_REF_H */