FSF GCC merge 02/23/03
[official-gcc.git] / gcc / cgraph.h
blob8dd37ed9e32e351f17377887e2c5cf4e3535ad47
1 /* Callgraph handling code.
2 Copyright (C) 2003 Free Software Foundation, Inc.
3 Contributed by Jan Hubicka
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 2, 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 COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
22 #ifndef GCC_CGRAPH_H
23 #define GCC_CGRAPH_H
25 /* The cgraph data strutcture.
26 Each function decl has assigned cgraph_node listing calees and callers. */
28 struct cgraph_node
30 tree decl;
31 struct cgraph_edge *callees;
32 struct cgraph_edge *callers;
33 struct cgraph_node *next;
34 /* For nested functions points to function the node is nested in. */
35 struct cgraph_node *origin;
36 /* Points to first nested function, if any. */
37 struct cgraph_node *nested;
38 /* Pointer to the next function with same origin, if any. */
39 struct cgraph_node *next_nested;
40 void *aux;
42 /* Set when function must be output - it is externally visible
43 or it's address is taken. */
44 bool needed;
45 /* Set when function is reachable by call from other function
46 that is eighter reachable or needed. */
47 bool reachable;
48 /* Set when the frontend has been asked to lower representation of this
49 function into trees. Callees lists are not available when lowered
50 is not set. */
51 bool lowered;
52 /* Set when function is scheduled to be assembled. */
53 bool output;
56 struct cgraph_edge
58 struct cgraph_node *caller, *callee;
59 struct cgraph_edge *next_caller;
60 struct cgraph_edge *next_callee;
63 extern struct cgraph_node *cgraph_nodes;
64 extern int cgraph_n_nodes;
66 /* In cgraph.c */
67 void dump_cgraph PARAMS ((FILE *));
68 void cgraph_remove_call PARAMS ((tree, tree));
69 struct cgraph_edge *cgraph_record_call PARAMS ((tree, tree));
70 struct cgraph_node *cgraph_node PARAMS ((tree decl));
71 bool cgraph_calls_p PARAMS ((tree, tree));
73 /* In cgraphunit.c */
74 void cgraph_finalize_function PARAMS ((tree, tree));
75 void cgraph_finalize_compilation_unit PARAMS ((void));
76 void cgraph_create_edges PARAMS ((tree, tree));
77 void cgraph_optimize PARAMS ((void));
78 void cgraph_mark_needed_node PARAMS ((struct cgraph_node *, int));
80 #endif /* GCC_CGRAPH_H */