comparison gcc/genconditions.c @ 16:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents f6334be47118
children 84e7813d76e9
comparison
equal deleted inserted replaced
15:561a7518be6b 16:04ced10e8804
1 /* Process machine description and calculate constant conditions. 1 /* Process machine description and calculate constant conditions.
2 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2010 2 Copyright (C) 2001-2017 Free Software Foundation, Inc.
3 Free Software Foundation, Inc.
4 3
5 This file is part of GCC. 4 This file is part of GCC.
6 5
7 GCC is free software; you can redistribute it and/or modify 6 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
30 #include "system.h" 29 #include "system.h"
31 #include "coretypes.h" 30 #include "coretypes.h"
32 #include "tm.h" 31 #include "tm.h"
33 #include "rtl.h" 32 #include "rtl.h"
34 #include "errors.h" 33 #include "errors.h"
35 #include "hashtab.h"
36 #include "read-md.h" 34 #include "read-md.h"
37 #include "gensupport.h" 35 #include "gensupport.h"
38 36
39 /* so we can include except.h in the generated file. */ 37 /* so we can include except.h in the generated file. */
40 static int saw_eh_return; 38 static int saw_eh_return;
51 puts ("\ 49 puts ("\
52 /* Generated automatically by the program `genconditions' from the target\n\ 50 /* Generated automatically by the program `genconditions' from the target\n\
53 machine description file. */\n\ 51 machine description file. */\n\
54 \n\ 52 \n\
55 #include \"bconfig.h\"\n\ 53 #include \"bconfig.h\"\n\
54 #define INCLUDE_STRING\n\
56 #include \"system.h\"\n\ 55 #include \"system.h\"\n\
57 \n\ 56 \n\
58 /* It is necessary, but not entirely safe, to include the headers below\n\ 57 /* It is necessary, but not entirely safe, to include the headers below\n\
59 in a generator program. As a defensive measure, don't do so when the\n\ 58 in a generator program. As a defensive measure, don't do so when the\n\
60 table isn't going to have anything in it. */\n\ 59 table isn't going to have anything in it. */\n\
61 #if GCC_VERSION >= 3001\n\ 60 #if GCC_VERSION >= 3001\n\
62 \n\ 61 \n\
63 /* Do not allow checking to confuse the issue. */\n\ 62 /* Do not allow checking to confuse the issue. */\n\
64 #undef ENABLE_CHECKING\n\ 63 #undef CHECKING_P\n\
64 #define CHECKING_P 0\n\
65 #undef ENABLE_TREE_CHECKING\n\ 65 #undef ENABLE_TREE_CHECKING\n\
66 #undef ENABLE_RTL_CHECKING\n\ 66 #undef ENABLE_RTL_CHECKING\n\
67 #undef ENABLE_RTL_FLAG_CHECKING\n\ 67 #undef ENABLE_RTL_FLAG_CHECKING\n\
68 #undef ENABLE_GC_CHECKING\n\ 68 #undef ENABLE_GC_CHECKING\n\
69 #undef ENABLE_GC_ALWAYS_COLLECT\n\ 69 #undef ENABLE_GC_ALWAYS_COLLECT\n\
70 #define USE_ENUM_MODES\n\
70 \n\ 71 \n\
71 #include \"coretypes.h\"\n\ 72 #include \"coretypes.h\"\n\
72 #include \"tm.h\"\n\ 73 #include \"tm.h\"\n\
73 #include \"insn-constants.h\"\n\ 74 #include \"insn-constants.h\"\n\
74 #include \"rtl.h\"\n\ 75 #include \"rtl.h\"\n\
76 #include \"memmodel.h\"\n\
75 #include \"tm_p.h\"\n\ 77 #include \"tm_p.h\"\n\
78 #include \"hard-reg-set.h\"\n\
76 #include \"function.h\"\n\ 79 #include \"function.h\"\n\
80 #include \"emit-rtl.h\"\n\
77 \n\ 81 \n\
78 /* Fake - insn-config.h doesn't exist yet. */\n\ 82 /* Fake - insn-config.h doesn't exist yet. */\n\
79 #define MAX_RECOG_OPERANDS 10\n\ 83 #define MAX_RECOG_OPERANDS 10\n\
80 #define MAX_DUP_OPERANDS 10\n\ 84 #define MAX_DUP_OPERANDS 10\n\
81 #define MAX_INSNS_PER_SPLIT 5\n\ 85 #define MAX_INSNS_PER_SPLIT 5\n\
83 #include \"regs.h\"\n\ 87 #include \"regs.h\"\n\
84 #include \"recog.h\"\n\ 88 #include \"recog.h\"\n\
85 #include \"output.h\"\n\ 89 #include \"output.h\"\n\
86 #include \"flags.h\"\n\ 90 #include \"flags.h\"\n\
87 #include \"hard-reg-set.h\"\n\ 91 #include \"hard-reg-set.h\"\n\
92 #include \"predict.h\"\n\
93 #include \"basic-block.h\"\n\
94 #include \"bitmap.h\"\n\
95 #include \"df.h\"\n\
88 #include \"resource.h\"\n\ 96 #include \"resource.h\"\n\
89 #include \"diagnostic-core.h\"\n\ 97 #include \"diagnostic-core.h\"\n\
90 #include \"reload.h\"\n\ 98 #include \"reload.h\"\n\
91 #include \"tm-constrs.h\"\n"); 99 #include \"tm-constrs.h\"\n");
92 100
94 puts ("#define HAVE_eh_return 1"); 102 puts ("#define HAVE_eh_return 1");
95 puts ("#include \"except.h\"\n"); 103 puts ("#include \"except.h\"\n");
96 104
97 puts ("\ 105 puts ("\
98 /* Dummy external declarations. */\n\ 106 /* Dummy external declarations. */\n\
99 extern rtx insn;\n\ 107 extern rtx_insn *insn;\n\
100 extern rtx ins1;\n\ 108 extern rtx ins1;\n\
101 extern rtx operands[];\n\ 109 extern rtx operands[];\n\
102 \n\ 110 \n\
103 #endif /* gcc >= 3.0.1 */\n"); 111 #endif /* gcc >= 3.0.1 */\n");
104 } 112 }
115 write_one_condition (void **slot, void * ARG_UNUSED (dummy)) 123 write_one_condition (void **slot, void * ARG_UNUSED (dummy))
116 { 124 {
117 const struct c_test *test = * (const struct c_test **) slot; 125 const struct c_test *test = * (const struct c_test **) slot;
118 const char *p; 126 const char *p;
119 127
120 print_md_ptr_loc (test->expr); 128 rtx_reader_ptr->print_md_ptr_loc (test->expr);
121 fputs (" { \"", stdout); 129 fputs (" { \"", stdout);
122 for (p = test->expr; *p; p++) 130 for (p = test->expr; *p; p++)
123 { 131 {
124 switch (*p) 132 switch (*p)
125 { 133 {
130 } 138 }
131 putchar (*p); 139 putchar (*p);
132 } 140 }
133 141
134 fputs ("\",\n __builtin_constant_p ", stdout); 142 fputs ("\",\n __builtin_constant_p ", stdout);
135 print_c_condition (test->expr); 143 rtx_reader_ptr->print_c_condition (test->expr);
136 fputs ("\n ? (int) ", stdout); 144 fputs ("\n ? (int) ", stdout);
137 print_c_condition (test->expr); 145 rtx_reader_ptr->print_c_condition (test->expr);
138 fputs ("\n : -1 },\n", stdout); 146 fputs ("\n : -1 },\n", stdout);
139 return 1; 147 return 1;
140 } 148 }
141 149
142 /* Write out the complete conditions table, its size, and a flag 150 /* Write out the complete conditions table, its size, and a flag
204 "return ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE;\n" 212 "return ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE;\n"
205 "}"); 213 "}");
206 } 214 }
207 215
208 int 216 int
209 main (int argc, char **argv) 217 main (int argc, const char **argv)
210 { 218 {
211 rtx desc;
212 int pattern_lineno; /* not used */
213 int code;
214
215 progname = "genconditions"; 219 progname = "genconditions";
216 220
217 if (!init_rtx_reader_args (argc, argv)) 221 if (!init_rtx_reader_args (argc, argv))
218 return (FATAL_EXIT_CODE); 222 return (FATAL_EXIT_CODE);
219 223
220 /* Read the machine description. */ 224 /* Read the machine description. */
221 while (1) 225 md_rtx_info info;
226 while (read_md_rtx (&info))
222 { 227 {
223 desc = read_md_rtx (&pattern_lineno, &code); 228 rtx def = info.def;
224 if (desc == NULL) 229 add_c_test (get_c_test (def), -1);
225 break; 230 switch (GET_CODE (def))
226
227 /* N.B. define_insn_and_split, define_cond_exec are handled
228 entirely within read_md_rtx; we never see them. */
229 switch (GET_CODE (desc))
230 { 231 {
231 default:
232 break;
233
234 case DEFINE_INSN: 232 case DEFINE_INSN:
235 case DEFINE_EXPAND: 233 case DEFINE_EXPAND:
236 add_c_test (XSTR (desc, 2), -1);
237 /* except.h needs to know whether there is an eh_return 234 /* except.h needs to know whether there is an eh_return
238 pattern in the machine description. */ 235 pattern in the machine description. */
239 if (!strcmp (XSTR (desc, 0), "eh_return")) 236 if (!strcmp (XSTR (def, 0), "eh_return"))
240 saw_eh_return = 1; 237 saw_eh_return = 1;
241 break; 238 break;
242 239
243 case DEFINE_SPLIT: 240 default:
244 case DEFINE_PEEPHOLE:
245 case DEFINE_PEEPHOLE2:
246 add_c_test (XSTR (desc, 1), -1);
247 break; 241 break;
248 } 242 }
249 } 243 }
250 244
251 write_header (); 245 write_header ();