gcc/gcc/read-md.c

1244 lines
28 KiB
C
Raw Normal View History

Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
/* MD reader for GCC.
Copyright (C) 1987-2016 Free Software Foundation, Inc.
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
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/>. */
#include "bconfig.h"
#include "system.h"
#include "coretypes.h"
#include "errors.h"
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
#include "statistics.h"
#include "vec.h"
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
#include "read-md.h"
/* Associates PTR (which can be a string, etc.) with the file location
specified by FILENAME and LINENO. */
struct ptr_loc {
const void *ptr;
const char *filename;
int lineno;
};
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
/* This callback will be invoked whenever an md include directive is
processed. To be used for creation of the dependency file. */
void (*include_callback) (const char *);
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
/* Global singleton. */
rtx_reader *rtx_reader_ptr;
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
/* Given an object that starts with a char * name field, return a hash
code for its name. */
hashval_t
leading_string_hash (const void *def)
{
return htab_hash_string (*(const char *const *) def);
}
/* Given two objects that start with char * name fields, return true if
they have the same name. */
int
leading_string_eq_p (const void *def1, const void *def2)
{
return strcmp (*(const char *const *) def1,
*(const char *const *) def2) == 0;
}
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
/* Return a hash value for the pointer pointed to by DEF. */
static hashval_t
leading_ptr_hash (const void *def)
{
return htab_hash_pointer (*(const void *const *) def);
}
/* Return true if DEF1 and DEF2 are pointers to the same pointer. */
static int
leading_ptr_eq_p (const void *def1, const void *def2)
{
return *(const void *const *) def1 == *(const void *const *) def2;
}
/* Associate PTR with the file position given by FILENAME and LINENO. */
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
void
rtx_reader::set_md_ptr_loc (const void *ptr, const char *filename, int lineno)
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
{
struct ptr_loc *loc;
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
loc = (struct ptr_loc *) obstack_alloc (&m_ptr_loc_obstack,
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
sizeof (struct ptr_loc));
loc->ptr = ptr;
loc->filename = filename;
loc->lineno = lineno;
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
*htab_find_slot (m_ptr_locs, loc, INSERT) = loc;
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
}
/* Return the position associated with pointer PTR. Return null if no
position was set. */
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
const struct ptr_loc *
rtx_reader::get_md_ptr_loc (const void *ptr)
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
{
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
return (const struct ptr_loc *) htab_find (m_ptr_locs, &ptr);
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
}
/* Associate NEW_PTR with the same file position as OLD_PTR. */
void
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
rtx_reader::copy_md_ptr_loc (const void *new_ptr, const void *old_ptr)
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
{
const struct ptr_loc *loc = get_md_ptr_loc (old_ptr);
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
if (loc != 0)
set_md_ptr_loc (new_ptr, loc->filename, loc->lineno);
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
}
/* If PTR is associated with a known file position, print a #line
directive for it to OUTF. */
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
void
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
rtx_reader::fprint_md_ptr_loc (FILE *outf, const void *ptr)
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
{
const struct ptr_loc *loc = get_md_ptr_loc (ptr);
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
if (loc != 0)
fprintf (outf, "#line %d \"%s\"\n", loc->lineno, loc->filename);
}
/* Special fprint_md_ptr_loc for writing to STDOUT. */
void
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
rtx_reader::print_md_ptr_loc (const void *ptr)
{
fprint_md_ptr_loc (stdout, ptr);
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
}
/* Return a condition that satisfies both COND1 and COND2. Either string
may be null or empty. */
const char *
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
rtx_reader::join_c_conditions (const char *cond1, const char *cond2)
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
{
char *result;
const void **entry;
if (cond1 == 0 || cond1[0] == 0)
return cond2;
if (cond2 == 0 || cond2[0] == 0)
return cond1;
if (strcmp (cond1, cond2) == 0)
return cond1;
result = concat ("(", cond1, ") && (", cond2, ")", NULL);
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
obstack_ptr_grow (&m_joined_conditions_obstack, result);
obstack_ptr_grow (&m_joined_conditions_obstack, cond1);
obstack_ptr_grow (&m_joined_conditions_obstack, cond2);
entry = XOBFINISH (&m_joined_conditions_obstack, const void **);
*htab_find_slot (m_joined_conditions, entry, INSERT) = entry;
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
return result;
}
/* Print condition COND to OUTF, wrapped in brackets. If COND was created
by join_c_conditions, recursively invoke this function for the original
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
conditions and join the result with "&&". Otherwise print a #line
directive for COND if its original file position is known. */
void
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
rtx_reader::fprint_c_condition (FILE *outf, const char *cond)
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
{
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
const char **halves = (const char **) htab_find (m_joined_conditions, &cond);
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
if (halves != 0)
{
fprintf (outf, "(");
fprint_c_condition (outf, halves[1]);
fprintf (outf, " && ");
fprint_c_condition (outf, halves[2]);
fprintf (outf, ")");
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
}
else
{
fputc ('\n', outf);
fprint_md_ptr_loc (outf, cond);
fprintf (outf, "(%s)", cond);
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
}
}
/* Special fprint_c_condition for writing to STDOUT. */
void
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
rtx_reader::print_c_condition (const char *cond)
{
fprint_c_condition (stdout, cond);
}
/* A vfprintf-like function for reporting an error against line LINENO
of the current MD file. */
static void ATTRIBUTE_PRINTF(2,0)
read-md.h (file_location): New structure. gcc/ * read-md.h (file_location): New structure. (directive_handler_t): Take a file_location rather than a line number. (message_at, error_at): Declare. (read_skip_construct): Delete. * read-md.c (message_with_line_1): Replace with... (message_at_1): ...this new function. (message_at, error_at): New functions. (message_with_line, error_with_line): Update to use message_at_1. (handle_enum): Take a file_location rather than a line number and use error_at for error reporting. (handle_include): Likewise. (read_skip_construct): Likewise. Make static. (handle_file): Update after above changes. Pass a file_location rather than a line number to handle_directive. * gensupport.c (queue_elem): Replace separate filename and lineno with a file_location. (queue_pattern): Replace filename and lineno arguments with a file_location. Update after change to queue_elem. (process_define_predicate): Replace lineno argument with a file_location and use error_at for error reporting. Update after above changes. (process_rtx): Likewise. (subst_pattern_match): Likewise. (get_alternatives_number): Likewise. (alter_predicate_for_insn): Likewise. (rtx_handle_directive): Likewise. (is_predicable): Update after above changes, using error_at rather than error_with_line. (has_subst_attribute): Likewise. (identify_predicable_attribute): Likewise. (alter_attrs_for_subst_insn): Likewise. (process_one_cond_exec): Likewise. (process_substs_on_one_elem): Likewise. (process_define_subst): Likewise. (check_define_attr_duplicates): Likewise. (read_md_rtx): Update after change to queue_elem. From-SVN: r225879
2015-07-16 15:41:41 +02:00
message_at_1 (file_location loc, const char *msg, va_list ap)
{
fprintf (stderr, "%s:%d:%d: ", loc.filename, loc.lineno, loc.colno);
vfprintf (stderr, msg, ap);
fputc ('\n', stderr);
}
read-md.h (file_location): New structure. gcc/ * read-md.h (file_location): New structure. (directive_handler_t): Take a file_location rather than a line number. (message_at, error_at): Declare. (read_skip_construct): Delete. * read-md.c (message_with_line_1): Replace with... (message_at_1): ...this new function. (message_at, error_at): New functions. (message_with_line, error_with_line): Update to use message_at_1. (handle_enum): Take a file_location rather than a line number and use error_at for error reporting. (handle_include): Likewise. (read_skip_construct): Likewise. Make static. (handle_file): Update after above changes. Pass a file_location rather than a line number to handle_directive. * gensupport.c (queue_elem): Replace separate filename and lineno with a file_location. (queue_pattern): Replace filename and lineno arguments with a file_location. Update after change to queue_elem. (process_define_predicate): Replace lineno argument with a file_location and use error_at for error reporting. Update after above changes. (process_rtx): Likewise. (subst_pattern_match): Likewise. (get_alternatives_number): Likewise. (alter_predicate_for_insn): Likewise. (rtx_handle_directive): Likewise. (is_predicable): Update after above changes, using error_at rather than error_with_line. (has_subst_attribute): Likewise. (identify_predicable_attribute): Likewise. (alter_attrs_for_subst_insn): Likewise. (process_one_cond_exec): Likewise. (process_substs_on_one_elem): Likewise. (process_define_subst): Likewise. (check_define_attr_duplicates): Likewise. (read_md_rtx): Update after change to queue_elem. From-SVN: r225879
2015-07-16 15:41:41 +02:00
/* A printf-like function for reporting a message against location LOC. */
void
message_at (file_location loc, const char *msg, ...)
{
va_list ap;
va_start (ap, msg);
message_at_1 (loc, msg, ap);
va_end (ap);
}
/* Like message_at, but treat the condition as an error. */
void
error_at (file_location loc, const char *msg, ...)
{
va_list ap;
va_start (ap, msg);
message_at_1 (loc, msg, ap);
va_end (ap);
have_error = 1;
}
/* Like message_at, but treat the condition as a fatal error. */
void
fatal_at (file_location loc, const char *msg, ...)
{
va_list ap;
va_start (ap, msg);
message_at_1 (loc, msg, ap);
va_end (ap);
exit (1);
}
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
/* A printf-like function for reporting an error against the current
position in the MD file. */
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
void
fatal_with_file_and_line (const char *msg, ...)
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
{
char context[64];
size_t i;
int c;
va_list ap;
va_start (ap, msg);
fprintf (stderr, "%s:%d:%d: error: ", rtx_reader_ptr->get_filename (),
rtx_reader_ptr->get_lineno (), rtx_reader_ptr->get_colno ());
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
vfprintf (stderr, msg, ap);
putc ('\n', stderr);
/* Gather some following context. */
for (i = 0; i < sizeof (context)-1; ++i)
{
c = read_char ();
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
if (c == EOF)
break;
if (c == '\r' || c == '\n')
{
unread_char (c);
break;
}
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
context[i] = c;
}
context[i] = '\0';
fprintf (stderr, "%s:%d:%d: note: following context is `%s'\n",
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
rtx_reader_ptr->get_filename (), rtx_reader_ptr->get_lineno (),
rtx_reader_ptr->get_colno (), context);
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
va_end (ap);
exit (1);
}
/* Report that we found character ACTUAL when we expected to find
character EXPECTED. */
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
void
fatal_expected_char (int expected, int actual)
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
{
if (actual == EOF)
fatal_with_file_and_line ("expected character `%c', found EOF",
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
expected);
else
fatal_with_file_and_line ("expected character `%c', found `%c'",
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
expected, actual);
}
/* Read chars from the MD file until a non-whitespace char and return that.
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
Comments, both Lisp style and C style, are treated as whitespace. */
int
read_skip_spaces (void)
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
{
int c;
while (1)
{
c = read_char ();
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
switch (c)
{
case ' ': case '\t': case '\f': case '\r': case '\n':
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
break;
case ';':
do
c = read_char ();
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
while (c != '\n' && c != EOF);
break;
case '/':
{
int prevc;
c = read_char ();
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
if (c != '*')
{
unread_char (c);
fatal_with_file_and_line ("stray '/' in file");
}
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
prevc = 0;
while ((c = read_char ()) && c != EOF)
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
{
if (prevc == '*' && c == '/')
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
break;
prevc = c;
}
}
break;
default:
return c;
}
}
}
/* Consume the next character, issuing a fatal error if it is not
EXPECTED. */
void
rtx_reader::require_char (char expected)
{
int ch = read_char ();
if (ch != expected)
fatal_expected_char (expected, ch);
}
/* Consume any whitespace, then consume the next non-whitespace
character, issuing a fatal error if it is not EXPECTED. */
void
rtx_reader::require_char_ws (char expected)
{
int ch = read_skip_spaces ();
if (ch != expected)
fatal_expected_char (expected, ch);
}
/* Consume any whitespace, then consume the next word (as per read_name),
issuing a fatal error if it is not EXPECTED. */
void
rtx_reader::require_word_ws (const char *expected)
{
struct md_name name;
read_name (&name);
if (strcmp (name.string, expected))
fatal_with_file_and_line ("missing '%s'", expected);
}
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
/* Read the next character from the file. */
int
rtx_reader::read_char (void)
{
int ch;
ch = getc (m_read_md_file);
if (ch == '\n')
{
m_read_md_lineno++;
m_last_line_colno = m_read_md_colno;
m_read_md_colno = 0;
}
else
m_read_md_colno++;
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
return ch;
}
/* Put back CH, which was the last character read from the file. */
void
rtx_reader::unread_char (int ch)
{
if (ch == '\n')
{
m_read_md_lineno--;
m_read_md_colno = m_last_line_colno;
}
else
m_read_md_colno--;
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
ungetc (ch, m_read_md_file);
}
/* Peek at the next character from the file without consuming it. */
int
rtx_reader::peek_char (void)
{
int ch = read_char ();
unread_char (ch);
return ch;
}
/* Read an rtx code name into NAME. It is terminated by any of the
punctuation chars of rtx printed syntax. */
void
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
rtx_reader::read_name (struct md_name *name)
{
int c;
size_t i;
int angle_bracket_depth;
c = read_skip_spaces ();
i = 0;
angle_bracket_depth = 0;
while (1)
{
if (c == '<')
angle_bracket_depth++;
if ((c == '>') && (angle_bracket_depth > 0))
angle_bracket_depth--;
if (c == ' ' || c == '\n' || c == '\t' || c == '\f' || c == '\r'
|| c == EOF)
break;
if (angle_bracket_depth == 0)
{
if (c == ':' || c == ')' || c == ']'
|| c == '"' || c == '/' || c == '(' || c == '[')
{
unread_char (c);
break;
}
}
if (i == sizeof (name->buffer) - 1)
fatal_with_file_and_line ("name too long");
name->buffer[i++] = c;
c = read_char ();
}
if (i == 0)
fatal_with_file_and_line ("missing name or number");
name->buffer[i] = 0;
name->string = name->buffer;
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
if (m_md_constants)
{
/* Do constant expansion. */
struct md_constant *def;
do
{
struct md_constant tmp_def;
tmp_def.name = name->string;
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
def = (struct md_constant *) htab_find (m_md_constants, &tmp_def);
if (def)
name->string = def->value;
}
while (def);
}
}
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
/* Subroutine of the string readers. Handles backslash escapes.
Caller has read the backslash, but not placed it into the obstack. */
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
void
rtx_reader::read_escape ()
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
{
int c = read_char ();
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
switch (c)
{
/* Backslash-newline is replaced by nothing, as in C. */
case '\n':
return;
/* \" \' \\ are replaced by the second character. */
case '\\':
case '"':
case '\'':
break;
/* Standard C string escapes:
\a \b \f \n \r \t \v
\[0-7] \x
all are passed through to the output string unmolested.
In normal use these wind up in a string constant processed
by the C compiler, which will translate them appropriately.
We do not bother checking that \[0-7] are followed by up to
two octal digits, or that \x is followed by N hex digits.
\? \u \U are left out because they are not in traditional C. */
case 'a': case 'b': case 'f': case 'n': case 'r': case 't': case 'v':
case '0': case '1': case '2': case '3': case '4': case '5': case '6':
case '7': case 'x':
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
obstack_1grow (&m_string_obstack, '\\');
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
break;
/* \; makes stuff for a C string constant containing
newline and tab. */
case ';':
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
obstack_grow (&m_string_obstack, "\\n\\t", 4);
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
return;
/* pass anything else through, but issue a warning. */
default:
fprintf (stderr, "%s:%d: warning: unrecognized escape \\%c\n",
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
get_filename (), get_lineno (),
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
c);
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
obstack_1grow (&m_string_obstack, '\\');
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
break;
}
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
obstack_1grow (&m_string_obstack, c);
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
}
/* Read a double-quoted string onto the obstack. Caller has scanned
the leading quote. */
char *
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
rtx_reader::read_quoted_string ()
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
{
int c;
while (1)
{
c = read_char (); /* Read the string */
if (c == '\\')
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
{
read_escape ();
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
continue;
}
else if (c == '"' || c == EOF)
break;
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
obstack_1grow (&m_string_obstack, c);
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
}
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
obstack_1grow (&m_string_obstack, 0);
return XOBFINISH (&m_string_obstack, char *);
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
}
/* Read a braced string (a la Tcl) onto the string obstack. Caller
has scanned the leading brace. Note that unlike quoted strings,
the outermost braces _are_ included in the string constant. */
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
char *
rtx_reader::read_braced_string ()
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
{
int c;
int brace_depth = 1; /* caller-processed */
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
unsigned long starting_read_md_lineno = get_lineno ();
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
obstack_1grow (&m_string_obstack, '{');
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
while (brace_depth)
{
c = read_char (); /* Read the string */
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
if (c == '{')
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
brace_depth++;
else if (c == '}')
brace_depth--;
else if (c == '\\')
{
read_escape ();
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
continue;
}
else if (c == EOF)
fatal_with_file_and_line
("missing closing } for opening brace on line %lu",
starting_read_md_lineno);
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
obstack_1grow (&m_string_obstack, c);
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
}
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
obstack_1grow (&m_string_obstack, 0);
return XOBFINISH (&m_string_obstack, char *);
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
}
/* Read some kind of string constant. This is the high-level routine
used by read_rtx. It handles surrounding parentheses, leading star,
and dispatch to the appropriate string constant reader. */
char *
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
rtx_reader::read_string (int star_if_braced)
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
{
char *stringbuf;
int saw_paren = 0;
int c, old_lineno;
c = read_skip_spaces ();
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
if (c == '(')
{
saw_paren = 1;
c = read_skip_spaces ();
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
}
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
old_lineno = get_lineno ();
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
if (c == '"')
stringbuf = read_quoted_string ();
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
else if (c == '{')
{
if (star_if_braced)
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
obstack_1grow (&m_string_obstack, '*');
stringbuf = read_braced_string ();
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
}
else
fatal_with_file_and_line ("expected `\"' or `{', found `%c'", c);
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
if (saw_paren)
require_char_ws (')');
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
set_md_ptr_loc (stringbuf, get_filename (), old_lineno);
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
return stringbuf;
}
/* Skip the rest of a construct that started at line LINENO and that
is currently nested by DEPTH levels of parentheses. */
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
void
rtx_reader::read_skip_construct (int depth, file_location loc)
{
struct md_name name;
int c;
do
{
c = read_skip_spaces ();
if (c == EOF)
{
read-md.h (file_location): New structure. gcc/ * read-md.h (file_location): New structure. (directive_handler_t): Take a file_location rather than a line number. (message_at, error_at): Declare. (read_skip_construct): Delete. * read-md.c (message_with_line_1): Replace with... (message_at_1): ...this new function. (message_at, error_at): New functions. (message_with_line, error_with_line): Update to use message_at_1. (handle_enum): Take a file_location rather than a line number and use error_at for error reporting. (handle_include): Likewise. (read_skip_construct): Likewise. Make static. (handle_file): Update after above changes. Pass a file_location rather than a line number to handle_directive. * gensupport.c (queue_elem): Replace separate filename and lineno with a file_location. (queue_pattern): Replace filename and lineno arguments with a file_location. Update after change to queue_elem. (process_define_predicate): Replace lineno argument with a file_location and use error_at for error reporting. Update after above changes. (process_rtx): Likewise. (subst_pattern_match): Likewise. (get_alternatives_number): Likewise. (alter_predicate_for_insn): Likewise. (rtx_handle_directive): Likewise. (is_predicable): Update after above changes, using error_at rather than error_with_line. (has_subst_attribute): Likewise. (identify_predicable_attribute): Likewise. (alter_attrs_for_subst_insn): Likewise. (process_one_cond_exec): Likewise. (process_substs_on_one_elem): Likewise. (process_define_subst): Likewise. (check_define_attr_duplicates): Likewise. (read_md_rtx): Update after change to queue_elem. From-SVN: r225879
2015-07-16 15:41:41 +02:00
error_at (loc, "unterminated construct");
exit (1);
}
switch (c)
{
case '(':
depth++;
break;
case ')':
depth--;
break;
case ':':
case '[':
case ']':
case '/':
break;
case '\"':
case '{':
unread_char (c);
read_string (false);
break;
default:
unread_char (c);
read_name (&name);
break;
}
}
while (depth > 0);
unread_char (c);
}
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
/* Given a string, return the number of comma-separated elements in it.
Return 0 for the null string. */
int
n_comma_elts (const char *s)
{
int n;
if (*s == '\0')
return 0;
for (n = 1; *s; s++)
if (*s == ',')
n++;
return n;
}
/* Given a pointer to a (char *), return a pointer to the beginning of the
next comma-separated element in the string. Advance the pointer given
to the end of that element. Return NULL if at end of string. Caller
is responsible for copying the string if necessary. White space between
a comma and an element is ignored. */
const char *
scan_comma_elt (const char **pstr)
{
const char *start;
const char *p = *pstr;
if (*p == ',')
p++;
alloc-pool.c, [...]: Add missing whitespace before "(". gcc/ * alloc-pool.c, asan.c, auto-inc-dec.c, basic-block.h, bb-reorder.c, bitmap.c, bitmap.h, bt-load.c, builtins.c, calls.c, cfgcleanup.c, cfgexpand.c, cfghooks.c, cfgloop.c, cfgloopmanip.c, cfgrtl.c, cgraph.c, cgraph.h, cgraphbuild.c, cgraphclones.c, cgraphunit.c, collect2.c, combine-stack-adj.c, combine.c, compare-elim.c, context.c, context.h, cprop.c, cse.c, cselib.c, dbxout.c, dce.c, defaults.h, df-core.c, df-problems.c, df-scan.c, df.h, diagnostic.c, double-int.c, dse.c, dumpfile.c, dwarf2asm.c, dwarf2cfi.c, dwarf2out.c, emit-rtl.c, errors.c, except.c, expmed.c, expr.c, file-find.c, final.c, fixed-value.c, fold-const.c, function.c, fwprop.c, gcc-ar.c, gcc.c, gcov-io.c, gcov-io.h, gcov.c, gcse.c, genattr-common.c, genattr.c, genattrtab.c, genautomata.c, genconfig.c, genemit.c, genextract.c, genflags.c, gengenrtl.c, gengtype-state.c, gengtype.c, genmodes.c, genopinit.c, genoutput.c, genpeep.c, genpreds.c, genrecog.c, gensupport.c, ggc-common.c, ggc-page.c, gimple-fold.c, gimple-low.c, gimple-pretty-print.c, gimple-ssa-strength-reduction.c, gimple.c, gimple.h, godump.c, graphite-clast-to-gimple.c, graphite-optimize-isl.c, graphite-poly.h, graphite-sese-to-poly.c, graphite.c, haifa-sched.c, hash-table.c, hash-table.h, hwint.c, hwint.h, ifcvt.c, incpath.c, init-regs.c, input.h, intl.c, intl.h, ipa-cp.c, ipa-devirt.c, ipa-inline-analysis.c, ipa-inline.c, ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c, ipa-utils.c, ipa.c, ira-build.c, ira.c, jump.c, loop-doloop.c, loop-init.c, loop-invariant.c, loop-iv.c, lower-subreg.c, lto-cgraph.c, lto-streamer-in.c, lto-streamer-out.c, lto-wrapper.c, mcf.c, mode-switching.c, modulo-sched.c, omp-low.c, optabs.c, opts.c, pass_manager.h, passes.c, plugin.c, postreload-gcse.c, postreload.c, predict.c, prefix.c, pretty-print.c, print-rtl.c, print-tree.c, profile.c, read-md.c, real.c, real.h, recog.c, ree.c, reg-stack.c, regcprop.c, reginfo.c, regmove.c, regrename.c, regs.h, regstat.c, reload1.c, reorg.c, rtl.c, rtl.h, rtlanal.c, sbitmap.c, sched-rgn.c, sdbout.c, sel-sched-ir.c, sel-sched.c, sparseset.c, stack-ptr-mod.c, statistics.c, stmt.c, stor-layout.c, store-motion.c, streamer-hooks.h, system.h, target-hooks-macros.h, targhooks.c, targhooks.h, toplev.c, tracer.c, trans-mem.c, tree-browser.c, tree-call-cdce.c, tree-cfg.c, tree-cfgcleanup.c, tree-complex.c, tree-data-ref.c, tree-data-ref.h, tree-eh.c, tree-emutls.c, tree-flow.h, tree-if-conv.c, tree-into-ssa.c, tree-iterator.c, tree-loop-distribution.c, tree-mudflap.c, tree-nested.c, tree-nomudflap.c, tree-nrv.c, tree-object-size.c, tree-optimize.c, tree-pass.h, tree-pretty-print.c, tree-profile.c, tree-scalar-evolution.c, tree-sra.c, tree-ssa-ccp.c, tree-ssa-coalesce.c, tree-ssa-copy.c, tree-ssa-copyrename.c, tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c, tree-ssa-ifcombine.c, tree-ssa-live.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-prefetch.c, tree-ssa-loop.c, tree-ssa-math-opts.c, tree-ssa-operands.c, tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c, tree-ssa-structalias.c, tree-ssa-threadedge.c, tree-ssa-threadupdate.c, tree-ssa-uncprop.c, tree-ssa-uninit.c, tree-ssa.c, tree-ssanames.c, tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c, tree-vect-data-refs.c, tree-vect-generic.c, tree-vect-loop-manip.c, tree-vect-stmts.c, tree-vectorizer.c, tree-vectorizer.h, tree-vrp.c, tree.c, tree.h, tsan.c, tsystem.h, value-prof.c, var-tracking.c, varasm.c, vec.h, vmsdbgout.c, vtable-verify.c, web.c: Add missing whitespace before "(". From-SVN: r203004
2013-09-28 10:42:34 +02:00
while (ISSPACE (*p))
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
p++;
if (*p == '\0')
return NULL;
start = p;
while (*p != ',' && *p != '\0')
p++;
*pstr = p;
return start;
}
md.texi (define_c_enum, [...]): Document. gcc/ * doc/md.texi (define_c_enum, define_enum): Document. * read-md.h (md_constant): Add a parent_enum field. (enum_value, enum_type): New structures. (upcase_string, traverse_enum_types): Declare. * read-md.c (enum_types): New variable. (upcase_string, add_constant): New functions. (handle_constants): Don't create the hash table here. Use add_constant. (traverse_md_constants): Don't check for a null md_constants. (decimal_string, handle_enum, traverse_enum_types): New functions. (read_md_files): Initialize md_constants and md_enums. * genconstants.c (print_md_constant): Ignore info argument. Only print constants that belong to no enum. (print_enum_type): New function. (main): Don't pass stdout to print_md_constant. Call print_enum_type for each defined enum type. * config/mips/mips.md (processor): New define_enum. (unspec): New define_c_enum. (UNSPEC_COMPARE_AND_SWAP, UNSPEC_COMPARE_AND_SWAP_12) (UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP, UNSPEC_SYNC_NEW_OP_12) (UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE, UNSPEC_SYNC_EXCHANGE_12) (UNSPEC_MEMORY_BARRIER): Moved to sync.md. (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ, UNSPEC_SUBQ_S, UNSPEC_ADDSC) (UNSPEC_ADDWC, UNSPEC_MODSUB, UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S) (UNSPEC_PRECRQ_QB_PH, UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W) (UNSPEC_PRECRQU_S_QB_PH, UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR) (UNSPEC_PRECEQU_PH_QBL, UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA) (UNSPEC_PRECEQU_PH_QBRA, UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR) (UNSPEC_PRECEU_PH_QBLA, UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL) (UNSPEC_SHLL_S, UNSPEC_SHRL_QB, UNSPEC_SHRA_PH, UNSPEC_SHRA_R) (UNSPEC_MULEU_S_PH_QBL, UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH) (UNSPEC_MULEQ_S_W_PHL, UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL) (UNSPEC_DPAU_H_QBR, UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR) (UNSPEC_DPAQ_S_W_PH, UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH) (UNSPEC_DPAQ_SA_L_W, UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL) (UNSPEC_MAQ_S_W_PHR, UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR) (UNSPEC_BITREV, UNSPEC_INSV, UNSPEC_REPL_QB, UNSPEC_REPL_PH) (UNSPEC_CMP_EQ, UNSPEC_CMP_LT, UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB) (UNSPEC_CMPGU_LT_QB, UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH) (UNSPEC_EXTR_W, UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H) (UNSPEC_EXTP, UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Move to mips-dsp.md. (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH, UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB) (UNSPEC_ADDUH_R_QB, UNSPEC_APPEND, UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB) (UNSPEC_CMPGDU_LT_QB, UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH) (UNSPEC_DPS_W_PH, UNSPEC_MADD, UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU) (UNSPEC_MUL_PH, UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH) (UNSPEC_MULQ_S_W, UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU) (UNSPEC_PRECR_QB_PH, UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W) (UNSPEC_PREPEND, UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH) (UNSPEC_SUBU_PH, UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB) (UNSPEC_ADDQH_PH, UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W) (UNSPEC_SUBQH_PH, UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W) (UNSPEC_DPAX_W_PH, UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH) (UNSPEC_DPAQX_SA_W_PH, UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved to mips-dspr2.md. (UNSPEC_MOVE_TF_PS, UNSPEC_C, UNSPEC_ALNV_PS, UNSPEC_CABS) (UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS, UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS) (UNSPEC_ABS_PS, UNSPEC_RSQRT1, UNSPEC_RSQRT2, UNSPEC_RECIP1) (UNSPEC_RECIP2, UNSPEC_SINGLE_CC, UNSPEC_SCC): Moved from mips-ps-3d.md. (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ, UNSPEC_LOONGSON_PCMPGT) (UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Move to mips-loongson.md. (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved to mips-loongson2ef.md. (cpu): Update comment. * config/mips/sync.md (UNSPEC_COMPARE_AND_SWAP) (UNSPEC_COMPARE_AND_SWAP_12, UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP) (UNSPEC_SYNC_NEW_OP_12, UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE) (UNSPEC_SYNC_EXCHANGE_12, UNSPEC_MEMORY_BARRIER): Moved from mips.md. * config/mips/loongson.md (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ) (UNSPEC_LOONGSON_PCMPGT, UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Moved from mips.md * config/mips/loongson2ef.md (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved from mips.md * config/mips/mips-dsp.md (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ) (UNSPEC_SUBQ_S, UNSPEC_ADDSC, UNSPEC_ADDWC, UNSPEC_MODSUB) (UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S, UNSPEC_PRECRQ_QB_PH) (UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W, UNSPEC_PRECRQU_S_QB_PH) (UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR, UNSPEC_PRECEQU_PH_QBL) (UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA, UNSPEC_PRECEQU_PH_QBRA) (UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR, UNSPEC_PRECEU_PH_QBLA) (UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL, UNSPEC_SHLL_S, UNSPEC_SHRL_QB) (UNSPEC_SHRA_PH, UNSPEC_SHRA_R, UNSPEC_MULEU_S_PH_QBL) (UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH, UNSPEC_MULEQ_S_W_PHL) (UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL, UNSPEC_DPAU_H_QBR) (UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR, UNSPEC_DPAQ_S_W_PH) (UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH, UNSPEC_DPAQ_SA_L_W) (UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL, UNSPEC_MAQ_S_W_PHR) (UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR, UNSPEC_BITREV, UNSPEC_INSV) (UNSPEC_REPL_QB, UNSPEC_REPL_PH, UNSPEC_CMP_EQ, UNSPEC_CMP_LT) (UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB, UNSPEC_CMPGU_LT_QB) (UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH, UNSPEC_EXTR_W) (UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H, UNSPEC_EXTP) (UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Moved from mips.md. * config/mips/mips-dspr2.md (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH) (UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB, UNSPEC_ADDUH_R_QB, UNSPEC_APPEND) (UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB, UNSPEC_CMPGDU_LT_QB) (UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH, UNSPEC_DPS_W_PH, UNSPEC_MADD) (UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU, UNSPEC_MUL_PH) (UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH, UNSPEC_MULQ_S_W) (UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU, UNSPEC_PRECR_QB_PH) (UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W, UNSPEC_PREPEND) (UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH, UNSPEC_SUBU_PH) (UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB, UNSPEC_ADDQH_PH) (UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W, UNSPEC_SUBQH_PH) (UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W, UNSPEC_DPAX_W_PH) (UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH, UNSPEC_DPAQX_SA_W_PH) (UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved from mips.md. * config/mips/mips-ps-3d.md (UNSPEC_MOVE_TF_PS, UNSPEC_C) (UNSPEC_ALNV_PS, UNSPEC_CABS, UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS) (UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS, UNSPEC_ABS_PS, UNSPEC_RSQRT1) (UNSPEC_RSQRT2, UNSPEC_RECIP1, UNSPEC_RECIP2, UNSPEC_SINGLE_CC) (UNSPEC_SCC): Moved from mips.md. * config/mips/mips.c (mips_arch, mips_tune): Change enum from "processor_type" to "processor". (mips_rtx_cost_data): Replace PROCESSOR_MAX with NUM_PROCESSOR_VALUES. * config/mips/mips.h (processor_type): Delete. (mips_cpu_info.cpu, mips_arch, mips_tune): Change enum from "processor_type" to "processor". From-SVN: r160580
2010-06-10 22:24:01 +02:00
/* Convert STRING to uppercase. */
void
upcase_string (char *string)
{
int i;
for (i = 0; string[i]; i++)
string[i] = TOUPPER (string[i]);
}
/* Add a NAME = VALUE definition to md_constants-style hash table DEFS,
where both NAME and VALUE are malloc()ed strings. PARENT_ENUM is the
enum to which NAME belongs, or null if NAME is a stand-alone constant. */
static struct md_constant *
add_constant (htab_t defs, char *name, char *value,
struct enum_type *parent_enum)
{
struct md_constant *def, tmp_def;
void **entry_ptr;
tmp_def.name = name;
entry_ptr = htab_find_slot (defs, &tmp_def, INSERT);
if (*entry_ptr)
{
def = (struct md_constant *) *entry_ptr;
if (strcmp (def->value, value) != 0)
fatal_with_file_and_line ("redefinition of `%s', was `%s', now `%s'",
def->name, def->value, value);
else if (parent_enum || def->parent_enum)
fatal_with_file_and_line ("redefinition of `%s'", def->name);
free (name);
free (value);
}
else
{
def = XNEW (struct md_constant);
def->name = name;
def->value = value;
def->parent_enum = parent_enum;
*entry_ptr = def;
}
return def;
}
/* Process a define_constants directive, starting with the optional space
after the "define_constants". */
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
void
rtx_reader::handle_constants ()
{
int c;
htab_t defs;
require_char_ws ('[');
/* Disable constant expansion during definition processing. */
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
defs = m_md_constants;
m_md_constants = 0;
while ( (c = read_skip_spaces ()) != ']')
{
struct md_name name, value;
if (c != '(')
fatal_expected_char ('(', c);
read_name (&name);
read_name (&value);
md.texi (define_c_enum, [...]): Document. gcc/ * doc/md.texi (define_c_enum, define_enum): Document. * read-md.h (md_constant): Add a parent_enum field. (enum_value, enum_type): New structures. (upcase_string, traverse_enum_types): Declare. * read-md.c (enum_types): New variable. (upcase_string, add_constant): New functions. (handle_constants): Don't create the hash table here. Use add_constant. (traverse_md_constants): Don't check for a null md_constants. (decimal_string, handle_enum, traverse_enum_types): New functions. (read_md_files): Initialize md_constants and md_enums. * genconstants.c (print_md_constant): Ignore info argument. Only print constants that belong to no enum. (print_enum_type): New function. (main): Don't pass stdout to print_md_constant. Call print_enum_type for each defined enum type. * config/mips/mips.md (processor): New define_enum. (unspec): New define_c_enum. (UNSPEC_COMPARE_AND_SWAP, UNSPEC_COMPARE_AND_SWAP_12) (UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP, UNSPEC_SYNC_NEW_OP_12) (UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE, UNSPEC_SYNC_EXCHANGE_12) (UNSPEC_MEMORY_BARRIER): Moved to sync.md. (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ, UNSPEC_SUBQ_S, UNSPEC_ADDSC) (UNSPEC_ADDWC, UNSPEC_MODSUB, UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S) (UNSPEC_PRECRQ_QB_PH, UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W) (UNSPEC_PRECRQU_S_QB_PH, UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR) (UNSPEC_PRECEQU_PH_QBL, UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA) (UNSPEC_PRECEQU_PH_QBRA, UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR) (UNSPEC_PRECEU_PH_QBLA, UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL) (UNSPEC_SHLL_S, UNSPEC_SHRL_QB, UNSPEC_SHRA_PH, UNSPEC_SHRA_R) (UNSPEC_MULEU_S_PH_QBL, UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH) (UNSPEC_MULEQ_S_W_PHL, UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL) (UNSPEC_DPAU_H_QBR, UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR) (UNSPEC_DPAQ_S_W_PH, UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH) (UNSPEC_DPAQ_SA_L_W, UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL) (UNSPEC_MAQ_S_W_PHR, UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR) (UNSPEC_BITREV, UNSPEC_INSV, UNSPEC_REPL_QB, UNSPEC_REPL_PH) (UNSPEC_CMP_EQ, UNSPEC_CMP_LT, UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB) (UNSPEC_CMPGU_LT_QB, UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH) (UNSPEC_EXTR_W, UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H) (UNSPEC_EXTP, UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Move to mips-dsp.md. (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH, UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB) (UNSPEC_ADDUH_R_QB, UNSPEC_APPEND, UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB) (UNSPEC_CMPGDU_LT_QB, UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH) (UNSPEC_DPS_W_PH, UNSPEC_MADD, UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU) (UNSPEC_MUL_PH, UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH) (UNSPEC_MULQ_S_W, UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU) (UNSPEC_PRECR_QB_PH, UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W) (UNSPEC_PREPEND, UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH) (UNSPEC_SUBU_PH, UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB) (UNSPEC_ADDQH_PH, UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W) (UNSPEC_SUBQH_PH, UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W) (UNSPEC_DPAX_W_PH, UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH) (UNSPEC_DPAQX_SA_W_PH, UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved to mips-dspr2.md. (UNSPEC_MOVE_TF_PS, UNSPEC_C, UNSPEC_ALNV_PS, UNSPEC_CABS) (UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS, UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS) (UNSPEC_ABS_PS, UNSPEC_RSQRT1, UNSPEC_RSQRT2, UNSPEC_RECIP1) (UNSPEC_RECIP2, UNSPEC_SINGLE_CC, UNSPEC_SCC): Moved from mips-ps-3d.md. (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ, UNSPEC_LOONGSON_PCMPGT) (UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Move to mips-loongson.md. (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved to mips-loongson2ef.md. (cpu): Update comment. * config/mips/sync.md (UNSPEC_COMPARE_AND_SWAP) (UNSPEC_COMPARE_AND_SWAP_12, UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP) (UNSPEC_SYNC_NEW_OP_12, UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE) (UNSPEC_SYNC_EXCHANGE_12, UNSPEC_MEMORY_BARRIER): Moved from mips.md. * config/mips/loongson.md (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ) (UNSPEC_LOONGSON_PCMPGT, UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Moved from mips.md * config/mips/loongson2ef.md (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved from mips.md * config/mips/mips-dsp.md (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ) (UNSPEC_SUBQ_S, UNSPEC_ADDSC, UNSPEC_ADDWC, UNSPEC_MODSUB) (UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S, UNSPEC_PRECRQ_QB_PH) (UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W, UNSPEC_PRECRQU_S_QB_PH) (UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR, UNSPEC_PRECEQU_PH_QBL) (UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA, UNSPEC_PRECEQU_PH_QBRA) (UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR, UNSPEC_PRECEU_PH_QBLA) (UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL, UNSPEC_SHLL_S, UNSPEC_SHRL_QB) (UNSPEC_SHRA_PH, UNSPEC_SHRA_R, UNSPEC_MULEU_S_PH_QBL) (UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH, UNSPEC_MULEQ_S_W_PHL) (UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL, UNSPEC_DPAU_H_QBR) (UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR, UNSPEC_DPAQ_S_W_PH) (UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH, UNSPEC_DPAQ_SA_L_W) (UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL, UNSPEC_MAQ_S_W_PHR) (UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR, UNSPEC_BITREV, UNSPEC_INSV) (UNSPEC_REPL_QB, UNSPEC_REPL_PH, UNSPEC_CMP_EQ, UNSPEC_CMP_LT) (UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB, UNSPEC_CMPGU_LT_QB) (UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH, UNSPEC_EXTR_W) (UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H, UNSPEC_EXTP) (UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Moved from mips.md. * config/mips/mips-dspr2.md (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH) (UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB, UNSPEC_ADDUH_R_QB, UNSPEC_APPEND) (UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB, UNSPEC_CMPGDU_LT_QB) (UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH, UNSPEC_DPS_W_PH, UNSPEC_MADD) (UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU, UNSPEC_MUL_PH) (UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH, UNSPEC_MULQ_S_W) (UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU, UNSPEC_PRECR_QB_PH) (UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W, UNSPEC_PREPEND) (UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH, UNSPEC_SUBU_PH) (UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB, UNSPEC_ADDQH_PH) (UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W, UNSPEC_SUBQH_PH) (UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W, UNSPEC_DPAX_W_PH) (UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH, UNSPEC_DPAQX_SA_W_PH) (UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved from mips.md. * config/mips/mips-ps-3d.md (UNSPEC_MOVE_TF_PS, UNSPEC_C) (UNSPEC_ALNV_PS, UNSPEC_CABS, UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS) (UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS, UNSPEC_ABS_PS, UNSPEC_RSQRT1) (UNSPEC_RSQRT2, UNSPEC_RECIP1, UNSPEC_RECIP2, UNSPEC_SINGLE_CC) (UNSPEC_SCC): Moved from mips.md. * config/mips/mips.c (mips_arch, mips_tune): Change enum from "processor_type" to "processor". (mips_rtx_cost_data): Replace PROCESSOR_MAX with NUM_PROCESSOR_VALUES. * config/mips/mips.h (processor_type): Delete. (mips_cpu_info.cpu, mips_arch, mips_tune): Change enum from "processor_type" to "processor". From-SVN: r160580
2010-06-10 22:24:01 +02:00
add_constant (defs, xstrdup (name.string), xstrdup (value.string), 0);
require_char_ws (')');
}
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
m_md_constants = defs;
}
/* For every constant definition, call CALLBACK with two arguments:
a pointer a pointer to the constant definition and INFO.
Stop when CALLBACK returns zero. */
void
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
rtx_reader::traverse_md_constants (htab_trav callback, void *info)
{
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
htab_traverse (get_md_constants (), callback, info);
md.texi (define_c_enum, [...]): Document. gcc/ * doc/md.texi (define_c_enum, define_enum): Document. * read-md.h (md_constant): Add a parent_enum field. (enum_value, enum_type): New structures. (upcase_string, traverse_enum_types): Declare. * read-md.c (enum_types): New variable. (upcase_string, add_constant): New functions. (handle_constants): Don't create the hash table here. Use add_constant. (traverse_md_constants): Don't check for a null md_constants. (decimal_string, handle_enum, traverse_enum_types): New functions. (read_md_files): Initialize md_constants and md_enums. * genconstants.c (print_md_constant): Ignore info argument. Only print constants that belong to no enum. (print_enum_type): New function. (main): Don't pass stdout to print_md_constant. Call print_enum_type for each defined enum type. * config/mips/mips.md (processor): New define_enum. (unspec): New define_c_enum. (UNSPEC_COMPARE_AND_SWAP, UNSPEC_COMPARE_AND_SWAP_12) (UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP, UNSPEC_SYNC_NEW_OP_12) (UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE, UNSPEC_SYNC_EXCHANGE_12) (UNSPEC_MEMORY_BARRIER): Moved to sync.md. (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ, UNSPEC_SUBQ_S, UNSPEC_ADDSC) (UNSPEC_ADDWC, UNSPEC_MODSUB, UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S) (UNSPEC_PRECRQ_QB_PH, UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W) (UNSPEC_PRECRQU_S_QB_PH, UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR) (UNSPEC_PRECEQU_PH_QBL, UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA) (UNSPEC_PRECEQU_PH_QBRA, UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR) (UNSPEC_PRECEU_PH_QBLA, UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL) (UNSPEC_SHLL_S, UNSPEC_SHRL_QB, UNSPEC_SHRA_PH, UNSPEC_SHRA_R) (UNSPEC_MULEU_S_PH_QBL, UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH) (UNSPEC_MULEQ_S_W_PHL, UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL) (UNSPEC_DPAU_H_QBR, UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR) (UNSPEC_DPAQ_S_W_PH, UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH) (UNSPEC_DPAQ_SA_L_W, UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL) (UNSPEC_MAQ_S_W_PHR, UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR) (UNSPEC_BITREV, UNSPEC_INSV, UNSPEC_REPL_QB, UNSPEC_REPL_PH) (UNSPEC_CMP_EQ, UNSPEC_CMP_LT, UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB) (UNSPEC_CMPGU_LT_QB, UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH) (UNSPEC_EXTR_W, UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H) (UNSPEC_EXTP, UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Move to mips-dsp.md. (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH, UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB) (UNSPEC_ADDUH_R_QB, UNSPEC_APPEND, UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB) (UNSPEC_CMPGDU_LT_QB, UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH) (UNSPEC_DPS_W_PH, UNSPEC_MADD, UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU) (UNSPEC_MUL_PH, UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH) (UNSPEC_MULQ_S_W, UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU) (UNSPEC_PRECR_QB_PH, UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W) (UNSPEC_PREPEND, UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH) (UNSPEC_SUBU_PH, UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB) (UNSPEC_ADDQH_PH, UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W) (UNSPEC_SUBQH_PH, UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W) (UNSPEC_DPAX_W_PH, UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH) (UNSPEC_DPAQX_SA_W_PH, UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved to mips-dspr2.md. (UNSPEC_MOVE_TF_PS, UNSPEC_C, UNSPEC_ALNV_PS, UNSPEC_CABS) (UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS, UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS) (UNSPEC_ABS_PS, UNSPEC_RSQRT1, UNSPEC_RSQRT2, UNSPEC_RECIP1) (UNSPEC_RECIP2, UNSPEC_SINGLE_CC, UNSPEC_SCC): Moved from mips-ps-3d.md. (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ, UNSPEC_LOONGSON_PCMPGT) (UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Move to mips-loongson.md. (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved to mips-loongson2ef.md. (cpu): Update comment. * config/mips/sync.md (UNSPEC_COMPARE_AND_SWAP) (UNSPEC_COMPARE_AND_SWAP_12, UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP) (UNSPEC_SYNC_NEW_OP_12, UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE) (UNSPEC_SYNC_EXCHANGE_12, UNSPEC_MEMORY_BARRIER): Moved from mips.md. * config/mips/loongson.md (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ) (UNSPEC_LOONGSON_PCMPGT, UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Moved from mips.md * config/mips/loongson2ef.md (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved from mips.md * config/mips/mips-dsp.md (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ) (UNSPEC_SUBQ_S, UNSPEC_ADDSC, UNSPEC_ADDWC, UNSPEC_MODSUB) (UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S, UNSPEC_PRECRQ_QB_PH) (UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W, UNSPEC_PRECRQU_S_QB_PH) (UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR, UNSPEC_PRECEQU_PH_QBL) (UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA, UNSPEC_PRECEQU_PH_QBRA) (UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR, UNSPEC_PRECEU_PH_QBLA) (UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL, UNSPEC_SHLL_S, UNSPEC_SHRL_QB) (UNSPEC_SHRA_PH, UNSPEC_SHRA_R, UNSPEC_MULEU_S_PH_QBL) (UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH, UNSPEC_MULEQ_S_W_PHL) (UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL, UNSPEC_DPAU_H_QBR) (UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR, UNSPEC_DPAQ_S_W_PH) (UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH, UNSPEC_DPAQ_SA_L_W) (UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL, UNSPEC_MAQ_S_W_PHR) (UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR, UNSPEC_BITREV, UNSPEC_INSV) (UNSPEC_REPL_QB, UNSPEC_REPL_PH, UNSPEC_CMP_EQ, UNSPEC_CMP_LT) (UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB, UNSPEC_CMPGU_LT_QB) (UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH, UNSPEC_EXTR_W) (UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H, UNSPEC_EXTP) (UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Moved from mips.md. * config/mips/mips-dspr2.md (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH) (UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB, UNSPEC_ADDUH_R_QB, UNSPEC_APPEND) (UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB, UNSPEC_CMPGDU_LT_QB) (UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH, UNSPEC_DPS_W_PH, UNSPEC_MADD) (UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU, UNSPEC_MUL_PH) (UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH, UNSPEC_MULQ_S_W) (UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU, UNSPEC_PRECR_QB_PH) (UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W, UNSPEC_PREPEND) (UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH, UNSPEC_SUBU_PH) (UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB, UNSPEC_ADDQH_PH) (UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W, UNSPEC_SUBQH_PH) (UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W, UNSPEC_DPAX_W_PH) (UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH, UNSPEC_DPAQX_SA_W_PH) (UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved from mips.md. * config/mips/mips-ps-3d.md (UNSPEC_MOVE_TF_PS, UNSPEC_C) (UNSPEC_ALNV_PS, UNSPEC_CABS, UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS) (UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS, UNSPEC_ABS_PS, UNSPEC_RSQRT1) (UNSPEC_RSQRT2, UNSPEC_RECIP1, UNSPEC_RECIP2, UNSPEC_SINGLE_CC) (UNSPEC_SCC): Moved from mips.md. * config/mips/mips.c (mips_arch, mips_tune): Change enum from "processor_type" to "processor". (mips_rtx_cost_data): Replace PROCESSOR_MAX with NUM_PROCESSOR_VALUES. * config/mips/mips.h (processor_type): Delete. (mips_cpu_info.cpu, mips_arch, mips_tune): Change enum from "processor_type" to "processor". From-SVN: r160580
2010-06-10 22:24:01 +02:00
}
/* Return a malloc()ed decimal string that represents number NUMBER. */
static char *
md_decimal_string (int number)
md.texi (define_c_enum, [...]): Document. gcc/ * doc/md.texi (define_c_enum, define_enum): Document. * read-md.h (md_constant): Add a parent_enum field. (enum_value, enum_type): New structures. (upcase_string, traverse_enum_types): Declare. * read-md.c (enum_types): New variable. (upcase_string, add_constant): New functions. (handle_constants): Don't create the hash table here. Use add_constant. (traverse_md_constants): Don't check for a null md_constants. (decimal_string, handle_enum, traverse_enum_types): New functions. (read_md_files): Initialize md_constants and md_enums. * genconstants.c (print_md_constant): Ignore info argument. Only print constants that belong to no enum. (print_enum_type): New function. (main): Don't pass stdout to print_md_constant. Call print_enum_type for each defined enum type. * config/mips/mips.md (processor): New define_enum. (unspec): New define_c_enum. (UNSPEC_COMPARE_AND_SWAP, UNSPEC_COMPARE_AND_SWAP_12) (UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP, UNSPEC_SYNC_NEW_OP_12) (UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE, UNSPEC_SYNC_EXCHANGE_12) (UNSPEC_MEMORY_BARRIER): Moved to sync.md. (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ, UNSPEC_SUBQ_S, UNSPEC_ADDSC) (UNSPEC_ADDWC, UNSPEC_MODSUB, UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S) (UNSPEC_PRECRQ_QB_PH, UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W) (UNSPEC_PRECRQU_S_QB_PH, UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR) (UNSPEC_PRECEQU_PH_QBL, UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA) (UNSPEC_PRECEQU_PH_QBRA, UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR) (UNSPEC_PRECEU_PH_QBLA, UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL) (UNSPEC_SHLL_S, UNSPEC_SHRL_QB, UNSPEC_SHRA_PH, UNSPEC_SHRA_R) (UNSPEC_MULEU_S_PH_QBL, UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH) (UNSPEC_MULEQ_S_W_PHL, UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL) (UNSPEC_DPAU_H_QBR, UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR) (UNSPEC_DPAQ_S_W_PH, UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH) (UNSPEC_DPAQ_SA_L_W, UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL) (UNSPEC_MAQ_S_W_PHR, UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR) (UNSPEC_BITREV, UNSPEC_INSV, UNSPEC_REPL_QB, UNSPEC_REPL_PH) (UNSPEC_CMP_EQ, UNSPEC_CMP_LT, UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB) (UNSPEC_CMPGU_LT_QB, UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH) (UNSPEC_EXTR_W, UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H) (UNSPEC_EXTP, UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Move to mips-dsp.md. (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH, UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB) (UNSPEC_ADDUH_R_QB, UNSPEC_APPEND, UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB) (UNSPEC_CMPGDU_LT_QB, UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH) (UNSPEC_DPS_W_PH, UNSPEC_MADD, UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU) (UNSPEC_MUL_PH, UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH) (UNSPEC_MULQ_S_W, UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU) (UNSPEC_PRECR_QB_PH, UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W) (UNSPEC_PREPEND, UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH) (UNSPEC_SUBU_PH, UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB) (UNSPEC_ADDQH_PH, UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W) (UNSPEC_SUBQH_PH, UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W) (UNSPEC_DPAX_W_PH, UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH) (UNSPEC_DPAQX_SA_W_PH, UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved to mips-dspr2.md. (UNSPEC_MOVE_TF_PS, UNSPEC_C, UNSPEC_ALNV_PS, UNSPEC_CABS) (UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS, UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS) (UNSPEC_ABS_PS, UNSPEC_RSQRT1, UNSPEC_RSQRT2, UNSPEC_RECIP1) (UNSPEC_RECIP2, UNSPEC_SINGLE_CC, UNSPEC_SCC): Moved from mips-ps-3d.md. (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ, UNSPEC_LOONGSON_PCMPGT) (UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Move to mips-loongson.md. (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved to mips-loongson2ef.md. (cpu): Update comment. * config/mips/sync.md (UNSPEC_COMPARE_AND_SWAP) (UNSPEC_COMPARE_AND_SWAP_12, UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP) (UNSPEC_SYNC_NEW_OP_12, UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE) (UNSPEC_SYNC_EXCHANGE_12, UNSPEC_MEMORY_BARRIER): Moved from mips.md. * config/mips/loongson.md (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ) (UNSPEC_LOONGSON_PCMPGT, UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Moved from mips.md * config/mips/loongson2ef.md (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved from mips.md * config/mips/mips-dsp.md (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ) (UNSPEC_SUBQ_S, UNSPEC_ADDSC, UNSPEC_ADDWC, UNSPEC_MODSUB) (UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S, UNSPEC_PRECRQ_QB_PH) (UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W, UNSPEC_PRECRQU_S_QB_PH) (UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR, UNSPEC_PRECEQU_PH_QBL) (UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA, UNSPEC_PRECEQU_PH_QBRA) (UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR, UNSPEC_PRECEU_PH_QBLA) (UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL, UNSPEC_SHLL_S, UNSPEC_SHRL_QB) (UNSPEC_SHRA_PH, UNSPEC_SHRA_R, UNSPEC_MULEU_S_PH_QBL) (UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH, UNSPEC_MULEQ_S_W_PHL) (UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL, UNSPEC_DPAU_H_QBR) (UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR, UNSPEC_DPAQ_S_W_PH) (UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH, UNSPEC_DPAQ_SA_L_W) (UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL, UNSPEC_MAQ_S_W_PHR) (UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR, UNSPEC_BITREV, UNSPEC_INSV) (UNSPEC_REPL_QB, UNSPEC_REPL_PH, UNSPEC_CMP_EQ, UNSPEC_CMP_LT) (UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB, UNSPEC_CMPGU_LT_QB) (UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH, UNSPEC_EXTR_W) (UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H, UNSPEC_EXTP) (UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Moved from mips.md. * config/mips/mips-dspr2.md (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH) (UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB, UNSPEC_ADDUH_R_QB, UNSPEC_APPEND) (UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB, UNSPEC_CMPGDU_LT_QB) (UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH, UNSPEC_DPS_W_PH, UNSPEC_MADD) (UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU, UNSPEC_MUL_PH) (UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH, UNSPEC_MULQ_S_W) (UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU, UNSPEC_PRECR_QB_PH) (UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W, UNSPEC_PREPEND) (UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH, UNSPEC_SUBU_PH) (UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB, UNSPEC_ADDQH_PH) (UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W, UNSPEC_SUBQH_PH) (UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W, UNSPEC_DPAX_W_PH) (UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH, UNSPEC_DPAQX_SA_W_PH) (UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved from mips.md. * config/mips/mips-ps-3d.md (UNSPEC_MOVE_TF_PS, UNSPEC_C) (UNSPEC_ALNV_PS, UNSPEC_CABS, UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS) (UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS, UNSPEC_ABS_PS, UNSPEC_RSQRT1) (UNSPEC_RSQRT2, UNSPEC_RECIP1, UNSPEC_RECIP2, UNSPEC_SINGLE_CC) (UNSPEC_SCC): Moved from mips.md. * config/mips/mips.c (mips_arch, mips_tune): Change enum from "processor_type" to "processor". (mips_rtx_cost_data): Replace PROCESSOR_MAX with NUM_PROCESSOR_VALUES. * config/mips/mips.h (processor_type): Delete. (mips_cpu_info.cpu, mips_arch, mips_tune): Change enum from "processor_type" to "processor". From-SVN: r160580
2010-06-10 22:24:01 +02:00
{
/* A safe overestimate. +1 for sign, +1 for null terminator. */
char buffer[sizeof (int) * CHAR_BIT + 1 + 1];
sprintf (buffer, "%d", number);
return xstrdup (buffer);
}
/* Process a define_enum or define_c_enum directive, starting with
the optional space after the "define_enum". LINENO is the line
number on which the directive started and MD_P is true if the
directive is a define_enum rather than a define_c_enum. */
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
void
rtx_reader::handle_enum (file_location loc, bool md_p)
md.texi (define_c_enum, [...]): Document. gcc/ * doc/md.texi (define_c_enum, define_enum): Document. * read-md.h (md_constant): Add a parent_enum field. (enum_value, enum_type): New structures. (upcase_string, traverse_enum_types): Declare. * read-md.c (enum_types): New variable. (upcase_string, add_constant): New functions. (handle_constants): Don't create the hash table here. Use add_constant. (traverse_md_constants): Don't check for a null md_constants. (decimal_string, handle_enum, traverse_enum_types): New functions. (read_md_files): Initialize md_constants and md_enums. * genconstants.c (print_md_constant): Ignore info argument. Only print constants that belong to no enum. (print_enum_type): New function. (main): Don't pass stdout to print_md_constant. Call print_enum_type for each defined enum type. * config/mips/mips.md (processor): New define_enum. (unspec): New define_c_enum. (UNSPEC_COMPARE_AND_SWAP, UNSPEC_COMPARE_AND_SWAP_12) (UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP, UNSPEC_SYNC_NEW_OP_12) (UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE, UNSPEC_SYNC_EXCHANGE_12) (UNSPEC_MEMORY_BARRIER): Moved to sync.md. (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ, UNSPEC_SUBQ_S, UNSPEC_ADDSC) (UNSPEC_ADDWC, UNSPEC_MODSUB, UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S) (UNSPEC_PRECRQ_QB_PH, UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W) (UNSPEC_PRECRQU_S_QB_PH, UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR) (UNSPEC_PRECEQU_PH_QBL, UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA) (UNSPEC_PRECEQU_PH_QBRA, UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR) (UNSPEC_PRECEU_PH_QBLA, UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL) (UNSPEC_SHLL_S, UNSPEC_SHRL_QB, UNSPEC_SHRA_PH, UNSPEC_SHRA_R) (UNSPEC_MULEU_S_PH_QBL, UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH) (UNSPEC_MULEQ_S_W_PHL, UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL) (UNSPEC_DPAU_H_QBR, UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR) (UNSPEC_DPAQ_S_W_PH, UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH) (UNSPEC_DPAQ_SA_L_W, UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL) (UNSPEC_MAQ_S_W_PHR, UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR) (UNSPEC_BITREV, UNSPEC_INSV, UNSPEC_REPL_QB, UNSPEC_REPL_PH) (UNSPEC_CMP_EQ, UNSPEC_CMP_LT, UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB) (UNSPEC_CMPGU_LT_QB, UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH) (UNSPEC_EXTR_W, UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H) (UNSPEC_EXTP, UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Move to mips-dsp.md. (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH, UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB) (UNSPEC_ADDUH_R_QB, UNSPEC_APPEND, UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB) (UNSPEC_CMPGDU_LT_QB, UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH) (UNSPEC_DPS_W_PH, UNSPEC_MADD, UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU) (UNSPEC_MUL_PH, UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH) (UNSPEC_MULQ_S_W, UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU) (UNSPEC_PRECR_QB_PH, UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W) (UNSPEC_PREPEND, UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH) (UNSPEC_SUBU_PH, UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB) (UNSPEC_ADDQH_PH, UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W) (UNSPEC_SUBQH_PH, UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W) (UNSPEC_DPAX_W_PH, UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH) (UNSPEC_DPAQX_SA_W_PH, UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved to mips-dspr2.md. (UNSPEC_MOVE_TF_PS, UNSPEC_C, UNSPEC_ALNV_PS, UNSPEC_CABS) (UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS, UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS) (UNSPEC_ABS_PS, UNSPEC_RSQRT1, UNSPEC_RSQRT2, UNSPEC_RECIP1) (UNSPEC_RECIP2, UNSPEC_SINGLE_CC, UNSPEC_SCC): Moved from mips-ps-3d.md. (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ, UNSPEC_LOONGSON_PCMPGT) (UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Move to mips-loongson.md. (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved to mips-loongson2ef.md. (cpu): Update comment. * config/mips/sync.md (UNSPEC_COMPARE_AND_SWAP) (UNSPEC_COMPARE_AND_SWAP_12, UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP) (UNSPEC_SYNC_NEW_OP_12, UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE) (UNSPEC_SYNC_EXCHANGE_12, UNSPEC_MEMORY_BARRIER): Moved from mips.md. * config/mips/loongson.md (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ) (UNSPEC_LOONGSON_PCMPGT, UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Moved from mips.md * config/mips/loongson2ef.md (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved from mips.md * config/mips/mips-dsp.md (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ) (UNSPEC_SUBQ_S, UNSPEC_ADDSC, UNSPEC_ADDWC, UNSPEC_MODSUB) (UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S, UNSPEC_PRECRQ_QB_PH) (UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W, UNSPEC_PRECRQU_S_QB_PH) (UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR, UNSPEC_PRECEQU_PH_QBL) (UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA, UNSPEC_PRECEQU_PH_QBRA) (UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR, UNSPEC_PRECEU_PH_QBLA) (UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL, UNSPEC_SHLL_S, UNSPEC_SHRL_QB) (UNSPEC_SHRA_PH, UNSPEC_SHRA_R, UNSPEC_MULEU_S_PH_QBL) (UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH, UNSPEC_MULEQ_S_W_PHL) (UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL, UNSPEC_DPAU_H_QBR) (UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR, UNSPEC_DPAQ_S_W_PH) (UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH, UNSPEC_DPAQ_SA_L_W) (UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL, UNSPEC_MAQ_S_W_PHR) (UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR, UNSPEC_BITREV, UNSPEC_INSV) (UNSPEC_REPL_QB, UNSPEC_REPL_PH, UNSPEC_CMP_EQ, UNSPEC_CMP_LT) (UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB, UNSPEC_CMPGU_LT_QB) (UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH, UNSPEC_EXTR_W) (UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H, UNSPEC_EXTP) (UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Moved from mips.md. * config/mips/mips-dspr2.md (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH) (UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB, UNSPEC_ADDUH_R_QB, UNSPEC_APPEND) (UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB, UNSPEC_CMPGDU_LT_QB) (UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH, UNSPEC_DPS_W_PH, UNSPEC_MADD) (UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU, UNSPEC_MUL_PH) (UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH, UNSPEC_MULQ_S_W) (UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU, UNSPEC_PRECR_QB_PH) (UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W, UNSPEC_PREPEND) (UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH, UNSPEC_SUBU_PH) (UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB, UNSPEC_ADDQH_PH) (UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W, UNSPEC_SUBQH_PH) (UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W, UNSPEC_DPAX_W_PH) (UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH, UNSPEC_DPAQX_SA_W_PH) (UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved from mips.md. * config/mips/mips-ps-3d.md (UNSPEC_MOVE_TF_PS, UNSPEC_C) (UNSPEC_ALNV_PS, UNSPEC_CABS, UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS) (UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS, UNSPEC_ABS_PS, UNSPEC_RSQRT1) (UNSPEC_RSQRT2, UNSPEC_RECIP1, UNSPEC_RECIP2, UNSPEC_SINGLE_CC) (UNSPEC_SCC): Moved from mips.md. * config/mips/mips.c (mips_arch, mips_tune): Change enum from "processor_type" to "processor". (mips_rtx_cost_data): Replace PROCESSOR_MAX with NUM_PROCESSOR_VALUES. * config/mips/mips.h (processor_type): Delete. (mips_cpu_info.cpu, mips_arch, mips_tune): Change enum from "processor_type" to "processor". From-SVN: r160580
2010-06-10 22:24:01 +02:00
{
char *enum_name, *value_name;
struct md_name name;
struct enum_type *def;
struct enum_value *ev;
void **slot;
int c;
enum_name = read_string (false);
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
slot = htab_find_slot (m_enum_types, &enum_name, INSERT);
md.texi (define_c_enum, [...]): Document. gcc/ * doc/md.texi (define_c_enum, define_enum): Document. * read-md.h (md_constant): Add a parent_enum field. (enum_value, enum_type): New structures. (upcase_string, traverse_enum_types): Declare. * read-md.c (enum_types): New variable. (upcase_string, add_constant): New functions. (handle_constants): Don't create the hash table here. Use add_constant. (traverse_md_constants): Don't check for a null md_constants. (decimal_string, handle_enum, traverse_enum_types): New functions. (read_md_files): Initialize md_constants and md_enums. * genconstants.c (print_md_constant): Ignore info argument. Only print constants that belong to no enum. (print_enum_type): New function. (main): Don't pass stdout to print_md_constant. Call print_enum_type for each defined enum type. * config/mips/mips.md (processor): New define_enum. (unspec): New define_c_enum. (UNSPEC_COMPARE_AND_SWAP, UNSPEC_COMPARE_AND_SWAP_12) (UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP, UNSPEC_SYNC_NEW_OP_12) (UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE, UNSPEC_SYNC_EXCHANGE_12) (UNSPEC_MEMORY_BARRIER): Moved to sync.md. (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ, UNSPEC_SUBQ_S, UNSPEC_ADDSC) (UNSPEC_ADDWC, UNSPEC_MODSUB, UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S) (UNSPEC_PRECRQ_QB_PH, UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W) (UNSPEC_PRECRQU_S_QB_PH, UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR) (UNSPEC_PRECEQU_PH_QBL, UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA) (UNSPEC_PRECEQU_PH_QBRA, UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR) (UNSPEC_PRECEU_PH_QBLA, UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL) (UNSPEC_SHLL_S, UNSPEC_SHRL_QB, UNSPEC_SHRA_PH, UNSPEC_SHRA_R) (UNSPEC_MULEU_S_PH_QBL, UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH) (UNSPEC_MULEQ_S_W_PHL, UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL) (UNSPEC_DPAU_H_QBR, UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR) (UNSPEC_DPAQ_S_W_PH, UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH) (UNSPEC_DPAQ_SA_L_W, UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL) (UNSPEC_MAQ_S_W_PHR, UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR) (UNSPEC_BITREV, UNSPEC_INSV, UNSPEC_REPL_QB, UNSPEC_REPL_PH) (UNSPEC_CMP_EQ, UNSPEC_CMP_LT, UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB) (UNSPEC_CMPGU_LT_QB, UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH) (UNSPEC_EXTR_W, UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H) (UNSPEC_EXTP, UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Move to mips-dsp.md. (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH, UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB) (UNSPEC_ADDUH_R_QB, UNSPEC_APPEND, UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB) (UNSPEC_CMPGDU_LT_QB, UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH) (UNSPEC_DPS_W_PH, UNSPEC_MADD, UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU) (UNSPEC_MUL_PH, UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH) (UNSPEC_MULQ_S_W, UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU) (UNSPEC_PRECR_QB_PH, UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W) (UNSPEC_PREPEND, UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH) (UNSPEC_SUBU_PH, UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB) (UNSPEC_ADDQH_PH, UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W) (UNSPEC_SUBQH_PH, UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W) (UNSPEC_DPAX_W_PH, UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH) (UNSPEC_DPAQX_SA_W_PH, UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved to mips-dspr2.md. (UNSPEC_MOVE_TF_PS, UNSPEC_C, UNSPEC_ALNV_PS, UNSPEC_CABS) (UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS, UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS) (UNSPEC_ABS_PS, UNSPEC_RSQRT1, UNSPEC_RSQRT2, UNSPEC_RECIP1) (UNSPEC_RECIP2, UNSPEC_SINGLE_CC, UNSPEC_SCC): Moved from mips-ps-3d.md. (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ, UNSPEC_LOONGSON_PCMPGT) (UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Move to mips-loongson.md. (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved to mips-loongson2ef.md. (cpu): Update comment. * config/mips/sync.md (UNSPEC_COMPARE_AND_SWAP) (UNSPEC_COMPARE_AND_SWAP_12, UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP) (UNSPEC_SYNC_NEW_OP_12, UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE) (UNSPEC_SYNC_EXCHANGE_12, UNSPEC_MEMORY_BARRIER): Moved from mips.md. * config/mips/loongson.md (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ) (UNSPEC_LOONGSON_PCMPGT, UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Moved from mips.md * config/mips/loongson2ef.md (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved from mips.md * config/mips/mips-dsp.md (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ) (UNSPEC_SUBQ_S, UNSPEC_ADDSC, UNSPEC_ADDWC, UNSPEC_MODSUB) (UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S, UNSPEC_PRECRQ_QB_PH) (UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W, UNSPEC_PRECRQU_S_QB_PH) (UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR, UNSPEC_PRECEQU_PH_QBL) (UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA, UNSPEC_PRECEQU_PH_QBRA) (UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR, UNSPEC_PRECEU_PH_QBLA) (UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL, UNSPEC_SHLL_S, UNSPEC_SHRL_QB) (UNSPEC_SHRA_PH, UNSPEC_SHRA_R, UNSPEC_MULEU_S_PH_QBL) (UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH, UNSPEC_MULEQ_S_W_PHL) (UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL, UNSPEC_DPAU_H_QBR) (UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR, UNSPEC_DPAQ_S_W_PH) (UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH, UNSPEC_DPAQ_SA_L_W) (UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL, UNSPEC_MAQ_S_W_PHR) (UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR, UNSPEC_BITREV, UNSPEC_INSV) (UNSPEC_REPL_QB, UNSPEC_REPL_PH, UNSPEC_CMP_EQ, UNSPEC_CMP_LT) (UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB, UNSPEC_CMPGU_LT_QB) (UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH, UNSPEC_EXTR_W) (UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H, UNSPEC_EXTP) (UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Moved from mips.md. * config/mips/mips-dspr2.md (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH) (UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB, UNSPEC_ADDUH_R_QB, UNSPEC_APPEND) (UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB, UNSPEC_CMPGDU_LT_QB) (UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH, UNSPEC_DPS_W_PH, UNSPEC_MADD) (UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU, UNSPEC_MUL_PH) (UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH, UNSPEC_MULQ_S_W) (UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU, UNSPEC_PRECR_QB_PH) (UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W, UNSPEC_PREPEND) (UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH, UNSPEC_SUBU_PH) (UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB, UNSPEC_ADDQH_PH) (UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W, UNSPEC_SUBQH_PH) (UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W, UNSPEC_DPAX_W_PH) (UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH, UNSPEC_DPAQX_SA_W_PH) (UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved from mips.md. * config/mips/mips-ps-3d.md (UNSPEC_MOVE_TF_PS, UNSPEC_C) (UNSPEC_ALNV_PS, UNSPEC_CABS, UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS) (UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS, UNSPEC_ABS_PS, UNSPEC_RSQRT1) (UNSPEC_RSQRT2, UNSPEC_RECIP1, UNSPEC_RECIP2, UNSPEC_SINGLE_CC) (UNSPEC_SCC): Moved from mips.md. * config/mips/mips.c (mips_arch, mips_tune): Change enum from "processor_type" to "processor". (mips_rtx_cost_data): Replace PROCESSOR_MAX with NUM_PROCESSOR_VALUES. * config/mips/mips.h (processor_type): Delete. (mips_cpu_info.cpu, mips_arch, mips_tune): Change enum from "processor_type" to "processor". From-SVN: r160580
2010-06-10 22:24:01 +02:00
if (*slot)
{
def = (struct enum_type *) *slot;
if (def->md_p != md_p)
read-md.h (file_location): New structure. gcc/ * read-md.h (file_location): New structure. (directive_handler_t): Take a file_location rather than a line number. (message_at, error_at): Declare. (read_skip_construct): Delete. * read-md.c (message_with_line_1): Replace with... (message_at_1): ...this new function. (message_at, error_at): New functions. (message_with_line, error_with_line): Update to use message_at_1. (handle_enum): Take a file_location rather than a line number and use error_at for error reporting. (handle_include): Likewise. (read_skip_construct): Likewise. Make static. (handle_file): Update after above changes. Pass a file_location rather than a line number to handle_directive. * gensupport.c (queue_elem): Replace separate filename and lineno with a file_location. (queue_pattern): Replace filename and lineno arguments with a file_location. Update after change to queue_elem. (process_define_predicate): Replace lineno argument with a file_location and use error_at for error reporting. Update after above changes. (process_rtx): Likewise. (subst_pattern_match): Likewise. (get_alternatives_number): Likewise. (alter_predicate_for_insn): Likewise. (rtx_handle_directive): Likewise. (is_predicable): Update after above changes, using error_at rather than error_with_line. (has_subst_attribute): Likewise. (identify_predicable_attribute): Likewise. (alter_attrs_for_subst_insn): Likewise. (process_one_cond_exec): Likewise. (process_substs_on_one_elem): Likewise. (process_define_subst): Likewise. (check_define_attr_duplicates): Likewise. (read_md_rtx): Update after change to queue_elem. From-SVN: r225879
2015-07-16 15:41:41 +02:00
error_at (loc, "redefining `%s' as a different type of enum",
enum_name);
md.texi (define_c_enum, [...]): Document. gcc/ * doc/md.texi (define_c_enum, define_enum): Document. * read-md.h (md_constant): Add a parent_enum field. (enum_value, enum_type): New structures. (upcase_string, traverse_enum_types): Declare. * read-md.c (enum_types): New variable. (upcase_string, add_constant): New functions. (handle_constants): Don't create the hash table here. Use add_constant. (traverse_md_constants): Don't check for a null md_constants. (decimal_string, handle_enum, traverse_enum_types): New functions. (read_md_files): Initialize md_constants and md_enums. * genconstants.c (print_md_constant): Ignore info argument. Only print constants that belong to no enum. (print_enum_type): New function. (main): Don't pass stdout to print_md_constant. Call print_enum_type for each defined enum type. * config/mips/mips.md (processor): New define_enum. (unspec): New define_c_enum. (UNSPEC_COMPARE_AND_SWAP, UNSPEC_COMPARE_AND_SWAP_12) (UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP, UNSPEC_SYNC_NEW_OP_12) (UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE, UNSPEC_SYNC_EXCHANGE_12) (UNSPEC_MEMORY_BARRIER): Moved to sync.md. (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ, UNSPEC_SUBQ_S, UNSPEC_ADDSC) (UNSPEC_ADDWC, UNSPEC_MODSUB, UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S) (UNSPEC_PRECRQ_QB_PH, UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W) (UNSPEC_PRECRQU_S_QB_PH, UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR) (UNSPEC_PRECEQU_PH_QBL, UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA) (UNSPEC_PRECEQU_PH_QBRA, UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR) (UNSPEC_PRECEU_PH_QBLA, UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL) (UNSPEC_SHLL_S, UNSPEC_SHRL_QB, UNSPEC_SHRA_PH, UNSPEC_SHRA_R) (UNSPEC_MULEU_S_PH_QBL, UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH) (UNSPEC_MULEQ_S_W_PHL, UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL) (UNSPEC_DPAU_H_QBR, UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR) (UNSPEC_DPAQ_S_W_PH, UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH) (UNSPEC_DPAQ_SA_L_W, UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL) (UNSPEC_MAQ_S_W_PHR, UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR) (UNSPEC_BITREV, UNSPEC_INSV, UNSPEC_REPL_QB, UNSPEC_REPL_PH) (UNSPEC_CMP_EQ, UNSPEC_CMP_LT, UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB) (UNSPEC_CMPGU_LT_QB, UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH) (UNSPEC_EXTR_W, UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H) (UNSPEC_EXTP, UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Move to mips-dsp.md. (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH, UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB) (UNSPEC_ADDUH_R_QB, UNSPEC_APPEND, UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB) (UNSPEC_CMPGDU_LT_QB, UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH) (UNSPEC_DPS_W_PH, UNSPEC_MADD, UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU) (UNSPEC_MUL_PH, UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH) (UNSPEC_MULQ_S_W, UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU) (UNSPEC_PRECR_QB_PH, UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W) (UNSPEC_PREPEND, UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH) (UNSPEC_SUBU_PH, UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB) (UNSPEC_ADDQH_PH, UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W) (UNSPEC_SUBQH_PH, UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W) (UNSPEC_DPAX_W_PH, UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH) (UNSPEC_DPAQX_SA_W_PH, UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved to mips-dspr2.md. (UNSPEC_MOVE_TF_PS, UNSPEC_C, UNSPEC_ALNV_PS, UNSPEC_CABS) (UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS, UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS) (UNSPEC_ABS_PS, UNSPEC_RSQRT1, UNSPEC_RSQRT2, UNSPEC_RECIP1) (UNSPEC_RECIP2, UNSPEC_SINGLE_CC, UNSPEC_SCC): Moved from mips-ps-3d.md. (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ, UNSPEC_LOONGSON_PCMPGT) (UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Move to mips-loongson.md. (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved to mips-loongson2ef.md. (cpu): Update comment. * config/mips/sync.md (UNSPEC_COMPARE_AND_SWAP) (UNSPEC_COMPARE_AND_SWAP_12, UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP) (UNSPEC_SYNC_NEW_OP_12, UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE) (UNSPEC_SYNC_EXCHANGE_12, UNSPEC_MEMORY_BARRIER): Moved from mips.md. * config/mips/loongson.md (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ) (UNSPEC_LOONGSON_PCMPGT, UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Moved from mips.md * config/mips/loongson2ef.md (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved from mips.md * config/mips/mips-dsp.md (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ) (UNSPEC_SUBQ_S, UNSPEC_ADDSC, UNSPEC_ADDWC, UNSPEC_MODSUB) (UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S, UNSPEC_PRECRQ_QB_PH) (UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W, UNSPEC_PRECRQU_S_QB_PH) (UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR, UNSPEC_PRECEQU_PH_QBL) (UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA, UNSPEC_PRECEQU_PH_QBRA) (UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR, UNSPEC_PRECEU_PH_QBLA) (UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL, UNSPEC_SHLL_S, UNSPEC_SHRL_QB) (UNSPEC_SHRA_PH, UNSPEC_SHRA_R, UNSPEC_MULEU_S_PH_QBL) (UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH, UNSPEC_MULEQ_S_W_PHL) (UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL, UNSPEC_DPAU_H_QBR) (UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR, UNSPEC_DPAQ_S_W_PH) (UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH, UNSPEC_DPAQ_SA_L_W) (UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL, UNSPEC_MAQ_S_W_PHR) (UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR, UNSPEC_BITREV, UNSPEC_INSV) (UNSPEC_REPL_QB, UNSPEC_REPL_PH, UNSPEC_CMP_EQ, UNSPEC_CMP_LT) (UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB, UNSPEC_CMPGU_LT_QB) (UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH, UNSPEC_EXTR_W) (UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H, UNSPEC_EXTP) (UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Moved from mips.md. * config/mips/mips-dspr2.md (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH) (UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB, UNSPEC_ADDUH_R_QB, UNSPEC_APPEND) (UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB, UNSPEC_CMPGDU_LT_QB) (UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH, UNSPEC_DPS_W_PH, UNSPEC_MADD) (UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU, UNSPEC_MUL_PH) (UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH, UNSPEC_MULQ_S_W) (UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU, UNSPEC_PRECR_QB_PH) (UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W, UNSPEC_PREPEND) (UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH, UNSPEC_SUBU_PH) (UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB, UNSPEC_ADDQH_PH) (UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W, UNSPEC_SUBQH_PH) (UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W, UNSPEC_DPAX_W_PH) (UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH, UNSPEC_DPAQX_SA_W_PH) (UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved from mips.md. * config/mips/mips-ps-3d.md (UNSPEC_MOVE_TF_PS, UNSPEC_C) (UNSPEC_ALNV_PS, UNSPEC_CABS, UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS) (UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS, UNSPEC_ABS_PS, UNSPEC_RSQRT1) (UNSPEC_RSQRT2, UNSPEC_RECIP1, UNSPEC_RECIP2, UNSPEC_SINGLE_CC) (UNSPEC_SCC): Moved from mips.md. * config/mips/mips.c (mips_arch, mips_tune): Change enum from "processor_type" to "processor". (mips_rtx_cost_data): Replace PROCESSOR_MAX with NUM_PROCESSOR_VALUES. * config/mips/mips.h (processor_type): Delete. (mips_cpu_info.cpu, mips_arch, mips_tune): Change enum from "processor_type" to "processor". From-SVN: r160580
2010-06-10 22:24:01 +02:00
}
else
{
def = XNEW (struct enum_type);
def->name = enum_name;
def->md_p = md_p;
def->values = 0;
def->tail_ptr = &def->values;
def->num_values = 0;
*slot = def;
}
require_char_ws ('[');
md.texi (define_c_enum, [...]): Document. gcc/ * doc/md.texi (define_c_enum, define_enum): Document. * read-md.h (md_constant): Add a parent_enum field. (enum_value, enum_type): New structures. (upcase_string, traverse_enum_types): Declare. * read-md.c (enum_types): New variable. (upcase_string, add_constant): New functions. (handle_constants): Don't create the hash table here. Use add_constant. (traverse_md_constants): Don't check for a null md_constants. (decimal_string, handle_enum, traverse_enum_types): New functions. (read_md_files): Initialize md_constants and md_enums. * genconstants.c (print_md_constant): Ignore info argument. Only print constants that belong to no enum. (print_enum_type): New function. (main): Don't pass stdout to print_md_constant. Call print_enum_type for each defined enum type. * config/mips/mips.md (processor): New define_enum. (unspec): New define_c_enum. (UNSPEC_COMPARE_AND_SWAP, UNSPEC_COMPARE_AND_SWAP_12) (UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP, UNSPEC_SYNC_NEW_OP_12) (UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE, UNSPEC_SYNC_EXCHANGE_12) (UNSPEC_MEMORY_BARRIER): Moved to sync.md. (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ, UNSPEC_SUBQ_S, UNSPEC_ADDSC) (UNSPEC_ADDWC, UNSPEC_MODSUB, UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S) (UNSPEC_PRECRQ_QB_PH, UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W) (UNSPEC_PRECRQU_S_QB_PH, UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR) (UNSPEC_PRECEQU_PH_QBL, UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA) (UNSPEC_PRECEQU_PH_QBRA, UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR) (UNSPEC_PRECEU_PH_QBLA, UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL) (UNSPEC_SHLL_S, UNSPEC_SHRL_QB, UNSPEC_SHRA_PH, UNSPEC_SHRA_R) (UNSPEC_MULEU_S_PH_QBL, UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH) (UNSPEC_MULEQ_S_W_PHL, UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL) (UNSPEC_DPAU_H_QBR, UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR) (UNSPEC_DPAQ_S_W_PH, UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH) (UNSPEC_DPAQ_SA_L_W, UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL) (UNSPEC_MAQ_S_W_PHR, UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR) (UNSPEC_BITREV, UNSPEC_INSV, UNSPEC_REPL_QB, UNSPEC_REPL_PH) (UNSPEC_CMP_EQ, UNSPEC_CMP_LT, UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB) (UNSPEC_CMPGU_LT_QB, UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH) (UNSPEC_EXTR_W, UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H) (UNSPEC_EXTP, UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Move to mips-dsp.md. (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH, UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB) (UNSPEC_ADDUH_R_QB, UNSPEC_APPEND, UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB) (UNSPEC_CMPGDU_LT_QB, UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH) (UNSPEC_DPS_W_PH, UNSPEC_MADD, UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU) (UNSPEC_MUL_PH, UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH) (UNSPEC_MULQ_S_W, UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU) (UNSPEC_PRECR_QB_PH, UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W) (UNSPEC_PREPEND, UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH) (UNSPEC_SUBU_PH, UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB) (UNSPEC_ADDQH_PH, UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W) (UNSPEC_SUBQH_PH, UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W) (UNSPEC_DPAX_W_PH, UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH) (UNSPEC_DPAQX_SA_W_PH, UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved to mips-dspr2.md. (UNSPEC_MOVE_TF_PS, UNSPEC_C, UNSPEC_ALNV_PS, UNSPEC_CABS) (UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS, UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS) (UNSPEC_ABS_PS, UNSPEC_RSQRT1, UNSPEC_RSQRT2, UNSPEC_RECIP1) (UNSPEC_RECIP2, UNSPEC_SINGLE_CC, UNSPEC_SCC): Moved from mips-ps-3d.md. (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ, UNSPEC_LOONGSON_PCMPGT) (UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Move to mips-loongson.md. (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved to mips-loongson2ef.md. (cpu): Update comment. * config/mips/sync.md (UNSPEC_COMPARE_AND_SWAP) (UNSPEC_COMPARE_AND_SWAP_12, UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP) (UNSPEC_SYNC_NEW_OP_12, UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE) (UNSPEC_SYNC_EXCHANGE_12, UNSPEC_MEMORY_BARRIER): Moved from mips.md. * config/mips/loongson.md (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ) (UNSPEC_LOONGSON_PCMPGT, UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Moved from mips.md * config/mips/loongson2ef.md (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved from mips.md * config/mips/mips-dsp.md (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ) (UNSPEC_SUBQ_S, UNSPEC_ADDSC, UNSPEC_ADDWC, UNSPEC_MODSUB) (UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S, UNSPEC_PRECRQ_QB_PH) (UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W, UNSPEC_PRECRQU_S_QB_PH) (UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR, UNSPEC_PRECEQU_PH_QBL) (UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA, UNSPEC_PRECEQU_PH_QBRA) (UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR, UNSPEC_PRECEU_PH_QBLA) (UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL, UNSPEC_SHLL_S, UNSPEC_SHRL_QB) (UNSPEC_SHRA_PH, UNSPEC_SHRA_R, UNSPEC_MULEU_S_PH_QBL) (UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH, UNSPEC_MULEQ_S_W_PHL) (UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL, UNSPEC_DPAU_H_QBR) (UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR, UNSPEC_DPAQ_S_W_PH) (UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH, UNSPEC_DPAQ_SA_L_W) (UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL, UNSPEC_MAQ_S_W_PHR) (UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR, UNSPEC_BITREV, UNSPEC_INSV) (UNSPEC_REPL_QB, UNSPEC_REPL_PH, UNSPEC_CMP_EQ, UNSPEC_CMP_LT) (UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB, UNSPEC_CMPGU_LT_QB) (UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH, UNSPEC_EXTR_W) (UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H, UNSPEC_EXTP) (UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Moved from mips.md. * config/mips/mips-dspr2.md (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH) (UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB, UNSPEC_ADDUH_R_QB, UNSPEC_APPEND) (UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB, UNSPEC_CMPGDU_LT_QB) (UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH, UNSPEC_DPS_W_PH, UNSPEC_MADD) (UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU, UNSPEC_MUL_PH) (UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH, UNSPEC_MULQ_S_W) (UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU, UNSPEC_PRECR_QB_PH) (UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W, UNSPEC_PREPEND) (UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH, UNSPEC_SUBU_PH) (UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB, UNSPEC_ADDQH_PH) (UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W, UNSPEC_SUBQH_PH) (UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W, UNSPEC_DPAX_W_PH) (UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH, UNSPEC_DPAQX_SA_W_PH) (UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved from mips.md. * config/mips/mips-ps-3d.md (UNSPEC_MOVE_TF_PS, UNSPEC_C) (UNSPEC_ALNV_PS, UNSPEC_CABS, UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS) (UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS, UNSPEC_ABS_PS, UNSPEC_RSQRT1) (UNSPEC_RSQRT2, UNSPEC_RECIP1, UNSPEC_RECIP2, UNSPEC_SINGLE_CC) (UNSPEC_SCC): Moved from mips.md. * config/mips/mips.c (mips_arch, mips_tune): Change enum from "processor_type" to "processor". (mips_rtx_cost_data): Replace PROCESSOR_MAX with NUM_PROCESSOR_VALUES. * config/mips/mips.h (processor_type): Delete. (mips_cpu_info.cpu, mips_arch, mips_tune): Change enum from "processor_type" to "processor". From-SVN: r160580
2010-06-10 22:24:01 +02:00
while ((c = read_skip_spaces ()) != ']')
{
if (c == EOF)
{
read-md.h (file_location): New structure. gcc/ * read-md.h (file_location): New structure. (directive_handler_t): Take a file_location rather than a line number. (message_at, error_at): Declare. (read_skip_construct): Delete. * read-md.c (message_with_line_1): Replace with... (message_at_1): ...this new function. (message_at, error_at): New functions. (message_with_line, error_with_line): Update to use message_at_1. (handle_enum): Take a file_location rather than a line number and use error_at for error reporting. (handle_include): Likewise. (read_skip_construct): Likewise. Make static. (handle_file): Update after above changes. Pass a file_location rather than a line number to handle_directive. * gensupport.c (queue_elem): Replace separate filename and lineno with a file_location. (queue_pattern): Replace filename and lineno arguments with a file_location. Update after change to queue_elem. (process_define_predicate): Replace lineno argument with a file_location and use error_at for error reporting. Update after above changes. (process_rtx): Likewise. (subst_pattern_match): Likewise. (get_alternatives_number): Likewise. (alter_predicate_for_insn): Likewise. (rtx_handle_directive): Likewise. (is_predicable): Update after above changes, using error_at rather than error_with_line. (has_subst_attribute): Likewise. (identify_predicable_attribute): Likewise. (alter_attrs_for_subst_insn): Likewise. (process_one_cond_exec): Likewise. (process_substs_on_one_elem): Likewise. (process_define_subst): Likewise. (check_define_attr_duplicates): Likewise. (read_md_rtx): Update after change to queue_elem. From-SVN: r225879
2015-07-16 15:41:41 +02:00
error_at (loc, "unterminated construct");
md.texi (define_c_enum, [...]): Document. gcc/ * doc/md.texi (define_c_enum, define_enum): Document. * read-md.h (md_constant): Add a parent_enum field. (enum_value, enum_type): New structures. (upcase_string, traverse_enum_types): Declare. * read-md.c (enum_types): New variable. (upcase_string, add_constant): New functions. (handle_constants): Don't create the hash table here. Use add_constant. (traverse_md_constants): Don't check for a null md_constants. (decimal_string, handle_enum, traverse_enum_types): New functions. (read_md_files): Initialize md_constants and md_enums. * genconstants.c (print_md_constant): Ignore info argument. Only print constants that belong to no enum. (print_enum_type): New function. (main): Don't pass stdout to print_md_constant. Call print_enum_type for each defined enum type. * config/mips/mips.md (processor): New define_enum. (unspec): New define_c_enum. (UNSPEC_COMPARE_AND_SWAP, UNSPEC_COMPARE_AND_SWAP_12) (UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP, UNSPEC_SYNC_NEW_OP_12) (UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE, UNSPEC_SYNC_EXCHANGE_12) (UNSPEC_MEMORY_BARRIER): Moved to sync.md. (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ, UNSPEC_SUBQ_S, UNSPEC_ADDSC) (UNSPEC_ADDWC, UNSPEC_MODSUB, UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S) (UNSPEC_PRECRQ_QB_PH, UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W) (UNSPEC_PRECRQU_S_QB_PH, UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR) (UNSPEC_PRECEQU_PH_QBL, UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA) (UNSPEC_PRECEQU_PH_QBRA, UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR) (UNSPEC_PRECEU_PH_QBLA, UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL) (UNSPEC_SHLL_S, UNSPEC_SHRL_QB, UNSPEC_SHRA_PH, UNSPEC_SHRA_R) (UNSPEC_MULEU_S_PH_QBL, UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH) (UNSPEC_MULEQ_S_W_PHL, UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL) (UNSPEC_DPAU_H_QBR, UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR) (UNSPEC_DPAQ_S_W_PH, UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH) (UNSPEC_DPAQ_SA_L_W, UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL) (UNSPEC_MAQ_S_W_PHR, UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR) (UNSPEC_BITREV, UNSPEC_INSV, UNSPEC_REPL_QB, UNSPEC_REPL_PH) (UNSPEC_CMP_EQ, UNSPEC_CMP_LT, UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB) (UNSPEC_CMPGU_LT_QB, UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH) (UNSPEC_EXTR_W, UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H) (UNSPEC_EXTP, UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Move to mips-dsp.md. (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH, UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB) (UNSPEC_ADDUH_R_QB, UNSPEC_APPEND, UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB) (UNSPEC_CMPGDU_LT_QB, UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH) (UNSPEC_DPS_W_PH, UNSPEC_MADD, UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU) (UNSPEC_MUL_PH, UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH) (UNSPEC_MULQ_S_W, UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU) (UNSPEC_PRECR_QB_PH, UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W) (UNSPEC_PREPEND, UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH) (UNSPEC_SUBU_PH, UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB) (UNSPEC_ADDQH_PH, UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W) (UNSPEC_SUBQH_PH, UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W) (UNSPEC_DPAX_W_PH, UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH) (UNSPEC_DPAQX_SA_W_PH, UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved to mips-dspr2.md. (UNSPEC_MOVE_TF_PS, UNSPEC_C, UNSPEC_ALNV_PS, UNSPEC_CABS) (UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS, UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS) (UNSPEC_ABS_PS, UNSPEC_RSQRT1, UNSPEC_RSQRT2, UNSPEC_RECIP1) (UNSPEC_RECIP2, UNSPEC_SINGLE_CC, UNSPEC_SCC): Moved from mips-ps-3d.md. (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ, UNSPEC_LOONGSON_PCMPGT) (UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Move to mips-loongson.md. (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved to mips-loongson2ef.md. (cpu): Update comment. * config/mips/sync.md (UNSPEC_COMPARE_AND_SWAP) (UNSPEC_COMPARE_AND_SWAP_12, UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP) (UNSPEC_SYNC_NEW_OP_12, UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE) (UNSPEC_SYNC_EXCHANGE_12, UNSPEC_MEMORY_BARRIER): Moved from mips.md. * config/mips/loongson.md (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ) (UNSPEC_LOONGSON_PCMPGT, UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Moved from mips.md * config/mips/loongson2ef.md (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved from mips.md * config/mips/mips-dsp.md (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ) (UNSPEC_SUBQ_S, UNSPEC_ADDSC, UNSPEC_ADDWC, UNSPEC_MODSUB) (UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S, UNSPEC_PRECRQ_QB_PH) (UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W, UNSPEC_PRECRQU_S_QB_PH) (UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR, UNSPEC_PRECEQU_PH_QBL) (UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA, UNSPEC_PRECEQU_PH_QBRA) (UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR, UNSPEC_PRECEU_PH_QBLA) (UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL, UNSPEC_SHLL_S, UNSPEC_SHRL_QB) (UNSPEC_SHRA_PH, UNSPEC_SHRA_R, UNSPEC_MULEU_S_PH_QBL) (UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH, UNSPEC_MULEQ_S_W_PHL) (UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL, UNSPEC_DPAU_H_QBR) (UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR, UNSPEC_DPAQ_S_W_PH) (UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH, UNSPEC_DPAQ_SA_L_W) (UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL, UNSPEC_MAQ_S_W_PHR) (UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR, UNSPEC_BITREV, UNSPEC_INSV) (UNSPEC_REPL_QB, UNSPEC_REPL_PH, UNSPEC_CMP_EQ, UNSPEC_CMP_LT) (UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB, UNSPEC_CMPGU_LT_QB) (UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH, UNSPEC_EXTR_W) (UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H, UNSPEC_EXTP) (UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Moved from mips.md. * config/mips/mips-dspr2.md (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH) (UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB, UNSPEC_ADDUH_R_QB, UNSPEC_APPEND) (UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB, UNSPEC_CMPGDU_LT_QB) (UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH, UNSPEC_DPS_W_PH, UNSPEC_MADD) (UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU, UNSPEC_MUL_PH) (UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH, UNSPEC_MULQ_S_W) (UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU, UNSPEC_PRECR_QB_PH) (UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W, UNSPEC_PREPEND) (UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH, UNSPEC_SUBU_PH) (UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB, UNSPEC_ADDQH_PH) (UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W, UNSPEC_SUBQH_PH) (UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W, UNSPEC_DPAX_W_PH) (UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH, UNSPEC_DPAQX_SA_W_PH) (UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved from mips.md. * config/mips/mips-ps-3d.md (UNSPEC_MOVE_TF_PS, UNSPEC_C) (UNSPEC_ALNV_PS, UNSPEC_CABS, UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS) (UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS, UNSPEC_ABS_PS, UNSPEC_RSQRT1) (UNSPEC_RSQRT2, UNSPEC_RECIP1, UNSPEC_RECIP2, UNSPEC_SINGLE_CC) (UNSPEC_SCC): Moved from mips.md. * config/mips/mips.c (mips_arch, mips_tune): Change enum from "processor_type" to "processor". (mips_rtx_cost_data): Replace PROCESSOR_MAX with NUM_PROCESSOR_VALUES. * config/mips/mips.h (processor_type): Delete. (mips_cpu_info.cpu, mips_arch, mips_tune): Change enum from "processor_type" to "processor". From-SVN: r160580
2010-06-10 22:24:01 +02:00
exit (1);
}
unread_char (c);
read_name (&name);
ev = XNEW (struct enum_value);
ev->next = 0;
if (md_p)
{
value_name = concat (def->name, "_", name.string, NULL);
upcase_string (value_name);
ev->name = xstrdup (name.string);
}
else
{
value_name = xstrdup (name.string);
ev->name = value_name;
}
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
ev->def = add_constant (get_md_constants (), value_name,
md_decimal_string (def->num_values), def);
md.texi (define_c_enum, [...]): Document. gcc/ * doc/md.texi (define_c_enum, define_enum): Document. * read-md.h (md_constant): Add a parent_enum field. (enum_value, enum_type): New structures. (upcase_string, traverse_enum_types): Declare. * read-md.c (enum_types): New variable. (upcase_string, add_constant): New functions. (handle_constants): Don't create the hash table here. Use add_constant. (traverse_md_constants): Don't check for a null md_constants. (decimal_string, handle_enum, traverse_enum_types): New functions. (read_md_files): Initialize md_constants and md_enums. * genconstants.c (print_md_constant): Ignore info argument. Only print constants that belong to no enum. (print_enum_type): New function. (main): Don't pass stdout to print_md_constant. Call print_enum_type for each defined enum type. * config/mips/mips.md (processor): New define_enum. (unspec): New define_c_enum. (UNSPEC_COMPARE_AND_SWAP, UNSPEC_COMPARE_AND_SWAP_12) (UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP, UNSPEC_SYNC_NEW_OP_12) (UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE, UNSPEC_SYNC_EXCHANGE_12) (UNSPEC_MEMORY_BARRIER): Moved to sync.md. (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ, UNSPEC_SUBQ_S, UNSPEC_ADDSC) (UNSPEC_ADDWC, UNSPEC_MODSUB, UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S) (UNSPEC_PRECRQ_QB_PH, UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W) (UNSPEC_PRECRQU_S_QB_PH, UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR) (UNSPEC_PRECEQU_PH_QBL, UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA) (UNSPEC_PRECEQU_PH_QBRA, UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR) (UNSPEC_PRECEU_PH_QBLA, UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL) (UNSPEC_SHLL_S, UNSPEC_SHRL_QB, UNSPEC_SHRA_PH, UNSPEC_SHRA_R) (UNSPEC_MULEU_S_PH_QBL, UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH) (UNSPEC_MULEQ_S_W_PHL, UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL) (UNSPEC_DPAU_H_QBR, UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR) (UNSPEC_DPAQ_S_W_PH, UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH) (UNSPEC_DPAQ_SA_L_W, UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL) (UNSPEC_MAQ_S_W_PHR, UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR) (UNSPEC_BITREV, UNSPEC_INSV, UNSPEC_REPL_QB, UNSPEC_REPL_PH) (UNSPEC_CMP_EQ, UNSPEC_CMP_LT, UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB) (UNSPEC_CMPGU_LT_QB, UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH) (UNSPEC_EXTR_W, UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H) (UNSPEC_EXTP, UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Move to mips-dsp.md. (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH, UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB) (UNSPEC_ADDUH_R_QB, UNSPEC_APPEND, UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB) (UNSPEC_CMPGDU_LT_QB, UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH) (UNSPEC_DPS_W_PH, UNSPEC_MADD, UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU) (UNSPEC_MUL_PH, UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH) (UNSPEC_MULQ_S_W, UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU) (UNSPEC_PRECR_QB_PH, UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W) (UNSPEC_PREPEND, UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH) (UNSPEC_SUBU_PH, UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB) (UNSPEC_ADDQH_PH, UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W) (UNSPEC_SUBQH_PH, UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W) (UNSPEC_DPAX_W_PH, UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH) (UNSPEC_DPAQX_SA_W_PH, UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved to mips-dspr2.md. (UNSPEC_MOVE_TF_PS, UNSPEC_C, UNSPEC_ALNV_PS, UNSPEC_CABS) (UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS, UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS) (UNSPEC_ABS_PS, UNSPEC_RSQRT1, UNSPEC_RSQRT2, UNSPEC_RECIP1) (UNSPEC_RECIP2, UNSPEC_SINGLE_CC, UNSPEC_SCC): Moved from mips-ps-3d.md. (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ, UNSPEC_LOONGSON_PCMPGT) (UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Move to mips-loongson.md. (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved to mips-loongson2ef.md. (cpu): Update comment. * config/mips/sync.md (UNSPEC_COMPARE_AND_SWAP) (UNSPEC_COMPARE_AND_SWAP_12, UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP) (UNSPEC_SYNC_NEW_OP_12, UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE) (UNSPEC_SYNC_EXCHANGE_12, UNSPEC_MEMORY_BARRIER): Moved from mips.md. * config/mips/loongson.md (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ) (UNSPEC_LOONGSON_PCMPGT, UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Moved from mips.md * config/mips/loongson2ef.md (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved from mips.md * config/mips/mips-dsp.md (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ) (UNSPEC_SUBQ_S, UNSPEC_ADDSC, UNSPEC_ADDWC, UNSPEC_MODSUB) (UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S, UNSPEC_PRECRQ_QB_PH) (UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W, UNSPEC_PRECRQU_S_QB_PH) (UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR, UNSPEC_PRECEQU_PH_QBL) (UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA, UNSPEC_PRECEQU_PH_QBRA) (UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR, UNSPEC_PRECEU_PH_QBLA) (UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL, UNSPEC_SHLL_S, UNSPEC_SHRL_QB) (UNSPEC_SHRA_PH, UNSPEC_SHRA_R, UNSPEC_MULEU_S_PH_QBL) (UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH, UNSPEC_MULEQ_S_W_PHL) (UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL, UNSPEC_DPAU_H_QBR) (UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR, UNSPEC_DPAQ_S_W_PH) (UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH, UNSPEC_DPAQ_SA_L_W) (UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL, UNSPEC_MAQ_S_W_PHR) (UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR, UNSPEC_BITREV, UNSPEC_INSV) (UNSPEC_REPL_QB, UNSPEC_REPL_PH, UNSPEC_CMP_EQ, UNSPEC_CMP_LT) (UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB, UNSPEC_CMPGU_LT_QB) (UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH, UNSPEC_EXTR_W) (UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H, UNSPEC_EXTP) (UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Moved from mips.md. * config/mips/mips-dspr2.md (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH) (UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB, UNSPEC_ADDUH_R_QB, UNSPEC_APPEND) (UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB, UNSPEC_CMPGDU_LT_QB) (UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH, UNSPEC_DPS_W_PH, UNSPEC_MADD) (UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU, UNSPEC_MUL_PH) (UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH, UNSPEC_MULQ_S_W) (UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU, UNSPEC_PRECR_QB_PH) (UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W, UNSPEC_PREPEND) (UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH, UNSPEC_SUBU_PH) (UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB, UNSPEC_ADDQH_PH) (UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W, UNSPEC_SUBQH_PH) (UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W, UNSPEC_DPAX_W_PH) (UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH, UNSPEC_DPAQX_SA_W_PH) (UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved from mips.md. * config/mips/mips-ps-3d.md (UNSPEC_MOVE_TF_PS, UNSPEC_C) (UNSPEC_ALNV_PS, UNSPEC_CABS, UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS) (UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS, UNSPEC_ABS_PS, UNSPEC_RSQRT1) (UNSPEC_RSQRT2, UNSPEC_RECIP1, UNSPEC_RECIP2, UNSPEC_SINGLE_CC) (UNSPEC_SCC): Moved from mips.md. * config/mips/mips.c (mips_arch, mips_tune): Change enum from "processor_type" to "processor". (mips_rtx_cost_data): Replace PROCESSOR_MAX with NUM_PROCESSOR_VALUES. * config/mips/mips.h (processor_type): Delete. (mips_cpu_info.cpu, mips_arch, mips_tune): Change enum from "processor_type" to "processor". From-SVN: r160580
2010-06-10 22:24:01 +02:00
*def->tail_ptr = ev;
def->tail_ptr = &ev->next;
def->num_values++;
}
}
/* Try to find the definition of the given enum. Return null on failure. */
struct enum_type *
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
rtx_reader::lookup_enum_type (const char *name)
{
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
return (struct enum_type *) htab_find (m_enum_types, &name);
}
md.texi (define_c_enum, [...]): Document. gcc/ * doc/md.texi (define_c_enum, define_enum): Document. * read-md.h (md_constant): Add a parent_enum field. (enum_value, enum_type): New structures. (upcase_string, traverse_enum_types): Declare. * read-md.c (enum_types): New variable. (upcase_string, add_constant): New functions. (handle_constants): Don't create the hash table here. Use add_constant. (traverse_md_constants): Don't check for a null md_constants. (decimal_string, handle_enum, traverse_enum_types): New functions. (read_md_files): Initialize md_constants and md_enums. * genconstants.c (print_md_constant): Ignore info argument. Only print constants that belong to no enum. (print_enum_type): New function. (main): Don't pass stdout to print_md_constant. Call print_enum_type for each defined enum type. * config/mips/mips.md (processor): New define_enum. (unspec): New define_c_enum. (UNSPEC_COMPARE_AND_SWAP, UNSPEC_COMPARE_AND_SWAP_12) (UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP, UNSPEC_SYNC_NEW_OP_12) (UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE, UNSPEC_SYNC_EXCHANGE_12) (UNSPEC_MEMORY_BARRIER): Moved to sync.md. (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ, UNSPEC_SUBQ_S, UNSPEC_ADDSC) (UNSPEC_ADDWC, UNSPEC_MODSUB, UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S) (UNSPEC_PRECRQ_QB_PH, UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W) (UNSPEC_PRECRQU_S_QB_PH, UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR) (UNSPEC_PRECEQU_PH_QBL, UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA) (UNSPEC_PRECEQU_PH_QBRA, UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR) (UNSPEC_PRECEU_PH_QBLA, UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL) (UNSPEC_SHLL_S, UNSPEC_SHRL_QB, UNSPEC_SHRA_PH, UNSPEC_SHRA_R) (UNSPEC_MULEU_S_PH_QBL, UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH) (UNSPEC_MULEQ_S_W_PHL, UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL) (UNSPEC_DPAU_H_QBR, UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR) (UNSPEC_DPAQ_S_W_PH, UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH) (UNSPEC_DPAQ_SA_L_W, UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL) (UNSPEC_MAQ_S_W_PHR, UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR) (UNSPEC_BITREV, UNSPEC_INSV, UNSPEC_REPL_QB, UNSPEC_REPL_PH) (UNSPEC_CMP_EQ, UNSPEC_CMP_LT, UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB) (UNSPEC_CMPGU_LT_QB, UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH) (UNSPEC_EXTR_W, UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H) (UNSPEC_EXTP, UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Move to mips-dsp.md. (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH, UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB) (UNSPEC_ADDUH_R_QB, UNSPEC_APPEND, UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB) (UNSPEC_CMPGDU_LT_QB, UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH) (UNSPEC_DPS_W_PH, UNSPEC_MADD, UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU) (UNSPEC_MUL_PH, UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH) (UNSPEC_MULQ_S_W, UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU) (UNSPEC_PRECR_QB_PH, UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W) (UNSPEC_PREPEND, UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH) (UNSPEC_SUBU_PH, UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB) (UNSPEC_ADDQH_PH, UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W) (UNSPEC_SUBQH_PH, UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W) (UNSPEC_DPAX_W_PH, UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH) (UNSPEC_DPAQX_SA_W_PH, UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved to mips-dspr2.md. (UNSPEC_MOVE_TF_PS, UNSPEC_C, UNSPEC_ALNV_PS, UNSPEC_CABS) (UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS, UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS) (UNSPEC_ABS_PS, UNSPEC_RSQRT1, UNSPEC_RSQRT2, UNSPEC_RECIP1) (UNSPEC_RECIP2, UNSPEC_SINGLE_CC, UNSPEC_SCC): Moved from mips-ps-3d.md. (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ, UNSPEC_LOONGSON_PCMPGT) (UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Move to mips-loongson.md. (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved to mips-loongson2ef.md. (cpu): Update comment. * config/mips/sync.md (UNSPEC_COMPARE_AND_SWAP) (UNSPEC_COMPARE_AND_SWAP_12, UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP) (UNSPEC_SYNC_NEW_OP_12, UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE) (UNSPEC_SYNC_EXCHANGE_12, UNSPEC_MEMORY_BARRIER): Moved from mips.md. * config/mips/loongson.md (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ) (UNSPEC_LOONGSON_PCMPGT, UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Moved from mips.md * config/mips/loongson2ef.md (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved from mips.md * config/mips/mips-dsp.md (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ) (UNSPEC_SUBQ_S, UNSPEC_ADDSC, UNSPEC_ADDWC, UNSPEC_MODSUB) (UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S, UNSPEC_PRECRQ_QB_PH) (UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W, UNSPEC_PRECRQU_S_QB_PH) (UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR, UNSPEC_PRECEQU_PH_QBL) (UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA, UNSPEC_PRECEQU_PH_QBRA) (UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR, UNSPEC_PRECEU_PH_QBLA) (UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL, UNSPEC_SHLL_S, UNSPEC_SHRL_QB) (UNSPEC_SHRA_PH, UNSPEC_SHRA_R, UNSPEC_MULEU_S_PH_QBL) (UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH, UNSPEC_MULEQ_S_W_PHL) (UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL, UNSPEC_DPAU_H_QBR) (UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR, UNSPEC_DPAQ_S_W_PH) (UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH, UNSPEC_DPAQ_SA_L_W) (UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL, UNSPEC_MAQ_S_W_PHR) (UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR, UNSPEC_BITREV, UNSPEC_INSV) (UNSPEC_REPL_QB, UNSPEC_REPL_PH, UNSPEC_CMP_EQ, UNSPEC_CMP_LT) (UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB, UNSPEC_CMPGU_LT_QB) (UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH, UNSPEC_EXTR_W) (UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H, UNSPEC_EXTP) (UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Moved from mips.md. * config/mips/mips-dspr2.md (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH) (UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB, UNSPEC_ADDUH_R_QB, UNSPEC_APPEND) (UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB, UNSPEC_CMPGDU_LT_QB) (UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH, UNSPEC_DPS_W_PH, UNSPEC_MADD) (UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU, UNSPEC_MUL_PH) (UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH, UNSPEC_MULQ_S_W) (UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU, UNSPEC_PRECR_QB_PH) (UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W, UNSPEC_PREPEND) (UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH, UNSPEC_SUBU_PH) (UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB, UNSPEC_ADDQH_PH) (UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W, UNSPEC_SUBQH_PH) (UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W, UNSPEC_DPAX_W_PH) (UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH, UNSPEC_DPAQX_SA_W_PH) (UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved from mips.md. * config/mips/mips-ps-3d.md (UNSPEC_MOVE_TF_PS, UNSPEC_C) (UNSPEC_ALNV_PS, UNSPEC_CABS, UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS) (UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS, UNSPEC_ABS_PS, UNSPEC_RSQRT1) (UNSPEC_RSQRT2, UNSPEC_RECIP1, UNSPEC_RECIP2, UNSPEC_SINGLE_CC) (UNSPEC_SCC): Moved from mips.md. * config/mips/mips.c (mips_arch, mips_tune): Change enum from "processor_type" to "processor". (mips_rtx_cost_data): Replace PROCESSOR_MAX with NUM_PROCESSOR_VALUES. * config/mips/mips.h (processor_type): Delete. (mips_cpu_info.cpu, mips_arch, mips_tune): Change enum from "processor_type" to "processor". From-SVN: r160580
2010-06-10 22:24:01 +02:00
/* For every enum definition, call CALLBACK with two arguments:
a pointer to the constant definition and INFO. Stop when CALLBACK
returns zero. */
void
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
rtx_reader::traverse_enum_types (htab_trav callback, void *info)
md.texi (define_c_enum, [...]): Document. gcc/ * doc/md.texi (define_c_enum, define_enum): Document. * read-md.h (md_constant): Add a parent_enum field. (enum_value, enum_type): New structures. (upcase_string, traverse_enum_types): Declare. * read-md.c (enum_types): New variable. (upcase_string, add_constant): New functions. (handle_constants): Don't create the hash table here. Use add_constant. (traverse_md_constants): Don't check for a null md_constants. (decimal_string, handle_enum, traverse_enum_types): New functions. (read_md_files): Initialize md_constants and md_enums. * genconstants.c (print_md_constant): Ignore info argument. Only print constants that belong to no enum. (print_enum_type): New function. (main): Don't pass stdout to print_md_constant. Call print_enum_type for each defined enum type. * config/mips/mips.md (processor): New define_enum. (unspec): New define_c_enum. (UNSPEC_COMPARE_AND_SWAP, UNSPEC_COMPARE_AND_SWAP_12) (UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP, UNSPEC_SYNC_NEW_OP_12) (UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE, UNSPEC_SYNC_EXCHANGE_12) (UNSPEC_MEMORY_BARRIER): Moved to sync.md. (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ, UNSPEC_SUBQ_S, UNSPEC_ADDSC) (UNSPEC_ADDWC, UNSPEC_MODSUB, UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S) (UNSPEC_PRECRQ_QB_PH, UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W) (UNSPEC_PRECRQU_S_QB_PH, UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR) (UNSPEC_PRECEQU_PH_QBL, UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA) (UNSPEC_PRECEQU_PH_QBRA, UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR) (UNSPEC_PRECEU_PH_QBLA, UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL) (UNSPEC_SHLL_S, UNSPEC_SHRL_QB, UNSPEC_SHRA_PH, UNSPEC_SHRA_R) (UNSPEC_MULEU_S_PH_QBL, UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH) (UNSPEC_MULEQ_S_W_PHL, UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL) (UNSPEC_DPAU_H_QBR, UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR) (UNSPEC_DPAQ_S_W_PH, UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH) (UNSPEC_DPAQ_SA_L_W, UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL) (UNSPEC_MAQ_S_W_PHR, UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR) (UNSPEC_BITREV, UNSPEC_INSV, UNSPEC_REPL_QB, UNSPEC_REPL_PH) (UNSPEC_CMP_EQ, UNSPEC_CMP_LT, UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB) (UNSPEC_CMPGU_LT_QB, UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH) (UNSPEC_EXTR_W, UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H) (UNSPEC_EXTP, UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Move to mips-dsp.md. (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH, UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB) (UNSPEC_ADDUH_R_QB, UNSPEC_APPEND, UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB) (UNSPEC_CMPGDU_LT_QB, UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH) (UNSPEC_DPS_W_PH, UNSPEC_MADD, UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU) (UNSPEC_MUL_PH, UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH) (UNSPEC_MULQ_S_W, UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU) (UNSPEC_PRECR_QB_PH, UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W) (UNSPEC_PREPEND, UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH) (UNSPEC_SUBU_PH, UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB) (UNSPEC_ADDQH_PH, UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W) (UNSPEC_SUBQH_PH, UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W) (UNSPEC_DPAX_W_PH, UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH) (UNSPEC_DPAQX_SA_W_PH, UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved to mips-dspr2.md. (UNSPEC_MOVE_TF_PS, UNSPEC_C, UNSPEC_ALNV_PS, UNSPEC_CABS) (UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS, UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS) (UNSPEC_ABS_PS, UNSPEC_RSQRT1, UNSPEC_RSQRT2, UNSPEC_RECIP1) (UNSPEC_RECIP2, UNSPEC_SINGLE_CC, UNSPEC_SCC): Moved from mips-ps-3d.md. (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ, UNSPEC_LOONGSON_PCMPGT) (UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Move to mips-loongson.md. (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved to mips-loongson2ef.md. (cpu): Update comment. * config/mips/sync.md (UNSPEC_COMPARE_AND_SWAP) (UNSPEC_COMPARE_AND_SWAP_12, UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP) (UNSPEC_SYNC_NEW_OP_12, UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE) (UNSPEC_SYNC_EXCHANGE_12, UNSPEC_MEMORY_BARRIER): Moved from mips.md. * config/mips/loongson.md (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ) (UNSPEC_LOONGSON_PCMPGT, UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Moved from mips.md * config/mips/loongson2ef.md (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved from mips.md * config/mips/mips-dsp.md (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ) (UNSPEC_SUBQ_S, UNSPEC_ADDSC, UNSPEC_ADDWC, UNSPEC_MODSUB) (UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S, UNSPEC_PRECRQ_QB_PH) (UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W, UNSPEC_PRECRQU_S_QB_PH) (UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR, UNSPEC_PRECEQU_PH_QBL) (UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA, UNSPEC_PRECEQU_PH_QBRA) (UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR, UNSPEC_PRECEU_PH_QBLA) (UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL, UNSPEC_SHLL_S, UNSPEC_SHRL_QB) (UNSPEC_SHRA_PH, UNSPEC_SHRA_R, UNSPEC_MULEU_S_PH_QBL) (UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH, UNSPEC_MULEQ_S_W_PHL) (UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL, UNSPEC_DPAU_H_QBR) (UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR, UNSPEC_DPAQ_S_W_PH) (UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH, UNSPEC_DPAQ_SA_L_W) (UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL, UNSPEC_MAQ_S_W_PHR) (UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR, UNSPEC_BITREV, UNSPEC_INSV) (UNSPEC_REPL_QB, UNSPEC_REPL_PH, UNSPEC_CMP_EQ, UNSPEC_CMP_LT) (UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB, UNSPEC_CMPGU_LT_QB) (UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH, UNSPEC_EXTR_W) (UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H, UNSPEC_EXTP) (UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Moved from mips.md. * config/mips/mips-dspr2.md (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH) (UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB, UNSPEC_ADDUH_R_QB, UNSPEC_APPEND) (UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB, UNSPEC_CMPGDU_LT_QB) (UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH, UNSPEC_DPS_W_PH, UNSPEC_MADD) (UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU, UNSPEC_MUL_PH) (UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH, UNSPEC_MULQ_S_W) (UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU, UNSPEC_PRECR_QB_PH) (UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W, UNSPEC_PREPEND) (UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH, UNSPEC_SUBU_PH) (UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB, UNSPEC_ADDQH_PH) (UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W, UNSPEC_SUBQH_PH) (UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W, UNSPEC_DPAX_W_PH) (UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH, UNSPEC_DPAQX_SA_W_PH) (UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved from mips.md. * config/mips/mips-ps-3d.md (UNSPEC_MOVE_TF_PS, UNSPEC_C) (UNSPEC_ALNV_PS, UNSPEC_CABS, UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS) (UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS, UNSPEC_ABS_PS, UNSPEC_RSQRT1) (UNSPEC_RSQRT2, UNSPEC_RECIP1, UNSPEC_RECIP2, UNSPEC_SINGLE_CC) (UNSPEC_SCC): Moved from mips.md. * config/mips/mips.c (mips_arch, mips_tune): Change enum from "processor_type" to "processor". (mips_rtx_cost_data): Replace PROCESSOR_MAX with NUM_PROCESSOR_VALUES. * config/mips/mips.h (processor_type): Delete. (mips_cpu_info.cpu, mips_arch, mips_tune): Change enum from "processor_type" to "processor". From-SVN: r160580
2010-06-10 22:24:01 +02:00
{
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
htab_traverse (m_enum_types, callback, info);
}
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
/* Constructor for rtx_reader. */
rtx_reader::rtx_reader ()
: m_toplevel_fname (NULL),
m_base_dir (NULL),
m_read_md_file (NULL),
m_read_md_filename (NULL),
m_read_md_lineno (0),
m_read_md_colno (0),
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
m_first_dir_md_include (NULL),
m_last_dir_md_include_ptr (&m_first_dir_md_include)
{
/* Set the global singleton pointer. */
rtx_reader_ptr = this;
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
obstack_init (&m_string_obstack);
m_ptr_locs = htab_create (161, leading_ptr_hash, leading_ptr_eq_p, 0);
obstack_init (&m_ptr_loc_obstack);
m_joined_conditions = htab_create (161, leading_ptr_hash, leading_ptr_eq_p, 0);
obstack_init (&m_joined_conditions_obstack);
m_md_constants = htab_create (31, leading_string_hash,
leading_string_eq_p, (htab_del) 0);
m_enum_types = htab_create (31, leading_string_hash,
leading_string_eq_p, (htab_del) 0);
/* Unlock the stdio streams. */
unlock_std_streams ();
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
}
/* rtx_reader's destructor. */
rtx_reader::~rtx_reader ()
{
read-md.c: Move various state to within class rtx_reader gcc/ChangeLog: * genattrtab.c (attr_string): Use rtx_reader_ptr for call to copy_md_ptr_loc. (gen_attr): Use rtx_reader_ptr for lookup_enum_type call. (write_test_expr): Use rtx_reader_ptr for calls to fprint_c_condition. (write_attr_value): Likewise. * genconditions.c (write_one_condition): Use rtx_reader_ptr for call to print_md_ptr_loc. (write_one_condition): Likewise for calls to print_c_condition. * genconstants.c: Include "statistics.h" and "vec.h". (main): Update for conversion to member functions. * genemit.c (emit_c_code): Use rtx_reader_ptr for call to print_md_ptr_loc. * genenums.c: Include "statistics.h" and "vec.h". (main): Update for conversion of traverse_enum_types to a method. * genmddeps.c: Include "statistics.h" and "vec.h". * genoutput.c (process_template): Use rtx_reader_ptr for call to print_md_ptr_loc. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Likewise for calls to print_c_condition. * genrecog.c (print_test): Likewise. * gensupport.c (process_rtx): Likewise for calls to copy_md_ptr_loc and join_c_conditions. (alter_test_for_insn): Likewise for call to join_c_conditions. (process_substs_on_one_elem): Likewise. (gen_mnemonic_setattr): Update for move of string_obstack to a field of rtx_reader. (mnemonic_htab_callback): Likewise. Fix formatting. (gen_mnemonic_attr): Likewise. * gentarget-def.c (def_target_insn): Use rtx_reader_ptr for calls to print_c_condition. * read-md.c: Include "statistics.h" and "vec.h". (string_obstack): Convert this global to field "m_string_obstack" of class rtx_reader. (ptr_locs): Likewise, as "m_ptr_locs". (ptr_loc_obstack): Likewise, as "m_ptr_loc_obstack". (joined_conditions): Likewise, as "m_joined_conditions". (joined_conditions_obstack): Likewise, as "m_joined_conditions_obstack". (md_constants): Likewise, as "m_md_constants". (enum_types): Likewise, as "m_enum_types". (set_md_ptr_loc): Convert to... (rtx_reader::set_md_ptr_loc): ...member function. (get_md_ptr_loc): Convert to... (rtx_reader::get_md_ptr_loc): ...member function. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (join_c_conditions): Convert to... (rtx_reader::join_c_conditions): ...member function. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (read_name): Convert to... (rtx_reader::read_name): ...member function. (read_escape): Convert to... (rtx_reader::read_escape): ...member function. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (read_braced_string): Convert to... (rtx_reader::read_braced_string): ...member function. (read_string): Convert to... (rtx_reader::read_string): ...member function. (read_skip_construct): Convert to... (rtx_reader::read_skip_construct): ...member function. (handle_constants): Convert to... (rtx_reader::handle_constants): ...member function. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (handle_enum): Convert to... (rtx_reader::handle_enum): ...member function. (lookup_enum_type): Convert to... (rtx_reader::lookup_enum_type): ...member function. (traverse_enum_types): Convert to... (rtx_reader::traverse_enum_types): ...member function. (rtx_reader::rtx_reader): Move initializations of various former global data from rtx_reader::read_md_files to here, as fields, along with the call to unlock_std_streams. (rtx_reader::~rtx_reader): Clean up m_base_dir, and clean up the new fields. (rtx_reader::read_md_files): Move initializations of various global data from here to the ctor. * read-md.h (read_name): Convert to... (rtx_reader::read_name): ...member function. (rtx_reader::read_escape): New method decl. (read_quoted_string): Convert to... (rtx_reader::read_quoted_string): ...member function. (rtx_reader::read_braced_string): New method decl. (read_string): Convert to... (rtx_reader::read_string): ...member function. (rtx_reader::read_skip_construct): New method decl. (rtx_reader::set_md_ptr_loc): New method decl. (rtx_reader::get_md_ptr_loc): New method decl. (copy_md_ptr_loc): Convert to... (rtx_reader::copy_md_ptr_loc): ...member function. (fprint_md_ptr_loc): Convert to... (rtx_reader::fprint_md_ptr_loc): ...member function. (print_md_ptr_loc): Convert to... (rtx_reader::print_md_ptr_loc): ...member function. (rtx_reader::lookup_enum_type): New method decl. (rtx_reader::traverse_enum_types): New method decl. (rtx_reader::handle_constants): New method decl. (traverse_md_constants): Convert to... (rtx_reader::traverse_md_constants): ...member function. (rtx_reader::handle_enum): New method decl. (rtx_reader::join_c_conditions): New method decl. (fprint_c_condition): Convert to... (rtx_reader::fprint_c_condition): ...member function. (print_c_condition): Convert to... (rtx_reader::print_c_condition): ...member function. (rtx_reader::apply_iterator_to_string): New method decl. (rtx_reader::copy_rtx_for_iterators): New method decl. (rtx_reader::read_conditions): New method decl. (rtx_reader::record_potential_iterator_use): New method decl. (rtx_reader::read_mapping): New method decl. (rtx_reader::read_rtx): New method decl. (rtx_reader::read_rtx_code): New method decl. (rtx_reader::read_rtx_operand): New method decl. (rtx_reader::read_nested_rtx): New method decl. (rtx_reader::read_rtx_variadic): New method decl. (rtx_reader::get_string_obstack): New method. (rtx_reader::get_md_constants): New method. (string_obstack): Convert global variable decl to... (rtx_reader::m_string_obstack): ...this new field. (rtx_reader::m_ptr_locs): New field. (rtx_reader::m_ptr_loc_obstack): New field. (rtx_reader::m_joined_conditions): New field. (rtx_reader::m_joined_conditions_obstack): New field. (rtx_reader::m_md_constants): New field. (rtx_reader::m_enum_types): New field. * read-rtl.c (apply_iterator_to_string): Convert to... (rtx_reader::apply_iterator_to_string): ...member function. (copy_rtx_for_iterators): Convert to... (rtx_reader::copy_rtx_for_iterators): ...member function. (add_condition_to_string): Use rtx_reader_ptr for calls join_c_conditions. (apply_iterators): Use rtx_reader_ptr for calls to join_c_conditions and copy_rtx_for_iterators. (read_conditions): Convert to... (rtx_reader::read_conditions): ...member function. (record_potential_iterator_use): Convert to... (rtx_reader::record_potential_iterator_use): ...member function. (read_mapping): Convert to... (rtx_reader::read_mapping): ...member function. (read_subst_mapping): Use rtx_reader_ptr for read_string call. (read_rtx): Convert to... (rtx_reader::read_rtx): ...member function. (read_rtx_code): Convert to... (rtx_reader::read_rtx_code): ...member function. (read_rtx_operand): Convert to... (rtx_reader::read_rtx_operand): ...member function. Update for move of string_obstack to a field. (read_nested_rtx): Convert to.. (rtx_reader::read_nested_rtx): ...member function. (read_rtx_variadic): Convert to.. (rtx_reader::read_rtx_variadic): ...member function. From-SVN: r241293
2016-10-18 02:19:17 +02:00
free (m_base_dir);
htab_delete (m_enum_types);
htab_delete (m_md_constants);
obstack_free (&m_joined_conditions_obstack, NULL);
htab_delete (m_joined_conditions);
obstack_free (&m_ptr_loc_obstack, NULL);
htab_delete (m_ptr_locs);
obstack_free (&m_string_obstack, NULL);
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
/* Clear the global singleton pointer. */
rtx_reader_ptr = NULL;
}
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
/* Process an "include" directive, starting with the optional space
after the "include". Read in the file and use HANDLE_DIRECTIVE
to process each unknown directive. LINENO is the line number on
2013-07-21 20:18:04 +02:00
which the "include" occurred. */
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
void
rtx_reader::handle_include (file_location loc)
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
{
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
const char *filename;
const char *old_filename;
int old_lineno, old_colno;
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
char *pathname;
FILE *input_file, *old_file;
filename = read_string (false);
input_file = NULL;
/* If the specified file name is absolute, skip the include stack. */
if (!IS_ABSOLUTE_PATH (filename))
{
struct file_name_list *stackp;
/* Search the directory path, trying to open the file. */
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
for (stackp = m_first_dir_md_include; stackp; stackp = stackp->next)
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
{
static const char sep[2] = { DIR_SEPARATOR, '\0' };
pathname = concat (stackp->fname, sep, filename, NULL);
input_file = fopen (pathname, "r");
if (input_file != NULL)
break;
free (pathname);
}
}
/* If we haven't managed to open the file yet, try combining the
filename with BASE_DIR. */
if (input_file == NULL)
{
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
if (m_base_dir)
pathname = concat (m_base_dir, filename, NULL);
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
else
pathname = xstrdup (filename);
input_file = fopen (pathname, "r");
}
if (input_file == NULL)
{
free (pathname);
read-md.h (file_location): New structure. gcc/ * read-md.h (file_location): New structure. (directive_handler_t): Take a file_location rather than a line number. (message_at, error_at): Declare. (read_skip_construct): Delete. * read-md.c (message_with_line_1): Replace with... (message_at_1): ...this new function. (message_at, error_at): New functions. (message_with_line, error_with_line): Update to use message_at_1. (handle_enum): Take a file_location rather than a line number and use error_at for error reporting. (handle_include): Likewise. (read_skip_construct): Likewise. Make static. (handle_file): Update after above changes. Pass a file_location rather than a line number to handle_directive. * gensupport.c (queue_elem): Replace separate filename and lineno with a file_location. (queue_pattern): Replace filename and lineno arguments with a file_location. Update after change to queue_elem. (process_define_predicate): Replace lineno argument with a file_location and use error_at for error reporting. Update after above changes. (process_rtx): Likewise. (subst_pattern_match): Likewise. (get_alternatives_number): Likewise. (alter_predicate_for_insn): Likewise. (rtx_handle_directive): Likewise. (is_predicable): Update after above changes, using error_at rather than error_with_line. (has_subst_attribute): Likewise. (identify_predicable_attribute): Likewise. (alter_attrs_for_subst_insn): Likewise. (process_one_cond_exec): Likewise. (process_substs_on_one_elem): Likewise. (process_define_subst): Likewise. (check_define_attr_duplicates): Likewise. (read_md_rtx): Update after change to queue_elem. From-SVN: r225879
2015-07-16 15:41:41 +02:00
error_at (loc, "include file `%s' not found", filename);
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
return;
}
/* Save the old cursor. Note that the LINENO argument to this
function is the beginning of the include statement, while
read_md_lineno has already been advanced. */
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
old_file = m_read_md_file;
old_filename = m_read_md_filename;
old_lineno = m_read_md_lineno;
old_colno = m_read_md_colno;
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
if (include_callback)
include_callback (pathname);
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
m_read_md_file = input_file;
m_read_md_filename = pathname;
handle_file ();
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
/* Restore the old cursor. */
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
m_read_md_file = old_file;
m_read_md_filename = old_filename;
m_read_md_lineno = old_lineno;
m_read_md_colno = old_colno;
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
/* Do not free the pathname. It is attached to the various rtx
queue elements. */
}
/* Process the current file, assuming that read_md_file and
read_md_filename are valid. Use HANDLE_DIRECTIVE to handle
unknown directives. */
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
void
rtx_reader::handle_file ()
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
{
struct md_name directive;
read-md.h (file_location): New structure. gcc/ * read-md.h (file_location): New structure. (directive_handler_t): Take a file_location rather than a line number. (message_at, error_at): Declare. (read_skip_construct): Delete. * read-md.c (message_with_line_1): Replace with... (message_at_1): ...this new function. (message_at, error_at): New functions. (message_with_line, error_with_line): Update to use message_at_1. (handle_enum): Take a file_location rather than a line number and use error_at for error reporting. (handle_include): Likewise. (read_skip_construct): Likewise. Make static. (handle_file): Update after above changes. Pass a file_location rather than a line number to handle_directive. * gensupport.c (queue_elem): Replace separate filename and lineno with a file_location. (queue_pattern): Replace filename and lineno arguments with a file_location. Update after change to queue_elem. (process_define_predicate): Replace lineno argument with a file_location and use error_at for error reporting. Update after above changes. (process_rtx): Likewise. (subst_pattern_match): Likewise. (get_alternatives_number): Likewise. (alter_predicate_for_insn): Likewise. (rtx_handle_directive): Likewise. (is_predicable): Update after above changes, using error_at rather than error_with_line. (has_subst_attribute): Likewise. (identify_predicable_attribute): Likewise. (alter_attrs_for_subst_insn): Likewise. (process_one_cond_exec): Likewise. (process_substs_on_one_elem): Likewise. (process_define_subst): Likewise. (check_define_attr_duplicates): Likewise. (read_md_rtx): Update after change to queue_elem. From-SVN: r225879
2015-07-16 15:41:41 +02:00
int c;
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
m_read_md_lineno = 1;
m_read_md_colno = 0;
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
while ((c = read_skip_spaces ()) != EOF)
{
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
file_location loc = get_current_location ();
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
if (c != '(')
fatal_expected_char ('(', c);
read_name (&directive);
if (strcmp (directive.string, "define_constants") == 0)
handle_constants ();
md.texi (define_c_enum, [...]): Document. gcc/ * doc/md.texi (define_c_enum, define_enum): Document. * read-md.h (md_constant): Add a parent_enum field. (enum_value, enum_type): New structures. (upcase_string, traverse_enum_types): Declare. * read-md.c (enum_types): New variable. (upcase_string, add_constant): New functions. (handle_constants): Don't create the hash table here. Use add_constant. (traverse_md_constants): Don't check for a null md_constants. (decimal_string, handle_enum, traverse_enum_types): New functions. (read_md_files): Initialize md_constants and md_enums. * genconstants.c (print_md_constant): Ignore info argument. Only print constants that belong to no enum. (print_enum_type): New function. (main): Don't pass stdout to print_md_constant. Call print_enum_type for each defined enum type. * config/mips/mips.md (processor): New define_enum. (unspec): New define_c_enum. (UNSPEC_COMPARE_AND_SWAP, UNSPEC_COMPARE_AND_SWAP_12) (UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP, UNSPEC_SYNC_NEW_OP_12) (UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE, UNSPEC_SYNC_EXCHANGE_12) (UNSPEC_MEMORY_BARRIER): Moved to sync.md. (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ, UNSPEC_SUBQ_S, UNSPEC_ADDSC) (UNSPEC_ADDWC, UNSPEC_MODSUB, UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S) (UNSPEC_PRECRQ_QB_PH, UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W) (UNSPEC_PRECRQU_S_QB_PH, UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR) (UNSPEC_PRECEQU_PH_QBL, UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA) (UNSPEC_PRECEQU_PH_QBRA, UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR) (UNSPEC_PRECEU_PH_QBLA, UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL) (UNSPEC_SHLL_S, UNSPEC_SHRL_QB, UNSPEC_SHRA_PH, UNSPEC_SHRA_R) (UNSPEC_MULEU_S_PH_QBL, UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH) (UNSPEC_MULEQ_S_W_PHL, UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL) (UNSPEC_DPAU_H_QBR, UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR) (UNSPEC_DPAQ_S_W_PH, UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH) (UNSPEC_DPAQ_SA_L_W, UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL) (UNSPEC_MAQ_S_W_PHR, UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR) (UNSPEC_BITREV, UNSPEC_INSV, UNSPEC_REPL_QB, UNSPEC_REPL_PH) (UNSPEC_CMP_EQ, UNSPEC_CMP_LT, UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB) (UNSPEC_CMPGU_LT_QB, UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH) (UNSPEC_EXTR_W, UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H) (UNSPEC_EXTP, UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Move to mips-dsp.md. (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH, UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB) (UNSPEC_ADDUH_R_QB, UNSPEC_APPEND, UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB) (UNSPEC_CMPGDU_LT_QB, UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH) (UNSPEC_DPS_W_PH, UNSPEC_MADD, UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU) (UNSPEC_MUL_PH, UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH) (UNSPEC_MULQ_S_W, UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU) (UNSPEC_PRECR_QB_PH, UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W) (UNSPEC_PREPEND, UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH) (UNSPEC_SUBU_PH, UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB) (UNSPEC_ADDQH_PH, UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W) (UNSPEC_SUBQH_PH, UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W) (UNSPEC_DPAX_W_PH, UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH) (UNSPEC_DPAQX_SA_W_PH, UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved to mips-dspr2.md. (UNSPEC_MOVE_TF_PS, UNSPEC_C, UNSPEC_ALNV_PS, UNSPEC_CABS) (UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS, UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS) (UNSPEC_ABS_PS, UNSPEC_RSQRT1, UNSPEC_RSQRT2, UNSPEC_RECIP1) (UNSPEC_RECIP2, UNSPEC_SINGLE_CC, UNSPEC_SCC): Moved from mips-ps-3d.md. (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ, UNSPEC_LOONGSON_PCMPGT) (UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Move to mips-loongson.md. (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved to mips-loongson2ef.md. (cpu): Update comment. * config/mips/sync.md (UNSPEC_COMPARE_AND_SWAP) (UNSPEC_COMPARE_AND_SWAP_12, UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP) (UNSPEC_SYNC_NEW_OP_12, UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE) (UNSPEC_SYNC_EXCHANGE_12, UNSPEC_MEMORY_BARRIER): Moved from mips.md. * config/mips/loongson.md (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ) (UNSPEC_LOONGSON_PCMPGT, UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Moved from mips.md * config/mips/loongson2ef.md (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved from mips.md * config/mips/mips-dsp.md (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ) (UNSPEC_SUBQ_S, UNSPEC_ADDSC, UNSPEC_ADDWC, UNSPEC_MODSUB) (UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S, UNSPEC_PRECRQ_QB_PH) (UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W, UNSPEC_PRECRQU_S_QB_PH) (UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR, UNSPEC_PRECEQU_PH_QBL) (UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA, UNSPEC_PRECEQU_PH_QBRA) (UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR, UNSPEC_PRECEU_PH_QBLA) (UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL, UNSPEC_SHLL_S, UNSPEC_SHRL_QB) (UNSPEC_SHRA_PH, UNSPEC_SHRA_R, UNSPEC_MULEU_S_PH_QBL) (UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH, UNSPEC_MULEQ_S_W_PHL) (UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL, UNSPEC_DPAU_H_QBR) (UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR, UNSPEC_DPAQ_S_W_PH) (UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH, UNSPEC_DPAQ_SA_L_W) (UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL, UNSPEC_MAQ_S_W_PHR) (UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR, UNSPEC_BITREV, UNSPEC_INSV) (UNSPEC_REPL_QB, UNSPEC_REPL_PH, UNSPEC_CMP_EQ, UNSPEC_CMP_LT) (UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB, UNSPEC_CMPGU_LT_QB) (UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH, UNSPEC_EXTR_W) (UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H, UNSPEC_EXTP) (UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Moved from mips.md. * config/mips/mips-dspr2.md (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH) (UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB, UNSPEC_ADDUH_R_QB, UNSPEC_APPEND) (UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB, UNSPEC_CMPGDU_LT_QB) (UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH, UNSPEC_DPS_W_PH, UNSPEC_MADD) (UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU, UNSPEC_MUL_PH) (UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH, UNSPEC_MULQ_S_W) (UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU, UNSPEC_PRECR_QB_PH) (UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W, UNSPEC_PREPEND) (UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH, UNSPEC_SUBU_PH) (UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB, UNSPEC_ADDQH_PH) (UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W, UNSPEC_SUBQH_PH) (UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W, UNSPEC_DPAX_W_PH) (UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH, UNSPEC_DPAQX_SA_W_PH) (UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved from mips.md. * config/mips/mips-ps-3d.md (UNSPEC_MOVE_TF_PS, UNSPEC_C) (UNSPEC_ALNV_PS, UNSPEC_CABS, UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS) (UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS, UNSPEC_ABS_PS, UNSPEC_RSQRT1) (UNSPEC_RSQRT2, UNSPEC_RECIP1, UNSPEC_RECIP2, UNSPEC_SINGLE_CC) (UNSPEC_SCC): Moved from mips.md. * config/mips/mips.c (mips_arch, mips_tune): Change enum from "processor_type" to "processor". (mips_rtx_cost_data): Replace PROCESSOR_MAX with NUM_PROCESSOR_VALUES. * config/mips/mips.h (processor_type): Delete. (mips_cpu_info.cpu, mips_arch, mips_tune): Change enum from "processor_type" to "processor". From-SVN: r160580
2010-06-10 22:24:01 +02:00
else if (strcmp (directive.string, "define_enum") == 0)
read-md.h (file_location): New structure. gcc/ * read-md.h (file_location): New structure. (directive_handler_t): Take a file_location rather than a line number. (message_at, error_at): Declare. (read_skip_construct): Delete. * read-md.c (message_with_line_1): Replace with... (message_at_1): ...this new function. (message_at, error_at): New functions. (message_with_line, error_with_line): Update to use message_at_1. (handle_enum): Take a file_location rather than a line number and use error_at for error reporting. (handle_include): Likewise. (read_skip_construct): Likewise. Make static. (handle_file): Update after above changes. Pass a file_location rather than a line number to handle_directive. * gensupport.c (queue_elem): Replace separate filename and lineno with a file_location. (queue_pattern): Replace filename and lineno arguments with a file_location. Update after change to queue_elem. (process_define_predicate): Replace lineno argument with a file_location and use error_at for error reporting. Update after above changes. (process_rtx): Likewise. (subst_pattern_match): Likewise. (get_alternatives_number): Likewise. (alter_predicate_for_insn): Likewise. (rtx_handle_directive): Likewise. (is_predicable): Update after above changes, using error_at rather than error_with_line. (has_subst_attribute): Likewise. (identify_predicable_attribute): Likewise. (alter_attrs_for_subst_insn): Likewise. (process_one_cond_exec): Likewise. (process_substs_on_one_elem): Likewise. (process_define_subst): Likewise. (check_define_attr_duplicates): Likewise. (read_md_rtx): Update after change to queue_elem. From-SVN: r225879
2015-07-16 15:41:41 +02:00
handle_enum (loc, true);
md.texi (define_c_enum, [...]): Document. gcc/ * doc/md.texi (define_c_enum, define_enum): Document. * read-md.h (md_constant): Add a parent_enum field. (enum_value, enum_type): New structures. (upcase_string, traverse_enum_types): Declare. * read-md.c (enum_types): New variable. (upcase_string, add_constant): New functions. (handle_constants): Don't create the hash table here. Use add_constant. (traverse_md_constants): Don't check for a null md_constants. (decimal_string, handle_enum, traverse_enum_types): New functions. (read_md_files): Initialize md_constants and md_enums. * genconstants.c (print_md_constant): Ignore info argument. Only print constants that belong to no enum. (print_enum_type): New function. (main): Don't pass stdout to print_md_constant. Call print_enum_type for each defined enum type. * config/mips/mips.md (processor): New define_enum. (unspec): New define_c_enum. (UNSPEC_COMPARE_AND_SWAP, UNSPEC_COMPARE_AND_SWAP_12) (UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP, UNSPEC_SYNC_NEW_OP_12) (UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE, UNSPEC_SYNC_EXCHANGE_12) (UNSPEC_MEMORY_BARRIER): Moved to sync.md. (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ, UNSPEC_SUBQ_S, UNSPEC_ADDSC) (UNSPEC_ADDWC, UNSPEC_MODSUB, UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S) (UNSPEC_PRECRQ_QB_PH, UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W) (UNSPEC_PRECRQU_S_QB_PH, UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR) (UNSPEC_PRECEQU_PH_QBL, UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA) (UNSPEC_PRECEQU_PH_QBRA, UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR) (UNSPEC_PRECEU_PH_QBLA, UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL) (UNSPEC_SHLL_S, UNSPEC_SHRL_QB, UNSPEC_SHRA_PH, UNSPEC_SHRA_R) (UNSPEC_MULEU_S_PH_QBL, UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH) (UNSPEC_MULEQ_S_W_PHL, UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL) (UNSPEC_DPAU_H_QBR, UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR) (UNSPEC_DPAQ_S_W_PH, UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH) (UNSPEC_DPAQ_SA_L_W, UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL) (UNSPEC_MAQ_S_W_PHR, UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR) (UNSPEC_BITREV, UNSPEC_INSV, UNSPEC_REPL_QB, UNSPEC_REPL_PH) (UNSPEC_CMP_EQ, UNSPEC_CMP_LT, UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB) (UNSPEC_CMPGU_LT_QB, UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH) (UNSPEC_EXTR_W, UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H) (UNSPEC_EXTP, UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Move to mips-dsp.md. (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH, UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB) (UNSPEC_ADDUH_R_QB, UNSPEC_APPEND, UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB) (UNSPEC_CMPGDU_LT_QB, UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH) (UNSPEC_DPS_W_PH, UNSPEC_MADD, UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU) (UNSPEC_MUL_PH, UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH) (UNSPEC_MULQ_S_W, UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU) (UNSPEC_PRECR_QB_PH, UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W) (UNSPEC_PREPEND, UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH) (UNSPEC_SUBU_PH, UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB) (UNSPEC_ADDQH_PH, UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W) (UNSPEC_SUBQH_PH, UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W) (UNSPEC_DPAX_W_PH, UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH) (UNSPEC_DPAQX_SA_W_PH, UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved to mips-dspr2.md. (UNSPEC_MOVE_TF_PS, UNSPEC_C, UNSPEC_ALNV_PS, UNSPEC_CABS) (UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS, UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS) (UNSPEC_ABS_PS, UNSPEC_RSQRT1, UNSPEC_RSQRT2, UNSPEC_RECIP1) (UNSPEC_RECIP2, UNSPEC_SINGLE_CC, UNSPEC_SCC): Moved from mips-ps-3d.md. (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ, UNSPEC_LOONGSON_PCMPGT) (UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Move to mips-loongson.md. (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved to mips-loongson2ef.md. (cpu): Update comment. * config/mips/sync.md (UNSPEC_COMPARE_AND_SWAP) (UNSPEC_COMPARE_AND_SWAP_12, UNSPEC_SYNC_OLD_OP, UNSPEC_SYNC_NEW_OP) (UNSPEC_SYNC_NEW_OP_12, UNSPEC_SYNC_OLD_OP_12, UNSPEC_SYNC_EXCHANGE) (UNSPEC_SYNC_EXCHANGE_12, UNSPEC_MEMORY_BARRIER): Moved from mips.md. * config/mips/loongson.md (UNSPEC_LOONGSON_PAVG, UNSPEC_LOONGSON_PCMPEQ) (UNSPEC_LOONGSON_PCMPGT, UNSPEC_LOONGSON_PEXTR, UNSPEC_LOONGSON_PINSR_0) (UNSPEC_LOONGSON_PINSR_1, UNSPEC_LOONGSON_PINSR_2) (UNSPEC_LOONGSON_PINSR_3, UNSPEC_LOONGSON_PMADD) (UNSPEC_LOONGSON_PMOVMSK, UNSPEC_LOONGSON_PMULHU) (UNSPEC_LOONGSON_PMULH, UNSPEC_LOONGSON_PMULL, UNSPEC_LOONGSON_PMULU) (UNSPEC_LOONGSON_PASUBUB, UNSPEC_LOONGSON_BIADD, UNSPEC_LOONGSON_PSADBH) (UNSPEC_LOONGSON_PSHUFH, UNSPEC_LOONGSON_PUNPCKH) (UNSPEC_LOONGSON_PUNPCKL, UNSPEC_LOONGSON_PADDD) (UNSPEC_LOONGSON_PSUBD): Moved from mips.md * config/mips/loongson2ef.md (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN) (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): Moved from mips.md * config/mips/mips-dsp.md (UNSPEC_ADDQ, UNSPEC_ADDQ_S, UNSPEC_SUBQ) (UNSPEC_SUBQ_S, UNSPEC_ADDSC, UNSPEC_ADDWC, UNSPEC_MODSUB) (UNSPEC_RADDU_W_QB, UNSPEC_ABSQ_S, UNSPEC_PRECRQ_QB_PH) (UNSPEC_PRECRQ_PH_W, UNSPEC_PRECRQ_RS_PH_W, UNSPEC_PRECRQU_S_QB_PH) (UNSPEC_PRECEQ_W_PHL, UNSPEC_PRECEQ_W_PHR, UNSPEC_PRECEQU_PH_QBL) (UNSPEC_PRECEQU_PH_QBR, UNSPEC_PRECEQU_PH_QBLA, UNSPEC_PRECEQU_PH_QBRA) (UNSPEC_PRECEU_PH_QBL, UNSPEC_PRECEU_PH_QBR, UNSPEC_PRECEU_PH_QBLA) (UNSPEC_PRECEU_PH_QBRA, UNSPEC_SHLL, UNSPEC_SHLL_S, UNSPEC_SHRL_QB) (UNSPEC_SHRA_PH, UNSPEC_SHRA_R, UNSPEC_MULEU_S_PH_QBL) (UNSPEC_MULEU_S_PH_QBR, UNSPEC_MULQ_RS_PH, UNSPEC_MULEQ_S_W_PHL) (UNSPEC_MULEQ_S_W_PHR, UNSPEC_DPAU_H_QBL, UNSPEC_DPAU_H_QBR) (UNSPEC_DPSU_H_QBL, UNSPEC_DPSU_H_QBR, UNSPEC_DPAQ_S_W_PH) (UNSPEC_DPSQ_S_W_PH, UNSPEC_MULSAQ_S_W_PH, UNSPEC_DPAQ_SA_L_W) (UNSPEC_DPSQ_SA_L_W, UNSPEC_MAQ_S_W_PHL, UNSPEC_MAQ_S_W_PHR) (UNSPEC_MAQ_SA_W_PHL, UNSPEC_MAQ_SA_W_PHR, UNSPEC_BITREV, UNSPEC_INSV) (UNSPEC_REPL_QB, UNSPEC_REPL_PH, UNSPEC_CMP_EQ, UNSPEC_CMP_LT) (UNSPEC_CMP_LE, UNSPEC_CMPGU_EQ_QB, UNSPEC_CMPGU_LT_QB) (UNSPEC_CMPGU_LE_QB, UNSPEC_PICK, UNSPEC_PACKRL_PH, UNSPEC_EXTR_W) (UNSPEC_EXTR_R_W, UNSPEC_EXTR_RS_W, UNSPEC_EXTR_S_H, UNSPEC_EXTP) (UNSPEC_EXTPDP, UNSPEC_SHILO, UNSPEC_MTHLIP, UNSPEC_WRDSP) (UNSPEC_RDDSP): Moved from mips.md. * config/mips/mips-dspr2.md (UNSPEC_ABSQ_S_QB, UNSPEC_ADDU_PH) (UNSPEC_ADDU_S_PH, UNSPEC_ADDUH_QB, UNSPEC_ADDUH_R_QB, UNSPEC_APPEND) (UNSPEC_BALIGN, UNSPEC_CMPGDU_EQ_QB, UNSPEC_CMPGDU_LT_QB) (UNSPEC_CMPGDU_LE_QB, UNSPEC_DPA_W_PH, UNSPEC_DPS_W_PH, UNSPEC_MADD) (UNSPEC_MADDU, UNSPEC_MSUB, UNSPEC_MSUBU, UNSPEC_MUL_PH) (UNSPEC_MUL_S_PH, UNSPEC_MULQ_RS_W, UNSPEC_MULQ_S_PH, UNSPEC_MULQ_S_W) (UNSPEC_MULSA_W_PH, UNSPEC_MULT, UNSPEC_MULTU, UNSPEC_PRECR_QB_PH) (UNSPEC_PRECR_SRA_PH_W, UNSPEC_PRECR_SRA_R_PH_W, UNSPEC_PREPEND) (UNSPEC_SHRA_QB, UNSPEC_SHRA_R_QB, UNSPEC_SHRL_PH, UNSPEC_SUBU_PH) (UNSPEC_SUBU_S_PH, UNSPEC_SUBUH_QB, UNSPEC_SUBUH_R_QB, UNSPEC_ADDQH_PH) (UNSPEC_ADDQH_R_PH, UNSPEC_ADDQH_W, UNSPEC_ADDQH_R_W, UNSPEC_SUBQH_PH) (UNSPEC_SUBQH_R_PH, UNSPEC_SUBQH_W, UNSPEC_SUBQH_R_W, UNSPEC_DPAX_W_PH) (UNSPEC_DPSX_W_PH, UNSPEC_DPAQX_S_W_PH, UNSPEC_DPAQX_SA_W_PH) (UNSPEC_DPSQX_S_W_PH, UNSPEC_DPSQX_SA_W_PH): Moved from mips.md. * config/mips/mips-ps-3d.md (UNSPEC_MOVE_TF_PS, UNSPEC_C) (UNSPEC_ALNV_PS, UNSPEC_CABS, UNSPEC_ADDR_PS, UNSPEC_CVT_PW_PS) (UNSPEC_CVT_PS_PW, UNSPEC_MULR_PS, UNSPEC_ABS_PS, UNSPEC_RSQRT1) (UNSPEC_RSQRT2, UNSPEC_RECIP1, UNSPEC_RECIP2, UNSPEC_SINGLE_CC) (UNSPEC_SCC): Moved from mips.md. * config/mips/mips.c (mips_arch, mips_tune): Change enum from "processor_type" to "processor". (mips_rtx_cost_data): Replace PROCESSOR_MAX with NUM_PROCESSOR_VALUES. * config/mips/mips.h (processor_type): Delete. (mips_cpu_info.cpu, mips_arch, mips_tune): Change enum from "processor_type" to "processor". From-SVN: r160580
2010-06-10 22:24:01 +02:00
else if (strcmp (directive.string, "define_c_enum") == 0)
read-md.h (file_location): New structure. gcc/ * read-md.h (file_location): New structure. (directive_handler_t): Take a file_location rather than a line number. (message_at, error_at): Declare. (read_skip_construct): Delete. * read-md.c (message_with_line_1): Replace with... (message_at_1): ...this new function. (message_at, error_at): New functions. (message_with_line, error_with_line): Update to use message_at_1. (handle_enum): Take a file_location rather than a line number and use error_at for error reporting. (handle_include): Likewise. (read_skip_construct): Likewise. Make static. (handle_file): Update after above changes. Pass a file_location rather than a line number to handle_directive. * gensupport.c (queue_elem): Replace separate filename and lineno with a file_location. (queue_pattern): Replace filename and lineno arguments with a file_location. Update after change to queue_elem. (process_define_predicate): Replace lineno argument with a file_location and use error_at for error reporting. Update after above changes. (process_rtx): Likewise. (subst_pattern_match): Likewise. (get_alternatives_number): Likewise. (alter_predicate_for_insn): Likewise. (rtx_handle_directive): Likewise. (is_predicable): Update after above changes, using error_at rather than error_with_line. (has_subst_attribute): Likewise. (identify_predicable_attribute): Likewise. (alter_attrs_for_subst_insn): Likewise. (process_one_cond_exec): Likewise. (process_substs_on_one_elem): Likewise. (process_define_subst): Likewise. (check_define_attr_duplicates): Likewise. (read_md_rtx): Update after change to queue_elem. From-SVN: r225879
2015-07-16 15:41:41 +02:00
handle_enum (loc, false);
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
else if (strcmp (directive.string, "include") == 0)
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
handle_include (loc);
else
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
handle_unknown_directive (loc, directive.string);
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
require_char_ws (')');
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
}
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
fclose (m_read_md_file);
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
}
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
/* Like handle_file, but for top-level files. Set up m_toplevel_fname
and m_base_dir accordingly. */
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
void
rtx_reader::handle_toplevel_file ()
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
{
Changelog c-family/ 2011-03-25 Kai Tietz <ktietz@redhat.com> * c-ada-spec.c (compare_comment): Use filename_cmp instead of strcmp for filename. Changelog fortran/ 2011-03-25 Kai Tietz <ktietz@redhat.com> * scanner.c (preprocessor_line): Use filename_cmp instead of strcmp. Changelog gcc/ 2011-03-25 Kai Tietz <ktietz@redhat.com> * collect2.c (write_c_file_stat): Handle backslash as right-hand directory separator. (resolve_lib_name): Use IS_DIR_SEPARATOR instead of checking just for slash. * coverage.c (coverage_init): Use IS_ABSOLUTE_PATH instead of checking for trailing slash. * gcc.c (record_temp_file): Use filename_cmp instead of strcmp. (do_spec_1): Likewise. (replace_outfile_spec_function): Likewise. (is_directory): Use filename_ncmp instead of strncmp. (print_multilib_info): Likewise. * gcov.c (find_source): Use filename_cmp instead instead of strcmp. (make_gcov_file_name): Fix order of slash/backslash checks. * incpath.c (DIRS_EQ): Use filename_cmp instead of strcmp. (add_standard_paths): Likewise. * mips-tfile.c (saber_stop): Handle backslash. * prefix.c (update_path): Use filename_ncmp instead of strncmp. * profile.c (output_location): Use filename_cmp instead of strcmp. * read-md.c (handle_toplevel_file): Handle backslash. * tlink.c (frob_extension): Likewise. * tree-cfg.c (same_line_p): Use filename_cmp instead of strcmp. * tree-dump.c (dequeue_and_dump): Handle backslash. * tree.c (get_file_function_name): Likewise. * gengtype.c (read_input_list): Likewise. (get_file_realbasename): Likewise. (get_output_file_with_visibility): Use filename_cmp instead of strcmp. ChangeLog java/ 2011-03-25 Kai Tietz <ktietz@redhat.com> * jcf-parse.c (java_read_sourcefilenames): Use filename_cmp instead of strcmp. (set_source_filename): Likewise. * win32-host.c (jcf_open_exact_case): Likewise. ChangeLog lto/ 2011-03-25 Kai Tietz <ktietz@redhat.com> * lto.c (lto_resolution_read): Use filename_cmp instead of strcmp. (lto_read_section_data): Likewise. ChangeLog cp/ 2011-03-25 Kai Tietz <ktietz@redhat.com> * lex.c (interface_strcmp): Handle dos-paths. (handle_pragma_implementation): Use filename_cmp instead of strcmp. (in_main_input_context): Likewise. From-SVN: r171522
2011-03-25 20:20:52 +01:00
const char *base;
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
m_toplevel_fname = m_read_md_filename;
base = lbasename (m_toplevel_fname);
if (base == m_toplevel_fname)
m_base_dir = NULL;
Changelog c-family/ 2011-03-25 Kai Tietz <ktietz@redhat.com> * c-ada-spec.c (compare_comment): Use filename_cmp instead of strcmp for filename. Changelog fortran/ 2011-03-25 Kai Tietz <ktietz@redhat.com> * scanner.c (preprocessor_line): Use filename_cmp instead of strcmp. Changelog gcc/ 2011-03-25 Kai Tietz <ktietz@redhat.com> * collect2.c (write_c_file_stat): Handle backslash as right-hand directory separator. (resolve_lib_name): Use IS_DIR_SEPARATOR instead of checking just for slash. * coverage.c (coverage_init): Use IS_ABSOLUTE_PATH instead of checking for trailing slash. * gcc.c (record_temp_file): Use filename_cmp instead of strcmp. (do_spec_1): Likewise. (replace_outfile_spec_function): Likewise. (is_directory): Use filename_ncmp instead of strncmp. (print_multilib_info): Likewise. * gcov.c (find_source): Use filename_cmp instead instead of strcmp. (make_gcov_file_name): Fix order of slash/backslash checks. * incpath.c (DIRS_EQ): Use filename_cmp instead of strcmp. (add_standard_paths): Likewise. * mips-tfile.c (saber_stop): Handle backslash. * prefix.c (update_path): Use filename_ncmp instead of strncmp. * profile.c (output_location): Use filename_cmp instead of strcmp. * read-md.c (handle_toplevel_file): Handle backslash. * tlink.c (frob_extension): Likewise. * tree-cfg.c (same_line_p): Use filename_cmp instead of strcmp. * tree-dump.c (dequeue_and_dump): Handle backslash. * tree.c (get_file_function_name): Likewise. * gengtype.c (read_input_list): Likewise. (get_file_realbasename): Likewise. (get_output_file_with_visibility): Use filename_cmp instead of strcmp. ChangeLog java/ 2011-03-25 Kai Tietz <ktietz@redhat.com> * jcf-parse.c (java_read_sourcefilenames): Use filename_cmp instead of strcmp. (set_source_filename): Likewise. * win32-host.c (jcf_open_exact_case): Likewise. ChangeLog lto/ 2011-03-25 Kai Tietz <ktietz@redhat.com> * lto.c (lto_resolution_read): Use filename_cmp instead of strcmp. (lto_read_section_data): Likewise. ChangeLog cp/ 2011-03-25 Kai Tietz <ktietz@redhat.com> * lex.c (interface_strcmp): Handle dos-paths. (handle_pragma_implementation): Use filename_cmp instead of strcmp. (in_main_input_context): Likewise. From-SVN: r171522
2011-03-25 20:20:52 +01:00
else
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
m_base_dir = xstrndup (m_toplevel_fname, base - m_toplevel_fname);
handle_file ();
}
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
file_location
rtx_reader::get_current_location () const
{
return file_location (m_read_md_filename, m_read_md_lineno, m_read_md_colno);
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
}
/* Parse a -I option with argument ARG. */
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
void
rtx_reader::add_include_path (const char *arg)
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
{
struct file_name_list *dirtmp;
dirtmp = XNEW (struct file_name_list);
dirtmp->next = 0;
dirtmp->fname = arg;
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
*m_last_dir_md_include_ptr = dirtmp;
m_last_dir_md_include_ptr = &dirtmp->next;
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
}
/* The main routine for reading .md files. Try to process all the .md
2013-07-21 20:18:04 +02:00
files specified on the command line and return true if no error occurred.
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
ARGC and ARGV are the arguments to main.
PARSE_OPT, if nonnull, is passed all unknown command-line arguments.
It should return true if it recognizes the argument or false if a
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
generic error should be reported. */
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
bool
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
rtx_reader::read_md_files (int argc, const char **argv,
bool (*parse_opt) (const char *))
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
{
int i;
bool no_more_options;
bool already_read_stdin;
int num_files;
/* First we loop over all the options. */
for (i = 1; i < argc; i++)
if (argv[i][0] == '-')
{
/* An argument consisting of exactly one dash is a request to
read stdin. This will be handled in the second loop. */
if (argv[i][1] == '\0')
continue;
/* An argument consisting of just two dashes causes option
parsing to cease. */
if (argv[i][1] == '-' && argv[i][2] == '\0')
break;
if (argv[i][1] == 'I')
{
if (argv[i][2] != '\0')
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
add_include_path (argv[i] + 2);
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
else if (++i < argc)
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
add_include_path (argv[i]);
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
else
fatal ("directory name missing after -I option");
continue;
}
/* The program may have provided a callback so it can
accept its own options. */
if (parse_opt && parse_opt (argv[i]))
continue;
fatal ("invalid option `%s'", argv[i]);
}
/* Now loop over all input files. */
num_files = 0;
no_more_options = false;
already_read_stdin = false;
for (i = 1; i < argc; i++)
{
if (argv[i][0] == '-')
{
if (argv[i][1] == '\0')
{
/* Read stdin. */
if (already_read_stdin)
fatal ("cannot read standard input twice");
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
m_read_md_file = stdin;
m_read_md_filename = "<stdin>";
handle_toplevel_file ();
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
already_read_stdin = true;
continue;
}
else if (argv[i][1] == '-' && argv[i][2] == '\0')
{
/* No further arguments are to be treated as options. */
no_more_options = true;
continue;
}
else if (!no_more_options)
continue;
}
/* If we get here we are looking at a non-option argument, i.e.
a file to be processed. */
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
m_read_md_filename = argv[i];
m_read_md_file = fopen (m_read_md_filename, "r");
if (m_read_md_file == 0)
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
{
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
perror (m_read_md_filename);
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
return false;
}
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
handle_toplevel_file ();
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
num_files++;
}
/* If we get to this point without having seen any files to process,
read the standard input now. */
if (num_files == 0 && !already_read_stdin)
{
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
m_read_md_file = stdin;
m_read_md_filename = "<stdin>";
handle_toplevel_file ();
Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). gcc/ * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H). * genmddeps.c: Include read-md.h. (main): Call init_rtx_reader_args instead of init_md_reader_args. * genattr.c (main): Likewise. * genattrtab.c (main): Likewise. * genautomata.c (main): Likewise. * gencodes.c (main): Likewise. * genconditions.c (main): Likewise. * genconfig.c (main): Likewise. * genconstants.c (main): Likewise. * genemit.c (main): Likewise. * genextract.c (main): Likewise. * genflags.c (main): Likewise. * genopinit.c (main): Likewise. * genoutput.c (main): Likewise. * genpeep.c (main): Likewise. * genrecog.c (main): Likewise. * genpreds.c (main): Likewise. * gensupport.h (in_fname): Move to read-md.h. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a bool. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a bool. (include_callback): Move to read-md.h. * gensupport.c (in_fname, include_callback, base_dir, max_include_len) (file_name_list, first_dir_md_include): Move to read-md.c (first_bracket_include): Delete unused variable. (last_dir_md_include): Move to read-md.c. (process_include): Delete, moving code to read-md.c:handle_include. (process_rtx): Don't handle INCLUDE. (save_string): Delete. (rtx_handle_directive): New function. (init_md_reader_args_cb): Rename to... (init_rtx_reader_args_cb): ...this and return a boolean success value. Use read_md_args. (init_md_reader_args): Rename to... (init_rtx_reader_args): ...this and return a boolean success value. * rtl.def (INCLUDE): Delete. * rtl.h (read_rtx): Remove "int *" argument. Add "const char *" argument. * read-rtl.c (read_conditions): Don't gobble ')' here. (read_mapping): Likewise. (read_rtx): Remove LINENO argument. Add RTX_NAME argument. Handle top-level non-rtx constructs here rather than in read_rtx_1. Store the whole queue in *X. Remove call to init_md_reader. (read_rtx_1): Rename to... (read_rtx_code): ...this. Call read_nested_rtx to read subrtxes. Don't handle top-level non-rtx constructs here. Don't handle (nil) here. (read_nested_rtx): New function. Handle (nil) here rather than in read_rtx_code. (read_rtx_variadic): Call read_nested_rtx to read subrtxes. Don't gobble ')' here. * read-md.h (directive_handler_t): New type. (in_fname, include_callback): Moved from read-md.h. (read_constants, init_md_reader): Delete. (read_md_files): Declare. * read-md.c (file_name_list, in_fname, base_dir, first_dir_md_include) (last_dir_md_include_ptr, include_callback, max_include_len): Moved from gensupport.c. (read_constants): Rename to... (handle_constants): ...this. Don't gobble ')' here. (handle_include, handle_file, handle_toplevel_file) (parse_include): New functions, mostly taken from gensupport.c. (init_md_reader): Subsume into... (read_md_files): ...this new function. From-SVN: r160577
2010-06-10 22:23:13 +02:00
}
return !have_error;
Makefile.in (READ_MD_H): New variable. gcc/ * Makefile.in (READ_MD_H): New variable. (BUILD_RTL): Add build/read-md.o. (lto-wrapper.o): Depend on coretypes.h instead of defaults.h. (build/gensupport.o, build/read-rtl.o, build/genattr.o) (build/genattrtab.o, build/genconditions.o build/genemit.o) (build/genextract.o, build/genflags.o, build/genoutput.o) (build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H). (build/read-md.o): New rule. * defaults.h (obstack_chunk_alloc, obstack_chunk_free) (OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to... * coretypes.h: ...here. * lto-wrapper.c: Include coretypes.h instead of defaults.h. * pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete. * genattr.c: Include read-md.h. * genattrtab.c: Likewise. * genconditions.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genoutput.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. * rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition, read_rtx_filename) (read_rtx_lineno): Move to read-md.h. * read-rtl.c: Include read-md.h. (ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack) (joined_conditions, joined_conditions_obstack, read_rtx_lineno) (read_rtx_filename, fatal_with_file_and_line, fatal_expected_char) (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc) (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions) (print_c_condition, read_skip_spaces, read_escape, read_quoted_string) (read_braced_string, read_string): Move to read-md.c. (read_rtx): Move some initialization to init_md_reader and call init_md_reader here. * gensupport.h (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.h. * gensupport.c: Include read-md.h. (message_with_line, n_comma_elts, scan_comma_elt): Move to read-md.c. * read-md.h, read-md.c: New files. From-SVN: r160570
2010-06-10 22:21:23 +02:00
}
Introduce class rtx_reader Bundle up various global variables within gensupport.c into a class rtx_reader, with a view towards making it easier to run the code more than once in-process. gcc/ChangeLog: * genconstants.c (main): Introduce noop_reader and convert call to read_md_files to a method call. * genenums.c (main): Likewise. * genmddeps.c (main): Likewise. * genpreds.c (write_tm_constrs_h): Replace use of "in_fname" with rtx_reader_ptr->get_top_level_filename (). (write_tm_preds_h): Likewise. (write_insn_preds_c): Likewise. * gensupport.c (class gen_reader): New subclass of rtx_reader. (rtx_handle_directive): Convert to... (gen_reader::handle_unknown_directive): ...this. (init_rtx_reader_args_cb): Convert return type from bool to rtx_reader *. Create a gen_reader instance, using it for the call to read_md_files. Return it if no errors occur. (init_rtx_reader_args): Convert return type from bool to rtx_reader *. * gensupport.h (init_rtx_reader_args_cb): Likewise. (init_rtx_reader_args_cb): Likewise. * read-md.c (struct file_name_list): Move to class rtx_reader. (read_md_file): Delete in favor of rtx_reader::m_read_md_file. (read_md_filename): Delete in favor of rtx_reader::m_read_md_filename. (read_md_lineno): Delete in favor of rtx_reader::m_read_md_lineno. (in_fname): Delete in favor of rtx_reader::m_toplevel_fname. (base_dir): Delete in favor of rtx_reader::m_base_dir. (first_dir_md_include): Delete in favor of rtx_reader::m_first_dir_md_include. (last_dir_md_include_ptr): Delete in favor of rtx_reader::m_last_dir_md_include_ptr. (max_include_len): Delete. (rtx_reader_ptr): New. (fatal_with_file_and_line): Use get_filename and get_lineno accessors of rtx_reader_ptr. (require_char_ws): Likewise. (rtx_reader::read_char): New method, based on ::read_char. (rtx_reader::unread_char): New method, based on ::unread_char. (read_escape): Use get_filename and get_lineno accessors of rtx_reader_ptr. (read_braced_string): Use get_lineno accessor of rtx_reader_ptr. (read_string): Use get_filename and get_lineno accessors of rtx_reader_ptr. (rtx_reader::rtx_reader): New ctor. (rtx_reader::~rtx_reader): New dtor. (handle_include): Convert from a function to... (rtx_reader::handle_include): ...this method, converting handle_directive from a callback to a virtual function. (handle_file): Likewise, converting to... (rtx_reader::handle_file): ...this method. (handle_toplevel_file): Likewise, converting to... (rtx_reader::handle_toplevel_file): ...this method. (rtx_reader::get_current_location): New method. (parse_include): Convert from a function to... (rtx_reader::add_include_path): ...this method, dropping redundant update to unused max_include_len. (read_md_files): Convert from a function to... (rtx_reader::read_md_files): ...this method, converting handle_directive from a callback to a virtual function. (noop_reader::handle_unknown_directive): New method. * read-md.h (directive_handler_t): Delete this typedef. (in_fname): Delete. (read_md_file): Delete. (read_md_lineno): Delete. (read_md_filename): Delete. (class rtx_reader): New class. (rtx_reader_ptr): New decl. (class noop_reader): New subclass of rtx_reader. (read_char): Reimplement in terms of rtx_reader::read_char. (unread_char): Reimplement in terms of rtx_reader::unread_char. (read_md_files): Delete. * read-rtl.c (read_rtx_code): Update for deletion of globals read_md_filename and read_md_lineno. From-SVN: r240333
2016-09-21 22:55:06 +02:00
/* class noop_reader : public rtx_reader */
/* A dummy implementation which skips unknown directives. */
void
noop_reader::handle_unknown_directive (file_location loc, const char *)
{
read_skip_construct (1, loc);
}