Make gcc::context be GC-managed
[gcc.git] / gcc / tree-nomudflap.c
1 /* Mudflap: narrow-pointer bounds-checking by tree rewriting.
2 Copyright (C) 2001-2013 Free Software Foundation, Inc.
3 Contributed by Frank Ch. Eigler <fche@redhat.com>
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 3, 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 COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
20
21
22 #include "config.h"
23 #include "system.h"
24 #include "coretypes.h"
25 #include "tm.h"
26 #include "tree.h"
27 #include "tree-inline.h"
28 #include "gimple.h"
29 #include "hashtab.h"
30 #include "langhooks.h"
31 #include "tree-mudflap.h"
32 #include "tree-pass.h"
33 #include "ggc.h"
34 #include "diagnostic-core.h"
35
36
37
38 /* This file contains placeholder functions, to be used only for
39 language processors that cannot handle tree-mudflap.c directly.
40 (e.g. Fortran). */
41
42 static void
43 nogo (void)
44 {
45 sorry ("mudflap: this language is not supported");
46 }
47
48 void
49 mudflap_enqueue_decl (tree obj ATTRIBUTE_UNUSED)
50 {
51 nogo ();
52 }
53
54 void
55 mudflap_enqueue_constant (tree obj ATTRIBUTE_UNUSED)
56 {
57 nogo ();
58 }
59
60 void
61 mudflap_finish_file (void)
62 {
63 nogo ();
64 }
65
66 int
67 mf_marked_p (tree t ATTRIBUTE_UNUSED)
68 {
69 nogo ();
70 return 0;
71 }
72
73 tree
74 mf_mark (tree t ATTRIBUTE_UNUSED)
75 {
76 nogo ();
77 return NULL;
78 }
79
80 /* The pass structures must exist, but need not do anything. */
81
82 static bool
83 gate_mudflap (void)
84 {
85 return flag_mudflap != 0;
86 }
87
88 namespace {
89
90 const pass_data pass_data_mudflap_1 =
91 {
92 GIMPLE_PASS, /* type */
93 "mudflap1", /* name */
94 OPTGROUP_NONE, /* optinfo_flags */
95 true, /* has_gate */
96 false, /* has_execute */
97 TV_NONE, /* tv_id */
98 0, /* properties_required */
99 0, /* properties_provided */
100 0, /* properties_destroyed */
101 0, /* todo_flags_start */
102 0, /* todo_flags_finish */
103 };
104
105 class pass_mudflap_1 : public gimple_opt_pass
106 {
107 public:
108 pass_mudflap_1(gcc::context *ctxt)
109 : gimple_opt_pass(pass_data_mudflap_1, ctxt)
110 {}
111
112 /* opt_pass methods: */
113 bool gate () { return gate_mudflap (); }
114
115 }; // class pass_mudflap_1
116
117 } // anon namespace
118
119 gimple_opt_pass *
120 make_pass_mudflap_1 (gcc::context *ctxt)
121 {
122 return new pass_mudflap_1 (ctxt);
123 }
124
125 namespace {
126
127 const pass_data pass_data_mudflap_2 =
128 {
129 GIMPLE_PASS, /* type */
130 "mudflap2", /* name */
131 OPTGROUP_NONE, /* optinfo_flags */
132 true, /* has_gate */
133 false, /* has_execute */
134 TV_NONE, /* tv_id */
135 0, /* properties_required */
136 0, /* properties_provided */
137 0, /* properties_destroyed */
138 0, /* todo_flags_start */
139 0, /* todo_flags_finish */
140 };
141
142 class pass_mudflap_2 : public gimple_opt_pass
143 {
144 public:
145 pass_mudflap_2(gcc::context *ctxt)
146 : gimple_opt_pass(pass_data_mudflap_2, ctxt)
147 {}
148
149 /* opt_pass methods: */
150 bool gate () { return gate_mudflap (); }
151
152 }; // class pass_mudflap_2
153
154 } // anon namespace
155
156 gimple_opt_pass *
157 make_pass_mudflap_2 (gcc::context *ctxt)
158 {
159 return new pass_mudflap_2 (ctxt);
160 }
161
162 /* Instead of:
163 #include "gt-tree-mudflap.h"
164 We prepare a little dummy struct here.
165 */
166
167 EXPORTED_CONST struct ggc_root_tab gt_ggc_r_gt_tree_mudflap_h[] = {
168 LAST_GGC_ROOT_TAB
169 };