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
36 /* Calculate the format for CONST_DOUBLE. This depends on the relative
37 widths of HOST_WIDE_INT and REAL_VALUE_TYPE.
39 We need to go out to e0wwwww, since REAL_ARITHMETIC assumes 16-bits
40 per element in REAL_VALUE_TYPE.
42 This is duplicated in gengenrtl.c.
44 A number of places assume that there are always at least two 'w'
45 slots in a CONST_DOUBLE, so we provide them even if one would suffice. */
47 #ifdef REAL_ARITHMETIC
48 # if MAX_LONG_DOUBLE_TYPE_SIZE == 96
50 (11*8 + HOST_BITS_PER_WIDE_INT)/HOST_BITS_PER_WIDE_INT
52 # if MAX_LONG_DOUBLE_TYPE_SIZE == 128
54 (19*8 + HOST_BITS_PER_WIDE_INT)/HOST_BITS_PER_WIDE_INT
56 # if HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT
58 (7*8 + HOST_BITS_PER_WIDE_INT)/HOST_BITS_PER_WIDE_INT
62 #endif /* REAL_ARITHMETIC */
65 # if HOST_BITS_PER_WIDE_INT*2 >= MAX_LONG_DOUBLE_TYPE_SIZE
68 # if HOST_BITS_PER_WIDE_INT*3 >= MAX_LONG_DOUBLE_TYPE_SIZE
71 # if HOST_BITS_PER_WIDE_INT*4 >= MAX_LONG_DOUBLE_TYPE_SIZE
76 #endif /* REAL_WIDTH */
79 # define CONST_DOUBLE_FORMAT "e0ww"
82 # define CONST_DOUBLE_FORMAT "e0ww"
85 # define CONST_DOUBLE_FORMAT "e0www"
88 # define CONST_DOUBLE_FORMAT "e0wwww"
91 # define CONST_DOUBLE_FORMAT "e0wwwww"
93 # define CONST_DOUBLE_FORMAT /* nothing - will cause syntax error */
100 /* Indexed by rtx code, gives number of operands for an rtx with that code.
101 Does NOT include rtx header data (code and links). */
103 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) sizeof FORMAT - 1 ,
105 const int rtx_length[NUM_RTX_CODE + 1] = {
111 /* Indexed by rtx code, gives the name of that kind of rtx, as a C string. */
113 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) NAME ,
115 const char * const rtx_name[] = {
116 #include "rtl.def" /* rtl expressions are documented here */
121 /* Indexed by machine mode, gives the name of that machine mode.
122 This name does not include the letters "mode". */
124 #define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER) NAME,
126 const char * const mode_name[(int) MAX_MACHINE_MODE + 1] = {
127 #include "machmode.def"
128 /* Add an extra field to avoid a core dump if someone tries to convert
129 MAX_MACHINE_MODE to a string. */
135 /* Indexed by machine mode, gives the class mode for GET_MODE_CLASS. */
137 #define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER) CLASS,
139 const enum mode_class mode_class[(int) MAX_MACHINE_MODE] = {
140 #include "machmode.def"
145 /* Indexed by machine mode, gives the length of the mode, in bits.
146 GET_MODE_BITSIZE uses this. */
148 #define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER) BITSIZE,
150 const unsigned int mode_bitsize[(int) MAX_MACHINE_MODE] = {
151 #include "machmode.def"
156 /* Indexed by machine mode, gives the length of the mode, in bytes.
157 GET_MODE_SIZE uses this. */
159 #define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER) SIZE,
161 const unsigned int mode_size[(int) MAX_MACHINE_MODE] = {
162 #include "machmode.def"
167 /* Indexed by machine mode, gives the length of the mode's subunit.
168 GET_MODE_UNIT_SIZE uses this. */
170 #define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER) UNIT,
172 const unsigned int mode_unit_size[(int) MAX_MACHINE_MODE] = {
173 #include "machmode.def" /* machine modes are documented here */
178 /* Indexed by machine mode, gives next wider natural mode
179 (QI -> HI -> SI -> DI, etc.) Widening multiply instructions
182 #define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER) \
183 (unsigned char) WIDER,
185 const unsigned char mode_wider_mode[(int) MAX_MACHINE_MODE] = {
186 #include "machmode.def" /* machine modes are documented here */
191 #define DEF_MACHMODE(SYM, NAME, CLASS, BITSIZE, SIZE, UNIT, WIDER) \
192 ((BITSIZE) >= HOST_BITS_PER_WIDE_INT) ? ~(unsigned HOST_WIDE_INT)0 : ((unsigned HOST_WIDE_INT) 1 << (BITSIZE)) - 1,
194 /* Indexed by machine mode, gives mask of significant bits in mode. */
196 const unsigned HOST_WIDE_INT mode_mask_array[(int) MAX_MACHINE_MODE] = {
197 #include "machmode.def"
200 /* Indexed by mode class, gives the narrowest mode for each class.
201 The Q modes are always of width 1 (2 for complex) - it is impossible
202 for any mode to be narrower.
204 Note that we use QImode instead of BImode for MODE_INT, since
205 otherwise the middle end will try to use it for bitfields in
206 structures and the like, which we do not want. Only the target
207 md file should generate BImode widgets. */
209 const enum machine_mode class_narrowest_mode[(int) MAX_MODE_CLASS] = {
210 /* MODE_RANDOM */ VOIDmode,
211 /* MODE_INT */ QImode,
212 /* MODE_FLOAT */ QFmode,
213 /* MODE_PARTIAL_INT */ PQImode,
214 /* MODE_CC */ CCmode,
215 /* MODE_COMPLEX_INT */ CQImode,
216 /* MODE_COMPLEX_FLOAT */ QCmode,
217 /* MODE_VECTOR_INT */ V2QImode,
218 /* MODE_VECTOR_FLOAT */ V2SFmode
222 /* Indexed by rtx code, gives a sequence of operand-types for
223 rtx's of that code. The sequence is a C string in which
224 each character describes one operand. */
226 const char * const rtx_format[] = {
228 can cause a warning message
229 "0" field is unused (or used in a phase-dependent manner)
233 "n" like "i", but prints entries from `note_insn_name'
234 "w" an integer of width HOST_BITS_PER_WIDE_INT
236 "s" a pointer to a string
238 "S" like "s", but optional:
239 the containing rtx may end before this operand
240 "e" a pointer to an rtl expression
241 prints the expression
242 "E" a pointer to a vector that points to a number of rtl expressions
243 prints a list of the rtl expressions
244 "V" like "E", but optional:
245 the containing rtx may end before this operand
246 "u" a pointer to another insn
247 prints the uid of the insn.
248 "b" is a pointer to a bitmap header.
249 "t" is a tree pointer. */
251 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) FORMAT ,
252 #include "rtl.def" /* rtl expressions are defined here */
256 /* Indexed by rtx code, gives a character representing the "class" of
257 that rtx code. See rtl.def for documentation on the defined classes. */
259 const char rtx_class[] = {
260 #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) CLASS,
261 #include "rtl.def" /* rtl expressions are defined here */
265 /* Names for kinds of NOTEs and REG_NOTEs. */
267 const char * const note_insn_name[NOTE_INSN_MAX - NOTE_INSN_BIAS] =
269 "", "NOTE_INSN_DELETED",
270 "NOTE_INSN_BLOCK_BEG", "NOTE_INSN_BLOCK_END",
271 "NOTE_INSN_LOOP_BEG", "NOTE_INSN_LOOP_END",
272 "NOTE_INSN_LOOP_CONT", "NOTE_INSN_LOOP_VTOP",
273 "NOTE_INSN_FUNCTION_END", "NOTE_INSN_SETJMP",
274 "NOTE_INSN_PROLOGUE_END", "NOTE_INSN_EPILOGUE_BEG",
275 "NOTE_INSN_DELETED_LABEL", "NOTE_INSN_FUNCTION_BEG",
276 "NOTE_INSN_EH_REGION_BEG", "NOTE_INSN_EH_REGION_END",
277 "NOTE_INSN_REPEATED_LINE_NUMBER", "NOTE_INSN_RANGE_BEG",
278 "NOTE_INSN_RANGE_END", "NOTE_INSN_LIVE",
279 "NOTE_INSN_BASIC_BLOCK", "NOTE_INSN_EXPECTED_VALUE"
282 const char * const reg_note_name[] =
284 "", "REG_DEAD", "REG_INC", "REG_EQUIV", "REG_EQUAL",
285 "REG_WAS_0", "REG_RETVAL", "REG_LIBCALL", "REG_NONNEG",
286 "REG_NO_CONFLICT", "REG_UNUSED", "REG_CC_SETTER", "REG_CC_USER",
287 "REG_LABEL", "REG_DEP_ANTI", "REG_DEP_OUTPUT", "REG_BR_PROB",
288 "REG_EXEC_COUNT", "REG_NOALIAS", "REG_SAVE_AREA", "REG_BR_PRED",
289 "REG_FRAME_RELATED_EXPR", "REG_EH_CONTEXT", "REG_EH_REGION",
290 "REG_EH_RETHROW", "REG_SAVE_NOTE", "REG_MAYBE_DEAD", "REG_NORETURN"
293 static void fatal_with_file_and_line PARAMS ((FILE *, const char *, ...))
294 ATTRIBUTE_PRINTF_2 ATTRIBUTE_NORETURN;
295 static void fatal_expected_char PARAMS ((FILE *, int, int)) ATTRIBUTE_NORETURN;
296 static void read_name PARAMS ((char *, FILE *));
299 /* Allocate an rtx vector of N elements.
300 Store the length, and initialize all elements to zero. */
308 rt = ggc_alloc_rtvec (n);
309 /* clear out the vector */
310 memset (&rt->elem[0], 0, n * sizeof (rtx));
312 PUT_NUM_ELEM (rt, n);
316 /* Allocate an rtx of code CODE. The CODE is stored in the rtx;
317 all the rest is initialized to zero. */
324 int n = GET_RTX_LENGTH (code);
326 rt = ggc_alloc_rtx (n);
328 /* We want to clear everything up to the FLD array. Normally, this
329 is one int, but we don't want to assume that and it isn't very
330 portable anyway; this is. */
332 memset (rt, 0, sizeof (struct rtx_def) - sizeof (rtunion));
338 /* Create a new copy of an rtx.
339 Recursively copies the operands of the rtx,
340 except for those few rtx codes that are sharable. */
348 register RTX_CODE code;
349 register const char *format_ptr;
351 code = GET_CODE (orig);
364 /* SCRATCH must be shared because they represent distinct values. */
369 /* CONST can be shared if it contains a SYMBOL_REF. If it contains
370 a LABEL_REF, it isn't sharable. */
371 if (GET_CODE (XEXP (orig, 0)) == PLUS
372 && GET_CODE (XEXP (XEXP (orig, 0), 0)) == SYMBOL_REF
373 && GET_CODE (XEXP (XEXP (orig, 0), 1)) == CONST_INT)
377 /* A MEM with a constant address is not sharable. The problem is that
378 the constant address may need to be reloaded. If the mem is shared,
379 then reloading one copy of this mem will cause all copies to appear
380 to have been reloaded. */
386 copy = rtx_alloc (code);
388 /* Copy the various flags, and other information. We assume that
389 all fields need copying, and then clear the fields that should
390 not be copied. That is the sensible default behavior, and forces
391 us to explicitly document why we are *not* copying a flag. */
392 memcpy (copy, orig, sizeof (struct rtx_def) - sizeof (rtunion));
394 /* We do not copy the USED flag, which is used as a mark bit during
395 walks over the RTL. */
398 /* We do not copy FRAME_RELATED for INSNs. */
399 if (GET_RTX_CLASS (code) == 'i')
400 copy->frame_related = 0;
401 copy->jump = orig->jump;
402 copy->call = orig->call;
404 format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
406 for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
408 copy->fld[i] = orig->fld[i];
409 switch (*format_ptr++)
412 if (XEXP (orig, i) != NULL)
413 XEXP (copy, i) = copy_rtx (XEXP (orig, i));
418 if (XVEC (orig, i) != NULL)
420 XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i));
421 for (j = 0; j < XVECLEN (copy, i); j++)
422 XVECEXP (copy, i, j) = copy_rtx (XVECEXP (orig, i, j));
433 /* These are left unchanged. */
443 /* Similar to `copy_rtx' except that if MAY_SHARE is present, it is
444 placed in the result directly, rather than being copied. */
447 copy_most_rtx (orig, may_share)
449 register rtx may_share;
453 register RTX_CODE code;
454 register const char *format_ptr;
456 if (orig == may_share)
459 code = GET_CODE (orig);
476 copy = rtx_alloc (code);
477 PUT_MODE (copy, GET_MODE (orig));
478 copy->in_struct = orig->in_struct;
479 copy->volatil = orig->volatil;
480 copy->unchanging = orig->unchanging;
481 copy->integrated = orig->integrated;
483 format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
485 for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
487 switch (*format_ptr++)
490 XEXP (copy, i) = XEXP (orig, i);
491 if (XEXP (orig, i) != NULL && XEXP (orig, i) != may_share)
492 XEXP (copy, i) = copy_most_rtx (XEXP (orig, i), may_share);
496 XEXP (copy, i) = XEXP (orig, i);
501 XVEC (copy, i) = XVEC (orig, i);
502 if (XVEC (orig, i) != NULL)
504 XVEC (copy, i) = rtvec_alloc (XVECLEN (orig, i));
505 for (j = 0; j < XVECLEN (copy, i); j++)
507 = copy_most_rtx (XVECEXP (orig, i, j), may_share);
512 XWINT (copy, i) = XWINT (orig, i);
517 XINT (copy, i) = XINT (orig, i);
521 XTREE (copy, i) = XTREE (orig, i);
526 XSTR (copy, i) = XSTR (orig, i);
530 /* Copy this through the wide int field; that's safest. */
531 X0WINT (copy, i) = X0WINT (orig, i);
541 /* Create a new copy of an rtx. Only copy just one level. */
543 shallow_copy_rtx (orig)
547 register RTX_CODE code = GET_CODE (orig);
548 register rtx copy = rtx_alloc (code);
550 PUT_MODE (copy, GET_MODE (orig));
551 copy->in_struct = orig->in_struct;
552 copy->volatil = orig->volatil;
553 copy->unchanging = orig->unchanging;
554 copy->integrated = orig->integrated;
556 for (i = 0; i < GET_RTX_LENGTH (code); i++)
557 copy->fld[i] = orig->fld[i];
562 /* This is 1 until after the rtl generation pass. */
563 int rtx_equal_function_value_matters;
565 /* Nonzero when we are generating CONCATs. */
566 int generating_concat_p;
568 /* Return 1 if X and Y are identical-looking rtx's.
569 This is the Lisp function EQUAL for rtx arguments. */
577 register enum rtx_code code;
578 register const char *fmt;
582 if (x == 0 || y == 0)
586 /* Rtx's of different codes cannot be equal. */
587 if (code != GET_CODE (y))
590 /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent.
591 (REG:SI x) and (REG:HI x) are NOT equivalent. */
593 if (GET_MODE (x) != GET_MODE (y))
596 /* Some RTL can be compared nonrecursively. */
600 /* Until rtl generation is complete, don't consider a reference to the
601 return register of the current function the same as the return from a
602 called function. This eases the job of function integration. Once the
603 distinction is no longer needed, they can be considered equivalent. */
604 return (REGNO (x) == REGNO (y)
605 && (! rtx_equal_function_value_matters
606 || REG_FUNCTION_VALUE_P (x) == REG_FUNCTION_VALUE_P (y)));
609 return XEXP (x, 0) == XEXP (y, 0);
612 return XSTR (x, 0) == XSTR (y, 0);
623 /* Compare the elements. If any pair of corresponding elements
624 fail to match, return 0 for the whole things. */
626 fmt = GET_RTX_FORMAT (code);
627 for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
632 if (XWINT (x, i) != XWINT (y, i))
638 if (XINT (x, i) != XINT (y, i))
644 /* Two vectors must have the same length. */
645 if (XVECLEN (x, i) != XVECLEN (y, i))
648 /* And the corresponding elements must match. */
649 for (j = 0; j < XVECLEN (x, i); j++)
650 if (rtx_equal_p (XVECEXP (x, i, j), XVECEXP (y, i, j)) == 0)
655 if (rtx_equal_p (XEXP (x, i), XEXP (y, i)) == 0)
661 if (strcmp (XSTR (x, i), XSTR (y, i)))
666 /* These are just backpointers, so they don't matter. */
673 /* It is believed that rtx's at this level will never
674 contain anything but integers and other rtx's,
675 except for within LABEL_REFs and SYMBOL_REFs. */
683 /* Subroutines of read_rtx. */
685 /* The current line number for the file. */
686 int read_rtx_lineno = 1;
688 /* The filename for aborting with file and line. */
689 const char *read_rtx_filename = "<unknown>";
692 fatal_with_file_and_line VPARAMS ((FILE *infile, const char *msg, ...))
694 #ifndef ANSI_PROTOTYPES
705 #ifndef ANSI_PROTOTYPES
706 infile = va_arg (ap, FILE *);
707 msg = va_arg (ap, const char *);
710 fprintf (stderr, "%s:%d: ", read_rtx_filename, read_rtx_lineno);
711 vfprintf (stderr, msg, ap);
714 /* Gather some following context. */
715 for (i = 0; i < sizeof(context)-1; ++i)
720 if (c == '\r' || c == '\n')
726 fprintf (stderr, "%s:%d: following context is `%s'\n",
727 read_rtx_filename, read_rtx_lineno, context);
733 /* Dump code after printing a message. Used when read_rtx finds
737 fatal_expected_char (infile, expected_c, actual_c)
739 int expected_c, actual_c;
741 fatal_with_file_and_line (infile, "expected character `%c', found `%c'",
742 expected_c, actual_c);
745 /* Read chars from INFILE until a non-whitespace char
746 and return that. Comments, both Lisp style and C style,
747 are treated as whitespace.
748 Tools such as genflags use this function. */
751 read_skip_spaces (infile)
764 case ' ': case '\t': case '\f': case '\r':
770 while (c != '\n' && c != EOF);
779 fatal_expected_char (infile, '*', c);
782 while ((c = getc (infile)) && c != EOF)
786 else if (prevc == '*' && c == '/')
799 /* Read an rtx code name into the buffer STR[].
800 It is terminated by any of the punctuation chars of rtx printed syntax. */
803 read_name (str, infile)
810 c = read_skip_spaces(infile);
815 if (c == ' ' || c == '\n' || c == '\t' || c == '\f')
817 if (c == ':' || c == ')' || c == ']' || c == '"' || c == '/'
818 || c == '(' || c == '[')
827 fatal_with_file_and_line (infile, "missing name or number");
834 /* Provide a version of a function to read a long long if the system does
836 #if HOST_BITS_PER_WIDE_INT > HOST_BITS_PER_LONG && !defined(HAVE_ATOLL) && !defined(HAVE_ATOQ)
842 HOST_WIDE_INT tmp_wide;
854 HOST_WIDE_INT new_wide = tmp_wide*10 + (*p - '0');
855 if (new_wide < tmp_wide)
857 /* Return INT_MAX equiv on overflow. */
858 tmp_wide = (~(unsigned HOST_WIDE_INT)0) >> 1;
866 tmp_wide = -tmp_wide;
871 /* Read an rtx in printed representation from INFILE
872 and return an actual rtx in core constructed accordingly.
873 read_rtx is not used in the compiler proper, but rather in
874 the utilities gen*.c that construct C code from machine descriptions. */
880 register int i, j, list_counter;
882 register const char *format_ptr;
883 /* tmp_char is a buffer used for reading decimal integers
884 and names of rtx types and machine modes.
885 Therefore, 256 must be enough. */
890 HOST_WIDE_INT tmp_wide;
892 /* Obstack used for allocating RTL objects. */
893 static struct obstack rtl_obstack;
894 static int initialized;
896 /* Linked list structure for making RTXs: */
899 struct rtx_list *next;
900 rtx value; /* Value of this node. */
904 _obstack_begin (&rtl_obstack,0, 0,
905 (void *(*) PARAMS ((long))) xmalloc,
906 (void (*) PARAMS ((void *))) free);
910 c = read_skip_spaces (infile); /* Should be open paren. */
912 fatal_expected_char (infile, '(', c);
914 read_name (tmp_char, infile);
918 for (i = 0; i < NUM_RTX_CODE; i++)
919 if (! strcmp (tmp_char, GET_RTX_NAME (i)))
921 tmp_code = (RTX_CODE) i; /* get value for name */
925 if (tmp_code == UNKNOWN)
926 fatal_with_file_and_line (infile, "unknown rtx code `%s'", tmp_char);
928 /* (NIL) stands for an expression that isn't there. */
931 /* Discard the closeparen. */
932 while ((c = getc (infile)) && c != ')')
938 /* If we end up with an insn expression then we free this space below. */
939 return_rtx = rtx_alloc (tmp_code);
940 format_ptr = GET_RTX_FORMAT (GET_CODE (return_rtx));
942 /* If what follows is `: mode ', read it and
943 store the mode in the rtx. */
945 i = read_skip_spaces (infile);
948 read_name (tmp_char, infile);
949 for (j = 0; j < NUM_MACHINE_MODES; j++)
950 if (! strcmp (GET_MODE_NAME (j), tmp_char))
953 if (j == MAX_MACHINE_MODE)
954 fatal_with_file_and_line (infile, "unknown mode `%s'", tmp_char);
956 PUT_MODE (return_rtx, (enum machine_mode) j);
961 for (i = 0; i < GET_RTX_LENGTH (GET_CODE (return_rtx)); i++)
962 switch (*format_ptr++)
964 /* 0 means a field for internal use only.
965 Don't expect it to be present in the input. */
971 XEXP (return_rtx, i) = read_rtx (infile);
975 /* 'V' is an optional vector: if a closeparen follows,
976 just store NULL for this element. */
977 c = read_skip_spaces (infile);
981 XVEC (return_rtx, i) = 0;
984 /* Now process the vector. */
988 register struct rtx_list *next_rtx, *rtx_list_link;
989 struct rtx_list *list_rtx = NULL;
991 c = read_skip_spaces (infile);
993 fatal_expected_char (infile, '[', c);
995 /* add expressions to a list, while keeping a count */
998 while ((c = read_skip_spaces (infile)) && c != ']')
1002 rtx_list_link = (struct rtx_list *)
1003 alloca (sizeof (struct rtx_list));
1004 rtx_list_link->value = read_rtx (infile);
1006 list_rtx = rtx_list_link;
1008 next_rtx->next = rtx_list_link;
1009 next_rtx = rtx_list_link;
1010 rtx_list_link->next = 0;
1012 /* get vector length and allocate it */
1013 XVEC (return_rtx, i) = (list_counter
1014 ? rtvec_alloc (list_counter) : NULL_RTVEC);
1015 if (list_counter > 0)
1017 next_rtx = list_rtx;
1018 for (j = 0; j < list_counter; j++,
1019 next_rtx = next_rtx->next)
1020 XVECEXP (return_rtx, i, j) = next_rtx->value;
1022 /* close bracket gotten */
1027 /* 'S' is an optional string: if a closeparen follows,
1028 just store NULL for this element. */
1029 c = read_skip_spaces (infile);
1033 XSTR (return_rtx, i) = 0;
1040 register char *stringbuf;
1042 c = read_skip_spaces (infile);
1046 c = read_skip_spaces (infile);
1049 fatal_expected_char (infile, '"', c);
1053 c = getc (infile); /* Read the string */
1058 c = getc (infile); /* Read the string */
1059 /* \; makes stuff for a C string constant containing
1063 obstack_grow (&rtl_obstack, "\\n\\t", 4);
1072 obstack_1grow (&rtl_obstack, c);
1075 obstack_1grow (&rtl_obstack, 0);
1076 stringbuf = (char *) obstack_finish (&rtl_obstack);
1080 c = read_skip_spaces (infile);
1082 fatal_expected_char (infile, ')', c);
1084 XSTR (return_rtx, i) = stringbuf;
1089 read_name (tmp_char, infile);
1090 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
1091 tmp_wide = atoi (tmp_char);
1093 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
1094 tmp_wide = atol (tmp_char);
1096 /* Prefer atoll over atoq, since the former is in the ISO C99 standard.
1097 But prefer not to use our hand-rolled function above either. */
1098 #if defined(HAVE_ATOLL) || !defined(HAVE_ATOQ)
1099 tmp_wide = atoll (tmp_char);
1101 tmp_wide = atoq (tmp_char);
1105 XWINT (return_rtx, i) = tmp_wide;
1110 read_name (tmp_char, infile);
1111 tmp_int = atoi (tmp_char);
1112 XINT (return_rtx, i) = tmp_int;
1117 "switch format wrong in rtl.read_rtx(). format was: %c.\n",
1119 fprintf (stderr, "\tfile position: %ld\n", ftell (infile));
1123 c = read_skip_spaces (infile);
1125 fatal_expected_char (infile, ')', c);
1130 #if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007)
1132 rtl_check_failed_bounds (r, n, file, line, func)
1139 error ("RTL check: access of elt %d of `%s' with last elt %d",
1140 n, GET_RTX_NAME (GET_CODE (r)), GET_RTX_LENGTH (GET_CODE (r))-1);
1141 fancy_abort (file, line, func);
1145 rtl_check_failed_type1 (r, n, c1, file, line, func)
1153 error ("RTL check: expected elt %d type '%c', have '%c' (rtx %s)",
1154 n, c1, GET_RTX_FORMAT (GET_CODE (r))[n], GET_RTX_NAME (GET_CODE (r)));
1155 fancy_abort (file, line, func);
1159 rtl_check_failed_type2 (r, n, c1, c2, file, line, func)
1168 error ("RTL check: expected elt %d type '%c' or '%c', have '%c' (rtx %s)",
1170 GET_RTX_FORMAT (GET_CODE (r))[n], GET_RTX_NAME (GET_CODE(r)));
1171 fancy_abort (file, line, func);
1175 rtl_check_failed_code1 (r, code, file, line, func)
1182 error ("RTL check: expected code `%s', have `%s'",
1183 GET_RTX_NAME (code), GET_RTX_NAME (GET_CODE (r)));
1184 fancy_abort (file, line, func);
1188 rtl_check_failed_code2 (r, code1, code2, file, line, func)
1190 enum rtx_code code1, code2;
1195 error ("RTL check: expected code `%s' or `%s', have `%s'",
1196 GET_RTX_NAME (code1), GET_RTX_NAME (code2),
1197 GET_RTX_NAME (GET_CODE (r)));
1198 fancy_abort (file, line, func);
1201 /* XXX Maybe print the vector? */
1203 rtvec_check_failed_bounds (r, n, file, line, func)
1210 error ("RTL check: access of elt %d of vector with last elt %d",
1211 n, GET_NUM_ELEM (r)-1);
1212 fancy_abort (file, line, func);
1214 #endif /* ENABLE_RTL_CHECKING */