OSDN Git Service

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