GCC Middle and Back End API Reference
|
Go to the source code of this file.
Data Structures | |
struct | input_file_st |
struct | fileloc |
struct | options |
struct | nested_ptr_data |
struct | pair |
struct | type |
struct | outf |
Typedefs | |
typedef unsigned | lang_bitmap |
typedef struct input_file_st | input_file |
typedef struct pair * | pair_p |
typedef struct type * | type_p |
typedef struct type * | const_type_p |
typedef struct options * | options_p |
typedef struct outf * | outf_p |
Enumerations | |
enum | typekind { TYPE_NONE = 0, TYPE_UNDEFINED, TYPE_SCALAR, TYPE_STRING, TYPE_STRUCT, TYPE_UNION, TYPE_POINTER, TYPE_ARRAY, TYPE_LANG_STRUCT, TYPE_PARAM_STRUCT, TYPE_USER_STRUCT } |
enum | option_kind { OPTION_NONE = 0, OPTION_STRING, OPTION_TYPE, OPTION_NESTED } |
enum | gc_used_enum { GC_UNUSED = 0, GC_USED, GC_MAYBE_POINTED_TO, GC_POINTED_TO } |
Functions | |
input_file * | input_file_by_name (const char *name) |
const char * | get_file_srcdir_relative_path (const input_file *inpf) |
static const char * | get_input_file_name () |
static lang_bitmap | get_lang_bitmap () |
static void | set_lang_bitmap () |
options_p | create_string_option (options_p next, const char *name, const char *info) |
options_p | create_type_option (options_p next, const char *name, type_p info) |
options_p | create_nested_option (options_p next, const char *name, struct nested_ptr_data *info) |
options_p | create_nested_ptr_option (options_p, type_p t, const char *from, const char *to) |
static bool | union_or_struct_p () |
static struct fileloc * | type_fileloc () |
void | oprintf (ATTRIBUTE_PRINTF_2, outf_p get_output_file_with_visibility(input_file *inpf), const char *get_output_file_name(input_file *inpf), extern const char *srcdir, extern size_t srcdir_len, extern const char *read_state_filename, extern const char *write_state_filename, void read_state(const char *path), void write_state(const char *path), extern void error_at_line(const struct fileloc *pos, const char *msg,...) ATTRIBUTE_PRINTF_2, extern char *xasprintf(const char *,...) ATTRIBUTE_PRINTF_1, extern void do_typedef(const char *s, type_p t, struct fileloc *pos), extern void do_scalar_typedef(const char *s, struct fileloc *pos), extern type_p resolve_typedef(const char *s, struct fileloc *pos), extern type_p new_structure(const char *name, enum typekind kind, struct fileloc *pos, pair_p fields, options_p o), type_p create_user_defined_type(const char *, struct fileloc *), extern type_p find_structure(const char *s, enum typekind kind), extern type_p create_scalar_type(const char *name), extern type_p create_pointer(type_p t), extern type_p create_array(type_p t, const char *len), extern pair_p create_field_at(pair_p next, type_p type, const char *name, options_p opt, struct fileloc *pos), extern pair_p nreverse_pairs(pair_p list), extern type_p adjust_field_type(type_p, options_p), extern void note_variable(const char *s, type_p t, options_p o, struct fileloc *pos), extern int yylex(const char **yylval), extern void yybegin(const char *fname), extern void yyend(void), extern void parse_file(const char *name), extern bool hit_error, enum gty_token) |
void | dbgprint_count_type_at (const char *, int, const char *, type_p) |
Variables | |
const input_file ** | gt_files |
size_t | num_gt_files |
input_file * | this_file |
input_file * | system_h_file |
const char ** | lang_dir_names |
size_t | num_lang_dirs |
int | lexer_toplevel_done |
struct fileloc | lexer_line |
pair_p | typedefs |
type_p | structures |
type_p | param_structs |
pair_p | variables |
struct type | string_type |
struct type | scalar_nonchar |
struct type | scalar_char |
outf_p | output_files |
outf_p | header_file |
int | verbosity_level |
int | do_dump |
int | do_debug |
typedef struct type* const_type_p |
typedef struct input_file_st input_file |
typedef unsigned lang_bitmap |
Sets of accepted source languages like C, C++, Ada... are represented by a bitmap.
enum gc_used_enum |
enum option_kind |
enum typekind |
options_p create_nested_option | ( | options_p | next, |
const char * | name, | ||
struct nested_ptr_data * | info | ||
) |
Create a nested option.
Create a nested pointer options structure with name NAME and info INFO. NEXT is the next option in the chain.
References options::info, options::kind, options::name, options::nested, options::next, type::next, and OPTION_NESTED.
Referenced by create_nested_ptr_option().
Create a nested pointer option.
Return an options structure for a "nested_ptr" option.
References adjust_field_type(), nested_ptr_data::convert_from, nested_ptr_data::convert_to, create_nested_option(), and nested_ptr_data::type.
Referenced by nestedptr_optvalue().
Some functions to create various options structures with name NAME and info INFO. NEXT is the next option in the chain.
Create a string option.
Create a type option.
void dbgprint_count_type_at | ( | const char * | , |
int | , | ||
const char * | , | ||
type_p | |||
) |
const char* get_file_srcdir_relative_path | ( | const input_file * | inpf | ) |
For F an input_file, return the relative path to F from $(srcdir) if the latter is a prefix in F, NULL otherwise.
|
inlinestatic |
Get the name of an input file.
References input_file_st::inpname.
Referenced by dump_fileloc(), error_at_line(), get_file_realbasename(), get_file_srcdir_relative_path(), get_output_file_with_visibility(), header_dot_h_frul(), htab_eq_inputfile(), htab_hash_inputfile(), main(), parse_error(), source_dot_c_frul(), type(), walk_type(), state_writer::write_state_fileloc(), and state_writer::write_state_files_list().
|
inlinestatic |
Return a bitmap which has bit `1 << BASE_FILE_<lang>' set iff INPUT_FILE is used by <lang>. This function should be written to assume that a file _is_ used if the situation is unclear. If it wrongly assumes a file _is_ used, a linker error will result. If it wrongly assumes a file _is not_ used, some GC roots may be missed, which is a much harder-to-debug problem.
References input_file_st::inpbitmap.
Referenced by create_undefined_type(), create_user_defined_type(), finish_root_table(), new_structure(), read_input_list(), write_array(), and state_writer::write_state_files_list().
input_file* input_file_by_name | ( | const char * | name | ) |
Retrieve or create the input_file for a given name, which is a file path. This is the only function allocating input_file-s and it is hash-consing them.
void oprintf | ( | ATTRIBUTE_PRINTF_2 | , |
outf_p | get_output_file_with_visibilityinput_file *inpf, | ||
const char * | get_output_file_nameinput_file *inpf, | ||
extern const char * | srcdir, | ||
extern size_t | srcdir_len, | ||
extern const char * | read_state_filename, | ||
extern const char * | write_state_filename, | ||
void | read_stateconst char *path, | ||
void | write_stateconst char *path, | ||
extern void error_at_line(const struct fileloc *pos, const char *msg,...) | ATTRIBUTE_PRINTF_2, | ||
extern char *xasprintf(const char *,...) | ATTRIBUTE_PRINTF_1, | ||
extern void | do_typedefconst char *s, type_p t, struct fileloc *pos, | ||
extern void | do_scalar_typedefconst char *s, struct fileloc *pos, | ||
extern type_p | resolve_typedefconst char *s, struct fileloc *pos, | ||
extern type_p | new_structureconst char *name, enum typekind kind,struct fileloc *pos, pair_p fields,options_p o, | ||
type_p | create_user_defined_typeconst char *, struct fileloc *, | ||
extern type_p | find_structureconst char *s, enum typekind kind, | ||
extern type_p | create_scalar_typeconst char *name, | ||
extern type_p | create_pointertype_p t, | ||
extern type_p | create_arraytype_p t, const char *len, | ||
extern pair_p | create_field_atpair_p next, type_p type,const char *name, options_p opt,struct fileloc *pos, | ||
extern pair_p | nreverse_pairspair_p list, | ||
extern type_p | adjust_field_typetype_p, options_p, | ||
extern void | note_variableconst char *s, type_p t, options_p o,struct fileloc *pos, | ||
extern int | yylexconst char **yylval, | ||
extern void | yybeginconst char *fname, | ||
extern void | yyendvoid, | ||
extern void | parse_fileconst char *name, | ||
extern bool | hit_error, | ||
enum | gty_token | ||
) |
Print, like fprintf, to O. No-op if O is NULL.
get_output_file_with_visibility | An output file, suitable for definitions, that can see declarations made in INPF and is linked into every language that uses INPF. May return NULL in plugin mode. The INPF argument is almost const, but since the result is cached in its inpoutf field it cannot be declared const. |
get_output_file_name | The name of an output file, suitable for definitions, that can see declarations made in INPF and is linked into every language that uses INPF. May return NULL. |
srcdir | Source directory. |
srcdir_len | Length of srcdir name. |
read_state_filename | Variable used for reading and writing the state. |
read_state | Functions reading and writing the entire gengtype state, called from main, and implemented in file gengtype-state.c. |
write_state | Write the state, and update the state_number field in types. |
ATTRIBUTE_PRINTF_2 | Print an error message. |
ATTRIBUTE_PRINTF_1 | Like asprintf, but calls fatal() on out of memory. |
do_typedef | Constructor routines for types. |
yylex | Lexer and parser routines. |
gty_token | Token codes. |
References SCALAR.
|
inlinestatic |
Set the bitmap returned by get_lang_bitmap. The only legitimate callers of this function are read_input_list & read_state_*.
References input_file_st::inpbitmap.
Referenced by read_input_list(), and read_state_files_list().
|
staticread |
Give the file location of a type, if any.
References type::kind, type::param_struct, type::s, TYPE_PARAM_STRUCT, type::u, and union_or_struct_p().
Referenced by write_typed_alloc_defns().
|
inlinestatic |
Test if a type is a union or a structure, perhaps a language specific one.
References TYPE_LANG_STRUCT, TYPE_STRUCT, TYPE_UNION, and TYPE_USER_STRUCT.
Referenced by adjust_field_type(), dump_type_u_s(), find_structure(), get_output_file_for_structure(), new_structure(), type_fileloc(), walk_type(), write_marker_function_name(), write_pch_user_walking_functions(), write_root(), state_writer::write_state_lang_struct_type(), write_type_decl(), write_typed_alloc_defns(), write_typed_struct_alloc_def(), write_user_func_for_structure_ptr(), and write_user_marking_functions().
int do_debug |
Trace the execution by many DBGPRINTF (with the position inside gengtype source code). Only useful to debug gengtype itself.
Referenced by main(), and parse_program_options().
int do_dump |
For debugging purposes we provide two flags.
Dump everything to understand gengtype's state. Might be useful to gengtype users.
Variables to help debugging.
Referenced by main(), and parse_program_options().
const input_file** gt_files |
Table of all input files and its size.
Input file handling.
Table of all input files.
Referenced by read_state_files_list(), and state_writer::write_state_files_list().
outf_p header_file |
The output header file that is included into pretty much every source file.
Referenced by main().
const char** lang_dir_names |
Vector of per-language directories.
Referenced by get_file_langdir(), get_prefix_langdir_index(), open_base_files(), read_input_list(), read_state_languages(), and state_writer::write_state_languages().
struct fileloc lexer_line |
int lexer_toplevel_done |
Variables used to communicate between the lexer and the parser.
Referenced by parse_file().
size_t num_gt_files |
Referenced by main(), measure_input_list(), read_input_list(), read_state_files_list(), and state_writer::write_state_files_list().
size_t num_lang_dirs |
outf_p output_files |
The list of output files.
Process source files and output type information. Copyright (C) 2002-2013 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Data types, macros, etc. used only in this file.
The list of output files.
Referenced by create_file().
type_p param_structs |
Referenced by find_param_structure(), read_state(), and state_writer::write_state_param_structs().
struct type scalar_char |
Referenced by create_scalar_type(), read_state_scalar_char_type(), and state_writer::write_state_scalar_type().
struct type scalar_nonchar |
The two and only TYPE_SCALARs. Their u.scalar_is_char flags are set early in main.
Referenced by adjust_field_rtx_def(), create_scalar_type(), read_state_scalar_nonchar_type(), and state_writer::write_state_scalar_type().
struct type string_type |
The one and only TYPE_STRING.
Referenced by adjust_field_rtx_def(), adjust_field_tree_exp(), adjust_field_type(), read_state_string_type(), and state_writer::write_state_string_type().
type_p structures |
Referenced by find_structure(), new_structure(), read_state(), and state_writer::write_state_structures().
input_file* system_h_file |
The "system.h" file is likewise specially useful.
Referenced by get_output_file_with_visibility().
input_file* this_file |
A number of places use the name of this "gengtype.c" file for a location for things that we can't rely on the source to define. We also need to refer to the "system.h" file specifically. These two pointers are initialized early in main.
A number of places use the name of this "gengtype.c" file for a location for things that we can't rely on the source to define. Make sure we can still use pointer comparison on filenames.
Referenced by trim_filename().
pair_p typedefs |
Various things, organized as linked lists, needed both in gengtype.c & in gengtype-state.c files.
Lists of various things.
Referenced by do_typedef(), read_state(), and state_writer::write_state_typedefs().
pair_p variables |
Referenced by note_variable(), read_state(), and state_writer::write_state_variables().
int verbosity_level |
Level for verbose messages, e.g. output file generation...
Level for verbose messages.
Referenced by close_output_files(), main(), parse_program_options(), read_state(), read_state_structures(), read_state_typedefs(), read_state_variables(), set_gc_used(), write_state(), state_writer::write_state_structures(), state_writer::write_state_typedefs(), state_writer::write_state_variables(), and write_types().