OSDN Git Service

* Makefile.in (cgraph.o): Depend on output.h, not depend on
[pf3gnuchains/gcc-fork.git] / gcc / cgraph.h
1 /* Callgraph handling code.
2    Copyright (C) 2003 Free Software Foundation, Inc.
3    Contributed by Jan Hubicka
4
5 This file is part of GCC.
6
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 2, or (at your option) any later
10 version.
11
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.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING.  If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA.  */
21
22 #ifndef GCC_CGRAPH_H
23 #define GCC_CGRAPH_H
24
25 /* Information about the function collected locally.
26    Available after function is lowered  */
27
28 struct cgraph_local_info
29 {
30   /* Set when function function is visiable in current compilation unit only
31      and it's address is never taken.  */
32   bool local;
33   /* Set when function is small enought to be inlinable many times.  */
34   bool inline_many;
35   /* Set when function can be inlined once (false only for functions calling
36      alloca, using varargs and so on).  */
37   bool can_inline_once;
38 };
39
40 /* Information about the function that needs to be computed globally
41    once compilation is finished.  Available only with -funit-at-time.  */
42
43 struct cgraph_global_info
44 {
45   /* Set when the function will be inlined exactly once.  */
46   bool inline_once;
47 };
48
49 /* Information about the function that is propagated by the RTL backend.
50    Available only for functions that has been already assembled.  */
51
52 struct cgraph_rtl_info
53 {
54    bool const_function, pure_function;
55    int preferred_incoming_stack_boundary;
56 };
57
58
59 /* The cgraph data strutcture.
60    Each function decl has assigned cgraph_node listing calees and callers.  */
61
62 struct cgraph_node
63 {
64   tree decl;
65   struct cgraph_edge *callees;
66   struct cgraph_edge *callers;
67   struct cgraph_node *next, *previous;
68   /* For nested functions points to function the node is nested in.  */
69   struct cgraph_node *origin;
70   /* Points to first nested function, if any.  */
71   struct cgraph_node *nested;
72   /* Pointer to the next function with same origin, if any.  */
73   struct cgraph_node *next_nested;
74   void *aux;
75
76   /* Set when function must be output - it is externally visible
77      or it's address is taken.  */
78   bool needed;
79   /* Set when function is reachable by call from other function
80      that is eighter reachable or needed.  */
81   bool reachable;
82   /* Set when the frontend has been asked to lower representation of this
83      function into trees.  Callees lists are not available when lowered
84      is not set.  */
85   bool lowered;
86   /* Set when function is scheduled to be assembled.  */
87   bool output;
88   struct cgraph_local_info local;
89   struct cgraph_global_info global;
90   struct cgraph_rtl_info rtl;
91 };
92
93 struct cgraph_edge
94 {
95   struct cgraph_node *caller, *callee;
96   struct cgraph_edge *next_caller;
97   struct cgraph_edge *next_callee;
98 };
99
100 /* The cgraph_varpool data strutcture.
101    Each static variable decl has assigned cgraph_varpool_node.  */
102
103 struct cgraph_varpool_node
104 {
105   tree decl;
106   void *aux;
107
108   /* Set when function must be output - it is externally visible
109      or it's address is taken.  */
110   bool needed;
111   /* Set once it has been finalized so we consider it to be output.  */
112   bool finalized;
113   /* Set when function is scheduled to be assembled.  */
114   bool output;
115 };
116
117 extern struct cgraph_node *cgraph_nodes;
118 extern int cgraph_n_nodes;
119 extern bool cgraph_global_info_ready;
120 extern struct cgraph_node *cgraph_nodes_queue;
121
122 extern int cgraph_varpool_n_nodes;
123 extern struct cgraph_varpool_node *cgraph_varpool_nodes_queue;
124
125
126 /* In cgraph.c  */
127 void dump_cgraph                        PARAMS ((FILE *));
128 void cgraph_remove_call                 PARAMS ((tree, tree));
129 void cgraph_remove_node                 PARAMS ((struct cgraph_node *));
130 struct cgraph_edge *cgraph_record_call  PARAMS ((tree, tree));
131 struct cgraph_node *cgraph_node         PARAMS ((tree decl));
132 struct cgraph_node *cgraph_node_for_identifier  PARAMS ((tree id));
133 bool cgraph_calls_p                     PARAMS ((tree, tree));
134 struct cgraph_local_info *cgraph_local_info PARAMS ((tree));
135 struct cgraph_global_info *cgraph_global_info PARAMS ((tree));
136 struct cgraph_rtl_info *cgraph_rtl_info PARAMS ((tree));
137
138 struct cgraph_varpool_node *cgraph_varpool_node (tree decl);
139 struct cgraph_varpool_node *cgraph_varpool_node_for_identifier (tree id);
140 void cgraph_varpool_mark_needed_node (struct cgraph_varpool_node *);
141 void cgraph_varpool_finalize_decl (tree);
142 bool cgraph_varpool_assemble_pending_decls (void);
143
144 /* In cgraphunit.c  */
145 void cgraph_finalize_function           PARAMS ((tree, tree));
146 void cgraph_finalize_compilation_unit   PARAMS ((void));
147 void cgraph_create_edges                PARAMS ((tree, tree));
148 void cgraph_optimize                    PARAMS ((void));
149 void cgraph_mark_needed_node            PARAMS ((struct cgraph_node *, int));
150
151 #endif  /* GCC_CGRAPH_H  */