Do not bias REG_N_REFS by loop_depth when optimising for size.
[official-gcc.git] / gcc / c-lang.c
blob331ff54e5dce74ca9608f060528ab3f2dd75399b
1 /* Language-specific hook definitions for C front end.
2 Copyright (C) 1991, 1995, 1997, 1998,
3 1999, 2000 Free Software Foundation, Inc.
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
23 #include "config.h"
24 #include "system.h"
25 #include "tree.h"
26 #include "function.h"
27 #include "input.h"
28 #include "c-tree.h"
29 #include "c-lex.h"
30 #include "toplev.h"
31 #include "output.h"
32 #include "flags.h"
33 #include "ggc.h"
35 #if USE_CPPLIB
36 #include "cpplib.h"
37 extern char *yy_cur;
38 extern cpp_reader parse_in;
39 extern cpp_options parse_options;
40 #endif
42 /* Each of the functions defined here
43 is an alternative to a function in objc-actions.c. */
45 int
46 lang_decode_option (argc, argv)
47 int argc;
48 char **argv;
50 return c_decode_option (argc, argv);
53 void
54 lang_init_options ()
56 #if USE_CPPLIB
57 cpp_reader_init (&parse_in);
58 parse_in.opts = &parse_options;
59 cpp_options_init (&parse_options);
60 #endif
61 /* Mark as "unspecified". */
62 flag_bounds_check = -1;
65 void
66 lang_init ()
68 /* If still "unspecified", make it match -fbounded-pointers. */
69 if (flag_bounds_check < 0)
70 flag_bounds_check = flag_bounded_pointers;
72 /* the beginning of the file is a new line; check for # */
73 /* With luck, we discover the real source file's name from that
74 and put it in input_filename. */
75 #if !USE_CPPLIB
76 ungetc (check_newline (), finput);
77 #else
78 check_newline ();
79 yy_cur--;
80 #endif
82 save_lang_status = &push_c_function_context;
83 restore_lang_status = &pop_c_function_context;
84 mark_lang_status = &mark_c_function_context;
86 c_parse_init ();
89 void
90 lang_finish ()
94 const char *
95 lang_identify ()
97 return "c";
100 void
101 print_lang_statistics ()
105 /* used by print-tree.c */
107 void
108 lang_print_xnode (file, node, indent)
109 FILE *file ATTRIBUTE_UNUSED;
110 tree node ATTRIBUTE_UNUSED;
111 int indent ATTRIBUTE_UNUSED;
115 /* Used by c-lex.c, but only for objc. */
117 tree
118 lookup_interface (arg)
119 tree arg ATTRIBUTE_UNUSED;
121 return 0;
124 tree
125 is_class_name (arg)
126 tree arg ATTRIBUTE_UNUSED;
128 return 0;
131 void
132 maybe_objc_check_decl (decl)
133 tree decl ATTRIBUTE_UNUSED;
138 maybe_objc_comptypes (lhs, rhs, reflexive)
139 tree lhs ATTRIBUTE_UNUSED;
140 tree rhs ATTRIBUTE_UNUSED;
141 int reflexive ATTRIBUTE_UNUSED;
143 return -1;
146 tree
147 maybe_objc_method_name (decl)
148 tree decl ATTRIBUTE_UNUSED;
150 return 0;
153 tree
154 maybe_building_objc_message_expr ()
156 return 0;
160 recognize_objc_keyword ()
162 return 0;
165 tree
166 build_objc_string (len, str)
167 int len ATTRIBUTE_UNUSED;
168 const char *str ATTRIBUTE_UNUSED;
170 abort ();
171 return NULL_TREE;
174 /* Called at end of parsing, but before end-of-file processing. */
176 void
177 finish_file ()
179 #ifndef ASM_OUTPUT_CONSTRUCTOR
180 extern tree static_ctors;
181 #endif
182 #ifndef ASM_OUTPUT_DESTRUCTOR
183 extern tree static_dtors;
184 #endif
185 extern tree build_function_call PARAMS ((tree, tree));
186 #if !defined(ASM_OUTPUT_CONSTRUCTOR) || !defined(ASM_OUTPUT_DESTRUCTOR)
187 tree void_list_node_1 = build_tree_list (NULL_TREE, void_type_node);
188 #endif
189 #ifndef ASM_OUTPUT_CONSTRUCTOR
190 if (static_ctors)
192 tree fnname = get_file_function_name ('I');
193 start_function (void_list_node_1,
194 build_parse_node (CALL_EXPR, fnname,
195 tree_cons (NULL_TREE, NULL_TREE,
196 void_list_node_1),
197 NULL_TREE),
198 NULL_TREE, NULL_TREE);
199 fnname = DECL_ASSEMBLER_NAME (current_function_decl);
200 store_parm_decls ();
202 for (; static_ctors; static_ctors = TREE_CHAIN (static_ctors))
203 expand_expr_stmt (build_function_call (TREE_VALUE (static_ctors),
204 NULL_TREE));
206 finish_function (0);
208 assemble_constructor (IDENTIFIER_POINTER (fnname));
210 #endif
211 #ifndef ASM_OUTPUT_DESTRUCTOR
212 if (static_dtors)
214 tree fnname = get_file_function_name ('D');
215 start_function (void_list_node_1,
216 build_parse_node (CALL_EXPR, fnname,
217 tree_cons (NULL_TREE, NULL_TREE,
218 void_list_node_1),
219 NULL_TREE),
220 NULL_TREE, NULL_TREE);
221 fnname = DECL_ASSEMBLER_NAME (current_function_decl);
222 store_parm_decls ();
224 for (; static_dtors; static_dtors = TREE_CHAIN (static_dtors))
225 expand_expr_stmt (build_function_call (TREE_VALUE (static_dtors),
226 NULL_TREE));
228 finish_function (0);
230 assemble_destructor (IDENTIFIER_POINTER (fnname));
232 #endif