summaryrefslogtreecommitdiff
path: root/gcc/genemit.c
diff options
context:
space:
mode:
authorcpopetz <cpopetz@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-03 17:45:26 +0000
committercpopetz <cpopetz@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-03 17:45:26 +0000
commitc5ddd6b5dc28a14f02289ac8e4ce8a5ef7c9426a (patch)
tree51d16ed3ff5a009c7dd29449525fd4e9a6dc37c1 /gcc/genemit.c
parent5da035580c776cbe8197d2961c425db357d61fea (diff)
downloadgcc-c5ddd6b5dc28a14f02289ac8e4ce8a5ef7c9426a.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33633 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/genemit.c')
-rw-r--r--gcc/genemit.c64
1 files changed, 27 insertions, 37 deletions
diff --git a/gcc/genemit.c b/gcc/genemit.c
index f2bac1686b4..6fc604d7c23 100644
--- a/gcc/genemit.c
+++ b/gcc/genemit.c
@@ -25,6 +25,7 @@ Boston, MA 02111-1307, USA. */
#include "rtl.h"
#include "obstack.h"
#include "errors.h"
+#include "gensupport.h"
static struct obstack obstack;
struct obstack *rtl_obstack = &obstack;
@@ -779,8 +780,6 @@ main (argc, argv)
char **argv;
{
rtx desc;
- FILE *infile;
- register int c;
progname = "genemit";
obstack_init (rtl_obstack);
@@ -788,13 +787,8 @@ main (argc, argv)
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];
+ if (init_md_reader (argv[1]) != SUCCESS_EXIT_CODE)
+ return (FATAL_EXIT_CODE);
/* Assign sequential codes to all entries in the machine description
in parallel with the tables in insn-output.c. */
@@ -828,37 +822,33 @@ from the machine description file `md'. */\n\n");
while (1)
{
- c = read_skip_spaces (infile);
- if (c == EOF)
- break;
- ungetc (c, infile);
+ int line_no;
- desc = read_rtx (infile);
+ desc = read_md_rtx (&line_no, &insn_code_number);
+ if (desc == NULL)
+ break;
- if (GET_CODE (desc) == DEFINE_INSN)
+ switch (GET_CODE (desc))
{
- gen_insn (desc);
- ++insn_code_number;
- }
- if (GET_CODE (desc) == DEFINE_EXPAND)
- {
- gen_expand (desc);
- ++insn_code_number;
- }
- if (GET_CODE (desc) == DEFINE_SPLIT)
- {
- gen_split (desc);
- ++insn_code_number;
- }
- if (GET_CODE (desc) == DEFINE_PEEPHOLE2)
- {
- gen_split (desc);
- ++insn_code_number;
- }
- if (GET_CODE (desc) == DEFINE_PEEPHOLE)
- {
- ++insn_code_number;
- }
+ case DEFINE_INSN:
+ gen_insn (desc);
+ break;
+
+ case DEFINE_EXPAND:
+ gen_expand (desc);
+ break;
+
+ case DEFINE_SPLIT:
+ gen_split (desc);
+ break;
+
+ case DEFINE_PEEPHOLE2:
+ gen_split (desc);
+ break;
+
+ default:
+ break;
+ }
++insn_index_number;
}