#ifndef GCC_CGRAPH_H
#define GCC_CGRAPH_H
+
+#include "vec.h"
#include "tree.h"
#include "basic-block.h"
-#include "ipa-ref.h"
+#include "function.h"
+#include "ipa-ref.h" /* FIXME: inappropriate dependency of cgraph on IPA. */
enum availability
{
/* Set when function is visible by other units. */
unsigned externally_visible : 1;
+ /* Set when resolver determines that function is visible by other units. */
+ unsigned used_from_object_file : 1;
+
/* Set once it has been finalized so we consider it to be output. */
unsigned finalized : 1;
/* False when there something makes inlining impossible (such as va_arg). */
unsigned inlinable : 1;
+ /* False when there something makes versioning impossible.
+ Currently computed and used only by ipa-cp. */
+ unsigned versionable : 1;
+
/* True when function should be inlined independently on its size. */
unsigned disregard_inline_limits : 1;
tree old_tree;
/* The new (replacing) tree. */
tree new_tree;
+ /* Parameter number to replace, when old_tree is NULL. */
+ int parm_num;
/* True when a substitution should be done, false otherwise. */
bool replace_p;
/* True when we replace a reference to old_tree. */
/* For functions with many calls sites it holds map from call expression
to the edge to speed up cgraph_edge function. */
htab_t GTY((param_is (struct cgraph_edge))) call_site_hash;
+#ifdef ENABLE_CHECKING
+ /* Declaration node used to be clone of. Used for checking only.
+ We must skip it or we get references from release checking GGC files. */
+ tree GTY ((skip)) former_clone_of;
+#endif
PTR GTY ((skip)) aux;
/* Set once the function has been instantiated and its callee
lists created. */
unsigned analyzed : 1;
- /* Set when function is available in the other LTRANS partition. */
+ /* Set when function is available in the other LTRANS partition.
+ During WPA output it is used to mark nodes that are present in
+ multiple partitions. */
unsigned in_other_partition : 1;
/* Set when function is scheduled to be processed by local passes. */
unsigned process : 1;
{
htab_t GTY((param_is (struct cgraph_node_set_element_def))) hashtab;
VEC(cgraph_node_ptr, gc) *nodes;
- PTR GTY ((skip)) aux;
};
typedef struct varpool_node *varpool_node_ptr;
{
htab_t GTY((param_is (struct varpool_node_set_element_def))) hashtab;
VEC(varpool_node_ptr, gc) *nodes;
- PTR GTY ((skip)) aux;
};
typedef struct cgraph_node_set_def *cgraph_node_set;
struct GTY(()) cgraph_indirect_call_info
{
+ /* Offset accumulated from ancestor jump functions of inlined call graph
+ edges. */
+ HOST_WIDE_INT anc_offset;
+ /* OBJ_TYPE_REF_TOKEN of a polymorphic call (if polymorphic is set). */
+ HOST_WIDE_INT otr_token;
+ /* Type of the object from OBJ_TYPE_REF_OBJECT. */
+ tree otr_type;
/* Index of the parameter that is called. */
int param_index;
/* ECF flags determined from the caller. */
int ecf_flags;
+
+ /* Set when the call is a virtual call with the parameter being the
+ associated object pointer rather than a simple direct call. */
+ unsigned polymorphic : 1;
};
struct GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller"))) cgraph_edge {
/* For normal nodes a pointer to the first extra name alias. For alias
nodes a pointer to the normal node. */
struct varpool_node *extra_name;
+ /* Circular list of nodes in the same comdat group if non-NULL. */
+ struct varpool_node *same_comdat_group;
struct ipa_ref_list ref_list;
+ /* File stream where this node is being written to. */
+ struct lto_file_decl_data * lto_file_data;
PTR GTY ((skip)) aux;
/* Ordering of all cgraph nodes. */
int order;
unsigned output : 1;
/* Set when function is visible by other units. */
unsigned externally_visible : 1;
+ /* Set when resolver determines that variable is visible by other units. */
+ unsigned used_from_object_file : 1;
/* Set for aliases once they got through assemble_alias. Also set for
extra name aliases in varpool_extra_name_alias. */
unsigned alias : 1;
/* Set when variable is used from other LTRANS partition. */
unsigned used_from_other_partition : 1;
- /* Set when variable is available in the other LTRANS partition. */
+ /* Set when variable is available in the other LTRANS partition.
+ During WPA output it is used to mark nodes that are present in
+ multiple partitions. */
unsigned in_other_partition : 1;
};
struct cgraph_edge *cgraph_create_indirect_edge (struct cgraph_node *, gimple, int,
gcov_type, int, int);
struct cgraph_node * cgraph_get_node (tree);
+struct cgraph_node * cgraph_get_node_or_alias (tree);
struct cgraph_node *cgraph_node (tree);
bool cgraph_same_body_alias (tree, tree);
void cgraph_add_thunk (tree, tree, bool, HOST_WIDE_INT, HOST_WIDE_INT, tree, tree);
struct cgraph_edge * cgraph_clone_edge (struct cgraph_edge *,
struct cgraph_node *, gimple,
unsigned, gcov_type, int, int, bool);
-struct cgraph_node * cgraph_clone_node (struct cgraph_node *, gcov_type, int,
+struct cgraph_node * cgraph_clone_node (struct cgraph_node *, tree, gcov_type, int,
int, bool, VEC(cgraph_edge_p,heap) *);
void cgraph_redirect_edge_callee (struct cgraph_edge *, struct cgraph_node *);
struct cgraph_node * cgraph_create_virtual_clone (struct cgraph_node *old_node,
VEC(cgraph_edge_p,heap)*,
VEC(ipa_replace_map_p,gc)* tree_map,
- bitmap args_to_skip);
+ bitmap args_to_skip,
+ const char *clone_name);
void cgraph_set_nothrow_flag (struct cgraph_node *, bool);
void cgraph_set_readonly_flag (struct cgraph_node *, bool);
void cgraph_set_pure_flag (struct cgraph_node *, bool);
void cgraph_set_looping_const_or_pure_flag (struct cgraph_node *, bool);
+tree clone_function_name (tree decl, const char *);
+bool cgraph_node_cannot_return (struct cgraph_node *);
+bool cgraph_edge_cannot_lead_to_return (struct cgraph_edge *);
/* In cgraphunit.c */
+extern FILE *cgraph_dump_file;
void cgraph_finalize_function (tree, bool);
void cgraph_mark_if_needed (tree);
void cgraph_finalize_compilation_unit (void);
struct cgraph_node *cgraph_function_versioning (struct cgraph_node *,
VEC(cgraph_edge_p,heap)*,
VEC(ipa_replace_map_p,gc)*,
- bitmap);
-void tree_function_versioning (tree, tree, VEC (ipa_replace_map_p,gc)*, bool, bitmap);
+ bitmap, bitmap, basic_block,
+ const char *);
+void tree_function_versioning (tree, tree, VEC (ipa_replace_map_p,gc)*, bool, bitmap,
+ bitmap, basic_block);
struct cgraph_node *save_inline_function_body (struct cgraph_node *);
void record_references_in_initializer (tree, bool);
bool cgraph_process_new_functions (void);
struct varpool_node *node;
for (node = varpool_nodes_queue; node; node = node->next_needed)
{
- gcc_assert (TREE_CODE (node->decl) == VAR_DECL);
+ gcc_checking_assert (TREE_CODE (node->decl) == VAR_DECL);
if (DECL_INITIAL (node->decl))
return node;
}
{
for (node = node->next_needed; node; node = node->next_needed)
{
- gcc_assert (TREE_CODE (node->decl) == VAR_DECL);
+ gcc_checking_assert (TREE_CODE (node->decl) == VAR_DECL);
if (DECL_INITIAL (node->decl))
return node;
}
static inline bool
cgraph_node_set_nonempty_p (cgraph_node_set set)
{
- return VEC_length (cgraph_node_ptr, set->nodes);
+ return !VEC_empty (cgraph_node_ptr, set->nodes);
}
/* Return true if set is nonempty. */
static inline bool
varpool_node_set_nonempty_p (varpool_node_set set)
{
- return VEC_length (varpool_node_ptr, set->nodes);
+ return !VEC_empty (varpool_node_ptr, set->nodes);
}
/* Return true when function NODE is only called directly.
/* Constant pool accessor function. */
htab_t constant_pool_htab (void);
+/* FIXME: inappropriate dependency of cgraph on IPA. */
#include "ipa-ref-inline.h"
#endif /* GCC_CGRAPH_H */