Merge branch 'master' into python
[official-gcc.git] / gcc / toplev.h
blobb7152f7b9e18fc56f66959300a38ac20ea6be00b
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.
6 This file is part of GCC.
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.
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.
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/>. */
22 #ifndef GCC_TOPLEV_H
23 #define GCC_TOPLEV_H
24 #include "input.h"
25 #include "bversion.h"
26 #include "diagnostic-core.h"
28 /* If non-NULL, return one past-the-end of the matching SUBPART of
29 the WHOLE string. */
30 #define skip_leading_substring(whole, part) \
31 (strncmp (whole, part, strlen (part)) ? NULL : whole + strlen (part))
33 extern int toplev_main (int, char **);
34 extern int read_integral_parameter (const char *, const char *, const int);
35 extern void strip_off_ending (char *, int);
36 extern void _fatal_insn_not_found (const_rtx, const char *, int, const char *)
37 ATTRIBUTE_NORETURN;
38 extern void _fatal_insn (const char *, const_rtx, const char *, int, const char *)
39 ATTRIBUTE_NORETURN;
41 #define fatal_insn(msgid, insn) \
42 _fatal_insn (msgid, insn, __FILE__, __LINE__, __FUNCTION__)
43 #define fatal_insn_not_found(insn) \
44 _fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__)
46 extern void rest_of_decl_compilation (tree, int, int);
47 extern void rest_of_type_compilation (tree, int);
48 extern void tree_rest_of_compilation (tree);
49 extern void init_optimization_passes (void);
50 extern void finish_optimization_passes (void);
51 extern bool enable_rtl_dump_file (void);
53 extern void announce_function (tree);
55 extern void error_for_asm (const_rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
56 extern void warning_for_asm (const_rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
57 extern void warn_deprecated_use (tree, tree);
58 extern bool parse_optimize_options (tree, bool);
60 #ifdef BUFSIZ
61 extern void output_quoted_string (FILE *, const char *);
62 extern void output_file_directive (FILE *, const char *);
63 #endif
65 extern void wrapup_global_declaration_1 (tree);
66 extern bool wrapup_global_declaration_2 (tree);
67 extern bool wrapup_global_declarations (tree *, int);
68 extern void check_global_declaration_1 (tree);
69 extern void check_global_declarations (tree *, int);
70 extern void emit_debug_global_declarations (tree *, int);
71 extern void write_global_declarations (void);
73 extern void dump_memory_report (bool);
75 extern void target_reinit (void);
77 /* A unique local time stamp, might be zero if none is available. */
78 extern unsigned local_tick;
80 /* Top-level source file. */
81 extern const char *main_input_filename;
83 extern const char *dump_base_name;
84 extern const char *dump_dir_name;
85 extern const char *aux_base_name;
86 extern const char *aux_info_file_name;
87 extern const char *profile_data_prefix;
88 extern const char *asm_file_name;
89 extern bool exit_after_options;
91 /* True if the user has tagged the function with the 'section'
92 attribute. */
94 extern bool user_defined_section_attribute;
96 /* See toplev.c. */
97 extern int flag_crossjumping;
98 extern int flag_if_conversion;
99 extern int flag_if_conversion2;
100 extern int flag_keep_static_consts;
101 extern int flag_peel_loops;
102 extern int flag_rerun_cse_after_global_opts;
103 extern int flag_rerun_cse_after_loop;
104 extern int flag_thread_jumps;
105 extern int flag_tracer;
106 extern int flag_unroll_loops;
107 extern int flag_unroll_all_loops;
108 extern int flag_unswitch_loops;
109 extern int flag_cprop_registers;
110 extern int time_report;
111 extern int flag_ira_loop_pressure;
112 extern int flag_ira_coalesce;
113 extern int flag_ira_move_spills;
114 extern int flag_ira_share_save_slots;
115 extern int flag_ira_share_spill_slots;
117 /* Things to do with target switches. */
118 extern void print_version (FILE *, const char *);
119 extern void * default_get_pch_validity (size_t *);
120 extern const char * default_pch_valid_p (const void *, size_t);
122 /* The hashtable, so that the C front ends can pass it to cpplib. */
123 extern struct ht *ident_hash;
125 /* This function can be used by targets to set the flags originally
126 implied by -ffast-math and -fno-fast-math. */
128 extern void set_fast_math_flags (int);
130 extern void set_unsafe_math_optimizations_flags (int);
132 /* Handle -d switch. */
133 extern void decode_d_option (const char *);
135 /* Return true iff flags are set as if -ffast-math. */
136 extern bool fast_math_flags_set_p (void);
137 extern bool fast_math_flags_struct_set_p (struct cl_optimization *);
139 /* Inline versions of the above for speed. */
140 #if GCC_VERSION < 3004
142 /* Return log2, or -1 if not exact. */
143 extern int exact_log2 (unsigned HOST_WIDE_INT);
145 /* Return floor of log2, with -1 for zero. */
146 extern int floor_log2 (unsigned HOST_WIDE_INT);
148 #else /* GCC_VERSION >= 3004 */
150 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
151 # define CLZ_HWI __builtin_clzl
152 # define CTZ_HWI __builtin_ctzl
153 # elif HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONGLONG
154 # define CLZ_HWI __builtin_clzll
155 # define CTZ_HWI __builtin_ctzll
156 # else
157 # define CLZ_HWI __builtin_clz
158 # define CTZ_HWI __builtin_ctz
159 # endif
161 static inline int
162 floor_log2 (unsigned HOST_WIDE_INT x)
164 return x ? HOST_BITS_PER_WIDE_INT - 1 - (int) CLZ_HWI (x) : -1;
167 static inline int
168 exact_log2 (unsigned HOST_WIDE_INT x)
170 return x == (x & -x) && x ? (int) CTZ_HWI (x) : -1;
173 #endif /* GCC_VERSION >= 3004 */
175 /* Functions used to get and set GCC's notion of in what directory
176 compilation was started. */
178 extern const char *get_src_pwd (void);
179 extern bool set_src_pwd (const char *);
181 /* Functions used to manipulate the random seed. */
183 extern const char *get_random_seed (bool);
184 extern const char *set_random_seed (const char *);
186 #endif /* ! GCC_TOPLEV_H */