OSDN Git Service

* common.opt (exit_after_options, write_symbols, debug_info_level,
[pf3gnuchains/gcc-fork.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 /* Decoded options, and number of such options.  */
33 extern struct cl_decoded_option *save_decoded_options;
34 extern unsigned int save_decoded_options_count;
35
36 extern int toplev_main (int, char **);
37 extern void strip_off_ending (char *, int);
38 extern void rest_of_decl_compilation (tree, int, int);
39 extern void rest_of_type_compilation (tree, int);
40 extern void tree_rest_of_compilation (tree);
41 extern void init_optimization_passes (void);
42 extern void finish_optimization_passes (void);
43 extern bool enable_rtl_dump_file (void);
44
45 /* In except.c.  Initialize exception handling.  This is used by the Ada
46    and LTO front ends to initialize EH "on demand".  See lto-streamer-in.c
47    and ada/gcc-interface/misc.c.  */
48 extern void init_eh (void);
49
50 extern void announce_function (tree);
51
52 extern void warn_deprecated_use (tree, tree);
53 extern bool parse_optimize_options (tree, bool);
54
55 #ifdef BUFSIZ
56 extern void output_quoted_string        (FILE *, const char *);
57 #endif
58
59 extern void wrapup_global_declaration_1 (tree);
60 extern bool wrapup_global_declaration_2 (tree);
61 extern bool wrapup_global_declarations (tree *, int);
62 extern void check_global_declaration_1 (tree);
63 extern void check_global_declarations (tree *, int);
64 extern void emit_debug_global_declarations (tree *, int);
65 extern void write_global_declarations (void);
66
67 extern void dump_memory_report (bool);
68
69 extern void target_reinit (void);
70
71 /* A unique local time stamp, might be zero if none is available.  */
72 extern unsigned local_tick;
73
74 /* Top-level source file.  */
75 extern const char *main_input_filename;
76 extern const char *main_input_basename;
77 extern int main_input_baselength;
78
79 /* True if the user has tagged the function with the 'section'
80    attribute.  */
81
82 extern bool user_defined_section_attribute;
83
84 /* See toplev.c.  */
85 extern int flag_rerun_cse_after_global_opts;
86
87 /* Things to do with target switches.  */
88 extern void print_version (FILE *, const char *);
89 extern void * default_get_pch_validity (size_t *);
90 extern const char * default_pch_valid_p (const void *, size_t);
91
92 /* The hashtable, so that the C front ends can pass it to cpplib.  */
93 extern struct ht *ident_hash;
94
95 /* Handle -d switch.  */
96 extern void decode_d_option             (const char *);
97
98 /* Return true iff flags are set as if -ffast-math.  */
99 extern bool fast_math_flags_set_p       (const struct gcc_options *);
100 extern bool fast_math_flags_struct_set_p (struct cl_optimization *);
101
102 /* Inline versions of the above for speed.  */
103 #if GCC_VERSION < 3004
104
105 extern int clz_hwi (unsigned HOST_WIDE_INT x);
106 extern int ctz_hwi (unsigned HOST_WIDE_INT x);
107 extern int ffs_hwi (unsigned HOST_WIDE_INT x);
108
109 /* Return log2, or -1 if not exact.  */
110 extern int exact_log2                  (unsigned HOST_WIDE_INT);
111
112 /* Return floor of log2, with -1 for zero.  */
113 extern int floor_log2                  (unsigned HOST_WIDE_INT);
114
115 #else /* GCC_VERSION >= 3004 */
116
117 /* For convenience, define 0 -> word_size.  */
118 static inline int
119 clz_hwi (unsigned HOST_WIDE_INT x)
120 {
121   if (x == 0)
122     return HOST_BITS_PER_WIDE_INT;
123 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
124   return __builtin_clzl (x);
125 # elif HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONGLONG
126   return __builtin_clzll (x);
127 # else
128   return __builtin_clz (x);
129 # endif
130 }
131
132 static inline int
133 ctz_hwi (unsigned HOST_WIDE_INT x)
134 {
135   if (x == 0)
136     return HOST_BITS_PER_WIDE_INT;
137 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
138   return __builtin_ctzl (x);
139 # elif HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONGLONG
140   return __builtin_ctzll (x);
141 # else
142   return __builtin_ctz (x);
143 # endif
144 }
145
146 static inline int
147 ffs_hwi (unsigned HOST_WIDE_INT x)
148 {
149 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
150   return __builtin_ffsl (x);
151 # elif HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONGLONG
152   return __builtin_ffsll (x);
153 # else
154   return __builtin_ffs (x);
155 # endif
156 }
157
158 static inline int
159 floor_log2 (unsigned HOST_WIDE_INT x)
160 {
161   return HOST_BITS_PER_WIDE_INT - 1 - clz_hwi (x);
162 }
163
164 static inline int
165 exact_log2 (unsigned HOST_WIDE_INT x)
166 {
167   return x == (x & -x) && x ? ctz_hwi (x) : -1;
168 }
169
170 #endif /* GCC_VERSION >= 3004 */
171
172 /* Functions used to get and set GCC's notion of in what directory
173    compilation was started.  */
174
175 extern const char *get_src_pwd         (void);
176 extern bool set_src_pwd                (const char *);
177
178 /* Functions used to manipulate the random seed.  */
179
180 extern const char *get_random_seed (bool);
181 extern const char *set_random_seed (const char *);
182
183 #endif /* ! GCC_TOPLEV_H */