diff options
author | Joseph Myers <joseph@codesourcery.com> | 2011-06-28 11:28:09 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2011-06-28 11:28:09 +0100 |
commit | 88a00ef7d65f16ce3851cf8ebcda756c97113cee (patch) | |
tree | b3eb1b6cdfe6199aca999ce1c33202fecb509335 /gcc/genattr-common.c | |
parent | a9633db4d2870935d07ea267637422b43f838977 (diff) | |
download | gcc-88a00ef7d65f16ce3851cf8ebcda756c97113cee.tar.gz |
genattr-common.c: New.
* genattr-common.c: New. Based on genattr.c.
* Makefile.in (INSN_ATTR_H): Include insn-attr-common.h.
(MOSTLYCLEANFILES): Add insn-attr-common.h.
(opts.o): Update dependencies.
(.PRECIOUS): Add insn-attr-common.h.
(simple_rtl_generated_h): Add insn-attr-common.h.
(build/genattr-common.o): New.
(genprogrtl): Add attr-common.
* genattr.c (main): Include insn-attr-common.h. Don't generate
definitions of DELAY_SLOTS or INSN_SCHEDULING.
* opts.c: Include insn-attr-common.h instead of rtl.h and
insn-attr.h.
From-SVN: r175579
Diffstat (limited to 'gcc/genattr-common.c')
-rw-r--r-- | gcc/genattr-common.c | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/gcc/genattr-common.c b/gcc/genattr-common.c new file mode 100644 index 00000000000..bc7e1bba993 --- /dev/null +++ b/gcc/genattr-common.c @@ -0,0 +1,83 @@ +/* Generate attribute information shared between driver and core + compilers (insn-attr-common.h) from machine description. Split out + of genattr.c. + Copyright (C) 1991, 1994, 1996, 1998, 1999, 2000, 2003, 2004, 2007, 2008, + 2010, 2011 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + + +#include "bconfig.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "rtl.h" +#include "errors.h" +#include "read-md.h" +#include "gensupport.h" + +int +main (int argc, char **argv) +{ + rtx desc; + bool have_delay = false; + bool have_sched = false; + + progname = "genattr-common"; + + if (!init_rtx_reader_args (argc, argv)) + return (FATAL_EXIT_CODE); + + puts ("/* Generated automatically by the program `genattr-common'"); + puts (" from the machine description file `md'. */\n"); + puts ("#ifndef GCC_INSN_ATTR_COMMON_H"); + puts ("#define GCC_INSN_ATTR_COMMON_H\n"); + + /* Read the machine description. */ + + while (1) + { + int line_no, insn_code_number; + + desc = read_md_rtx (&line_no, &insn_code_number); + if (desc == NULL) + break; + + if (GET_CODE (desc) == DEFINE_DELAY) + { + if (!have_delay) + { + printf ("#define DELAY_SLOTS\n"); + have_delay = true; + } + } + else if (GET_CODE (desc) == DEFINE_INSN_RESERVATION) + { + if (!have_sched) + { + printf ("#define INSN_SCHEDULING\n"); + have_sched = true; + } + } + } + puts ("\n#endif /* GCC_INSN_ATTR_COMMON_H */"); + + if (ferror (stdout) || fflush (stdout) || fclose (stdout)) + return FATAL_EXIT_CODE; + + return SUCCESS_EXIT_CODE; +} |