]>
Commit | Line | Data |
---|---|---|
f12b8918 | 1 | /* Generate attribute information (insn-attr.h) from machine description. |
3d7aafde AJ |
2 | Copyright (C) 1991, 1994, 1996, 1998, 1999, 2000, 2003 |
3 | Free Software Foundation, Inc. | |
c9309570 | 4 | Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) |
41299f41 | 5 | |
1322177d | 6 | This file is part of GCC. |
41299f41 | 7 | |
1322177d LB |
8 | GCC is free software; you can redistribute it and/or modify it under |
9 | the terms of the GNU General Public License as published by the Free | |
10 | Software Foundation; either version 2, or (at your option) any later | |
11 | version. | |
41299f41 | 12 | |
1322177d LB |
13 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
14 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 | for more details. | |
41299f41 TW |
17 | |
18 | You should have received a copy of the GNU General Public License | |
1322177d LB |
19 | along with GCC; see the file COPYING. If not, write to the Free |
20 | Software Foundation, 59 Temple Place - Suite 330, Boston, MA | |
21 | 02111-1307, USA. */ | |
41299f41 TW |
22 | |
23 | ||
4977bab6 | 24 | #include "bconfig.h" |
0b93b64e | 25 | #include "system.h" |
4977bab6 ZW |
26 | #include "coretypes.h" |
27 | #include "tm.h" | |
41299f41 | 28 | #include "rtl.h" |
f8b6598e | 29 | #include "errors.h" |
c88c0d42 | 30 | #include "gensupport.h" |
41299f41 | 31 | |
41299f41 | 32 | |
ef3fad04 TW |
33 | /* A range of values. */ |
34 | ||
f12b8918 TM |
35 | struct range |
36 | { | |
37 | int min; | |
38 | int max; | |
39 | }; | |
ef3fad04 | 40 | |
f12b8918 TM |
41 | /* Record information about each function unit mentioned in a |
42 | DEFINE_FUNCTION_UNIT. */ | |
ef3fad04 | 43 | |
f12b8918 TM |
44 | struct function_unit |
45 | { | |
46 | char *name; /* Function unit name. */ | |
47 | struct function_unit *next; /* Next function unit. */ | |
48 | int multiplicity; /* Number of units of this type. */ | |
49 | int simultaneity; /* Maximum number of simultaneous insns | |
50 | on this function unit or 0 if unlimited. */ | |
51 | struct range ready_cost; /* Range of ready cost values. */ | |
52 | struct range issue_delay; /* Range of issue delay values. */ | |
53 | }; | |
b29d5f75 | 54 | |
3d7aafde AJ |
55 | static void extend_range (struct range *, int, int); |
56 | static void init_range (struct range *); | |
57 | static void write_upcase (const char *); | |
58 | static void gen_attr (rtx); | |
59 | static void write_units (int, struct range *, struct range *, | |
60 | struct range *, struct range *, | |
61 | struct range *); | |
ef3fad04 | 62 | static void |
3d7aafde | 63 | extend_range (struct range *range, int min, int max) |
ef3fad04 | 64 | { |
f12b8918 TM |
65 | if (range->min > min) range->min = min; |
66 | if (range->max < max) range->max = max; | |
ef3fad04 TW |
67 | } |
68 | ||
69 | static void | |
3d7aafde | 70 | init_range (struct range *range) |
ef3fad04 | 71 | { |
f12b8918 TM |
72 | range->min = 100000; |
73 | range->max = -1; | |
ef3fad04 TW |
74 | } |
75 | ||
41299f41 | 76 | static void |
3d7aafde | 77 | write_upcase (const char *str) |
41299f41 | 78 | { |
f12b8918 | 79 | for (; *str; str++) |
92a438d1 | 80 | putchar (TOUPPER(*str)); |
4beba5da | 81 | } |
4beba5da TM |
82 | |
83 | static void | |
3d7aafde | 84 | gen_attr (rtx attr) |
4beba5da | 85 | { |
9a5834ae | 86 | const char *p, *tag; |
3d7aafde | 87 | int is_const = GET_CODE (XEXP (attr, 2)) == CONST; |
41299f41 | 88 | |
f12b8918 | 89 | printf ("#define HAVE_ATTR_%s\n", XSTR (attr, 0)); |
41299f41 | 90 | |
f12b8918 | 91 | /* If numeric attribute, don't need to write an enum. */ |
9a5834ae ZW |
92 | p = XSTR (attr, 1); |
93 | if (*p == '\0') | |
3d7aafde | 94 | printf ("extern int get_attr_%s (%s);\n", XSTR (attr, 0), |
ffee6d93 | 95 | (is_const ? "void" : "rtx")); |
41299f41 TW |
96 | else |
97 | { | |
f12b8918 | 98 | printf ("enum attr_%s {", XSTR (attr, 0)); |
4beba5da | 99 | |
9a5834ae | 100 | while ((tag = scan_comma_elt (&p)) != 0) |
41299f41 | 101 | { |
9a5834ae ZW |
102 | write_upcase (XSTR (attr, 0)); |
103 | putchar ('_'); | |
104 | while (tag != p) | |
105 | putchar (TOUPPER (*tag++)); | |
0b42c8f8 ZW |
106 | if (*p == ',') |
107 | fputs (", ", stdout); | |
41299f41 TW |
108 | } |
109 | ||
9a5834ae | 110 | fputs ("};\n", stdout); |
3d7aafde | 111 | printf ("extern enum attr_%s get_attr_%s (%s);\n\n", |
ffee6d93 | 112 | XSTR (attr, 0), XSTR (attr, 0), (is_const ? "void" : "rtx")); |
41299f41 TW |
113 | } |
114 | ||
f12b8918 TM |
115 | /* If `length' attribute, write additional function definitions and define |
116 | variables used by `insn_current_length'. */ | |
117 | if (! strcmp (XSTR (attr, 0), "length")) | |
41299f41 | 118 | { |
9a5834ae | 119 | puts ("\ |
3d7aafde AJ |
120 | extern void shorten_branches (rtx);\n\ |
121 | extern int insn_default_length (rtx);\n\ | |
122 | extern int insn_variable_length_p (rtx);\n\ | |
123 | extern int insn_current_length (rtx);\n\n\ | |
9a5834ae | 124 | #include \"insn-addr.h\"\n"); |
41299f41 TW |
125 | } |
126 | } | |
127 | ||
128 | static void | |
3d7aafde AJ |
129 | write_units (int num_units, struct range *multiplicity, struct range *simultaneity, |
130 | struct range *ready_cost, struct range *issue_delay, | |
131 | struct range *blockage) | |
f12b8918 TM |
132 | { |
133 | int i, q_size; | |
134 | ||
135 | printf ("#define INSN_SCHEDULING\n\n"); | |
3d7aafde AJ |
136 | printf ("extern int result_ready_cost (rtx);\n"); |
137 | printf ("extern int function_units_used (rtx);\n\n"); | |
8b60264b | 138 | printf ("extern const struct function_unit_desc\n"); |
41299f41 | 139 | printf ("{\n"); |
8b60264b KG |
140 | printf (" const char *const name;\n"); |
141 | printf (" const int bitmask;\n"); | |
142 | printf (" const int multiplicity;\n"); | |
143 | printf (" const int simultaneity;\n"); | |
144 | printf (" const int default_cost;\n"); | |
145 | printf (" const int max_issue_delay;\n"); | |
3d7aafde AJ |
146 | printf (" int (*const ready_cost_function) (rtx);\n"); |
147 | printf (" int (*const conflict_cost_function) (rtx, rtx);\n"); | |
8b60264b | 148 | printf (" const int max_blockage;\n"); |
3d7aafde AJ |
149 | printf (" unsigned int (*const blockage_range_function) (rtx);\n"); |
150 | printf (" int (*const blockage_function) (rtx, rtx);\n"); | |
f12b8918 TM |
151 | printf ("} function_units[];\n\n"); |
152 | printf ("#define FUNCTION_UNITS_SIZE %d\n", num_units); | |
153 | printf ("#define MIN_MULTIPLICITY %d\n", multiplicity->min); | |
154 | printf ("#define MAX_MULTIPLICITY %d\n", multiplicity->max); | |
155 | printf ("#define MIN_SIMULTANEITY %d\n", simultaneity->min); | |
156 | printf ("#define MAX_SIMULTANEITY %d\n", simultaneity->max); | |
157 | printf ("#define MIN_READY_COST %d\n", ready_cost->min); | |
158 | printf ("#define MAX_READY_COST %d\n", ready_cost->max); | |
159 | printf ("#define MIN_ISSUE_DELAY %d\n", issue_delay->min); | |
160 | printf ("#define MAX_ISSUE_DELAY %d\n", issue_delay->max); | |
161 | printf ("#define MIN_BLOCKAGE %d\n", blockage->min); | |
162 | printf ("#define MAX_BLOCKAGE %d\n", blockage->max); | |
163 | for (i = 0; (1 << i) < blockage->max; i++) | |
ef3fad04 | 164 | ; |
f12b8918 | 165 | printf ("#define BLOCKAGE_BITS %d\n", i + 1); |
4beba5da | 166 | |
f12b8918 | 167 | /* INSN_QUEUE_SIZE is a power of two larger than MAX_BLOCKAGE and |
4d6922ee | 168 | MAX_READY_COST. This is the longest time an insn may be queued. */ |
f12b8918 TM |
169 | i = MAX (blockage->max, ready_cost->max); |
170 | for (q_size = 1; q_size <= i; q_size <<= 1) | |
171 | ; | |
172 | printf ("#define INSN_QUEUE_SIZE %d\n", q_size); | |
41299f41 TW |
173 | } |
174 | ||
41299f41 | 175 | int |
3d7aafde | 176 | main (int argc, char **argv) |
41299f41 TW |
177 | { |
178 | rtx desc; | |
f12b8918 TM |
179 | int have_delay = 0; |
180 | int have_annul_true = 0; | |
181 | int have_annul_false = 0; | |
fae15c93 | 182 | int num_insn_reservations = 0; |
f12b8918 TM |
183 | int num_units = 0; |
184 | struct range all_simultaneity, all_multiplicity; | |
185 | struct range all_ready_cost, all_issue_delay, all_blockage; | |
186 | struct function_unit *units = 0, *unit; | |
41299f41 TW |
187 | int i; |
188 | ||
f12b8918 TM |
189 | init_range (&all_multiplicity); |
190 | init_range (&all_simultaneity); | |
191 | init_range (&all_ready_cost); | |
192 | init_range (&all_issue_delay); | |
193 | init_range (&all_blockage); | |
194 | ||
f8b6598e | 195 | progname = "genattr"; |
41299f41 TW |
196 | |
197 | if (argc <= 1) | |
1f978f5f | 198 | fatal ("no input file name"); |
41299f41 | 199 | |
04d8aa70 | 200 | if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE) |
c88c0d42 | 201 | return (FATAL_EXIT_CODE); |
41299f41 | 202 | |
0313e85b ZW |
203 | puts ("/* Generated automatically by the program `genattr'"); |
204 | puts (" from the machine description file `md'. */\n"); | |
205 | puts ("#ifndef GCC_INSN_ATTR_H"); | |
206 | puts ("#define GCC_INSN_ATTR_H\n"); | |
41299f41 | 207 | |
f12b8918 TM |
208 | /* For compatibility, define the attribute `alternative', which is just |
209 | a reference to the variable `which_alternative'. */ | |
210 | ||
0313e85b ZW |
211 | puts ("#define HAVE_ATTR_alternative"); |
212 | puts ("#define get_attr_alternative(insn) which_alternative"); | |
3d7aafde | 213 | |
41299f41 TW |
214 | /* Read the machine description. */ |
215 | ||
216 | while (1) | |
217 | { | |
c88c0d42 CP |
218 | int line_no, insn_code_number; |
219 | ||
220 | desc = read_md_rtx (&line_no, &insn_code_number); | |
221 | if (desc == NULL) | |
41299f41 | 222 | break; |
41299f41 | 223 | |
f12b8918 TM |
224 | if (GET_CODE (desc) == DEFINE_ATTR) |
225 | gen_attr (desc); | |
41299f41 | 226 | |
f12b8918 TM |
227 | else if (GET_CODE (desc) == DEFINE_DELAY) |
228 | { | |
229 | if (! have_delay) | |
230 | { | |
231 | printf ("#define DELAY_SLOTS\n"); | |
3d7aafde AJ |
232 | printf ("extern int num_delay_slots (rtx);\n"); |
233 | printf ("extern int eligible_for_delay (rtx, int, rtx, int);\n\n"); | |
234 | printf ("extern int const_num_delay_slots (rtx);\n\n"); | |
f12b8918 TM |
235 | have_delay = 1; |
236 | } | |
41299f41 | 237 | |
f12b8918 TM |
238 | for (i = 0; i < XVECLEN (desc, 1); i += 3) |
239 | { | |
240 | if (XVECEXP (desc, 1, i + 1) && ! have_annul_true) | |
241 | { | |
242 | printf ("#define ANNUL_IFTRUE_SLOTS\n"); | |
3d7aafde | 243 | printf ("extern int eligible_for_annul_true (rtx, int, rtx, int);\n"); |
f12b8918 TM |
244 | have_annul_true = 1; |
245 | } | |
ef3fad04 | 246 | |
f12b8918 TM |
247 | if (XVECEXP (desc, 1, i + 2) && ! have_annul_false) |
248 | { | |
249 | printf ("#define ANNUL_IFFALSE_SLOTS\n"); | |
3d7aafde | 250 | printf ("extern int eligible_for_annul_false (rtx, int, rtx, int);\n"); |
f12b8918 TM |
251 | have_annul_false = 1; |
252 | } | |
253 | } | |
254 | } | |
ef3fad04 | 255 | |
4beba5da TM |
256 | else if (GET_CODE (desc) == DEFINE_FUNCTION_UNIT) |
257 | { | |
3cce094d | 258 | const char *name = XSTR (desc, 0); |
f12b8918 TM |
259 | int multiplicity = XINT (desc, 1); |
260 | int simultaneity = XINT (desc, 2); | |
261 | int ready_cost = MAX (XINT (desc, 4), 1); | |
262 | int issue_delay = MAX (XINT (desc, 5), 1); | |
263 | int issueexp_p = (XVEC (desc, 6) != 0); | |
ef3fad04 | 264 | |
f12b8918 TM |
265 | for (unit = units; unit; unit = unit->next) |
266 | if (strcmp (unit->name, name) == 0) | |
267 | break; | |
ef3fad04 | 268 | |
f12b8918 TM |
269 | if (unit == 0) |
270 | { | |
703ad42b | 271 | unit = xmalloc (sizeof (struct function_unit)); |
b548dffb | 272 | unit->name = xstrdup (name); |
f12b8918 TM |
273 | unit->multiplicity = multiplicity; |
274 | unit->simultaneity = simultaneity; | |
275 | unit->ready_cost.min = unit->ready_cost.max = ready_cost; | |
276 | unit->issue_delay.min = unit->issue_delay.max = issue_delay; | |
277 | unit->next = units; | |
278 | units = unit; | |
279 | num_units++; | |
280 | ||
281 | extend_range (&all_multiplicity, multiplicity, multiplicity); | |
282 | extend_range (&all_simultaneity, simultaneity, simultaneity); | |
283 | } | |
284 | else if (unit->multiplicity != multiplicity | |
285 | || unit->simultaneity != simultaneity) | |
357351e5 | 286 | fatal ("Differing specifications given for `%s' function unit", |
f12b8918 | 287 | unit->name); |
ef3fad04 | 288 | |
f12b8918 TM |
289 | extend_range (&unit->ready_cost, ready_cost, ready_cost); |
290 | extend_range (&unit->issue_delay, | |
291 | issueexp_p ? 1 : issue_delay, issue_delay); | |
292 | extend_range (&all_ready_cost, | |
293 | unit->ready_cost.min, unit->ready_cost.max); | |
294 | extend_range (&all_issue_delay, | |
295 | unit->issue_delay.min, unit->issue_delay.max); | |
296 | } | |
fae15c93 VM |
297 | else if (GET_CODE (desc) == DEFINE_INSN_RESERVATION) |
298 | num_insn_reservations++; | |
f12b8918 | 299 | } |
ef3fad04 | 300 | |
fae15c93 | 301 | if (num_units > 0 || num_insn_reservations > 0) |
f12b8918 TM |
302 | { |
303 | /* Compute the range of blockage cost values. See genattrtab.c | |
304 | for the derivation. BLOCKAGE (E,C) when SIMULTANEITY is zero is | |
ef3fad04 | 305 | |
f12b8918 TM |
306 | MAX (ISSUE-DELAY (E,C), |
307 | READY-COST (E) - (READY-COST (C) - 1)) | |
ef3fad04 | 308 | |
f12b8918 | 309 | and otherwise |
4beba5da | 310 | |
f12b8918 TM |
311 | MAX (ISSUE-DELAY (E,C), |
312 | READY-COST (E) - (READY-COST (C) - 1), | |
313 | READY-COST (E) - FILL-TIME) */ | |
4beba5da | 314 | |
f12b8918 TM |
315 | for (unit = units; unit; unit = unit->next) |
316 | { | |
317 | struct range blockage; | |
4beba5da | 318 | |
f12b8918 TM |
319 | blockage = unit->issue_delay; |
320 | blockage.max = MAX (unit->ready_cost.max | |
321 | - (unit->ready_cost.min - 1), | |
322 | blockage.max); | |
323 | blockage.min = MAX (1, blockage.min); | |
4beba5da | 324 | |
f12b8918 TM |
325 | if (unit->simultaneity != 0) |
326 | { | |
327 | int fill_time = ((unit->simultaneity - 1) | |
328 | * unit->issue_delay.min); | |
329 | blockage.min = MAX (unit->ready_cost.min - fill_time, | |
330 | blockage.min); | |
331 | blockage.max = MAX (unit->ready_cost.max - fill_time, | |
332 | blockage.max); | |
333 | } | |
334 | extend_range (&all_blockage, blockage.min, blockage.max); | |
335 | } | |
4beba5da | 336 | |
f12b8918 TM |
337 | write_units (num_units, &all_multiplicity, &all_simultaneity, |
338 | &all_ready_cost, &all_issue_delay, &all_blockage); | |
fae15c93 VM |
339 | |
340 | /* Output interface for pipeline hazards recognition based on | |
341 | DFA (deterministic finite state automata. */ | |
342 | printf ("\n/* DFA based pipeline interface. */"); | |
d530b07f VM |
343 | printf ("\n#ifndef AUTOMATON_ALTS\n"); |
344 | printf ("#define AUTOMATON_ALTS 0\n"); | |
345 | printf ("#endif\n\n"); | |
fae15c93 VM |
346 | printf ("\n#ifndef AUTOMATON_STATE_ALTS\n"); |
347 | printf ("#define AUTOMATON_STATE_ALTS 0\n"); | |
348 | printf ("#endif\n\n"); | |
349 | printf ("#ifndef CPU_UNITS_QUERY\n"); | |
350 | printf ("#define CPU_UNITS_QUERY 0\n"); | |
351 | printf ("#endif\n\n"); | |
352 | /* Interface itself: */ | |
353 | printf ("extern int max_dfa_issue_rate;\n\n"); | |
354 | printf ("/* The following macro value is calculated from the\n"); | |
355 | printf (" automaton based pipeline description and is equal to\n"); | |
356 | printf (" maximal number of all insns described in constructions\n"); | |
357 | printf (" `define_insn_reservation' which can be issued on the\n"); | |
358 | printf (" same processor cycle. */\n"); | |
359 | printf ("#define MAX_DFA_ISSUE_RATE max_dfa_issue_rate\n\n"); | |
360 | printf ("/* Insn latency time defined in define_insn_reservation. */\n"); | |
3d7aafde | 361 | printf ("extern int insn_default_latency (rtx);\n\n"); |
fae15c93 VM |
362 | printf ("/* Return nonzero if there is a bypass for given insn\n"); |
363 | printf (" which is a data producer. */\n"); | |
3d7aafde | 364 | printf ("extern int bypass_p (rtx);\n\n"); |
fae15c93 VM |
365 | printf ("/* Insn latency time on data consumed by the 2nd insn.\n"); |
366 | printf (" Use the function if bypass_p returns nonzero for\n"); | |
367 | printf (" the 1st insn. */\n"); | |
3d7aafde | 368 | printf ("extern int insn_latency (rtx, rtx);\n\n"); |
d530b07f | 369 | printf ("\n#if AUTOMATON_ALTS\n"); |
fae15c93 VM |
370 | printf ("/* The following function returns number of alternative\n"); |
371 | printf (" reservations of given insn. It may be used for better\n"); | |
372 | printf (" insns scheduling heuristics. */\n"); | |
3d7aafde | 373 | printf ("extern int insn_alts (rtx);\n\n"); |
d530b07f | 374 | printf ("#endif\n\n"); |
fae15c93 VM |
375 | printf ("/* Maximal possible number of insns waiting results being\n"); |
376 | printf (" produced by insns whose execution is not finished. */\n"); | |
377 | printf ("extern int max_insn_queue_index;\n\n"); | |
378 | printf ("/* Pointer to data describing current state of DFA. */\n"); | |
379 | printf ("typedef void *state_t;\n\n"); | |
380 | printf ("/* Size of the data in bytes. */\n"); | |
3d7aafde | 381 | printf ("extern int state_size (void);\n\n"); |
fae15c93 VM |
382 | printf ("/* Initiate given DFA state, i.e. Set up the state\n"); |
383 | printf (" as all functional units were not reserved. */\n"); | |
3d7aafde | 384 | printf ("extern void state_reset (state_t);\n"); |
fae15c93 VM |
385 | printf ("/* The following function returns negative value if given\n"); |
386 | printf (" insn can be issued in processor state described by given\n"); | |
387 | printf (" DFA state. In this case, the DFA state is changed to\n"); | |
388 | printf (" reflect the current and future reservations by given\n"); | |
389 | printf (" insn. Otherwise the function returns minimal time\n"); | |
390 | printf (" delay to issue the insn. This delay may be zero\n"); | |
391 | printf (" for superscalar or VLIW processors. If the second\n"); | |
392 | printf (" parameter is NULL the function changes given DFA state\n"); | |
393 | printf (" as new processor cycle started. */\n"); | |
3d7aafde | 394 | printf ("extern int state_transition (state_t, rtx);\n"); |
fae15c93 VM |
395 | printf ("\n#if AUTOMATON_STATE_ALTS\n"); |
396 | printf ("/* The following function returns number of possible\n"); | |
397 | printf (" alternative reservations of given insn in given\n"); | |
398 | printf (" DFA state. It may be used for better insns scheduling\n"); | |
399 | printf (" heuristics. By default the function is defined if\n"); | |
400 | printf (" macro AUTOMATON_STATE_ALTS is defined because its\n"); | |
401 | printf (" implementation may require much memory. */\n"); | |
3d7aafde | 402 | printf ("extern int state_alts (state_t, rtx);\n"); |
fae15c93 | 403 | printf ("#endif\n\n"); |
3d7aafde | 404 | printf ("extern int min_issue_delay (state_t, rtx);\n"); |
fae15c93 VM |
405 | printf ("/* The following function returns nonzero if no one insn\n"); |
406 | printf (" can be issued in current DFA state. */\n"); | |
3d7aafde | 407 | printf ("extern int state_dead_lock_p (state_t);\n"); |
fae15c93 VM |
408 | printf ("/* The function returns minimal delay of issue of the 2nd\n"); |
409 | printf (" insn after issuing the 1st insn in given DFA state.\n"); | |
410 | printf (" The 1st insn should be issued in given state (i.e.\n"); | |
411 | printf (" state_transition should return negative value for\n"); | |
412 | printf (" the insn and the state). Data dependencies between\n"); | |
413 | printf (" the insns are ignored by the function. */\n"); | |
414 | printf | |
3d7aafde | 415 | ("extern int min_insn_conflict_delay (state_t, rtx, rtx);\n"); |
fae15c93 VM |
416 | printf ("/* The following function outputs reservations for given\n"); |
417 | printf (" insn as they are described in the corresponding\n"); | |
418 | printf (" define_insn_reservation. */\n"); | |
3d7aafde | 419 | printf ("extern void print_reservation (FILE *, rtx);\n"); |
fae15c93 VM |
420 | printf ("\n#if CPU_UNITS_QUERY\n"); |
421 | printf ("/* The following function returns code of functional unit\n"); | |
422 | printf (" with given name (see define_cpu_unit). */\n"); | |
3d7aafde | 423 | printf ("extern int get_cpu_unit_code (const char *);\n"); |
fae15c93 VM |
424 | printf ("/* The following function returns nonzero if functional\n"); |
425 | printf (" unit with given code is currently reserved in given\n"); | |
426 | printf (" DFA state. */\n"); | |
3d7aafde | 427 | printf ("extern int cpu_unit_reservation_p (state_t, int);\n"); |
dd1b7476 | 428 | printf ("#endif\n\n"); |
30028c85 VM |
429 | printf ("/* Clean insn code cache. It should be called if there\n"); |
430 | printf (" is a chance that condition value in a\n"); | |
431 | printf (" define_insn_reservation will be changed after\n"); | |
432 | printf (" last call of dfa_start. */\n"); | |
3d7aafde | 433 | printf ("extern void dfa_clean_insn_cache (void);\n\n"); |
fae15c93 VM |
434 | printf ("/* Initiate and finish work with DFA. They should be\n"); |
435 | printf (" called as the first and the last interface\n"); | |
436 | printf (" functions. */\n"); | |
3d7aafde AJ |
437 | printf ("extern void dfa_start (void);\n"); |
438 | printf ("extern void dfa_finish (void);\n"); | |
fae15c93 VM |
439 | } |
440 | else | |
441 | { | |
442 | /* Otherwise we do no scheduling, but we need these typedefs | |
443 | in order to avoid uglifying other code with more ifdefs. */ | |
444 | printf ("typedef void *state_t;\n\n"); | |
a224278b | 445 | } |
b29d5f75 | 446 | |
3d7aafde | 447 | /* Output flag masks for use by reorg. |
eaa48dab JL |
448 | |
449 | Flags are used to hold branch direction and prediction information | |
450 | for use by eligible_for_... */ | |
451 | printf("\n#define ATTR_FLAG_forward\t0x1\n"); | |
452 | printf("#define ATTR_FLAG_backward\t0x2\n"); | |
453 | printf("#define ATTR_FLAG_likely\t0x4\n"); | |
454 | printf("#define ATTR_FLAG_very_likely\t0x8\n"); | |
455 | printf("#define ATTR_FLAG_unlikely\t0x10\n"); | |
456 | printf("#define ATTR_FLAG_very_unlikely\t0x20\n"); | |
457 | ||
0313e85b ZW |
458 | puts("\n#endif /* GCC_INSN_ATTR_H */"); |
459 | ||
460 | if (ferror (stdout) || fflush (stdout) || fclose (stdout)) | |
461 | return FATAL_EXIT_CODE; | |
462 | ||
463 | return SUCCESS_EXIT_CODE; | |
41299f41 | 464 | } |
a995e389 RH |
465 | |
466 | /* Define this so we can link with print-rtl.o to get debug_rtx function. */ | |
467 | const char * | |
3d7aafde | 468 | get_insn_name (int code ATTRIBUTE_UNUSED) |
a995e389 RH |
469 | { |
470 | return NULL; | |
471 | } |