GCC Middle and Back End API Reference
gcc.h
Go to the documentation of this file.
1/* Header file for modules that link with gcc.cc
2 Copyright (C) 1999-2024 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20#ifndef GCC_GCC_H
21#define GCC_GCC_H
22
23#include "version.h"
24#include "diagnostic-core.h"
25
26/* The top-level "main" within the driver would be ~1000 lines long.
27 This class breaks it up into smaller functions and contains some
28 state shared by them. */
29
30class driver
31{
32 public:
33 driver (bool can_finalize, bool debug);
34 ~driver ();
35 int main (int argc, char **argv);
36 void finalize ();
37
38 private:
39 void set_progname (const char *argv0) const;
40 void expand_at_files (int *argc, char ***argv) const;
41 void decode_argv (int argc, const char **argv);
43 void build_multilib_strings () const;
44 void set_up_specs () const;
45 void putenv_COLLECT_GCC (const char *argv0) const;
47 void maybe_putenv_OFFLOAD_TARGETS () const;
49 int maybe_print_and_exit () const;
50 bool prepare_infiles ();
51 void do_spec_on_infiles () const;
52 void maybe_run_linker (const char *argv0) const;
53 void final_actions () const;
54 void detect_jobserver () const;
55 int get_exit_code () const;
56
57 private:
62};
63
64/* The mapping of a spec function name to the C function that
65 implements it. */
67{
68 const char *name;
69 const char *(*func) (int, const char **);
70};
71
72/* These are exported by gcc.cc. */
73extern int do_spec (const char *);
74extern void record_temp_file (const char *, int, int);
75extern void set_input (const char *);
76
77/* Spec files linked with gcc.cc must provide definitions for these. */
78
79/* Called before processing to change/add/remove arguments. */
81 unsigned int *, int *);
82
83/* Called before linking. Returns 0 on success and -1 on failure. */
84extern int lang_specific_pre_link (void);
85
86extern int n_infiles;
87
88/* Number of extra output files that lang_specific_pre_link may generate. */
90
91/* A vector of corresponding output files is made up later. */
92
93extern const char **outfiles;
94
95extern void
96driver_get_configure_time_options (void (*cb)(const char *option,
97 void *user_data),
98 void *user_data);
99
100#endif /* ! GCC_GCC_H */
Definition gcc.h:31
~driver()
Definition gcc.cc:8251
void putenv_COLLECT_GCC(const char *argv0) const
Definition gcc.cc:8696
option_proposer m_option_proposer
Definition gcc.h:61
void global_initializations()
Definition gcc.cc:8341
void detect_jobserver() const
Definition gcc.cc:9319
void expand_at_files(int *argc, char ***argv) const
Definition gcc.cc:8313
void build_multilib_strings() const
Definition gcc.cc:8393
int get_exit_code() const
Definition gcc.cc:9329
bool prepare_infiles()
Definition gcc.cc:8946
driver(bool can_finalize, bool debug)
Definition gcc.cc:8244
void decode_argv(int argc, const char **argv)
Definition gcc.cc:8328
int maybe_print_and_exit() const
Definition gcc.cc:8774
struct cl_decoded_option * decoded_options
Definition gcc.h:59
char * explicit_link_files
Definition gcc.h:58
unsigned int decoded_options_count
Definition gcc.h:60
void maybe_putenv_OFFLOAD_TARGETS() const
Definition gcc.cc:8732
void set_progname(const char *argv0) const
Definition gcc.cc:8299
void handle_unrecognized_options()
Definition gcc.cc:8754
void finalize()
Definition gcc.cc:11224
void set_up_specs() const
Definition gcc.cc:8447
void maybe_run_linker(const char *argv0) const
Definition gcc.cc:9160
void maybe_putenv_COLLECT_LTO_WRAPPER() const
Definition gcc.cc:8707
void do_spec_on_infiles() const
Definition gcc.cc:9013
void final_actions() const
Definition gcc.cc:9295
Definition opt-suggestions.h:30
bool debug
Definition collect-utils.cc:34
int main(void)
Definition fp-test.cc:85
void lang_specific_driver(struct cl_decoded_option **, unsigned int *, int *)
int lang_specific_pre_link(void)
int n_infiles
Definition gcc.cc:3650
void set_input(const char *)
Definition gcc.cc:8083
int do_spec(const char *)
Definition gcc.cc:5815
void record_temp_file(const char *, int, int)
Definition gcc.cc:2660
int lang_specific_extra_outfiles
void driver_get_configure_time_options(void(*cb)(const char *option, void *user_data), void *user_data)
Definition gcc.cc:11402
const char ** outfiles
Definition gcc.cc:3671
static options_p option(options_p prev)
Definition gengtype-parse.cc:547
Definition opts.h:250
Definition gcc.h:67
const char * name
Definition gcc.h:68