OSDN Git Service

Warning fixes:
[pf3gnuchains/gcc-fork.git] / gcc / rtl.c
1 /* Allocate and read RTL for GNU C Compiler.
2    Copyright (C) 1987, 1988, 1991, 1994, 1997, 1998 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING.  If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.  */
20
21
22 #include "config.h"
23 #include "system.h"
24 #include "rtl.h"
25 #include "real.h"
26 #include "bitmap.h"
27
28 #include "obstack.h"
29 #define obstack_chunk_alloc     xmalloc
30 #define obstack_chunk_free      free
31
32 /* Obstack used for allocating RTL objects.
33    Between functions, this is the permanent_obstack.
34    While parsing and expanding a function, this is maybepermanent_obstack
35    so we can save it if it is an inline function.
36    During optimization and output, this is function_obstack.  */
37
38 extern struct obstack *rtl_obstack;
39 \f
40 /* Indexed by rtx code, gives number of operands for an rtx with that code.
41    Does NOT include rtx header data (code and links).
42    This array is initialized in init_rtl.  */
43
44 int rtx_length[NUM_RTX_CODE + 1];
45
46 /* Indexed by rtx code, gives the name of that kind of rtx, as a C string.  */
47
48 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS)   NAME ,
49
50 char *rtx_name[] = {
51 #include "rtl.def"              /* rtl expressions are documented here */
52 };
53
54 #undef DEF_RTL_EXPR
55
56 /* Indexed by machine mode, gives the name of that machine mode.
57    This name does not include the letters "mode".  */
58
59 #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER)  NAME,
60
61 char *mode_name[(int) MAX_MACHINE_MODE + 1] = {
62 #include "machmode.def"
63
64 #ifdef EXTRA_CC_MODES
65   EXTRA_CC_NAMES,
66 #endif
67   /* Add an extra field to avoid a core dump if someone tries to convert
68      MAX_MACHINE_MODE to a string.   */
69   ""
70 };
71
72 #undef DEF_MACHMODE
73
74 /* Indexed by machine mode, gives the length of the mode, in bytes.
75    GET_MODE_CLASS uses this.  */
76
77 #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER)  CLASS,
78
79 enum mode_class mode_class[(int) MAX_MACHINE_MODE] = {
80 #include "machmode.def"
81 };
82
83 #undef DEF_MACHMODE
84
85 /* Indexed by machine mode, gives the length of the mode, in bytes.
86    GET_MODE_SIZE uses this.  */
87
88 #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER)  SIZE,
89
90 int mode_size[(int) MAX_MACHINE_MODE] = {
91 #include "machmode.def"
92 };
93
94 #undef DEF_MACHMODE
95
96 /* Indexed by machine mode, gives the length of the mode's subunit.
97    GET_MODE_UNIT_SIZE uses this.  */
98
99 #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER)  UNIT,
100
101 int mode_unit_size[(int) MAX_MACHINE_MODE] = {
102 #include "machmode.def"         /* machine modes are documented here */
103 };
104
105 #undef DEF_MACHMODE
106
107 /* Indexed by machine mode, gives next wider natural mode
108    (QI -> HI -> SI -> DI, etc.)  Widening multiply instructions
109    use this.  */
110
111 #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER)  \
112   (unsigned char) WIDER,
113
114 unsigned char mode_wider_mode[(int) MAX_MACHINE_MODE] = {
115 #include "machmode.def"         /* machine modes are documented here */
116 };
117
118 #undef DEF_MACHMODE
119
120 #define DEF_MACHMODE(SYM, NAME, CLASS, SIZE, UNIT, WIDER)  \
121   ((SIZE) * BITS_PER_UNIT >= HOST_BITS_PER_WIDE_INT) ? ~(unsigned HOST_WIDE_INT)0 : ((unsigned HOST_WIDE_INT) 1 << (SIZE) * BITS_PER_UNIT) - 1,
122
123 /* Indexed by machine mode, gives mask of significant bits in mode.  */
124
125 unsigned HOST_WIDE_INT mode_mask_array[(int) MAX_MACHINE_MODE] = {
126 #include "machmode.def"
127 };
128
129 /* Indexed by mode class, gives the narrowest mode for each class.  */
130
131 enum machine_mode class_narrowest_mode[(int) MAX_MODE_CLASS];
132
133 /* Indexed by rtx code, gives a sequence of operand-types for
134    rtx's of that code.  The sequence is a C string in which
135    each character describes one operand.  */
136
137 char *rtx_format[] = {
138   /* "*" undefined.
139          can cause a warning message
140      "0" field is unused (or used in a phase-dependent manner)
141          prints nothing
142      "i" an integer
143          prints the integer
144      "n" like "i", but prints entries from `note_insn_name'
145      "w" an integer of width HOST_BITS_PER_WIDE_INT
146          prints the integer
147      "s" a pointer to a string
148          prints the string
149      "S" like "s", but optional:
150          the containing rtx may end before this operand
151      "e" a pointer to an rtl expression
152          prints the expression
153      "E" a pointer to a vector that points to a number of rtl expressions
154          prints a list of the rtl expressions
155      "V" like "E", but optional:
156          the containing rtx may end before this operand
157      "u" a pointer to another insn
158          prints the uid of the insn.
159      "b" is a pointer to a bitmap header.
160      "t" is a tree pointer. */
161
162 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS)   FORMAT ,
163 #include "rtl.def"              /* rtl expressions are defined here */
164 #undef DEF_RTL_EXPR
165 };
166
167 /* Indexed by rtx code, gives a character representing the "class" of
168    that rtx code.  See rtl.def for documentation on the defined classes.  */
169
170 char rtx_class[] = {
171 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS)   CLASS, 
172 #include "rtl.def"              /* rtl expressions are defined here */
173 #undef DEF_RTL_EXPR
174 };
175
176 /* Names for kinds of NOTEs and REG_NOTEs.  */
177
178 char *note_insn_name[] = { 0                    , "NOTE_INSN_DELETED",
179                            "NOTE_INSN_BLOCK_BEG", "NOTE_INSN_BLOCK_END",
180                            "NOTE_INSN_LOOP_BEG", "NOTE_INSN_LOOP_END",
181                            "NOTE_INSN_FUNCTION_END", "NOTE_INSN_SETJMP",
182                            "NOTE_INSN_LOOP_CONT", "NOTE_INSN_LOOP_VTOP",
183                            "NOTE_INSN_PROLOGUE_END", "NOTE_INSN_EPILOGUE_BEG",
184                            "NOTE_INSN_DELETED_LABEL", "NOTE_INSN_FUNCTION_BEG",
185                            "NOTE_INSN_EH_REGION_BEG", "NOTE_INSN_EH_REGION_END",
186                            "NOTE_REPEATED_LINE_NUMBER", "NOTE_INSN_RANGE_START",
187                            "NOTE_INSN_RANGE_END", "NOTE_INSN_LIVE",
188                            "NOTE_INSN_BASIC_BLOCK" };
189
190 char *reg_note_name[] = { "", "REG_DEAD", "REG_INC", "REG_EQUIV", "REG_WAS_0",
191                           "REG_EQUAL", "REG_RETVAL", "REG_LIBCALL",
192                           "REG_NONNEG", "REG_NO_CONFLICT", "REG_UNUSED",
193                           "REG_CC_SETTER", "REG_CC_USER", "REG_LABEL",
194                           "REG_DEP_ANTI", "REG_DEP_OUTPUT", "REG_BR_PROB",
195                           "REG_EXEC_COUNT", "REG_NOALIAS", "REG_SAVE_AREA",
196                           "REG_BR_PRED", "REG_EH_CONTEXT",
197                           "REG_FRAME_RELATED_EXPR", "REG_EH_REGION",
198                           "REG_EH_RETHROW" };
199
200 static void dump_and_abort      PROTO((int, int, FILE *)) ATTRIBUTE_NORETURN;
201 static void read_name           PROTO((char *, FILE *));
202 \f
203 /* Allocate an rtx vector of N elements.
204    Store the length, and initialize all elements to zero.  */
205
206 rtvec
207 rtvec_alloc (n)
208      int n;
209 {
210   rtvec rt;
211   int i;
212
213   rt = (rtvec) obstack_alloc (rtl_obstack,
214                               sizeof (struct rtvec_def)
215                               + (( n - 1) * sizeof (rtunion)));
216
217   /* clear out the vector */
218   PUT_NUM_ELEM (rt, n);
219
220   for (i = 0; i < n; i++)
221     rt->elem[i].rtwint = 0;
222
223   return rt;
224 }
225
226 /* Allocate an rtx of code CODE.  The CODE is stored in the rtx;
227    all the rest is initialized to zero.  */
228
229 rtx
230 rtx_alloc (code)
231   RTX_CODE code;
232 {
233   rtx rt;
234   register struct obstack *ob = rtl_obstack;
235   register int nelts = GET_RTX_LENGTH (code);
236   register int length = sizeof (struct rtx_def)
237     + (nelts - 1) * sizeof (rtunion);
238
239   /* This function is called more than any other in GCC,
240      so we manipulate the obstack directly.
241
242      Even though rtx objects are word aligned, we may be sharing an obstack
243      with tree nodes, which may have to be double-word aligned.  So align
244      our length to the alignment mask in the obstack.  */
245
246   length = (length + ob->alignment_mask) & ~ ob->alignment_mask;
247
248   if (ob->chunk_limit - ob->next_free < length)
249     _obstack_newchunk (ob, length);
250   rt = (rtx)ob->object_base;
251   ob->next_free += length;
252   ob->object_base = ob->next_free;
253
254   /* We want to clear everything up to the FLD array.  Normally, this is
255      one int, but we don't want to assume that and it isn't very portable
256      anyway; this is.  */
257
258   memset (rt, 0, sizeof (struct rtx_def) - sizeof (rtunion));
259
260   PUT_CODE (rt, code);
261
262   return rt;
263 }
264
265 /* Free the rtx X and all RTL allocated since X.  */
266
267 void
268 rtx_free (x)
269      rtx x;
270 {
271   obstack_free (rtl_obstack, x);
272 }
273 \f
274 /* Create a new copy of an rtx.
275    Recursively copies the operands of the rtx,
276    except for those few rtx codes that are sharable.  */
277
278 rtx
279 copy_rtx (orig)
280      register rtx orig;
281 {
282   register rtx copy;
283   register int i, j;
284   register RTX_CODE code;
285   register char *format_ptr;
286
287   code = GET_CODE (orig);
288
289   switch (code)
290     {
291     case REG:
292     case QUEUED:
293     case CONST_INT:
294     case CONST_DOUBLE:
295     case SYMBOL_REF:
296     case CODE_LABEL:
297     case PC:
298     case CC0:
299     case SCRATCH:
300       /* SCRATCH must be shared because they represent distinct values.  */
301     case ADDRESSOF:
302       return orig;
303
304     case CONST:
305       /* CONST can be shared if it contains a SYMBOL_REF.  If it contains
306          a LABEL_REF, it isn't sharable.  */
307       if (GET_CODE (XEXP (orig, 0)) == PLUS
308           && GET_CODE (XEXP (XEXP (orig, 0), 0)) == SYMBOL_REF
309           && GET_CODE (XEXP (XEXP (orig, 0), 1)) == CONST_INT)
310         return orig;
311       break;
312
313       /* A MEM with a constant address is not sharable.  The problem is that
314          the constant address may need to be reloaded.  If the mem is shared,
315          then reloading one copy of this mem will cause all copies to appear
316          to have been reloaded.  */
317
318     default:
319       break;
320     }
321
322   copy = rtx_alloc (code);
323
324   /* Copy the various flags, and other information.  We assume that
325      all fields need copying, and then clear the fields that should
326      not be copied.  That is the sensible default behavior, and forces
327      us to explicitly document why we are *not* copying a flag.  */
328   memcpy (copy, orig, sizeof (struct rtx_def) - sizeof (rtunion));
329
330   /* We do not copy the USED flag, which is used as a mark bit during
331      walks over the RTL.  */
332   copy->used = 0;
333
334   /* We do not copy JUMP, CALL, or FRAME_RELATED for INSNs.  */
335   if (GET_RTX_CLASS (code) == 'i')
336     {
337       copy->jump = 0;
338       copy->call = 0;
339       copy->frame_related = 0;
340     }
341   
342   format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
343
344   for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
345     {
346       switch (*format_ptr++)
347         {
348         case 'e':
349           XEXP (copy, i) = XEXP (orig, i);
350           if (XEXP (orig, i) != NULL)
351             XEXP (copy, i) = copy_rtx (XEXP (orig, i));
352           break;
353
354         case '0':
355         case 'u':
356           XEXP (copy, i) = XEXP (orig, i);
357           break;
358
359         case 'E':
360         case 'V':
361           XVEC (copy, i) = XVEC (orig, i);
362           if (XVEC (orig, i) != NULL)
363             {
364               XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i));
365               for (j = 0; j < XVECLEN (copy, i); j++)
366                 XVECEXP (copy, i, j) = copy_rtx (XVECEXP (orig, i, j));
367             }
368           break;
369
370         case 'b':
371           {
372             bitmap new_bits = BITMAP_OBSTACK_ALLOC (rtl_obstack);
373             bitmap_copy (new_bits, XBITMAP (orig, i));
374             XBITMAP (copy, i) = new_bits;
375             break;
376           }
377
378         case 't':
379           XTREE (copy, i) = XTREE (orig, i);
380           break;
381
382         case 'w':
383           XWINT (copy, i) = XWINT (orig, i);
384           break;
385
386         case 'i':
387           XINT (copy, i) = XINT (orig, i);
388           break;
389
390         case 's':
391         case 'S':
392           XSTR (copy, i) = XSTR (orig, i);
393           break;
394
395         default:
396           abort ();
397         }
398     }
399   return copy;
400 }
401
402 /* Similar to `copy_rtx' except that if MAY_SHARE is present, it is
403    placed in the result directly, rather than being copied.  */
404
405 rtx
406 copy_most_rtx (orig, may_share)
407      register rtx orig;
408      register rtx may_share;
409 {
410   register rtx copy;
411   register int i, j;
412   register RTX_CODE code;
413   register char *format_ptr;
414
415   if (orig == may_share)
416     return orig;
417
418   code = GET_CODE (orig);
419
420   switch (code)
421     {
422     case REG:
423     case QUEUED:
424     case CONST_INT:
425     case CONST_DOUBLE:
426     case SYMBOL_REF:
427     case CODE_LABEL:
428     case PC:
429     case CC0:
430       return orig;
431     default:
432       break;
433     }
434
435   copy = rtx_alloc (code);
436   PUT_MODE (copy, GET_MODE (orig));
437   copy->in_struct = orig->in_struct;
438   copy->volatil = orig->volatil;
439   copy->unchanging = orig->unchanging;
440   copy->integrated = orig->integrated;
441   
442   format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
443
444   for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
445     {
446       switch (*format_ptr++)
447         {
448         case 'e':
449           XEXP (copy, i) = XEXP (orig, i);
450           if (XEXP (orig, i) != NULL && XEXP (orig, i) != may_share)
451             XEXP (copy, i) = copy_most_rtx (XEXP (orig, i), may_share);
452           break;
453
454         case '0':
455         case 'u':
456           XEXP (copy, i) = XEXP (orig, i);
457           break;
458
459         case 'E':
460         case 'V':
461           XVEC (copy, i) = XVEC (orig, i);
462           if (XVEC (orig, i) != NULL)
463             {
464               XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i));
465               for (j = 0; j < XVECLEN (copy, i); j++)
466                 XVECEXP (copy, i, j)
467                   = copy_most_rtx (XVECEXP (orig, i, j), may_share);
468             }
469           break;
470
471         case 'w':
472           XWINT (copy, i) = XWINT (orig, i);
473           break;
474
475         case 'n':
476         case 'i':
477           XINT (copy, i) = XINT (orig, i);
478           break;
479
480         case 's':
481         case 'S':
482           XSTR (copy, i) = XSTR (orig, i);
483           break;
484
485         default:
486           abort ();
487         }
488     }
489   return copy;
490 }
491
492 /* Create a new copy of an rtx.  Only copy just one level.  */
493 rtx
494 shallow_copy_rtx (orig)
495      rtx orig;
496 {
497   register int i;
498   register RTX_CODE code = GET_CODE (orig);
499   register rtx copy = rtx_alloc (code);
500
501   PUT_MODE (copy, GET_MODE (orig));
502   copy->in_struct = orig->in_struct;
503   copy->volatil = orig->volatil;
504   copy->unchanging = orig->unchanging;
505   copy->integrated = orig->integrated;
506
507   for (i = 0; i < GET_RTX_LENGTH (code); i++)
508     copy->fld[i] = orig->fld[i];
509
510   return copy;
511 }
512 \f
513 /* Subroutines of read_rtx.  */
514
515 /* Dump code after printing a message.  Used when read_rtx finds
516    invalid data.  */
517
518 static void
519 dump_and_abort (expected_c, actual_c, infile)
520      int expected_c, actual_c;
521      FILE *infile;
522 {
523   int c, i;
524
525   if (expected_c >= 0)
526     fprintf (stderr,
527              "Expected character %c.  Found character %c.",
528              expected_c, actual_c);
529   fprintf (stderr, "  At file position: %ld\n", ftell (infile));
530   fprintf (stderr, "Following characters are:\n\t");
531   for (i = 0; i < 200; i++)
532     {
533       c = getc (infile);
534       if (EOF == c) break;
535       putc (c, stderr);
536     }
537   fprintf (stderr, "Aborting.\n");
538   abort ();
539 }
540
541 /* Read chars from INFILE until a non-whitespace char
542    and return that.  Comments, both Lisp style and C style,
543    are treated as whitespace.
544    Tools such as genflags use this function.  */
545
546 int
547 read_skip_spaces (infile)
548      FILE *infile;
549 {
550   register int c;
551   while ((c = getc (infile)))
552     {
553       if (c == ' ' || c == '\n' || c == '\t' || c == '\f')
554         ;
555       else if (c == ';')
556         {
557           while ((c = getc (infile)) && c != '\n' && c != EOF)
558             ;
559         }
560       else if (c == '/')
561         {
562           register int prevc;
563           c = getc (infile);
564           if (c != '*')
565             dump_and_abort ('*', c, infile);
566           
567           prevc = 0;
568           while ((c = getc (infile)) && c != EOF)
569             {
570               if (prevc == '*' && c == '/')
571                 break;
572               prevc = c;
573             }
574         }
575       else break;
576     }
577   return c;
578 }
579
580 /* Read an rtx code name into the buffer STR[].
581    It is terminated by any of the punctuation chars of rtx printed syntax.  */
582
583 static void
584 read_name (str, infile)
585      char *str;
586      FILE *infile;
587 {
588   register char *p;
589   register int c;
590
591   c = read_skip_spaces(infile);
592
593   p = str;
594   while (1)
595     {
596       if (c == ' ' || c == '\n' || c == '\t' || c == '\f')
597         break;
598       if (c == ':' || c == ')' || c == ']' || c == '"' || c == '/'
599           || c == '(' || c == '[')
600         {
601           ungetc (c, infile);
602           break;
603         }
604       *p++ = c;
605       c = getc (infile);
606     }
607   if (p == str)
608     {
609       fprintf (stderr, "missing name or number");
610       dump_and_abort (-1, -1, infile);
611     }
612
613   *p = 0;
614 }
615 \f
616 /* Provide a version of a function to read a long long if the system does
617    not provide one.  */
618 #if HOST_BITS_PER_WIDE_INT > HOST_BITS_PER_LONG && !defined(HAVE_ATOLL) && !defined(HAVE_ATOQ)
619 HOST_WIDE_INT
620 atoll(p)
621     const char *p;
622 {
623   int neg = 0;
624   HOST_WIDE_INT tmp_wide;
625
626   while (ISSPACE(*p))
627     p++;
628   if (*p == '-')
629     neg = 1, p++;
630   else if (*p == '+')
631     p++;
632
633   tmp_wide = 0;
634   while (ISDIGIT(*p))
635     {
636       HOST_WIDE_INT new_wide = tmp_wide*10 + (*p - '0');
637       if (new_wide < tmp_wide)
638         {
639           /* Return INT_MAX equiv on overflow.  */
640           tmp_wide = (~(unsigned HOST_WIDE_INT)0) >> 1;
641           break;
642         }
643       tmp_wide = new_wide;
644       p++;
645     }
646
647   if (neg)
648     tmp_wide = -tmp_wide;
649   return tmp_wide;
650 }
651 #endif
652
653 /* Read an rtx in printed representation from INFILE
654    and return an actual rtx in core constructed accordingly.
655    read_rtx is not used in the compiler proper, but rather in
656    the utilities gen*.c that construct C code from machine descriptions.  */
657
658 rtx
659 read_rtx (infile)
660      FILE *infile;
661 {
662   register int i, j, list_counter;
663   RTX_CODE tmp_code;
664   register char *format_ptr;
665   /* tmp_char is a buffer used for reading decimal integers
666      and names of rtx types and machine modes.
667      Therefore, 256 must be enough.  */
668   char tmp_char[256];
669   rtx return_rtx;
670   register int c;
671   int tmp_int;
672   HOST_WIDE_INT tmp_wide;
673
674   /* Linked list structure for making RTXs: */
675   struct rtx_list
676     {
677       struct rtx_list *next;
678       rtx value;                /* Value of this node...                */
679     };
680
681   c = read_skip_spaces (infile); /* Should be open paren.  */
682   if (c != '(')
683     dump_and_abort ('(', c, infile);
684
685   read_name (tmp_char, infile);
686
687   tmp_code = UNKNOWN;
688
689   for (i=0; i < NUM_RTX_CODE; i++) /* @@ might speed this search up */
690     {
691       if (!(strcmp (tmp_char, GET_RTX_NAME (i))))
692         {
693           tmp_code = (RTX_CODE) i;      /* get value for name */
694           break;
695         }
696     }
697   if (tmp_code == UNKNOWN)
698     {
699       fprintf (stderr,
700                "Unknown rtx read in rtl.read_rtx(). Code name was %s .",
701                tmp_char);
702     }
703   /* (NIL) stands for an expression that isn't there.  */
704   if (tmp_code == NIL)
705     {
706       /* Discard the closeparen.  */
707       while ((c = getc (infile)) && c != ')');
708       return 0;
709     }
710
711   return_rtx = rtx_alloc (tmp_code); /* if we end up with an insn expression
712                                        then we free this space below.  */
713   format_ptr = GET_RTX_FORMAT (GET_CODE (return_rtx));
714
715   /* If what follows is `: mode ', read it and
716      store the mode in the rtx.  */
717
718   i = read_skip_spaces (infile);
719   if (i == ':')
720     {
721       register int k;
722       read_name (tmp_char, infile);
723       for (k = 0; k < NUM_MACHINE_MODES; k++)
724         if (!strcmp (GET_MODE_NAME (k), tmp_char))
725           break;
726
727       PUT_MODE (return_rtx, (enum machine_mode) k );
728     }
729   else
730     ungetc (i, infile);
731
732   for (i = 0; i < GET_RTX_LENGTH (GET_CODE (return_rtx)); i++)
733     switch (*format_ptr++)
734       {
735         /* 0 means a field for internal use only.
736            Don't expect it to be present in the input.  */
737       case '0':
738         break;
739
740       case 'e':
741       case 'u':
742         XEXP (return_rtx, i) = read_rtx (infile);
743         break;
744
745       case 'V':
746         /* 'V' is an optional vector: if a closeparen follows,
747            just store NULL for this element.  */
748         c = read_skip_spaces (infile);
749         ungetc (c, infile);
750         if (c == ')')
751           {
752             XVEC (return_rtx, i) = 0;
753             break;
754           }
755         /* Now process the vector.  */
756   
757       case 'E':
758         {
759           register struct rtx_list *next_rtx, *rtx_list_link;
760           struct rtx_list *list_rtx = NULL;
761
762           c = read_skip_spaces (infile);
763           if (c != '[')
764             dump_and_abort ('[', c, infile);
765
766           /* add expressions to a list, while keeping a count */
767           next_rtx = NULL;
768           list_counter = 0;
769           while ((c = read_skip_spaces (infile)) && c != ']')
770             {
771               ungetc (c, infile);
772               list_counter++;
773               rtx_list_link = (struct rtx_list *)
774                 alloca (sizeof (struct rtx_list));
775               rtx_list_link->value = read_rtx (infile);
776               if (next_rtx == 0)
777                 list_rtx = rtx_list_link;
778               else
779                 next_rtx->next = rtx_list_link;
780               next_rtx = rtx_list_link;
781               rtx_list_link->next = 0;
782             }
783           /* get vector length and allocate it */
784           XVEC (return_rtx, i) = (list_counter
785                                   ? rtvec_alloc (list_counter) : NULL_RTVEC);
786           if (list_counter > 0)
787             {
788               next_rtx = list_rtx;
789               for (j = 0; j < list_counter; j++,
790                    next_rtx = next_rtx->next)
791                 XVECEXP (return_rtx, i, j) = next_rtx->value;
792             }
793           /* close bracket gotten */
794         }
795         break;
796
797       case 'S':
798         /* 'S' is an optional string: if a closeparen follows,
799            just store NULL for this element.  */
800         c = read_skip_spaces (infile);
801         ungetc (c, infile);
802         if (c == ')')
803           {
804             XSTR (return_rtx, i) = 0;
805             break;
806           }
807
808       case 's':
809         {
810           int saw_paren = 0;
811           register char *stringbuf;
812
813           c = read_skip_spaces (infile);
814           if (c == '(')
815             {
816               saw_paren = 1;
817               c = read_skip_spaces (infile);
818             }
819           if (c != '"')
820             dump_and_abort ('"', c, infile);
821
822           while (1)
823             {
824               c = getc (infile); /* Read the string  */
825               if (c == '\\')
826                 {
827                   c = getc (infile);    /* Read the string  */
828                   /* \; makes stuff for a C string constant containing
829                      newline and tab.  */
830                   if (c == ';')
831                     {
832                       obstack_grow (rtl_obstack, "\\n\\t", 4);
833                       continue;
834                     }
835                 }
836               else if (c == '"')
837                 break;
838
839               obstack_1grow (rtl_obstack, c);
840             }
841
842           obstack_1grow (rtl_obstack, 0);
843           stringbuf = (char *) obstack_finish (rtl_obstack);
844
845           if (saw_paren)
846             {
847               c = read_skip_spaces (infile);
848               if (c != ')')
849                 dump_and_abort (')', c, infile);
850             }
851           XSTR (return_rtx, i) = stringbuf;
852         }
853         break;
854
855       case 'w':
856         read_name (tmp_char, infile);
857 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
858         tmp_wide = atoi (tmp_char);
859 #else
860 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
861         tmp_wide = atol (tmp_char);
862 #else
863         /* Prefer atoll over atoq, since the former is in the ISO C9X draft. 
864            But prefer not to use our hand-rolled function above either.  */
865 #if defined(HAVE_ATOLL) || !defined(HAVE_ATOQ)
866         tmp_wide = atoll (tmp_char);
867 #else
868         tmp_wide = atoq (tmp_char);
869 #endif
870 #endif
871 #endif
872         XWINT (return_rtx, i) = tmp_wide;
873         break;
874
875       case 'i':
876       case 'n':
877         read_name (tmp_char, infile);
878         tmp_int = atoi (tmp_char);
879         XINT (return_rtx, i) = tmp_int;
880         break;
881
882       default:
883         fprintf (stderr,
884                  "switch format wrong in rtl.read_rtx(). format was: %c.\n",
885                  format_ptr[-1]);
886         fprintf (stderr, "\tfile position: %ld\n", ftell (infile));
887         abort ();
888       }
889
890   c = read_skip_spaces (infile);
891   if (c != ')')
892     dump_and_abort (')', c, infile);
893
894   return return_rtx;
895 }
896 \f
897 /* This is called once per compilation, before any rtx's are constructed.
898    It initializes the vector `rtx_length', the extra CC modes, if any,
899    and computes certain commonly-used modes.  */
900
901 void
902 init_rtl ()
903 {
904   int min_class_size[(int) MAX_MODE_CLASS];
905   enum machine_mode mode;
906   int i;
907
908   for (i = 0; i < NUM_RTX_CODE; i++)
909     rtx_length[i] = strlen (rtx_format[i]);
910
911   /* Make CONST_DOUBLE bigger, if real values are bigger than
912      it normally expects to have room for.
913      Note that REAL_VALUE_TYPE is not defined by default,
914      since tree.h is not included.  But the default dfn as `double'
915      would do no harm.  */
916 #ifdef REAL_VALUE_TYPE
917   i = sizeof (REAL_VALUE_TYPE) / sizeof (rtunion) + 2;
918   if (rtx_length[(int) CONST_DOUBLE] < i)
919     {
920       char *s = (char *) xmalloc (i + 1);
921       rtx_length[(int) CONST_DOUBLE] = i;
922       rtx_format[(int) CONST_DOUBLE] = s;
923       *s++ = 'e';
924       *s++ = '0';
925       /* Set the GET_RTX_FORMAT of CONST_DOUBLE to a string
926          of as many `w's as we now have elements.  Subtract two from
927          the size to account for the 'e' and the '0'.  */
928       for (i = 2; i < rtx_length[(int) CONST_DOUBLE]; i++)
929         *s++ = 'w';
930       *s++ = 0;
931     }
932 #endif
933
934 #ifdef EXTRA_CC_MODES
935   for (i = (int) CCmode + 1; i < (int) MAX_MACHINE_MODE; i++)
936     {
937       mode_class[i] = MODE_CC;
938       mode_mask_array[i] = mode_mask_array[(int) CCmode];
939       mode_size[i] = mode_size[(int) CCmode];
940       mode_unit_size[i] = mode_unit_size[(int) CCmode];
941       mode_wider_mode[i - 1] = i;
942       mode_wider_mode[i] = (unsigned char)VOIDmode;
943     }
944 #endif
945
946   /* Find the narrowest mode for each class.  */
947
948   for (i = 0; i < (int) MAX_MODE_CLASS; i++)
949     min_class_size[i] = 1000;
950
951   for (mode = VOIDmode; (int) mode < (int) MAX_MACHINE_MODE;
952        mode = (enum machine_mode) ((int) mode + 1))
953     {
954       if (GET_MODE_SIZE (mode) < min_class_size[(int) GET_MODE_CLASS (mode)])
955         {
956           class_narrowest_mode[(int) GET_MODE_CLASS (mode)] = mode;
957           min_class_size[(int) GET_MODE_CLASS (mode)] = GET_MODE_SIZE (mode);
958         }
959     }
960 }