1 /* Allocate and read RTL for GNU C Compiler.
2 Copyright (C) 1987, 1988, 1991, 1994, 1997, 1998, 1999, 2000
3 Free Software Foundation, Inc.
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
32 #define obstack_chunk_alloc xmalloc
33 #define obstack_chunk_free free
35 /* Obstack used for allocating RTL objects.
36 Between functions, this is the permanent_obstack.
37 While parsing and expanding a function, this is maybepermanent_obstack
38 so we can save it if it is an inline function.
39 During optimization and output, this is function_obstack. */
41 extern struct obstack *rtl_obstack;
43 /* Calculate the format for CONST_DOUBLE. This depends on the relative
44 widths of HOST_WIDE_INT and REAL_VALUE_TYPE.
46 We need to go out to e0wwwww, since REAL_ARITHMETIC assumes 16-bits
47 per element in REAL_VALUE_TYPE.
49 This is duplicated in gengenrtl.c.
51 A number of places assume that there are always at least two 'w'
52 slots in a CONST_DOUBLE, so we provide them even if one would suffice. */
54 #ifdef REAL_ARITHMETIC
55 # if MAX_LONG_DOUBLE_TYPE_SIZE == 96
57 (11*8 + HOST_BITS_PER_WIDE_INT)/HOST_BITS_PER_WIDE_INT
59 # if MAX_LONG_DOUBLE_TYPE_SIZE == 128
61 (19*8 + HOST_BITS_PER_WIDE_INT)/HOST_BITS_PER_WIDE_INT
63 # if HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT
65 (7*8 + HOST_BITS_PER_WIDE_INT)/HOST_BITS_PER_WIDE_INT
69 #endif /* REAL_ARITHMETIC */
72 # if HOST_BITS_PER_WIDE_INT*2 >= MAX_LONG_DOUBLE_TYPE_SIZE
75 # if HOST_BITS_PER_WIDE_INT*3 >= MAX_LONG_DOUBLE_TYPE_SIZE
78 # if HOST_BITS_PER_WIDE_INT*4 >= MAX_LONG_DOUBLE_TYPE_SIZE
83 #endif /* REAL_WIDTH */
86 # define CONST_DOUBLE_FORMAT "e0ww"
89 # define CONST_DOUBLE_FORMAT "e0ww"
92 # define CONST_DOUBLE_FORMAT "e0www"
95 # define CONST_DOUBLE_FORMAT "e0wwww"
98 # define CONST_DOUBLE_FORMAT "e0wwwww"
100 # define CONST_DOUBLE_FORMAT /* nothing - will cause syntax error */
107 /* Indexed by rtx code, gives number of operands for an rtx with that code.
108 Does NOT include rtx header data (code and links). */
110 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) sizeof FORMAT - 1 ,
112 const int rtx_length[NUM_RTX_CODE + 1] = {
118 /* Indexed by rtx code, gives the name of that kind of rtx, as a C string. */
120 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) NAME ,
122 const char * const rtx_name[] = {
123 #include "rtl.def" /* rtl expressions are documented here */
128 /* Indexed by machine mode, gives the name of that machine mode.
129 This name does not include the letters "mode". */
131 #define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER) NAME,
133 const char * const mode_name[(int) MAX_MACHINE_MODE + 1] = {
134 #include "machmode.def"
135 /* Add an extra field to avoid a core dump if someone tries to convert
136 MAX_MACHINE_MODE to a string. */
142 /* Indexed by machine mode, gives the class mode for GET_MODE_CLASS. */
144 #define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER) CLASS,
146 const enum mode_class mode_class[(int) MAX_MACHINE_MODE] = {
147 #include "machmode.def"
152 /* Indexed by machine mode, gives the length of the mode, in bits.
153 GET_MODE_BITSIZE uses this. */
155 #define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER) BITSIZE,
157 const unsigned int mode_bitsize[(int) MAX_MACHINE_MODE] = {
158 #include "machmode.def"
163 /* Indexed by machine mode, gives the length of the mode, in bytes.
164 GET_MODE_SIZE uses this. */
166 #define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER) SIZE,
168 const unsigned int mode_size[(int) MAX_MACHINE_MODE] = {
169 #include "machmode.def"
174 /* Indexed by machine mode, gives the length of the mode's subunit.
175 GET_MODE_UNIT_SIZE uses this. */
177 #define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER) UNIT,
179 const unsigned int mode_unit_size[(int) MAX_MACHINE_MODE] = {
180 #include "machmode.def" /* machine modes are documented here */
185 /* Indexed by machine mode, gives next wider natural mode
186 (QI -> HI -> SI -> DI, etc.) Widening multiply instructions
189 #define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER) \
190 (unsigned char) WIDER,
192 const unsigned char mode_wider_mode[(int) MAX_MACHINE_MODE] = {
193 #include "machmode.def" /* machine modes are documented here */
198 #define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER) \
199 ((BITSIZE) >= HOST_BITS_PER_WIDE_INT) ? ~(unsigned HOST_WIDE_INT)0 : ((unsigned HOST_WIDE_INT) 1 << (BITSIZE)) - 1,
201 /* Indexed by machine mode, gives mask of significant bits in mode. */
203 const unsigned HOST_WIDE_INT mode_mask_array[(int) MAX_MACHINE_MODE] = {
204 #include "machmode.def"
207 /* Indexed by mode class, gives the narrowest mode for each class.
208 The Q modes are always of width 1 (2 for complex) - it is impossible
209 for any mode to be narrower.
211 Note that we use QImode instead of BImode for MODE_INT, since
212 otherwise the middle end will try to use it for bitfields in
213 structures and the like, which we do not want. Only the target
214 md file should generate BImode widgets. */
216 const enum machine_mode class_narrowest_mode[(int) MAX_MODE_CLASS] = {
217 /* MODE_RANDOM */ VOIDmode,
218 /* MODE_INT */ QImode,
219 /* MODE_FLOAT */ QFmode,
220 /* MODE_PARTIAL_INT */ PQImode,
221 /* MODE_CC */ CCmode,
222 /* MODE_COMPLEX_INT */ CQImode,
223 /* MODE_COMPLEX_FLOAT */ QCmode,
224 /* MODE_VECTOR_INT */ V2QImode,
225 /* MODE_VECTOR_FLOAT */ V2SFmode
229 /* Indexed by rtx code, gives a sequence of operand-types for
230 rtx's of that code. The sequence is a C string in which
231 each character describes one operand. */
233 const char * const rtx_format[] = {
235 can cause a warning message
236 "0" field is unused (or used in a phase-dependent manner)
240 "n" like "i", but prints entries from `note_insn_name'
241 "w" an integer of width HOST_BITS_PER_WIDE_INT
243 "s" a pointer to a string
245 "S" like "s", but optional:
246 the containing rtx may end before this operand
247 "e" a pointer to an rtl expression
248 prints the expression
249 "E" a pointer to a vector that points to a number of rtl expressions
250 prints a list of the rtl expressions
251 "V" like "E", but optional:
252 the containing rtx may end before this operand
253 "u" a pointer to another insn
254 prints the uid of the insn.
255 "b" is a pointer to a bitmap header.
256 "t" is a tree pointer. */
258 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) FORMAT ,
259 #include "rtl.def" /* rtl expressions are defined here */
263 /* Indexed by rtx code, gives a character representing the "class" of
264 that rtx code. See rtl.def for documentation on the defined classes. */
266 const char rtx_class[] = {
267 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) CLASS,
268 #include "rtl.def" /* rtl expressions are defined here */
272 /* Names for kinds of NOTEs and REG_NOTEs. */
274 const char * const note_insn_name[NOTE_INSN_MAX - NOTE_INSN_BIAS] =
276 "", "NOTE_INSN_DELETED",
277 "NOTE_INSN_BLOCK_BEG", "NOTE_INSN_BLOCK_END",
278 "NOTE_INSN_LOOP_BEG", "NOTE_INSN_LOOP_END",
279 "NOTE_INSN_LOOP_CONT", "NOTE_INSN_LOOP_VTOP",
280 "NOTE_INSN_FUNCTION_END", "NOTE_INSN_SETJMP",
281 "NOTE_INSN_PROLOGUE_END", "NOTE_INSN_EPILOGUE_BEG",
282 "NOTE_INSN_DELETED_LABEL", "NOTE_INSN_FUNCTION_BEG",
283 "NOTE_INSN_EH_REGION_BEG", "NOTE_INSN_EH_REGION_END",
284 "NOTE_INSN_REPEATED_LINE_NUMBER", "NOTE_INSN_RANGE_BEG",
285 "NOTE_INSN_RANGE_END", "NOTE_INSN_LIVE",
286 "NOTE_INSN_BASIC_BLOCK", "NOTE_INSN_EXPECTED_VALUE"
289 const char * const reg_note_name[] =
291 "", "REG_DEAD", "REG_INC", "REG_EQUIV", "REG_EQUAL",
292 "REG_WAS_0", "REG_RETVAL", "REG_LIBCALL", "REG_NONNEG",
293 "REG_NO_CONFLICT", "REG_UNUSED", "REG_CC_SETTER", "REG_CC_USER",
294 "REG_LABEL", "REG_DEP_ANTI", "REG_DEP_OUTPUT", "REG_BR_PROB",
295 "REG_EXEC_COUNT", "REG_NOALIAS", "REG_SAVE_AREA", "REG_BR_PRED",
296 "REG_FRAME_RELATED_EXPR", "REG_EH_CONTEXT", "REG_EH_REGION",
297 "REG_EH_RETHROW", "REG_SAVE_NOTE", "REG_MAYBE_DEAD", "REG_NORETURN"
300 static void fatal_with_file_and_line PARAMS ((FILE *, const char *, ...))
301 ATTRIBUTE_PRINTF_2 ATTRIBUTE_NORETURN;
302 static void fatal_expected_char PARAMS ((FILE *, int, int)) ATTRIBUTE_NORETURN;
303 static void read_name PARAMS ((char *, FILE *));
306 /* Allocate an rtx vector of N elements.
307 Store the length, and initialize all elements to zero. */
316 rt = ggc_alloc_rtvec (n);
318 rt = (rtvec) obstack_alloc (rtl_obstack,
319 sizeof (struct rtvec_def)
320 + ((n - 1) * sizeof (rtx)));
321 /* clear out the vector */
322 memset (&rt->elem[0], 0, n * sizeof (rtx));
324 PUT_NUM_ELEM (rt, n);
328 /* Allocate an rtx of code CODE. The CODE is stored in the rtx;
329 all the rest is initialized to zero. */
336 int n = GET_RTX_LENGTH (code);
339 rt = ggc_alloc_rtx (n);
341 rt = (rtx) obstack_alloc (rtl_obstack,
342 sizeof (struct rtx_def)
343 + ((n - 1) * sizeof (rtunion)));
345 /* We want to clear everything up to the FLD array. Normally, this
346 is one int, but we don't want to assume that and it isn't very
347 portable anyway; this is. */
349 memset (rt, 0, sizeof (struct rtx_def) - sizeof (rtunion));
354 /* Free the rtx X and all RTL allocated since X. */
361 obstack_free (rtl_obstack, x);
364 /* Create a new copy of an rtx.
365 Recursively copies the operands of the rtx,
366 except for those few rtx codes that are sharable. */
374 register RTX_CODE code;
375 register const char *format_ptr;
377 code = GET_CODE (orig);
390 /* SCRATCH must be shared because they represent distinct values. */
395 /* CONST can be shared if it contains a SYMBOL_REF. If it contains
396 a LABEL_REF, it isn't sharable. */
397 if (GET_CODE (XEXP (orig, 0)) == PLUS
398 && GET_CODE (XEXP (XEXP (orig, 0), 0)) == SYMBOL_REF
399 && GET_CODE (XEXP (XEXP (orig, 0), 1)) == CONST_INT)
403 /* A MEM with a constant address is not sharable. The problem is that
404 the constant address may need to be reloaded. If the mem is shared,
405 then reloading one copy of this mem will cause all copies to appear
406 to have been reloaded. */
412 copy = rtx_alloc (code);
414 /* Copy the various flags, and other information. We assume that
415 all fields need copying, and then clear the fields that should
416 not be copied. That is the sensible default behavior, and forces
417 us to explicitly document why we are *not* copying a flag. */
418 memcpy (copy, orig, sizeof (struct rtx_def) - sizeof (rtunion));
420 /* We do not copy the USED flag, which is used as a mark bit during
421 walks over the RTL. */
424 /* We do not copy FRAME_RELATED for INSNs. */
425 if (GET_RTX_CLASS (code) == 'i')
426 copy->frame_related = 0;
427 copy->jump = orig->jump;
428 copy->call = orig->call;
430 format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
432 for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
434 copy->fld[i] = orig->fld[i];
435 switch (*format_ptr++)
438 if (XEXP (orig, i) != NULL)
439 XEXP (copy, i) = copy_rtx (XEXP (orig, i));
444 if (XVEC (orig, i) != NULL)
446 XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i));
447 for (j = 0; j < XVECLEN (copy, i); j++)
448 XVECEXP (copy, i, j) = copy_rtx (XVECEXP (orig, i, j));
454 bitmap new_bits = BITMAP_OBSTACK_ALLOC (rtl_obstack);
455 bitmap_copy (new_bits, XBITMAP (orig, i));
456 XBITMAP (copy, i) = new_bits;
467 /* These are left unchanged. */
477 /* Similar to `copy_rtx' except that if MAY_SHARE is present, it is
478 placed in the result directly, rather than being copied. */
481 copy_most_rtx (orig, may_share)
483 register rtx may_share;
487 register RTX_CODE code;
488 register const char *format_ptr;
490 if (orig == may_share)
493 code = GET_CODE (orig);
510 copy = rtx_alloc (code);
511 PUT_MODE (copy, GET_MODE (orig));
512 copy->in_struct = orig->in_struct;
513 copy->volatil = orig->volatil;
514 copy->unchanging = orig->unchanging;
515 copy->integrated = orig->integrated;
517 format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
519 for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
521 switch (*format_ptr++)
524 XEXP (copy, i) = XEXP (orig, i);
525 if (XEXP (orig, i) != NULL && XEXP (orig, i) != may_share)
526 XEXP (copy, i) = copy_most_rtx (XEXP (orig, i), may_share);
530 XEXP (copy, i) = XEXP (orig, i);
535 XVEC (copy, i) = XVEC (orig, i);
536 if (XVEC (orig, i) != NULL)
538 XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i));
539 for (j = 0; j < XVECLEN (copy, i); j++)
541 = copy_most_rtx (XVECEXP (orig, i, j), may_share);
546 XWINT (copy, i) = XWINT (orig, i);
551 XINT (copy, i) = XINT (orig, i);
555 XTREE (copy, i) = XTREE (orig, i);
560 XSTR (copy, i) = XSTR (orig, i);
564 /* Copy this through the wide int field; that's safest. */
565 X0WINT (copy, i) = X0WINT (orig, i);
575 /* Create a new copy of an rtx. Only copy just one level. */
577 shallow_copy_rtx (orig)
581 register RTX_CODE code = GET_CODE (orig);
582 register rtx copy = rtx_alloc (code);
584 PUT_MODE (copy, GET_MODE (orig));
585 copy->in_struct = orig->in_struct;
586 copy->volatil = orig->volatil;
587 copy->unchanging = orig->unchanging;
588 copy->integrated = orig->integrated;
590 for (i = 0; i < GET_RTX_LENGTH (code); i++)
591 copy->fld[i] = orig->fld[i];
596 /* This is 1 until after the rtl generation pass. */
597 int rtx_equal_function_value_matters;
599 /* Nonzero when we are generating CONCATs. */
600 int generating_concat_p;
602 /* Return 1 if X and Y are identical-looking rtx's.
603 This is the Lisp function EQUAL for rtx arguments. */
611 register enum rtx_code code;
612 register const char *fmt;
616 if (x == 0 || y == 0)
620 /* Rtx's of different codes cannot be equal. */
621 if (code != GET_CODE (y))
624 /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent.
625 (REG:SI x) and (REG:HI x) are NOT equivalent. */
627 if (GET_MODE (x) != GET_MODE (y))
630 /* Some RTL can be compared nonrecursively. */
634 /* Until rtl generation is complete, don't consider a reference to the
635 return register of the current function the same as the return from a
636 called function. This eases the job of function integration. Once the
637 distinction is no longer needed, they can be considered equivalent. */
638 return (REGNO (x) == REGNO (y)
639 && (! rtx_equal_function_value_matters
640 || REG_FUNCTION_VALUE_P (x) == REG_FUNCTION_VALUE_P (y)));
643 return XEXP (x, 0) == XEXP (y, 0);
646 return XSTR (x, 0) == XSTR (y, 0);
657 /* Compare the elements. If any pair of corresponding elements
658 fail to match, return 0 for the whole things. */
660 fmt = GET_RTX_FORMAT (code);
661 for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
666 if (XWINT (x, i) != XWINT (y, i))
672 if (XINT (x, i) != XINT (y, i))
678 /* Two vectors must have the same length. */
679 if (XVECLEN (x, i) != XVECLEN (y, i))
682 /* And the corresponding elements must match. */
683 for (j = 0; j < XVECLEN (x, i); j++)
684 if (rtx_equal_p (XVECEXP (x, i, j), XVECEXP (y, i, j)) == 0)
689 if (rtx_equal_p (XEXP (x, i), XEXP (y, i)) == 0)
695 if (strcmp (XSTR (x, i), XSTR (y, i)))
700 /* These are just backpointers, so they don't matter. */
707 /* It is believed that rtx's at this level will never
708 contain anything but integers and other rtx's,
709 except for within LABEL_REFs and SYMBOL_REFs. */
717 /* Subroutines of read_rtx. */
719 /* The current line number for the file. */
720 int read_rtx_lineno = 1;
722 /* The filename for aborting with file and line. */
723 const char *read_rtx_filename = "<unknown>";
726 fatal_with_file_and_line VPARAMS ((FILE *infile, const char *msg, ...))
728 #ifndef ANSI_PROTOTYPES
739 #ifndef ANSI_PROTOTYPES
740 infile = va_arg (ap, FILE *);
741 msg = va_arg (ap, const char *);
744 fprintf (stderr, "%s:%d: ", read_rtx_filename, read_rtx_lineno);
745 vfprintf (stderr, msg, ap);
748 /* Gather some following context. */
749 for (i = 0; i < sizeof(context)-1; ++i)
754 if (c == '\r' || c == '\n')
760 fprintf (stderr, "%s:%d: following context is `%s'\n",
761 read_rtx_filename, read_rtx_lineno, context);
767 /* Dump code after printing a message. Used when read_rtx finds
771 fatal_expected_char (infile, expected_c, actual_c)
773 int expected_c, actual_c;
775 fatal_with_file_and_line (infile, "expected character `%c', found `%c'",
776 expected_c, actual_c);
779 /* Read chars from INFILE until a non-whitespace char
780 and return that. Comments, both Lisp style and C style,
781 are treated as whitespace.
782 Tools such as genflags use this function. */
785 read_skip_spaces (infile)
798 case ' ': case '\t': case '\f': case '\r':
804 while (c != '\n' && c != EOF);
813 fatal_expected_char (infile, '*', c);
816 while ((c = getc (infile)) && c != EOF)
820 else if (prevc == '*' && c == '/')
833 /* Read an rtx code name into the buffer STR[].
834 It is terminated by any of the punctuation chars of rtx printed syntax. */
837 read_name (str, infile)
844 c = read_skip_spaces(infile);
849 if (c == ' ' || c == '\n' || c == '\t' || c == '\f')
851 if (c == ':' || c == ')' || c == ']' || c == '"' || c == '/'
852 || c == '(' || c == '[')
861 fatal_with_file_and_line (infile, "missing name or number");
868 /* Provide a version of a function to read a long long if the system does
870 #if HOST_BITS_PER_WIDE_INT > HOST_BITS_PER_LONG && !defined(HAVE_ATOLL) && !defined(HAVE_ATOQ)
876 HOST_WIDE_INT tmp_wide;
888 HOST_WIDE_INT new_wide = tmp_wide*10 + (*p - '0');
889 if (new_wide < tmp_wide)
891 /* Return INT_MAX equiv on overflow. */
892 tmp_wide = (~(unsigned HOST_WIDE_INT)0) >> 1;
900 tmp_wide = -tmp_wide;
905 /* Read an rtx in printed representation from INFILE
906 and return an actual rtx in core constructed accordingly.
907 read_rtx is not used in the compiler proper, but rather in
908 the utilities gen*.c that construct C code from machine descriptions. */
914 register int i, j, list_counter;
916 register const char *format_ptr;
917 /* tmp_char is a buffer used for reading decimal integers
918 and names of rtx types and machine modes.
919 Therefore, 256 must be enough. */
924 HOST_WIDE_INT tmp_wide;
926 /* Linked list structure for making RTXs: */
929 struct rtx_list *next;
930 rtx value; /* Value of this node. */
933 c = read_skip_spaces (infile); /* Should be open paren. */
935 fatal_expected_char (infile, '(', c);
937 read_name (tmp_char, infile);
941 for (i = 0; i < NUM_RTX_CODE; i++)
942 if (! strcmp (tmp_char, GET_RTX_NAME (i)))
944 tmp_code = (RTX_CODE) i; /* get value for name */
948 if (tmp_code == UNKNOWN)
949 fatal_with_file_and_line (infile, "unknown rtx code `%s'", tmp_char);
951 /* (NIL) stands for an expression that isn't there. */
954 /* Discard the closeparen. */
955 while ((c = getc (infile)) && c != ')')
961 /* If we end up with an insn expression then we free this space below. */
962 return_rtx = rtx_alloc (tmp_code);
963 format_ptr = GET_RTX_FORMAT (GET_CODE (return_rtx));
965 /* If what follows is `: mode ', read it and
966 store the mode in the rtx. */
968 i = read_skip_spaces (infile);
971 read_name (tmp_char, infile);
972 for (j = 0; j < NUM_MACHINE_MODES; j++)
973 if (! strcmp (GET_MODE_NAME (j), tmp_char))
976 if (j == MAX_MACHINE_MODE)
977 fatal_with_file_and_line (infile, "unknown mode `%s'", tmp_char);
979 PUT_MODE (return_rtx, (enum machine_mode) j);
984 for (i = 0; i < GET_RTX_LENGTH (GET_CODE (return_rtx)); i++)
985 switch (*format_ptr++)
987 /* 0 means a field for internal use only.
988 Don't expect it to be present in the input. */
994 XEXP (return_rtx, i) = read_rtx (infile);
998 /* 'V' is an optional vector: if a closeparen follows,
999 just store NULL for this element. */
1000 c = read_skip_spaces (infile);
1004 XVEC (return_rtx, i) = 0;
1007 /* Now process the vector. */
1011 register struct rtx_list *next_rtx, *rtx_list_link;
1012 struct rtx_list *list_rtx = NULL;
1014 c = read_skip_spaces (infile);
1016 fatal_expected_char (infile, '[', c);
1018 /* add expressions to a list, while keeping a count */
1021 while ((c = read_skip_spaces (infile)) && c != ']')
1025 rtx_list_link = (struct rtx_list *)
1026 alloca (sizeof (struct rtx_list));
1027 rtx_list_link->value = read_rtx (infile);
1029 list_rtx = rtx_list_link;
1031 next_rtx->next = rtx_list_link;
1032 next_rtx = rtx_list_link;
1033 rtx_list_link->next = 0;
1035 /* get vector length and allocate it */
1036 XVEC (return_rtx, i) = (list_counter
1037 ? rtvec_alloc (list_counter) : NULL_RTVEC);
1038 if (list_counter > 0)
1040 next_rtx = list_rtx;
1041 for (j = 0; j < list_counter; j++,
1042 next_rtx = next_rtx->next)
1043 XVECEXP (return_rtx, i, j) = next_rtx->value;
1045 /* close bracket gotten */
1050 /* 'S' is an optional string: if a closeparen follows,
1051 just store NULL for this element. */
1052 c = read_skip_spaces (infile);
1056 XSTR (return_rtx, i) = 0;
1063 register char *stringbuf;
1065 c = read_skip_spaces (infile);
1069 c = read_skip_spaces (infile);
1072 fatal_expected_char (infile, '"', c);
1076 c = getc (infile); /* Read the string */
1081 c = getc (infile); /* Read the string */
1082 /* \; makes stuff for a C string constant containing
1086 obstack_grow (rtl_obstack, "\\n\\t", 4);
1095 obstack_1grow (rtl_obstack, c);
1098 obstack_1grow (rtl_obstack, 0);
1099 stringbuf = (char *) obstack_finish (rtl_obstack);
1103 c = read_skip_spaces (infile);
1105 fatal_expected_char (infile, ')', c);
1107 XSTR (return_rtx, i) = stringbuf;
1112 read_name (tmp_char, infile);
1113 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
1114 tmp_wide = atoi (tmp_char);
1116 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
1117 tmp_wide = atol (tmp_char);
1119 /* Prefer atoll over atoq, since the former is in the ISO C9X draft.
1120 But prefer not to use our hand-rolled function above either. */
1121 #if defined(HAVE_ATOLL) || !defined(HAVE_ATOQ)
1122 tmp_wide = atoll (tmp_char);
1124 tmp_wide = atoq (tmp_char);
1128 XWINT (return_rtx, i) = tmp_wide;
1133 read_name (tmp_char, infile);
1134 tmp_int = atoi (tmp_char);
1135 XINT (return_rtx, i) = tmp_int;
1140 "switch format wrong in rtl.read_rtx(). format was: %c.\n",
1142 fprintf (stderr, "\tfile position: %ld\n", ftell (infile));
1146 c = read_skip_spaces (infile);
1148 fatal_expected_char (infile, ')', c);
1153 #if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007)
1155 rtl_check_failed_bounds (r, n, file, line, func)
1162 error ("RTL check: access of elt %d of `%s' with last elt %d",
1163 n, GET_RTX_NAME (GET_CODE (r)), GET_RTX_LENGTH (GET_CODE (r))-1);
1164 fancy_abort (file, line, func);
1168 rtl_check_failed_type1 (r, n, c1, file, line, func)
1176 error ("RTL check: expected elt %d type '%c', have '%c' (rtx %s)",
1177 n, c1, GET_RTX_FORMAT (GET_CODE (r))[n], GET_RTX_NAME (GET_CODE (r)));
1178 fancy_abort (file, line, func);
1182 rtl_check_failed_type2 (r, n, c1, c2, file, line, func)
1191 error ("RTL check: expected elt %d type '%c' or '%c', have '%c' (rtx %s)",
1193 GET_RTX_FORMAT (GET_CODE (r))[n], GET_RTX_NAME (GET_CODE(r)));
1194 fancy_abort (file, line, func);
1198 rtl_check_failed_code1 (r, code, file, line, func)
1205 error ("RTL check: expected code `%s', have `%s'",
1206 GET_RTX_NAME (code), GET_RTX_NAME (GET_CODE (r)));
1207 fancy_abort (file, line, func);
1211 rtl_check_failed_code2 (r, code1, code2, file, line, func)
1213 enum rtx_code code1, code2;
1218 error ("RTL check: expected code `%s' or `%s', have `%s'",
1219 GET_RTX_NAME (code1), GET_RTX_NAME (code2),
1220 GET_RTX_NAME (GET_CODE (r)));
1221 fancy_abort (file, line, func);
1224 /* XXX Maybe print the vector? */
1226 rtvec_check_failed_bounds (r, n, file, line, func)
1233 error ("RTL check: access of elt %d of vector with last elt %d",
1234 n, GET_NUM_ELEM (r)-1);
1235 fancy_abort (file, line, func);
1237 #endif /* ENABLE_RTL_CHECKING */