8sa1-gcc/gcc/genconstants.c

90 lines
2.4 KiB
C
Raw Normal View History

/* Generate from machine description:
a series of #define statements, one for each constant named in
a (define_constants ...) pattern.
Copyright (C) 1987, 1991, 1995, 1998,
1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, 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 COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* This program does not use gensupport.c because it does not need to
look at insn patterns, only (define_constants), and we want to
minimize dependencies. */
#include "hconfig.h"
#include "system.h"
#include "rtl.h"
#include "errors.h"
#include "gensupport.h"
static int print_md_constant PARAMS ((void **, void *));
extern int main PARAMS ((int, char **));
/* Called via traverse_md_constants; emit a #define for
the current constant definition. */
static int
print_md_constant (slot, info)
void **slot;
void *info;
{
struct md_constant *def = *slot;
FILE *file = info;
fprintf (file, "#define %s %s\n", def->name, def->value);
return 1;
}
int
main (argc, argv)
int argc;
char **argv;
{
int dummy1, dummy2;
rtx desc;
progname = "genconstants";
if (argc <= 1)
c-decl.c (duplicate_decls, [...]): Remove leading capital from diagnostics. * c-decl.c (duplicate_decls, push_parm_decl): Remove leading capital from diagnostics. * c-lex.c (cb_file_change): Similarly. * c-parse.in : Similarly. * cfgrtl.c (verify_flow_info): Similarly. * collect2.c: Similarly. * cppfiles.c (find_include_file): Similarly. * cppinit.c (cpp_handle_option): Similarly. * cpplex.c (cpp_spell_token): Similarly. * cppmain.c (do_preprocessing): Similarly. * gcc.c (translate_options, process_command, do_spec1, main, pfatal_execute): Similarly. * genattr.c (main): Similarly. * genattrtab.c (check_attr_test, operate_exp, simplify_test_exp, write_test_expr, main): Similarly. * gencodes.c (main): Similarly. * genconfig.c (main): Similarly. * genconstants.c (main): Similarly. * genemit.c (main): Similarly. * genextract.c (main): Similarly. * genflags.c (main): Similarly. * genopinit.c (main): Similarly. * genoutput.c (process_template, main): Similarly. * genpeep.c (main): Similarly. * genrecog.c (main): Similarly. * gensupport.c (is_predicable, identify_predicable_attribute, alter_predicate_for_insn, init_md_reader_args, main): Similarly. * ggc-page.c (alloc_anon): Similarly. * mips-tfile.c (add_string, add_procedure, add_file, read_line, parse_begin, parse_bend, parse_def, parse_end, parse_file, parse_stabs_common, parse_stabs, write_varray, write_object, read_seek, copy_object, main, error): Similarly. * profile.c (compute_branch_probabilities): Similarly. * reg-stack.c (check_asm_stack_operands): Similarly. * reload.c (find_reloads): Similarly. * reload1.c (spill_failure, failed_reload): Similarly. * rtl-error.c (_fatal_insn_not_found): Similarly. * toplev.c (read_integral_parameter, crash_signal, decode_f_option, set_target_switch, parse_options_and_default_flags) : Similarly. * tradcif.y (parse_number, yylex): Similarly. * tradcpp.c (main, fancy_abort): Similarly. * tree.c (tree_check_failed): Similarly. * varray.c (varray_check_failed): Similarly. * xcoffout.c (xcoff_output_standard_types): Similarly. cp: * call.c (build_java_interface_fn_ref): Similarly. * except.c (is_admissible_throw_operand): Similarly. * init.c (build_java_class_ref): Similarly. * xref.c (open_xref_file): Similarly. objc: * objc-act.c (get_object_ref, lookup_and_install_protocols, build_objc_string_object, objc_declare_alias, build_ivar_chain, finish_message_expr, build_protocol_expr, is_public, start_class): Similarly. testsuite: * objc.dg/alias.m: Update. * objc.dg/class-1.m: Update. * objc.dg/const-str-1.m: Update. * objc.dg/fwd-proto-1.m: Update. * objc.dg/id-1.m: Update. * objc.dg/super-class-1.m: Update. From-SVN: r47518
2001-12-01 19:04:36 -05:00
fatal ("no input file name");
if (init_md_reader (argv[1]) != SUCCESS_EXIT_CODE)
return (FATAL_EXIT_CODE);
/* Scan and discard the entire file. This has the side effect
of loading up the constants table that we wish to scan. */
do
desc = read_md_rtx (&dummy1, &dummy2);
while (desc);
puts ("/* Generated automatically by the program `genconstants'");
puts (" from the machine description file `md'. */\n");
puts ("#ifndef GCC_INSN_CONSTANTS_H");
puts ("#define GCC_INSN_CONSTANTS_H\n");
traverse_md_constants (print_md_constant, stdout);
puts ("\n#endif /* GCC_INSN_CONSTANTS_H */");
if (ferror (stdout) || fflush (stdout) || fclose (stdout))
return FATAL_EXIT_CODE;
return SUCCESS_EXIT_CODE;
}