GCC Middle and Back End API Reference
|
Public Member Functions | |
state_writer () | |
void | write_new_line () |
void | write_any_indent (int leading_spaces) |
void | begin_s_expr (const char *tag) |
void | end_s_expr () |
Private Attributes | |
int | m_state_written_type_count |
Friends | |
void | write_state (const char *state_path) |
A class for writing out "gtype.state".
state_writer::state_writer | ( | ) |
class state_writer's trivial constructor.
|
inherited |
Write the beginning of a new s-expresion e.g. "(!foo " The writer automatically adds whitespace to show the hierarchical structure of the expressions, so each one starts on a new line, and any within it will be at an increased indentation level.
Referenced by write_state_array_type(), write_state_param_structs(), write_state_type(), and write_state_typedefs().
|
inherited |
Write out the end of an s-expression: any necssessary indentation, a closing parenthesis, and a new line.
References fatal().
Referenced by write_state_param_structs(), write_state_type(), and write_state_typedefs().
|
inherited |
If we've just had a newline, write the indentation amount, potentially omitting some spaces.
LEADING_SPACES exists to support code that writes strings with leading spaces (e.g " foo") which might occur within a line, or could be the first thing on a line. By passing leading_spaces == 1, when such a string is the first thing on a line, write_any_indent () swallows the successive leading spaces into the indentation so that the "foo" begins at the expected column.
References s_expr_writer::m_indent_amount, and s_expr_writer::write_new_line().
Referenced by write_state_array_type(), write_state_fileloc(), write_state_scalar_type(), write_state_type(), write_state_union_type(), and write_state_version().
|
inherited |
Write a newline to the output file, merging adjacent newlines.
Don't add a newline if we've just had one.
References s_expr_writer::m_had_recent_newline, and s_expr_writer::m_indent_amount.
Referenced by s_expr_writer::write_any_indent().
|
private |
Write a null-terminated string in our lexical convention, very similar to the convention of C.
Referenced by write_state_scalar_type(), write_state_type(), and write_state_typedefs().
|
private |
Write an array type.
References s_expr_writer::begin_s_expr(), DBGPRINTF, m_state_written_type_count, NULL, state_file, type::state_number, and s_expr_writer::write_any_indent().
Referenced by write_state_gc_used().
|
private |
Utility routine to write the common content of all types. Notice that the next field is not written on purpose.
We do not write the next type, because list of types are explicitly written. However, lang_struct are special in that respect. See function write_state_lang_struct_type for more.
Referenced by write_state_scalar_type().
|
private |
Write a list of fields.
|
private |
Write a file location. Files relative to are quite frequent and are handled specially. This ensures that two gengtype state file-s produced by gengtype on the same GCC source tree are very similar and can be reasonably compared with diff, even if the two GCC source trees have different absolute paths.
Most of the files are inside so it is worth to handle them specially.
References state_file, and s_expr_writer::write_any_indent().
Referenced by write_state_type().
|
private |
Count and write the list of our files.
Write the list of files with their lang_bitmap.
Most of the files are inside $(srcdir) so it is worth to handle them specially.
Terminate the inner s-expression (either "srcfile" or "file").
Terminate the "fileslist" s-expression.
|
private |
Write the gc_used information.
References gcc_unreachable, TYPE_ARRAY, TYPE_LANG_STRUCT, TYPE_NONE, TYPE_PARAM_STRUCT, TYPE_POINTER, TYPE_STRUCT, TYPE_UNDEFINED, TYPE_UNION, TYPE_USER_STRUCT, write_state_array_type(), write_state_lang_struct_type(), write_state_pointer_type(), write_state_struct_type(), write_state_undefined_type(), write_state_union_type(), and write_state_user_struct_type().
|
private |
Write a bitmap representing a set of GCC front-end languages.
|
private |
Write a lang_struct type. This is tricky and was painful to debug, we deal with the next field specifically within their lang_struct subfield, which points to a linked list of homonumous types. Change this function with extreme care, see also read_state_lang_struct_type.
lang_struct-ures are particularly tricky, since their u.s.lang_struct field gives a list of homonymous struct-s or union-s!
Every member of the homonymous list should have the same tag.
Referenced by write_state_gc_used().
|
private |
Write the list of GCC front-end languages.
Languages names are identifiers, we expect only letters or underscores or digits in them. In particular, C++ is not a valid language name, but cp is valid.
|
private |
|
private |
Terminate the "option" s-expression.
|
private |
Write a list of GTY options.
Referenced by write_state_type().
|
private |
Write a pair.
Terminate the "pair" s-expression.
|
private |
Write a pair list and return the number of pairs written.
|
private |
Write a parametrized structure GTY type.
|
private |
Write our param_struct-s.
References s_expr_writer::begin_s_expr(), s_expr_writer::end_s_expr(), lang_dir_names, num_lang_dirs, and state_file.
|
private |
Write a pointer type.
Referenced by write_state_gc_used().
|
private |
Write a scalar type. We have only two of these.
References DBGPRINTF, NULL, type::s, state_file, type::state_number, type::u, s_expr_writer::write_any_indent(), write_state_a_string(), and write_state_common_type_content().
|
private |
Write the source directory. File locations within the source directory have been written specifically.
|
private |
Our option-s have three kinds, each with its writer.
|
private |
Write the string type. There is only one such thing!
|
private |
Write a GTY struct type.
Referenced by write_state_gc_used().
|
private |
Common code to write structure like types.
References type::s, type::u, and write_state_type().
|
private |
Write our structures.
Terminate the "structures" s-expression.
|
private |
The important and recursive routine writing GTY types as understood by gengtype. Types which have a positive state_number have already been seen and written.
Terminate the "type" s-expression.
References s_expr_writer::begin_s_expr(), s_expr_writer::end_s_expr(), pair::line, pair::name, NULL, pair::opt, state_file, pair::type, s_expr_writer::write_any_indent(), write_state_a_string(), write_state_fileloc(), and write_state_options().
Referenced by write_state_struct_union_type().
|
private |
|
private |
When writing imported linked lists, like typedefs, structures, param_structs, ... we count their length first and write it. These eases the reading, and enables an extra verification on the number of actually read items. Write our typedefs.
References s_expr_writer::begin_s_expr(), s_expr_writer::end_s_expr(), srcdir, and write_state_a_string().
|
private |
Write an undefined type.
Referenced by write_state_gc_used().
|
private |
write a GTY union type.
References state_file, and s_expr_writer::write_any_indent().
Referenced by write_state_gc_used().
|
private |
Write a GTY user-defined struct type.
Referenced by write_state_gc_used().
|
private |
Write our variables.
References errno, fatal(), and state_file.
|
private |
Write version information.
References state_file, and s_expr_writer::write_any_indent().
|
friend |
|
private |
Counter of written types.
Referenced by write_state_array_type().