]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/toplev.h
2008-08-21 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
[thirdparty/gcc.git] / gcc / toplev.h
CommitLineData
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 5This file is part of GCC.
70d11e67 6
f12b58b3 7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
8c4c00c1 9Software Foundation; either version 3, or (at your option) any later
f12b58b3 10version.
70d11e67 11
f12b58b3 12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
70d11e67 16
17You should have received a copy of the GNU General Public License
8c4c00c1 18along 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 30extern int toplev_main (unsigned int, const char **);
31extern int read_integral_parameter (const char *, const char *, const int);
32extern void strip_off_ending (char *, int);
33extern const char *trim_filename (const char *);
dd9b9fc5 34extern void _fatal_insn_not_found (const_rtx, const char *, int, const char *)
7237deda 35 ATTRIBUTE_NORETURN;
dd9b9fc5 36extern 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 57extern 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 60extern bool warning (int, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
61extern bool warning_at (location_t, int, const char *, ...)
bdbc474b 62 ATTRIBUTE_GCC_DIAG(3,4);
7781aa77 63extern void error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
00ea394c 64extern 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. */
67extern bool pedwarn (location_t, int, const char *, ...)
5519c0df 68 ATTRIBUTE_GCC_DIAG(3,4);
2b9e3597 69extern bool permerror (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
7781aa77 70extern void sorry (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
5bcc316e 71extern void inform (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
a208cd0d 72extern void verbatim (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
00ea394c 73
b2c4af5e 74extern void rest_of_decl_compilation (tree, int, int);
00ea394c 75extern void rest_of_type_compilation (tree, int);
6148a911 76extern void tree_rest_of_compilation (tree);
77fce4cd 77extern void init_optimization_passes (void);
a49a878f 78extern void finish_optimization_passes (void);
5d48fdb4 79extern bool enable_rtl_dump_file (void);
00ea394c 80
00ea394c 81extern void announce_function (tree);
82
dd9b9fc5 83extern void error_for_asm (const_rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
84extern void warning_for_asm (const_rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
00ea394c 85extern void warn_deprecated_use (tree);
46f8e3b0 86extern bool parse_optimize_options (tree, bool);
7237deda 87
ebd9163c 88#ifdef BUFSIZ
7237deda 89extern void output_quoted_string (FILE *, const char *);
90extern 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 96extern void fnotice (FILE *, const char *, ...)
97 ATTRIBUTE_PRINTF_2;
e3c3cde6 98#endif
0cc5917f 99
c131e678 100extern void wrapup_global_declaration_1 (tree);
101extern bool wrapup_global_declaration_2 (tree);
102extern bool wrapup_global_declarations (tree *, int);
103extern void check_global_declaration_1 (tree);
00ea394c 104extern void check_global_declarations (tree *, int);
c131e678 105extern void emit_debug_global_declarations (tree *, int);
40109983 106extern void write_global_declarations (void);
9ea83430 107
51949610 108extern void dump_memory_report (bool);
109
6d8b68a3 110extern void target_reinit (void);
111
b80f1d67 112/* A unique local time stamp, might be zero if none is available. */
113extern unsigned local_tick;
114
9ea83430 115extern const char *progname;
364c0b82 116extern const char *dump_base_name;
e690b385 117extern const char *aux_base_name;
118extern const char *aux_info_file_name;
3e3a0e9c 119extern const char *profile_data_prefix;
e690b385 120extern const char *asm_file_name;
121extern bool exit_after_options;
d036315f 122
065efcb1 123/* True if the user has tagged the function with the 'section'
124 attribute. */
125
126extern bool user_defined_section_attribute;
127
1e06725a 128/* See toplev.c. */
1e06725a 129extern int flag_crossjumping;
130extern int flag_if_conversion;
131extern int flag_if_conversion2;
1e06725a 132extern int flag_keep_static_consts;
133extern int flag_peel_loops;
134extern int flag_rerun_cse_after_loop;
135extern int flag_thread_jumps;
136extern int flag_tracer;
137extern int flag_unroll_loops;
138extern int flag_unroll_all_loops;
139extern int flag_unswitch_loops;
ecdb6d1a 140extern int flag_cprop_registers;
ecdb6d1a 141extern int time_report;
1e06725a 142
7988d6e2 143/* Things to do with target switches. */
e690b385 144extern void print_version (FILE *, const char *);
7988d6e2 145extern void * default_get_pch_validity (size_t *);
146extern 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. */
149extern 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 154extern void set_fast_math_flags (int);
7f3be425 155
49d060d7 156extern void set_unsafe_math_optimizations_flags (int);
157
e690b385 158/* Handle -d switch. */
159extern void decode_d_option (const char *);
160
18aa8a54 161/* Return true iff flags are set as if -ffast-math. */
7237deda 162extern bool fast_math_flags_set_p (void);
46f8e3b0 163extern bool fast_math_flags_struct_set_p (struct cl_optimization *);
7f3be425 164
05c09cb8 165/* Return log2, or -1 if not exact. */
166extern int exact_log2 (unsigned HOST_WIDE_INT);
167
168/* Return floor of log2, with -1 for zero. */
169extern 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
184extern inline int
185floor_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 190extern inline int
191exact_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
200extern const char *get_src_pwd (void);
201extern bool set_src_pwd (const char *);
202
b6c1bd72 203/* Functions used to manipulate the random seed. */
204
205extern const char *get_random_seed (bool);
206extern const char *set_random_seed (const char *);
207
2a281353 208#endif /* ! GCC_TOPLEV_H */