]>
Commit | Line | Data |
---|---|---|
9cdfa0b0 | 1 | /* toplev.h - Various declarations for functions found in toplev.c |
b6c1bd72 | 2 | Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 |
a8349c62 | 3 | Free Software Foundation, Inc. |
70d11e67 | 4 | |
f12b58b3 | 5 | This file is part of GCC. |
70d11e67 | 6 | |
f12b58b3 | 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 | |
8c4c00c1 | 9 | Software Foundation; either version 3, or (at your option) any later |
f12b58b3 | 10 | version. |
70d11e67 | 11 | |
f12b58b3 | 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. | |
70d11e67 | 16 | |
17 | You should have received a copy of the GNU General Public License | |
8c4c00c1 | 18 | along with GCC; see the file COPYING3. If not see |
19 | <http://www.gnu.org/licenses/>. */ | |
9cdfa0b0 | 20 | |
2a281353 | 21 | #ifndef GCC_TOPLEV_H |
22 | #define GCC_TOPLEV_H | |
bdbc474b | 23 | #include "input.h" |
9cdfa0b0 | 24 | |
46e0b24f | 25 | /* If non-NULL, return one past-the-end of the matching SUBPART of |
26 | the WHOLE string. */ | |
27 | #define skip_leading_substring(whole, part) \ | |
28 | (strncmp (whole, part, strlen (part)) ? NULL : whole + strlen (part)) | |
29 | ||
00ea394c | 30 | extern int toplev_main (unsigned int, const char **); |
31 | extern int read_integral_parameter (const char *, const char *, const int); | |
32 | extern void strip_off_ending (char *, int); | |
33 | extern const char *trim_filename (const char *); | |
dd9b9fc5 | 34 | extern void _fatal_insn_not_found (const_rtx, const char *, int, const char *) |
7237deda | 35 | ATTRIBUTE_NORETURN; |
dd9b9fc5 | 36 | extern void _fatal_insn (const char *, const_rtx, const char *, int, const char *) |
7237deda | 37 | ATTRIBUTE_NORETURN; |
dda90815 | 38 | |
dda90815 | 39 | #define fatal_insn(msgid, insn) \ |
19fafbd3 | 40 | _fatal_insn (msgid, insn, __FILE__, __LINE__, __FUNCTION__) |
dda90815 | 41 | #define fatal_insn_not_found(insn) \ |
19fafbd3 | 42 | _fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__) |
43 | ||
69579044 | 44 | /* If we haven't already defined a frontend specific diagnostics |
45 | style, use the generic one. */ | |
46 | #ifndef GCC_DIAG_STYLE | |
7781aa77 | 47 | #define GCC_DIAG_STYLE __gcc_tdiag__ |
69579044 | 48 | #endif |
5124a2c8 | 49 | /* None of these functions are suitable for ATTRIBUTE_PRINTF, because |
50 | each language front end can extend them with its own set of format | |
7781aa77 | 51 | specifiers. We must use custom format checks. */ |
52 | #if GCC_VERSION >= 4001 | |
69579044 | 53 | #define ATTRIBUTE_GCC_DIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m) |
54 | #else | |
55 | #define ATTRIBUTE_GCC_DIAG(m, n) ATTRIBUTE_NONNULL(m) | |
56 | #endif | |
00ea394c | 57 | extern void internal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2) |
7237deda | 58 | ATTRIBUTE_NORETURN; |
e8d0745d | 59 | /* Pass one of the OPT_W* from options.h as the first parameter. */ |
a52d5726 | 60 | extern bool warning (int, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); |
61 | extern bool warning_at (location_t, int, const char *, ...) | |
bdbc474b | 62 | ATTRIBUTE_GCC_DIAG(3,4); |
7781aa77 | 63 | extern void error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); |
00ea394c | 64 | extern void fatal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2) |
69579044 | 65 | ATTRIBUTE_NORETURN; |
21ca8540 | 66 | /* Pass one of the OPT_W* from options.h as the second parameter. */ |
67 | extern bool pedwarn (location_t, int, const char *, ...) | |
5519c0df | 68 | ATTRIBUTE_GCC_DIAG(3,4); |
2b9e3597 | 69 | extern bool permerror (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); |
7781aa77 | 70 | extern void sorry (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); |
5bcc316e | 71 | extern void inform (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); |
a208cd0d | 72 | extern void verbatim (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); |
00ea394c | 73 | |
b2c4af5e | 74 | extern void rest_of_decl_compilation (tree, int, int); |
00ea394c | 75 | extern void rest_of_type_compilation (tree, int); |
6148a911 | 76 | extern void tree_rest_of_compilation (tree); |
77fce4cd | 77 | extern void init_optimization_passes (void); |
a49a878f | 78 | extern void finish_optimization_passes (void); |
5d48fdb4 | 79 | extern bool enable_rtl_dump_file (void); |
00ea394c | 80 | |
00ea394c | 81 | extern void announce_function (tree); |
82 | ||
dd9b9fc5 | 83 | extern void error_for_asm (const_rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); |
84 | extern void warning_for_asm (const_rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); | |
00ea394c | 85 | extern void warn_deprecated_use (tree); |
46f8e3b0 | 86 | extern bool parse_optimize_options (tree, bool); |
7237deda | 87 | |
ebd9163c | 88 | #ifdef BUFSIZ |
7237deda | 89 | extern void output_quoted_string (FILE *, const char *); |
90 | extern void output_file_directive (FILE *, const char *); | |
ebd9163c | 91 | #endif |
bca09c45 | 92 | |
e3c3cde6 | 93 | #ifdef BUFSIZ |
5124a2c8 | 94 | /* N.B. Unlike all the others, fnotice is just gettext+fprintf, and |
95 | therefore it can have ATTRIBUTE_PRINTF. */ | |
7237deda | 96 | extern void fnotice (FILE *, const char *, ...) |
97 | ATTRIBUTE_PRINTF_2; | |
e3c3cde6 | 98 | #endif |
0cc5917f | 99 | |
c131e678 | 100 | extern void wrapup_global_declaration_1 (tree); |
101 | extern bool wrapup_global_declaration_2 (tree); | |
102 | extern bool wrapup_global_declarations (tree *, int); | |
103 | extern void check_global_declaration_1 (tree); | |
00ea394c | 104 | extern void check_global_declarations (tree *, int); |
c131e678 | 105 | extern void emit_debug_global_declarations (tree *, int); |
40109983 | 106 | extern void write_global_declarations (void); |
9ea83430 | 107 | |
51949610 | 108 | extern void dump_memory_report (bool); |
109 | ||
6d8b68a3 | 110 | extern void target_reinit (void); |
111 | ||
b80f1d67 | 112 | /* A unique local time stamp, might be zero if none is available. */ |
113 | extern unsigned local_tick; | |
114 | ||
9ea83430 | 115 | extern const char *progname; |
364c0b82 | 116 | extern const char *dump_base_name; |
e690b385 | 117 | extern const char *aux_base_name; |
118 | extern const char *aux_info_file_name; | |
3e3a0e9c | 119 | extern const char *profile_data_prefix; |
e690b385 | 120 | extern const char *asm_file_name; |
121 | extern bool exit_after_options; | |
d036315f | 122 | |
065efcb1 | 123 | /* True if the user has tagged the function with the 'section' |
124 | attribute. */ | |
125 | ||
126 | extern bool user_defined_section_attribute; | |
127 | ||
1e06725a | 128 | /* See toplev.c. */ |
1e06725a | 129 | extern int flag_crossjumping; |
130 | extern int flag_if_conversion; | |
131 | extern int flag_if_conversion2; | |
1e06725a | 132 | extern int flag_keep_static_consts; |
133 | extern int flag_peel_loops; | |
134 | extern int flag_rerun_cse_after_loop; | |
135 | extern int flag_thread_jumps; | |
136 | extern int flag_tracer; | |
137 | extern int flag_unroll_loops; | |
138 | extern int flag_unroll_all_loops; | |
139 | extern int flag_unswitch_loops; | |
ecdb6d1a | 140 | extern int flag_cprop_registers; |
ecdb6d1a | 141 | extern int time_report; |
1e06725a | 142 | |
7988d6e2 | 143 | /* Things to do with target switches. */ |
e690b385 | 144 | extern void print_version (FILE *, const char *); |
7988d6e2 | 145 | extern void * default_get_pch_validity (size_t *); |
146 | extern const char * default_pch_valid_p (const void *, size_t); | |
e690b385 | 147 | |
0d086e18 | 148 | /* The hashtable, so that the C front ends can pass it to cpplib. */ |
149 | extern struct ht *ident_hash; | |
150 | ||
18aa8a54 | 151 | /* This function can be used by targets to set the flags originally |
152 | implied by -ffast-math and -fno-fast-math. */ | |
6c34d0c2 | 153 | |
7237deda | 154 | extern void set_fast_math_flags (int); |
7f3be425 | 155 | |
49d060d7 | 156 | extern void set_unsafe_math_optimizations_flags (int); |
157 | ||
e690b385 | 158 | /* Handle -d switch. */ |
159 | extern void decode_d_option (const char *); | |
160 | ||
18aa8a54 | 161 | /* Return true iff flags are set as if -ffast-math. */ |
7237deda | 162 | extern bool fast_math_flags_set_p (void); |
46f8e3b0 | 163 | extern bool fast_math_flags_struct_set_p (struct cl_optimization *); |
7f3be425 | 164 | |
05c09cb8 | 165 | /* Return log2, or -1 if not exact. */ |
166 | extern int exact_log2 (unsigned HOST_WIDE_INT); | |
167 | ||
168 | /* Return floor of log2, with -1 for zero. */ | |
169 | extern int floor_log2 (unsigned HOST_WIDE_INT); | |
170 | ||
171 | /* Inline versions of the above for speed. */ | |
172 | #if GCC_VERSION >= 3004 | |
173 | # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG | |
174 | # define CLZ_HWI __builtin_clzl | |
175 | # define CTZ_HWI __builtin_ctzl | |
176 | # elif HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONGLONG | |
177 | # define CLZ_HWI __builtin_clzll | |
178 | # define CTZ_HWI __builtin_ctzll | |
179 | # else | |
180 | # define CLZ_HWI __builtin_clz | |
181 | # define CTZ_HWI __builtin_ctz | |
182 | # endif | |
183 | ||
184 | extern inline int | |
185 | floor_log2 (unsigned HOST_WIDE_INT x) | |
2f8c3981 | 186 | { |
05c09cb8 | 187 | return x ? HOST_BITS_PER_WIDE_INT - 1 - (int) CLZ_HWI (x) : -1; |
2f8c3981 | 188 | } |
2f8c3981 | 189 | |
05c09cb8 | 190 | extern inline int |
191 | exact_log2 (unsigned HOST_WIDE_INT x) | |
192 | { | |
193 | return x == (x & -x) && x ? (int) CTZ_HWI (x) : -1; | |
194 | } | |
195 | #endif /* GCC_VERSION >= 3004 */ | |
2ade676b | 196 | |
e7aa92b2 | 197 | /* Functions used to get and set GCC's notion of in what directory |
198 | compilation was started. */ | |
199 | ||
200 | extern const char *get_src_pwd (void); | |
201 | extern bool set_src_pwd (const char *); | |
202 | ||
b6c1bd72 | 203 | /* Functions used to manipulate the random seed. */ |
204 | ||
205 | extern const char *get_random_seed (bool); | |
206 | extern const char *set_random_seed (const char *); | |
207 | ||
2a281353 | 208 | #endif /* ! GCC_TOPLEV_H */ |