xref: /dflybsd-src/contrib/gcc-4.7/gcc/genattr.c (revision 04febcfb30580676d3e95f58a16c5137ee478b32)
1*e4b17023SJohn Marino /* Generate attribute information (insn-attr.h) from machine description.
2*e4b17023SJohn Marino    Copyright (C) 1991, 1994, 1996, 1998, 1999, 2000, 2003, 2004, 2007, 2008,
3*e4b17023SJohn Marino    2010, 2011  Free Software Foundation, Inc.
4*e4b17023SJohn Marino    Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
5*e4b17023SJohn Marino 
6*e4b17023SJohn Marino This file is part of GCC.
7*e4b17023SJohn Marino 
8*e4b17023SJohn Marino GCC is free software; you can redistribute it and/or modify it under
9*e4b17023SJohn Marino the terms of the GNU General Public License as published by the Free
10*e4b17023SJohn Marino Software Foundation; either version 3, or (at your option) any later
11*e4b17023SJohn Marino version.
12*e4b17023SJohn Marino 
13*e4b17023SJohn Marino GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14*e4b17023SJohn Marino WARRANTY; without even the implied warranty of MERCHANTABILITY or
15*e4b17023SJohn Marino FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16*e4b17023SJohn Marino for more details.
17*e4b17023SJohn Marino 
18*e4b17023SJohn Marino You should have received a copy of the GNU General Public License
19*e4b17023SJohn Marino along with GCC; see the file COPYING3.  If not see
20*e4b17023SJohn Marino <http://www.gnu.org/licenses/>.  */
21*e4b17023SJohn Marino 
22*e4b17023SJohn Marino 
23*e4b17023SJohn Marino #include "bconfig.h"
24*e4b17023SJohn Marino #include "system.h"
25*e4b17023SJohn Marino #include "coretypes.h"
26*e4b17023SJohn Marino #include "tm.h"
27*e4b17023SJohn Marino #include "rtl.h"
28*e4b17023SJohn Marino #include "errors.h"
29*e4b17023SJohn Marino #include "read-md.h"
30*e4b17023SJohn Marino #include "gensupport.h"
31*e4b17023SJohn Marino 
32*e4b17023SJohn Marino 
33*e4b17023SJohn Marino static void gen_attr (rtx);
34*e4b17023SJohn Marino 
VEC(rtx,heap)35*e4b17023SJohn Marino static VEC (rtx, heap) *const_attrs, *reservations;
36*e4b17023SJohn Marino 
37*e4b17023SJohn Marino 
38*e4b17023SJohn Marino static void
39*e4b17023SJohn Marino gen_attr (rtx attr)
40*e4b17023SJohn Marino {
41*e4b17023SJohn Marino   const char *p;
42*e4b17023SJohn Marino   int is_const = GET_CODE (XEXP (attr, 2)) == CONST;
43*e4b17023SJohn Marino 
44*e4b17023SJohn Marino   if (is_const)
45*e4b17023SJohn Marino     VEC_safe_push (rtx, heap, const_attrs, attr);
46*e4b17023SJohn Marino 
47*e4b17023SJohn Marino   printf ("#define HAVE_ATTR_%s\n", XSTR (attr, 0));
48*e4b17023SJohn Marino 
49*e4b17023SJohn Marino   /* If numeric attribute, don't need to write an enum.  */
50*e4b17023SJohn Marino   if (GET_CODE (attr) == DEFINE_ENUM_ATTR)
51*e4b17023SJohn Marino     printf ("extern enum %s get_attr_%s (%s);\n\n",
52*e4b17023SJohn Marino 	    XSTR (attr, 1), XSTR (attr, 0), (is_const ? "void" : "rtx"));
53*e4b17023SJohn Marino   else
54*e4b17023SJohn Marino     {
55*e4b17023SJohn Marino       p = XSTR (attr, 1);
56*e4b17023SJohn Marino       if (*p == '\0')
57*e4b17023SJohn Marino 	printf ("extern int get_attr_%s (%s);\n", XSTR (attr, 0),
58*e4b17023SJohn Marino 		(is_const ? "void" : "rtx"));
59*e4b17023SJohn Marino       else
60*e4b17023SJohn Marino 	printf ("extern enum attr_%s get_attr_%s (%s);\n\n",
61*e4b17023SJohn Marino 		XSTR (attr, 0), XSTR (attr, 0), (is_const ? "void" : "rtx"));
62*e4b17023SJohn Marino     }
63*e4b17023SJohn Marino 
64*e4b17023SJohn Marino   /* If `length' attribute, write additional function definitions and define
65*e4b17023SJohn Marino      variables used by `insn_current_length'.  */
66*e4b17023SJohn Marino   if (! strcmp (XSTR (attr, 0), "length"))
67*e4b17023SJohn Marino     {
68*e4b17023SJohn Marino       puts ("\
69*e4b17023SJohn Marino extern void shorten_branches (rtx);\n\
70*e4b17023SJohn Marino extern int insn_default_length (rtx);\n\
71*e4b17023SJohn Marino extern int insn_min_length (rtx);\n\
72*e4b17023SJohn Marino extern int insn_variable_length_p (rtx);\n\
73*e4b17023SJohn Marino extern int insn_current_length (rtx);\n\n\
74*e4b17023SJohn Marino #include \"insn-addr.h\"\n");
75*e4b17023SJohn Marino     }
76*e4b17023SJohn Marino }
77*e4b17023SJohn Marino 
78*e4b17023SJohn Marino /* Check that attribute NAME is used in define_insn_reservation condition
79*e4b17023SJohn Marino    EXP.  Return true if it is.  */
80*e4b17023SJohn Marino static bool
check_tune_attr(const char * name,rtx exp)81*e4b17023SJohn Marino check_tune_attr (const char *name, rtx exp)
82*e4b17023SJohn Marino {
83*e4b17023SJohn Marino   switch (GET_CODE (exp))
84*e4b17023SJohn Marino     {
85*e4b17023SJohn Marino     case AND:
86*e4b17023SJohn Marino       if (check_tune_attr (name, XEXP (exp, 0)))
87*e4b17023SJohn Marino 	return true;
88*e4b17023SJohn Marino       return check_tune_attr (name, XEXP (exp, 1));
89*e4b17023SJohn Marino 
90*e4b17023SJohn Marino     case IOR:
91*e4b17023SJohn Marino       return (check_tune_attr (name, XEXP (exp, 0))
92*e4b17023SJohn Marino 	      && check_tune_attr (name, XEXP (exp, 1)));
93*e4b17023SJohn Marino 
94*e4b17023SJohn Marino     case EQ_ATTR:
95*e4b17023SJohn Marino       return strcmp (XSTR (exp, 0), name) == 0;
96*e4b17023SJohn Marino 
97*e4b17023SJohn Marino     default:
98*e4b17023SJohn Marino       return false;
99*e4b17023SJohn Marino     }
100*e4b17023SJohn Marino }
101*e4b17023SJohn Marino 
102*e4b17023SJohn Marino /* Try to find a const attribute (usually cpu or tune) that is used
103*e4b17023SJohn Marino    in all define_insn_reservation conditions.  */
104*e4b17023SJohn Marino static bool
find_tune_attr(rtx exp)105*e4b17023SJohn Marino find_tune_attr (rtx exp)
106*e4b17023SJohn Marino {
107*e4b17023SJohn Marino   unsigned int i;
108*e4b17023SJohn Marino   rtx attr;
109*e4b17023SJohn Marino 
110*e4b17023SJohn Marino   switch (GET_CODE (exp))
111*e4b17023SJohn Marino     {
112*e4b17023SJohn Marino     case AND:
113*e4b17023SJohn Marino     case IOR:
114*e4b17023SJohn Marino       if (find_tune_attr (XEXP (exp, 0)))
115*e4b17023SJohn Marino 	return true;
116*e4b17023SJohn Marino       return find_tune_attr (XEXP (exp, 1));
117*e4b17023SJohn Marino 
118*e4b17023SJohn Marino     case EQ_ATTR:
119*e4b17023SJohn Marino       if (strcmp (XSTR (exp, 0), "alternative") == 0)
120*e4b17023SJohn Marino 	return false;
121*e4b17023SJohn Marino 
122*e4b17023SJohn Marino       FOR_EACH_VEC_ELT (rtx, const_attrs, i, attr)
123*e4b17023SJohn Marino 	if (strcmp (XSTR (attr, 0), XSTR (exp, 0)) == 0)
124*e4b17023SJohn Marino 	  {
125*e4b17023SJohn Marino 	    unsigned int j;
126*e4b17023SJohn Marino 	    rtx resv;
127*e4b17023SJohn Marino 
128*e4b17023SJohn Marino 	    FOR_EACH_VEC_ELT (rtx, reservations, j, resv)
129*e4b17023SJohn Marino 	      if (! check_tune_attr (XSTR (attr, 0), XEXP (resv, 2)))
130*e4b17023SJohn Marino 		return false;
131*e4b17023SJohn Marino 	    return true;
132*e4b17023SJohn Marino 	  }
133*e4b17023SJohn Marino       return false;
134*e4b17023SJohn Marino 
135*e4b17023SJohn Marino     default:
136*e4b17023SJohn Marino       return false;
137*e4b17023SJohn Marino     }
138*e4b17023SJohn Marino }
139*e4b17023SJohn Marino 
140*e4b17023SJohn Marino int
main(int argc,char ** argv)141*e4b17023SJohn Marino main (int argc, char **argv)
142*e4b17023SJohn Marino {
143*e4b17023SJohn Marino   rtx desc;
144*e4b17023SJohn Marino   int have_delay = 0;
145*e4b17023SJohn Marino   int have_annul_true = 0;
146*e4b17023SJohn Marino   int have_annul_false = 0;
147*e4b17023SJohn Marino   int num_insn_reservations = 0;
148*e4b17023SJohn Marino   int i;
149*e4b17023SJohn Marino 
150*e4b17023SJohn Marino   progname = "genattr";
151*e4b17023SJohn Marino 
152*e4b17023SJohn Marino   if (!init_rtx_reader_args (argc, argv))
153*e4b17023SJohn Marino     return (FATAL_EXIT_CODE);
154*e4b17023SJohn Marino 
155*e4b17023SJohn Marino   puts ("/* Generated automatically by the program `genattr'");
156*e4b17023SJohn Marino   puts ("   from the machine description file `md'.  */\n");
157*e4b17023SJohn Marino   puts ("#ifndef GCC_INSN_ATTR_H");
158*e4b17023SJohn Marino   puts ("#define GCC_INSN_ATTR_H\n");
159*e4b17023SJohn Marino 
160*e4b17023SJohn Marino   puts ("#include \"insn-attr-common.h\"\n");
161*e4b17023SJohn Marino 
162*e4b17023SJohn Marino   /* For compatibility, define the attribute `alternative', which is just
163*e4b17023SJohn Marino      a reference to the variable `which_alternative'.  */
164*e4b17023SJohn Marino 
165*e4b17023SJohn Marino   puts ("#define HAVE_ATTR_alternative");
166*e4b17023SJohn Marino   puts ("#define get_attr_alternative(insn) which_alternative");
167*e4b17023SJohn Marino 
168*e4b17023SJohn Marino   /* Read the machine description.  */
169*e4b17023SJohn Marino 
170*e4b17023SJohn Marino   while (1)
171*e4b17023SJohn Marino     {
172*e4b17023SJohn Marino       int line_no, insn_code_number;
173*e4b17023SJohn Marino 
174*e4b17023SJohn Marino       desc = read_md_rtx (&line_no, &insn_code_number);
175*e4b17023SJohn Marino       if (desc == NULL)
176*e4b17023SJohn Marino 	break;
177*e4b17023SJohn Marino 
178*e4b17023SJohn Marino       if (GET_CODE (desc) == DEFINE_ATTR
179*e4b17023SJohn Marino 	  || GET_CODE (desc) == DEFINE_ENUM_ATTR)
180*e4b17023SJohn Marino 	gen_attr (desc);
181*e4b17023SJohn Marino 
182*e4b17023SJohn Marino       else if (GET_CODE (desc) == DEFINE_DELAY)
183*e4b17023SJohn Marino         {
184*e4b17023SJohn Marino 	  if (! have_delay)
185*e4b17023SJohn Marino 	    {
186*e4b17023SJohn Marino 	      printf ("extern int num_delay_slots (rtx);\n");
187*e4b17023SJohn Marino 	      printf ("extern int eligible_for_delay (rtx, int, rtx, int);\n\n");
188*e4b17023SJohn Marino 	      printf ("extern int const_num_delay_slots (rtx);\n\n");
189*e4b17023SJohn Marino 	      have_delay = 1;
190*e4b17023SJohn Marino 	    }
191*e4b17023SJohn Marino 
192*e4b17023SJohn Marino 	  for (i = 0; i < XVECLEN (desc, 1); i += 3)
193*e4b17023SJohn Marino 	    {
194*e4b17023SJohn Marino 	      if (XVECEXP (desc, 1, i + 1) && ! have_annul_true)
195*e4b17023SJohn Marino 		{
196*e4b17023SJohn Marino 		  printf ("#define ANNUL_IFTRUE_SLOTS\n");
197*e4b17023SJohn Marino 		  printf ("extern int eligible_for_annul_true (rtx, int, rtx, int);\n");
198*e4b17023SJohn Marino 		  have_annul_true = 1;
199*e4b17023SJohn Marino 		}
200*e4b17023SJohn Marino 
201*e4b17023SJohn Marino 	      if (XVECEXP (desc, 1, i + 2) && ! have_annul_false)
202*e4b17023SJohn Marino 		{
203*e4b17023SJohn Marino 		  printf ("#define ANNUL_IFFALSE_SLOTS\n");
204*e4b17023SJohn Marino 		  printf ("extern int eligible_for_annul_false (rtx, int, rtx, int);\n");
205*e4b17023SJohn Marino 		  have_annul_false = 1;
206*e4b17023SJohn Marino 		}
207*e4b17023SJohn Marino 	    }
208*e4b17023SJohn Marino         }
209*e4b17023SJohn Marino 
210*e4b17023SJohn Marino       else if (GET_CODE (desc) == DEFINE_INSN_RESERVATION)
211*e4b17023SJohn Marino 	{
212*e4b17023SJohn Marino 	  num_insn_reservations++;
213*e4b17023SJohn Marino 	  VEC_safe_push (rtx, heap, reservations, desc);
214*e4b17023SJohn Marino 	}
215*e4b17023SJohn Marino     }
216*e4b17023SJohn Marino 
217*e4b17023SJohn Marino   if (num_insn_reservations > 0)
218*e4b17023SJohn Marino     {
219*e4b17023SJohn Marino       bool has_tune_attr
220*e4b17023SJohn Marino 	= find_tune_attr (XEXP (VEC_index (rtx, reservations, 0), 2));
221*e4b17023SJohn Marino       /* Output interface for pipeline hazards recognition based on
222*e4b17023SJohn Marino 	 DFA (deterministic finite state automata.  */
223*e4b17023SJohn Marino       printf ("\n/* DFA based pipeline interface.  */");
224*e4b17023SJohn Marino       printf ("\n#ifndef AUTOMATON_ALTS\n");
225*e4b17023SJohn Marino       printf ("#define AUTOMATON_ALTS 0\n");
226*e4b17023SJohn Marino       printf ("#endif\n\n");
227*e4b17023SJohn Marino       printf ("\n#ifndef AUTOMATON_STATE_ALTS\n");
228*e4b17023SJohn Marino       printf ("#define AUTOMATON_STATE_ALTS 0\n");
229*e4b17023SJohn Marino       printf ("#endif\n\n");
230*e4b17023SJohn Marino       printf ("#ifndef CPU_UNITS_QUERY\n");
231*e4b17023SJohn Marino       printf ("#define CPU_UNITS_QUERY 0\n");
232*e4b17023SJohn Marino       printf ("#endif\n\n");
233*e4b17023SJohn Marino       /* Interface itself: */
234*e4b17023SJohn Marino       if (has_tune_attr)
235*e4b17023SJohn Marino 	{
236*e4b17023SJohn Marino 	  printf ("/* Initialize fn pointers for internal_dfa_insn_code\n");
237*e4b17023SJohn Marino 	  printf ("   and insn_default_latency.  */\n");
238*e4b17023SJohn Marino 	  printf ("extern void init_sched_attrs (void);\n\n");
239*e4b17023SJohn Marino 	  printf ("/* Internal insn code number used by automata.  */\n");
240*e4b17023SJohn Marino 	  printf ("extern int (*internal_dfa_insn_code) (rtx);\n\n");
241*e4b17023SJohn Marino 	  printf ("/* Insn latency time defined in define_insn_reservation. */\n");
242*e4b17023SJohn Marino 	  printf ("extern int (*insn_default_latency) (rtx);\n\n");
243*e4b17023SJohn Marino 	}
244*e4b17023SJohn Marino       else
245*e4b17023SJohn Marino 	{
246*e4b17023SJohn Marino 	  printf ("#define init_sched_attrs() do { } while (0)\n\n");
247*e4b17023SJohn Marino 	  printf ("/* Internal insn code number used by automata.  */\n");
248*e4b17023SJohn Marino 	  printf ("extern int internal_dfa_insn_code (rtx);\n\n");
249*e4b17023SJohn Marino 	  printf ("/* Insn latency time defined in define_insn_reservation. */\n");
250*e4b17023SJohn Marino 	  printf ("extern int insn_default_latency (rtx);\n\n");
251*e4b17023SJohn Marino 	}
252*e4b17023SJohn Marino       printf ("/* Return nonzero if there is a bypass for given insn\n");
253*e4b17023SJohn Marino       printf ("   which is a data producer.  */\n");
254*e4b17023SJohn Marino       printf ("extern int bypass_p (rtx);\n\n");
255*e4b17023SJohn Marino       printf ("/* Insn latency time on data consumed by the 2nd insn.\n");
256*e4b17023SJohn Marino       printf ("   Use the function if bypass_p returns nonzero for\n");
257*e4b17023SJohn Marino       printf ("   the 1st insn. */\n");
258*e4b17023SJohn Marino       printf ("extern int insn_latency (rtx, rtx);\n\n");
259*e4b17023SJohn Marino       printf ("/* Maximal insn latency time possible of all bypasses for this insn.\n");
260*e4b17023SJohn Marino       printf ("   Use the function if bypass_p returns nonzero for\n");
261*e4b17023SJohn Marino       printf ("   the 1st insn. */\n");
262*e4b17023SJohn Marino       printf ("extern int maximal_insn_latency (rtx);\n\n");
263*e4b17023SJohn Marino       printf ("\n#if AUTOMATON_ALTS\n");
264*e4b17023SJohn Marino       printf ("/* The following function returns number of alternative\n");
265*e4b17023SJohn Marino       printf ("   reservations of given insn.  It may be used for better\n");
266*e4b17023SJohn Marino       printf ("   insns scheduling heuristics. */\n");
267*e4b17023SJohn Marino       printf ("extern int insn_alts (rtx);\n\n");
268*e4b17023SJohn Marino       printf ("#endif\n\n");
269*e4b17023SJohn Marino       printf ("/* Maximal possible number of insns waiting results being\n");
270*e4b17023SJohn Marino       printf ("   produced by insns whose execution is not finished. */\n");
271*e4b17023SJohn Marino       printf ("extern const int max_insn_queue_index;\n\n");
272*e4b17023SJohn Marino       printf ("/* Pointer to data describing current state of DFA.  */\n");
273*e4b17023SJohn Marino       printf ("typedef void *state_t;\n\n");
274*e4b17023SJohn Marino       printf ("/* Size of the data in bytes.  */\n");
275*e4b17023SJohn Marino       printf ("extern int state_size (void);\n\n");
276*e4b17023SJohn Marino       printf ("/* Initiate given DFA state, i.e. Set up the state\n");
277*e4b17023SJohn Marino       printf ("   as all functional units were not reserved.  */\n");
278*e4b17023SJohn Marino       printf ("extern void state_reset (state_t);\n");
279*e4b17023SJohn Marino       printf ("/* The following function returns negative value if given\n");
280*e4b17023SJohn Marino       printf ("   insn can be issued in processor state described by given\n");
281*e4b17023SJohn Marino       printf ("   DFA state.  In this case, the DFA state is changed to\n");
282*e4b17023SJohn Marino       printf ("   reflect the current and future reservations by given\n");
283*e4b17023SJohn Marino       printf ("   insn.  Otherwise the function returns minimal time\n");
284*e4b17023SJohn Marino       printf ("   delay to issue the insn.  This delay may be zero\n");
285*e4b17023SJohn Marino       printf ("   for superscalar or VLIW processors.  If the second\n");
286*e4b17023SJohn Marino       printf ("   parameter is NULL the function changes given DFA state\n");
287*e4b17023SJohn Marino       printf ("   as new processor cycle started.  */\n");
288*e4b17023SJohn Marino       printf ("extern int state_transition (state_t, rtx);\n");
289*e4b17023SJohn Marino       printf ("\n#if AUTOMATON_STATE_ALTS\n");
290*e4b17023SJohn Marino       printf ("/* The following function returns number of possible\n");
291*e4b17023SJohn Marino       printf ("   alternative reservations of given insn in given\n");
292*e4b17023SJohn Marino       printf ("   DFA state.  It may be used for better insns scheduling\n");
293*e4b17023SJohn Marino       printf ("   heuristics.  By default the function is defined if\n");
294*e4b17023SJohn Marino       printf ("   macro AUTOMATON_STATE_ALTS is defined because its\n");
295*e4b17023SJohn Marino       printf ("   implementation may require much memory.  */\n");
296*e4b17023SJohn Marino       printf ("extern int state_alts (state_t, rtx);\n");
297*e4b17023SJohn Marino       printf ("#endif\n\n");
298*e4b17023SJohn Marino       printf ("extern int min_issue_delay (state_t, rtx);\n");
299*e4b17023SJohn Marino       printf ("/* The following function returns nonzero if no one insn\n");
300*e4b17023SJohn Marino       printf ("   can be issued in current DFA state. */\n");
301*e4b17023SJohn Marino       printf ("extern int state_dead_lock_p (state_t);\n");
302*e4b17023SJohn Marino       printf ("/* The function returns minimal delay of issue of the 2nd\n");
303*e4b17023SJohn Marino       printf ("   insn after issuing the 1st insn in given DFA state.\n");
304*e4b17023SJohn Marino       printf ("   The 1st insn should be issued in given state (i.e.\n");
305*e4b17023SJohn Marino       printf ("    state_transition should return negative value for\n");
306*e4b17023SJohn Marino       printf ("    the insn and the state).  Data dependencies between\n");
307*e4b17023SJohn Marino       printf ("    the insns are ignored by the function.  */\n");
308*e4b17023SJohn Marino       printf
309*e4b17023SJohn Marino 	("extern int min_insn_conflict_delay (state_t, rtx, rtx);\n");
310*e4b17023SJohn Marino       printf ("/* The following function outputs reservations for given\n");
311*e4b17023SJohn Marino       printf ("   insn as they are described in the corresponding\n");
312*e4b17023SJohn Marino       printf ("   define_insn_reservation.  */\n");
313*e4b17023SJohn Marino       printf ("extern void print_reservation (FILE *, rtx);\n");
314*e4b17023SJohn Marino       printf ("\n#if CPU_UNITS_QUERY\n");
315*e4b17023SJohn Marino       printf ("/* The following function returns code of functional unit\n");
316*e4b17023SJohn Marino       printf ("   with given name (see define_cpu_unit). */\n");
317*e4b17023SJohn Marino       printf ("extern int get_cpu_unit_code (const char *);\n");
318*e4b17023SJohn Marino       printf ("/* The following function returns nonzero if functional\n");
319*e4b17023SJohn Marino       printf ("   unit with given code is currently reserved in given\n");
320*e4b17023SJohn Marino       printf ("   DFA state.  */\n");
321*e4b17023SJohn Marino       printf ("extern int cpu_unit_reservation_p (state_t, int);\n");
322*e4b17023SJohn Marino       printf ("#endif\n\n");
323*e4b17023SJohn Marino       printf ("/* The following function returns true if insn\n");
324*e4b17023SJohn Marino       printf ("   has a dfa reservation.  */\n");
325*e4b17023SJohn Marino       printf ("extern bool insn_has_dfa_reservation_p (rtx);\n\n");
326*e4b17023SJohn Marino       printf ("/* Clean insn code cache.  It should be called if there\n");
327*e4b17023SJohn Marino       printf ("   is a chance that condition value in a\n");
328*e4b17023SJohn Marino       printf ("   define_insn_reservation will be changed after\n");
329*e4b17023SJohn Marino       printf ("   last call of dfa_start.  */\n");
330*e4b17023SJohn Marino       printf ("extern void dfa_clean_insn_cache (void);\n\n");
331*e4b17023SJohn Marino       printf ("extern void dfa_clear_single_insn_cache (rtx);\n\n");
332*e4b17023SJohn Marino       printf ("/* Initiate and finish work with DFA.  They should be\n");
333*e4b17023SJohn Marino       printf ("   called as the first and the last interface\n");
334*e4b17023SJohn Marino       printf ("   functions.  */\n");
335*e4b17023SJohn Marino       printf ("extern void dfa_start (void);\n");
336*e4b17023SJohn Marino       printf ("extern void dfa_finish (void);\n");
337*e4b17023SJohn Marino     }
338*e4b17023SJohn Marino   else
339*e4b17023SJohn Marino     {
340*e4b17023SJohn Marino       /* Otherwise we do no scheduling, but we need these typedefs
341*e4b17023SJohn Marino 	 in order to avoid uglifying other code with more ifdefs.  */
342*e4b17023SJohn Marino       printf ("typedef void *state_t;\n\n");
343*e4b17023SJohn Marino     }
344*e4b17023SJohn Marino 
345*e4b17023SJohn Marino   /* Output flag masks for use by reorg.
346*e4b17023SJohn Marino 
347*e4b17023SJohn Marino      Flags are used to hold branch direction and prediction information
348*e4b17023SJohn Marino      for use by eligible_for_...  */
349*e4b17023SJohn Marino   printf("\n#define ATTR_FLAG_forward\t0x1\n");
350*e4b17023SJohn Marino   printf("#define ATTR_FLAG_backward\t0x2\n");
351*e4b17023SJohn Marino   printf("#define ATTR_FLAG_likely\t0x4\n");
352*e4b17023SJohn Marino   printf("#define ATTR_FLAG_very_likely\t0x8\n");
353*e4b17023SJohn Marino   printf("#define ATTR_FLAG_unlikely\t0x10\n");
354*e4b17023SJohn Marino   printf("#define ATTR_FLAG_very_unlikely\t0x20\n");
355*e4b17023SJohn Marino 
356*e4b17023SJohn Marino   puts("\n#endif /* GCC_INSN_ATTR_H */");
357*e4b17023SJohn Marino 
358*e4b17023SJohn Marino   if (ferror (stdout) || fflush (stdout) || fclose (stdout))
359*e4b17023SJohn Marino     return FATAL_EXIT_CODE;
360*e4b17023SJohn Marino 
361*e4b17023SJohn Marino   return SUCCESS_EXIT_CODE;
362*e4b17023SJohn Marino }
363