* ipa-utils.h (method_class_type): Declare.
[official-gcc.git] / gcc / ipa-utils.h
blob427245509b03f69baed017d9d83fb784e03d424e
1 /* Utilities for ipa analysis.
2 Copyright (C) 2004-2013 Free Software Foundation, Inc.
3 Contributed by Kenneth Zadeck <zadeck@naturalbridge.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 #ifndef GCC_IPA_UTILS_H
22 #define GCC_IPA_UTILS_H
23 #include "tree.h"
24 #include "cgraph.h"
26 struct ipa_dfs_info {
27 int dfn_number;
28 int low_link;
29 /* This field will have the samy value for any two nodes in the same strongly
30 connected component. */
31 int scc_no;
32 bool new_node;
33 bool on_stack;
34 struct cgraph_node* next_cycle;
35 PTR aux;
39 /* In ipa-utils.c */
40 void ipa_print_order (FILE*, const char *, struct cgraph_node**, int);
41 int ipa_reduced_postorder (struct cgraph_node **, bool, bool,
42 bool (*ignore_edge) (struct cgraph_edge *));
43 void ipa_free_postorder_info (void);
44 vec<cgraph_node_ptr> ipa_get_nodes_in_cycle (struct cgraph_node *);
45 int ipa_reverse_postorder (struct cgraph_node **);
46 tree get_base_var (tree);
48 /* In ipa-devirt.c */
50 struct odr_type_d;
51 typedef odr_type_d *odr_type;
52 void build_type_inheritance_graph (void);
53 void update_type_inheritance_graph (void);
54 vec <cgraph_node *>
55 possible_polymorphic_call_targets (tree, HOST_WIDE_INT,
56 bool *final = NULL,
57 void **cache_token = NULL);
58 odr_type get_odr_type (tree, bool insert = false);
59 void dump_possible_polymorphic_call_targets (FILE *, tree, HOST_WIDE_INT);
60 bool possible_polymorphic_call_target_p (tree, HOST_WIDE_INT,
61 struct cgraph_node *n);
62 tree method_class_type (tree);
64 /* Return vector containing possible targets of polymorphic call E.
65 If FINALP is non-NULL, store true if the list is complette.
66 CACHE_TOKEN (if non-NULL) will get stored to an unique ID of entry
67 in the target cache. If user needs to visit every target list
68 just once, it can memoize them.
70 Returned vector is placed into cache. It is NOT caller's responsibility
71 to free it. The vector can be freed on cgraph_remove_node call if
72 the particular node is a virtual function present in the cache. */
74 inline vec <cgraph_node *>
75 possible_polymorphic_call_targets (struct cgraph_edge *e,
76 bool *final = NULL,
77 void **cache_token = NULL)
79 gcc_checking_assert (e->indirect_info->polymorphic);
80 return possible_polymorphic_call_targets (e->indirect_info->otr_type,
81 e->indirect_info->otr_token,
82 final, cache_token);
85 /* Dump possible targets of a polymorphic call E into F. */
87 inline void
88 dump_possible_polymorphic_call_targets (FILE *f, struct cgraph_edge *e)
90 gcc_checking_assert (e->indirect_info->polymorphic);
91 dump_possible_polymorphic_call_targets (f, e->indirect_info->otr_type,
92 e->indirect_info->otr_token);
95 /* Return true if N can be possibly target of a polymorphic call of
96 E. */
98 inline bool
99 possible_polymorphic_call_target_p (struct cgraph_edge *e,
100 struct cgraph_node *n)
102 return possible_polymorphic_call_target_p (e->indirect_info->otr_type,
103 e->indirect_info->otr_token, n);
105 #endif /* GCC_IPA_UTILS_H */