/* Information about the function collected locally.
Available after function is analyzed. */
-struct cgraph_local_info GTY(())
-{
+struct GTY(()) cgraph_local_info {
struct inline_summary {
/* Estimated stack frame consumption by the function. */
HOST_WIDE_INT estimated_self_stack_size;
/* Information about the function that needs to be computed globally
once compilation is finished. Available only with -funit-at-a-time. */
-struct cgraph_global_info GTY(())
-{
+struct GTY(()) cgraph_global_info {
/* Estimated stack frame consumption by the function. */
HOST_WIDE_INT estimated_stack_size;
/* Expected offset of the stack frame of inlined function. */
/* Information about the function that is propagated by the RTL backend.
Available only for functions that has been already assembled. */
-struct cgraph_rtl_info GTY(())
-{
+struct GTY(()) cgraph_rtl_info {
unsigned int preferred_incoming_stack_boundary;
};
/* The cgraph data structure.
Each function decl has assigned cgraph_node listing callees and callers. */
-struct cgraph_node GTY((chain_next ("%h.next"), chain_prev ("%h.previous")))
-{
+struct GTY((chain_next ("%h.next"), chain_prev ("%h.previous"))) cgraph_node {
tree decl;
struct cgraph_edge *callees;
struct cgraph_edge *callers;
tree inline_decl;
};
+typedef struct cgraph_node *cgraph_node_ptr;
+
+DEF_VEC_P(cgraph_node_ptr);
+DEF_VEC_ALLOC_P(cgraph_node_ptr,heap);
+DEF_VEC_ALLOC_P(cgraph_node_ptr,gc);
+
+/* A cgraph node set is a collection of cgraph nodes. A cgraph node
+ can appear in multiple sets. */
+struct GTY(()) cgraph_node_set_def
+{
+ htab_t GTY((param_is (struct cgraph_node_set_element_def))) hashtab;
+ VEC(cgraph_node_ptr, gc) *nodes;
+ PTR GTY ((skip)) aux;
+};
+
+typedef struct cgraph_node_set_def *cgraph_node_set;
+
+DEF_VEC_P(cgraph_node_set);
+DEF_VEC_ALLOC_P(cgraph_node_set,gc);
+DEF_VEC_ALLOC_P(cgraph_node_set,heap);
+
+/* A cgraph node set element contains an index in the vector of nodes in
+ the set. */
+struct GTY(()) cgraph_node_set_element_def
+{
+ struct cgraph_node *node;
+ HOST_WIDE_INT index;
+};
+
+typedef struct cgraph_node_set_element_def *cgraph_node_set_element;
+typedef const struct cgraph_node_set_element_def *const_cgraph_node_set_element;
+
+/* Iterator structure for cgraph node sets. */
+typedef struct
+{
+ cgraph_node_set set;
+ unsigned index;
+} cgraph_node_set_iterator;
+
#define DEFCIFCODE(code, string) CIF_ ## code,
/* Reasons for inlining failures. */
typedef enum {
CIF_N_REASONS
} cgraph_inline_failed_t;
-struct cgraph_edge GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller")))
-{
+struct GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller"))) cgraph_edge {
struct cgraph_node *caller;
struct cgraph_node *callee;
struct cgraph_edge *prev_caller;
per function call. The range is 0 to CGRAPH_FREQ_MAX. */
int frequency;
/* Depth of loop nest, 1 means no loop nest. */
- unsigned int loop_nest : 31;
+ unsigned int loop_nest : 30;
/* Whether this edge describes a call that was originally indirect. */
unsigned int indirect_call : 1;
+ /* Can this call throw externally? */
+ unsigned int can_throw_external : 1;
/* Unique id of the edge. */
int uid;
};
/* The varpool data structure.
Each static variable decl has assigned varpool_node. */
-struct varpool_node GTY((chain_next ("%h.next")))
-{
+struct GTY((chain_next ("%h.next"))) varpool_node {
tree decl;
/* Pointer to the next function in varpool_nodes. */
struct varpool_node *next;
/* Every top level asm statement is put into a cgraph_asm_node. */
-struct cgraph_asm_node GTY(())
-{
+struct GTY(()) cgraph_asm_node {
/* Next asm node. */
struct cgraph_asm_node *next;
/* String for this asm node. */
/* In ipa.c */
bool cgraph_remove_unreachable_nodes (bool, FILE *);
int cgraph_postorder (struct cgraph_node **);
+cgraph_node_set cgraph_node_set_new (void);
+cgraph_node_set_iterator cgraph_node_set_find (cgraph_node_set,
+ struct cgraph_node *);
+void cgraph_node_set_add (cgraph_node_set, struct cgraph_node *);
+void cgraph_node_set_remove (cgraph_node_set, struct cgraph_node *);
+void dump_cgraph_node_set (FILE *, cgraph_node_set);
+void debug_cgraph_node_set (cgraph_node_set);
+
+/* In predict.c */
bool cgraph_maybe_hot_edge_p (struct cgraph_edge *e);
/* In varpool.c */
-
extern GTY(()) struct varpool_node *varpool_nodes_queue;
extern GTY(()) struct varpool_node *varpool_nodes;
/* Create a new static variable of type TYPE. */
tree add_new_static_var (tree type);
+
+/* Return true if iterator CSI points to nothing. */
+static inline bool
+csi_end_p (cgraph_node_set_iterator csi)
+{
+ return csi.index >= VEC_length (cgraph_node_ptr, csi.set->nodes);
+}
+
+/* Advance iterator CSI. */
+static inline void
+csi_next (cgraph_node_set_iterator *csi)
+{
+ csi->index++;
+}
+
+/* Return the node pointed to by CSI. */
+static inline struct cgraph_node *
+csi_node (cgraph_node_set_iterator csi)
+{
+ return VEC_index (cgraph_node_ptr, csi.set->nodes, csi.index);
+}
+
+/* Return an iterator to the first node in SET. */
+static inline cgraph_node_set_iterator
+csi_start (cgraph_node_set set)
+{
+ cgraph_node_set_iterator csi;
+
+ csi.set = set;
+ csi.index = 0;
+ return csi;
+}
+
+/* Return true if SET contains NODE. */
+static inline bool
+cgraph_node_in_set_p (struct cgraph_node *node, cgraph_node_set set)
+{
+ cgraph_node_set_iterator csi;
+ csi = cgraph_node_set_find (set, node);
+ return !csi_end_p (csi);
+}
+
+/* Return number of nodes in SET. */
+static inline size_t
+cgraph_node_set_size (cgraph_node_set set)
+{
+ return htab_elements (set->hashtab);
+}
+
+
#endif /* GCC_CGRAPH_H */