OSDN Git Service

6967900cb8aa9dc14ee1d961cc329d072364bf2a
[pf3gnuchains/gcc-fork.git] / gcc / ggc.h
1 /* Garbage collection for the GNU compiler.
2    Copyright (C) 1998 Free Software Foundation, Inc.
3
4    This file is part of GNU CC.
5
6    GNU CC is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2, or (at your option)
9    any later version.
10
11    GNU CC is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with GNU CC; see the file COPYING.  If not, write to
18    the Free Software Foundation, 59 Temple Place - Suite 330,
19    Boston, MA 02111-1307, USA.  */
20
21 #include "gansidecl.h"
22
23 /* Symbols are marked with `ggc' for `gcc gc' so as not to interfere with
24    an external gc library that might be linked in.  */
25
26 /* These structures are defined in various headers throughout the
27    compiler.  However, rather than force everyone who includes this
28    header to include all the headers in which they are declared, we
29    just forward-declare them here.  */
30 struct label_node;
31 struct eh_status;
32 struct emit_status;
33 struct stmt_status;
34 struct varasm_status;
35
36 /* Startup */
37
38 extern void init_ggc PROTO ((void));
39
40 /* Allocation.  */
41
42 struct rtx_def *ggc_alloc_rtx PROTO ((int nslots));
43 struct rtvec_def *ggc_alloc_rtvec PROTO ((int nelt));
44 union tree_node *ggc_alloc_tree PROTO ((int length));
45 char *ggc_alloc_string PROTO ((const char *contents, int length));
46
47 /* Invoke the collector.  This is really just a hint, but in the case of
48    the simple collector, the only time it will happen.  */
49
50 void ggc_collect PROTO ((void));
51
52 /* Manipulate global roots that are needed between calls to gc.  */
53 void ggc_add_root PROTO ((void *base, int nelt, int size,
54                            void (*)(void *)));
55 void ggc_add_rtx_root PROTO ((struct rtx_def **, int nelt));
56 void ggc_add_tree_root PROTO ((union tree_node **, int nelt));
57 void ggc_del_root PROTO ((void *base));
58
59 /* Mark nodes from the gc_add_root callback.  */
60 void ggc_mark_rtx PROTO ((struct rtx_def *));
61 void ggc_mark_rtvec PROTO ((struct rtvec_def *));
62 void ggc_mark_tree PROTO ((union tree_node *));
63 void ggc_mark_string PROTO ((char *));
64
65 /* Callbacks to the languages.  */
66
67 /* This is the language's opportunity to mark nodes held through
68    the lang_specific hooks in the tree.  */
69 void lang_mark_tree PROTO ((union tree_node *));
70
71 /* And similarly to free that data when the tree node is released.  */
72 void lang_cleanup_tree PROTO ((union tree_node *));
73
74 /* The FALSE_LABEL_STACK, declared in except.h, has
75    language-dependent semantics.  Each front-end should define this
76    function appropriately.  */
77 void lang_mark_false_label_stack PROTO ((struct label_node *));
78
79 /* Mark functions for various structs scattered about.  */
80
81 void mark_eh_state PROTO ((struct eh_status *));
82 void mark_stmt_state PROTO ((struct stmt_status *));
83 void mark_emit_state PROTO ((struct emit_status *));
84 void mark_varasm_state PROTO ((struct varasm_status *));
85 void mark_optab PROTO ((void *));