* jvspec.c (jvgenmain_spec): Don't handle -fnew-verifier.
[gcc.git] / gcc / toplev.h
1 /* toplev.h - Various declarations for functions found in toplev.c
2 Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007,
3 2008, 2009, 2010
4 Free Software Foundation, Inc.
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
21
22 #ifndef GCC_TOPLEV_H
23 #define GCC_TOPLEV_H
24 #include "input.h"
25 #include "bversion.h"
26
27 /* If non-NULL, return one past-the-end of the matching SUBPART of
28 the WHOLE string. */
29 #define skip_leading_substring(whole, part) \
30 (strncmp (whole, part, strlen (part)) ? NULL : whole + strlen (part))
31
32 extern int toplev_main (int, char **);
33 extern void strip_off_ending (char *, int);
34 extern void rest_of_decl_compilation (tree, int, int);
35 extern void rest_of_type_compilation (tree, int);
36 extern void tree_rest_of_compilation (tree);
37 extern void init_optimization_passes (void);
38 extern void finish_optimization_passes (void);
39 extern bool enable_rtl_dump_file (void);
40
41 /* In except.c. Initialize exception handling. This is used by the Ada
42 and LTO front ends to initialize EH "on demand". See lto-streamer-in.c
43 and ada/gcc-interface/misc.c. */
44 extern void init_eh (void);
45
46 extern void announce_function (tree);
47
48 extern void warn_deprecated_use (tree, tree);
49 extern bool parse_optimize_options (tree, bool);
50
51 #ifdef BUFSIZ
52 extern void output_quoted_string (FILE *, const char *);
53 #endif
54
55 extern void wrapup_global_declaration_1 (tree);
56 extern bool wrapup_global_declaration_2 (tree);
57 extern bool wrapup_global_declarations (tree *, int);
58 extern void check_global_declaration_1 (tree);
59 extern void check_global_declarations (tree *, int);
60 extern void emit_debug_global_declarations (tree *, int);
61 extern void write_global_declarations (void);
62
63 extern void dump_memory_report (bool);
64
65 extern void target_reinit (void);
66
67 /* A unique local time stamp, might be zero if none is available. */
68 extern unsigned local_tick;
69
70 /* Top-level source file. */
71 extern const char *main_input_filename;
72
73 extern const char *dump_base_name;
74 extern const char *dump_dir_name;
75 extern const char *aux_base_name;
76 extern const char *aux_info_file_name;
77 extern const char *profile_data_prefix;
78 extern const char *asm_file_name;
79 extern bool exit_after_options;
80
81 /* True if the user has tagged the function with the 'section'
82 attribute. */
83
84 extern bool user_defined_section_attribute;
85
86 /* See toplev.c. */
87 extern int flag_rerun_cse_after_global_opts;
88
89 /* Things to do with target switches. */
90 extern void print_version (FILE *, const char *);
91 extern void * default_get_pch_validity (size_t *);
92 extern const char * default_pch_valid_p (const void *, size_t);
93
94 /* The hashtable, so that the C front ends can pass it to cpplib. */
95 extern struct ht *ident_hash;
96
97 /* This function can be used by targets to set the flags originally
98 implied by -ffast-math and -fno-fast-math. */
99
100 extern void set_fast_math_flags (int);
101
102 extern void set_unsafe_math_optimizations_flags (int);
103
104 /* Handle -d switch. */
105 extern void decode_d_option (const char *);
106
107 /* Return true iff flags are set as if -ffast-math. */
108 extern bool fast_math_flags_set_p (void);
109 extern bool fast_math_flags_struct_set_p (struct cl_optimization *);
110
111 /* Inline versions of the above for speed. */
112 #if GCC_VERSION < 3004
113
114 extern int clz_hwi (unsigned HOST_WIDE_INT x);
115 extern int ctz_hwi (unsigned HOST_WIDE_INT x);
116 extern int ffs_hwi (unsigned HOST_WIDE_INT x);
117
118 /* Return log2, or -1 if not exact. */
119 extern int exact_log2 (unsigned HOST_WIDE_INT);
120
121 /* Return floor of log2, with -1 for zero. */
122 extern int floor_log2 (unsigned HOST_WIDE_INT);
123
124 #else /* GCC_VERSION >= 3004 */
125
126 /* For convenience, define 0 -> word_size. */
127 static inline int
128 clz_hwi (unsigned HOST_WIDE_INT x)
129 {
130 if (x == 0)
131 return HOST_BITS_PER_WIDE_INT;
132 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
133 return __builtin_clzl (x);
134 # elif HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONGLONG
135 return __builtin_clzll (x);
136 # else
137 return __builtin_clz (x);
138 # endif
139 }
140
141 static inline int
142 ctz_hwi (unsigned HOST_WIDE_INT x)
143 {
144 if (x == 0)
145 return HOST_BITS_PER_WIDE_INT;
146 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
147 return __builtin_ctzl (x);
148 # elif HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONGLONG
149 return __builtin_ctzll (x);
150 # else
151 return __builtin_ctz (x);
152 # endif
153 }
154
155 static inline int
156 ffs_hwi (unsigned HOST_WIDE_INT x)
157 {
158 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
159 return __builtin_ffsl (x);
160 # elif HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONGLONG
161 return __builtin_ffsll (x);
162 # else
163 return __builtin_ffs (x);
164 # endif
165 }
166
167 static inline int
168 floor_log2 (unsigned HOST_WIDE_INT x)
169 {
170 return HOST_BITS_PER_WIDE_INT - 1 - clz_hwi (x);
171 }
172
173 static inline int
174 exact_log2 (unsigned HOST_WIDE_INT x)
175 {
176 return x == (x & -x) && x ? ctz_hwi (x) : -1;
177 }
178
179 #endif /* GCC_VERSION >= 3004 */
180
181 /* Functions used to get and set GCC's notion of in what directory
182 compilation was started. */
183
184 extern const char *get_src_pwd (void);
185 extern bool set_src_pwd (const char *);
186
187 /* Functions used to manipulate the random seed. */
188
189 extern const char *get_random_seed (bool);
190 extern const char *set_random_seed (const char *);
191
192 #endif /* ! GCC_TOPLEV_H */