1 /* toplev.h - Various declarations for functions found in toplev.c
2 Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007,
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
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
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/>. */
25 /* If non-NULL, return one past-the-end of the matching SUBPART of
27 #define skip_leading_substring(whole, part) \
28 (strncmp (whole, part, strlen (part)) ? NULL : whole + strlen (part))
30 /* Decoded options, and number of such options. */
31 extern struct cl_decoded_option *save_decoded_options;
32 extern unsigned int save_decoded_options_count;
34 extern int toplev_main (int, char **);
35 extern void rest_of_decl_compilation (tree, int, int);
36 extern void rest_of_type_compilation (tree, int);
37 extern void tree_rest_of_compilation (tree);
38 extern void init_optimization_passes (void);
39 extern void finish_optimization_passes (void);
40 extern bool enable_rtl_dump_file (void);
42 /* In except.c. Initialize exception handling. This is used by the Ada
43 and LTO front ends to initialize EH "on demand". See lto-streamer-in.c
44 and ada/gcc-interface/misc.c. */
45 extern void init_eh (void);
47 extern void announce_function (tree);
49 extern void warn_deprecated_use (tree, tree);
52 extern void output_quoted_string (FILE *, const char *);
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);
63 extern void dump_memory_report (bool);
65 extern void target_reinit (void);
67 /* A unique local time stamp, might be zero if none is available. */
68 extern unsigned local_tick;
70 /* Top-level source file. */
71 extern const char *main_input_filename;
72 extern const char *main_input_basename;
73 extern int main_input_baselength;
75 /* True if the user has tagged the function with the 'section'
78 extern bool user_defined_section_attribute;
81 extern int flag_rerun_cse_after_global_opts;
83 /* Things to do with target switches. */
84 extern void print_version (FILE *, const char *);
85 extern void * default_get_pch_validity (size_t *);
86 extern const char * default_pch_valid_p (const void *, size_t);
88 /* The hashtable, so that the C front ends can pass it to cpplib. */
89 extern struct ht *ident_hash;
91 /* Inline versions of the above for speed. */
92 #if GCC_VERSION < 3004
94 extern int clz_hwi (unsigned HOST_WIDE_INT x);
95 extern int ctz_hwi (unsigned HOST_WIDE_INT x);
96 extern int ffs_hwi (unsigned HOST_WIDE_INT x);
98 /* Return log2, or -1 if not exact. */
99 extern int exact_log2 (unsigned HOST_WIDE_INT);
101 /* Return floor of log2, with -1 for zero. */
102 extern int floor_log2 (unsigned HOST_WIDE_INT);
104 #else /* GCC_VERSION >= 3004 */
106 /* For convenience, define 0 -> word_size. */
108 clz_hwi (unsigned HOST_WIDE_INT x)
111 return HOST_BITS_PER_WIDE_INT;
112 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
113 return __builtin_clzl (x);
114 # elif HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONGLONG
115 return __builtin_clzll (x);
117 return __builtin_clz (x);
122 ctz_hwi (unsigned HOST_WIDE_INT x)
125 return HOST_BITS_PER_WIDE_INT;
126 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
127 return __builtin_ctzl (x);
128 # elif HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONGLONG
129 return __builtin_ctzll (x);
131 return __builtin_ctz (x);
136 ffs_hwi (unsigned HOST_WIDE_INT x)
138 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
139 return __builtin_ffsl (x);
140 # elif HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONGLONG
141 return __builtin_ffsll (x);
143 return __builtin_ffs (x);
148 floor_log2 (unsigned HOST_WIDE_INT x)
150 return HOST_BITS_PER_WIDE_INT - 1 - clz_hwi (x);
154 exact_log2 (unsigned HOST_WIDE_INT x)
156 return x == (x & -x) && x ? ctz_hwi (x) : -1;
159 #endif /* GCC_VERSION >= 3004 */
161 /* Functions used to get and set GCC's notion of in what directory
162 compilation was started. */
164 extern const char *get_src_pwd (void);
165 extern bool set_src_pwd (const char *);
167 /* Functions used to manipulate the random seed. */
169 extern const char *get_random_seed (bool);
170 extern const char *set_random_seed (const char *);
172 #endif /* ! GCC_TOPLEV_H */