summaryrefslogtreecommitdiff
path: root/gcc/genattrtab.c
diff options
context:
space:
mode:
authorClinton Popetz <cpopetz@cygnus.com>2000-05-03 17:45:26 +0000
committerClinton Popetz <cpopetz@gcc.gnu.org>2000-05-03 13:45:26 -0400
commitc88c0d42a1ac718915fcd7c79ebe517baa624348 (patch)
tree51d16ed3ff5a009c7dd29449525fd4e9a6dc37c1 /gcc/genattrtab.c
parent18ca529b1976bfdc7f84b96f93d0ac3f483bf7f8 (diff)
downloadgcc-c88c0d42a1ac718915fcd7c79ebe517baa624348.tar.gz
gensupport.c: New file.
* gensupport.c: New file. * gensupport.h: New file. * Makefile.in (HOST_RTL): Depend on gensupport. (gensupport.o) New rule. * genattr.c: Use gensupport for reading .md files. * genattrtab.c: Ditto. * gencodes.c: Ditto. * genconfig.c: Ditto. * genemit.c: Ditto. * genextract.c: Ditto. * genflags.c: Ditto. * genopinit.c: Ditto. * genoutput.c: Ditto. * genpeep.c: Ditto. * genrecog.c: Ditto. * rtl.def (define_insn_and_split): New DEF_RTL_EXPR. * md.texi (Insn Splitting): Document define_insn_and_split. From-SVN: r33633
Diffstat (limited to 'gcc/genattrtab.c')
-rw-r--r--gcc/genattrtab.c86
1 files changed, 38 insertions, 48 deletions
diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c
index 2dab1b6f5bb..b1be9a070e4 100644
--- a/gcc/genattrtab.c
+++ b/gcc/genattrtab.c
@@ -100,6 +100,7 @@ Boston, MA 02111-1307, USA. */
#include "system.h"
#include "rtl.h"
#include "ggc.h"
+#include "gensupport.h"
#ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
@@ -4304,8 +4305,8 @@ gen_insn (exp)
switch (GET_CODE (exp))
{
case DEFINE_INSN:
- id->insn_code = insn_code_number++;
- id->insn_index = insn_index_number++;
+ id->insn_code = insn_code_number;
+ id->insn_index = insn_index_number;
id->num_alternatives = count_alternatives (exp);
if (id->num_alternatives == 0)
id->num_alternatives = 1;
@@ -4313,8 +4314,8 @@ gen_insn (exp)
break;
case DEFINE_PEEPHOLE:
- id->insn_code = insn_code_number++;
- id->insn_index = insn_index_number++;
+ id->insn_code = insn_code_number;
+ id->insn_index = insn_index_number;
id->num_alternatives = count_alternatives (exp);
if (id->num_alternatives == 0)
id->num_alternatives = 1;
@@ -5967,8 +5968,6 @@ main (argc, argv)
char **argv;
{
rtx desc;
- FILE *infile;
- register int c;
struct attr_desc *attr;
struct insn_def *id;
rtx tem;
@@ -5976,6 +5975,12 @@ main (argc, argv)
progname = "genattrtab";
+ if (argc <= 1)
+ fatal ("No input file name.");
+
+ if (init_md_reader (argv[1]) != SUCCESS_EXIT_CODE)
+ return (FATAL_EXIT_CODE);
+
#if defined (RLIMIT_STACK) && defined (HAVE_GETRLIMIT) && defined (HAVE_SETRLIMIT)
/* Get rid of any avoidable limit on stack size. */
{
@@ -5993,17 +5998,6 @@ main (argc, argv)
obstack_init (hash_obstack);
obstack_init (temp_obstack);
- if (argc <= 1)
- fatal ("No input file name.");
-
- infile = fopen (argv[1], "r");
- if (infile == 0)
- {
- perror (argv[1]);
- return (FATAL_EXIT_CODE);
- }
- read_rtx_filename = argv[1];
-
/* Set up true and false rtx's */
true_rtx = rtx_alloc (CONST_INT);
XWINT (true_rtx, 0) = 1;
@@ -6021,45 +6015,41 @@ from the machine description file `md'. */\n\n");
while (1)
{
- c = read_skip_spaces (infile);
- if (c == EOF)
- break;
- ungetc (c, infile);
-
- desc = read_rtx (infile);
- if (GET_CODE (desc) == DEFINE_INSN
- || GET_CODE (desc) == DEFINE_PEEPHOLE
- || GET_CODE (desc) == DEFINE_ASM_ATTRIBUTES)
- gen_insn (desc);
-
- else if (GET_CODE (desc) == DEFINE_EXPAND)
- insn_code_number++, insn_index_number++;
+ int line_no;
- else if (GET_CODE (desc) == DEFINE_SPLIT)
- insn_code_number++, insn_index_number++;
-
- else if (GET_CODE (desc) == DEFINE_PEEPHOLE2)
- insn_code_number++, insn_index_number++;
+ desc = read_md_rtx (&line_no, &insn_code_number);
+ if (desc == NULL)
+ break;
- else if (GET_CODE (desc) == DEFINE_ATTR)
+ switch (GET_CODE (desc))
{
- gen_attr (desc);
- insn_index_number++;
- }
+ case DEFINE_INSN:
+ case DEFINE_PEEPHOLE:
+ case DEFINE_ASM_ATTRIBUTES:
+ gen_insn(desc);
+ break;
+
+ case DEFINE_ATTR:
+ gen_attr (desc);
+ break;
- else if (GET_CODE (desc) == DEFINE_DELAY)
- {
- gen_delay (desc);
- insn_index_number++;
- }
+ case DEFINE_DELAY:
+ gen_delay (desc);
+ break;
- else if (GET_CODE (desc) == DEFINE_FUNCTION_UNIT)
- {
- gen_unit (desc);
- insn_index_number++;
+ case DEFINE_FUNCTION_UNIT:
+ gen_unit (desc);
+ break;
+
+ default:
+ break;
}
+ if (GET_CODE (desc) != DEFINE_ASM_ATTRIBUTES)
+ insn_index_number++;
}
+ insn_code_number++;
+
/* If we didn't have a DEFINE_ASM_ATTRIBUTES, make a null one. */
if (! got_define_asm_attributes)
{