Deleted Added
full compact
gencodes.c (90075) gencodes.c (117395)
1/* Generate from machine description:
2 - some macros CODE_FOR_... giving the insn_code_number value
3 for each of the defined standard insn names.
4 Copyright (C) 1987, 1991, 1995, 1998,
5 1999, 2000, 2001 Free Software Foundation, Inc.
6
7This file is part of GCC.
8
9GCC is free software; you can redistribute it and/or modify it under
10the terms of the GNU General Public License as published by the Free
11Software Foundation; either version 2, or (at your option) any later
12version.
13
14GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15WARRANTY; without even the implied warranty of MERCHANTABILITY or
16FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17for more details.
18
19You should have received a copy of the GNU General Public License
20along with GCC; see the file COPYING. If not, write to the Free
21Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2202111-1307, USA. */
23
24
25#include "hconfig.h"
26#include "system.h"
27#include "rtl.h"
28#include "errors.h"
29#include "gensupport.h"
30
1/* Generate from machine description:
2 - some macros CODE_FOR_... giving the insn_code_number value
3 for each of the defined standard insn names.
4 Copyright (C) 1987, 1991, 1995, 1998,
5 1999, 2000, 2001 Free Software Foundation, Inc.
6
7This file is part of GCC.
8
9GCC is free software; you can redistribute it and/or modify it under
10the terms of the GNU General Public License as published by the Free
11Software Foundation; either version 2, or (at your option) any later
12version.
13
14GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15WARRANTY; without even the implied warranty of MERCHANTABILITY or
16FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17for more details.
18
19You should have received a copy of the GNU General Public License
20along with GCC; see the file COPYING. If not, write to the Free
21Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2202111-1307, USA. */
23
24
25#include "hconfig.h"
26#include "system.h"
27#include "rtl.h"
28#include "errors.h"
29#include "gensupport.h"
30
31static void gen_insn PARAMS ((const char *, int));
31static void gen_insn PARAMS ((rtx, int));
32
33static void
32
33static void
34gen_insn (name, code)
35 const char *name;
34gen_insn (insn, code)
35 rtx insn;
36 int code;
37{
36 int code;
37{
38 const char *name = XSTR (insn, 0);
39 int truth = maybe_eval_c_test (XSTR (insn, 2));
40
38 /* Don't mention instructions whose names are the null string
39 or begin with '*'. They are in the machine description just
40 to be recognized. */
41 if (name[0] != 0 && name[0] != '*')
41 /* Don't mention instructions whose names are the null string
42 or begin with '*'. They are in the machine description just
43 to be recognized. */
44 if (name[0] != 0 && name[0] != '*')
42 printf (" CODE_FOR_%s = %d,\n", name, code);
45 {
46 if (truth == 0)
47 printf ("#define CODE_FOR_%s CODE_FOR_nothing\n", name);
48 else
49 printf (" CODE_FOR_%s = %d,\n", name, code);
50 }
43}
44
45extern int main PARAMS ((int, char **));
46
47int
48main (argc, argv)
49 int argc;
50 char **argv;
51{
52 rtx desc;
53
54 progname = "gencodes";
55
51}
52
53extern int main PARAMS ((int, char **));
54
55int
56main (argc, argv)
57 int argc;
58 char **argv;
59{
60 rtx desc;
61
62 progname = "gencodes";
63
64 /* We need to see all the possibilities. Elided insns may have
65 direct references to CODE_FOR_xxx in C code. */
66 insn_elision = 0;
67
56 if (argc <= 1)
57 fatal ("no input file name");
58
59 if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE)
60 return (FATAL_EXIT_CODE);
61
62 puts ("\
63/* Generated automatically by the program `gencodes'\n\
64 from the machine description file `md'. */\n\
65\n\
66#ifndef GCC_INSN_CODES_H\n\
67#define GCC_INSN_CODES_H\n\
68\n\
69enum insn_code {");
70
71 /* Read the machine description. */
72
73 while (1)
74 {
75 int line_no;
76 int insn_code_number;
77
78 desc = read_md_rtx (&line_no, &insn_code_number);
79 if (desc == NULL)
80 break;
81
82 if (GET_CODE (desc) == DEFINE_INSN || GET_CODE (desc) == DEFINE_EXPAND)
68 if (argc <= 1)
69 fatal ("no input file name");
70
71 if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE)
72 return (FATAL_EXIT_CODE);
73
74 puts ("\
75/* Generated automatically by the program `gencodes'\n\
76 from the machine description file `md'. */\n\
77\n\
78#ifndef GCC_INSN_CODES_H\n\
79#define GCC_INSN_CODES_H\n\
80\n\
81enum insn_code {");
82
83 /* Read the machine description. */
84
85 while (1)
86 {
87 int line_no;
88 int insn_code_number;
89
90 desc = read_md_rtx (&line_no, &insn_code_number);
91 if (desc == NULL)
92 break;
93
94 if (GET_CODE (desc) == DEFINE_INSN || GET_CODE (desc) == DEFINE_EXPAND)
83 gen_insn (XSTR (desc, 0), insn_code_number);
95 gen_insn (desc, insn_code_number);
84 }
85
96 }
97
86 puts ("CODE_FOR_nothing\n\
98 puts (" CODE_FOR_nothing\n\
87};\n\
88\n\
89#endif /* GCC_INSN_CODES_H */");
90
91 if (ferror (stdout) || fflush (stdout) || fclose (stdout))
92 return FATAL_EXIT_CODE;
93
94 return SUCCESS_EXIT_CODE;
95}
96
97/* Define this so we can link with print-rtl.o to get debug_rtx function. */
98
99const char *
100get_insn_name (code)
101 int code ATTRIBUTE_UNUSED;
102{
103 return NULL;
104}
99};\n\
100\n\
101#endif /* GCC_INSN_CODES_H */");
102
103 if (ferror (stdout) || fflush (stdout) || fclose (stdout))
104 return FATAL_EXIT_CODE;
105
106 return SUCCESS_EXIT_CODE;
107}
108
109/* Define this so we can link with print-rtl.o to get debug_rtx function. */
110
111const char *
112get_insn_name (code)
113 int code ATTRIBUTE_UNUSED;
114{
115 return NULL;
116}