1 /* Support routines for the various generation passes.
2 Copyright (C) 2000, 2001, 2002, 2003, 2004
3 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it
8 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 GCC is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
24 #include "coretypes.h"
30 #include "gensupport.h"
33 /* In case some macros used by files we include need it, define this here. */
38 static struct obstack obstack
;
39 struct obstack
*rtl_obstack
= &obstack
;
41 static int sequence_num
;
44 static int predicable_default
;
45 static const char *predicable_true
;
46 static const char *predicable_false
;
48 static htab_t condition_table
;
50 static char *base_dir
= NULL
;
52 /* We initially queue all patterns, process the define_insn and
53 define_cond_exec patterns, then return them one at a time. */
60 struct queue_elem
*next
;
63 static struct queue_elem
*define_attr_queue
;
64 static struct queue_elem
**define_attr_tail
= &define_attr_queue
;
65 static struct queue_elem
*define_insn_queue
;
66 static struct queue_elem
**define_insn_tail
= &define_insn_queue
;
67 static struct queue_elem
*define_cond_exec_queue
;
68 static struct queue_elem
**define_cond_exec_tail
= &define_cond_exec_queue
;
69 static struct queue_elem
*other_queue
;
70 static struct queue_elem
**other_tail
= &other_queue
;
72 static void queue_pattern (rtx
, struct queue_elem
***,
75 /* Current maximum length of directory names in the search path
76 for include files. (Altered as we get more of them.) */
78 size_t max_include_len
;
82 struct file_name_list
*next
;
86 struct file_name_list
*first_dir_md_include
= 0; /* First dir to search */
87 /* First dir to search for <file> */
88 struct file_name_list
*first_bracket_include
= 0;
89 struct file_name_list
*last_dir_md_include
= 0; /* Last in chain */
91 static void remove_constraints (rtx
);
92 static void process_rtx (rtx
, int);
94 static int is_predicable (struct queue_elem
*);
95 static void identify_predicable_attribute (void);
96 static int n_alternatives (const char *);
97 static void collect_insn_data (rtx
, int *, int *);
98 static rtx
alter_predicate_for_insn (rtx
, int, int, int);
99 static const char *alter_test_for_insn (struct queue_elem
*,
100 struct queue_elem
*);
101 static char *shift_output_template (char *, const char *, int);
102 static const char *alter_output_for_insn (struct queue_elem
*,
105 static void process_one_cond_exec (struct queue_elem
*);
106 static void process_define_cond_exec (void);
107 static void process_include (rtx
, int);
108 static char *save_string (const char *, int);
111 message_with_line (int lineno
, const char *msg
, ...)
117 fprintf (stderr
, "%s:%d: ", read_rtx_filename
, lineno
);
118 vfprintf (stderr
, msg
, ap
);
119 fputc ('\n', stderr
);
124 /* Make a version of gen_rtx_CONST_INT so that GEN_INT can be used in
125 the gensupport programs. */
128 gen_rtx_CONST_INT (enum machine_mode mode ATTRIBUTE_UNUSED
,
131 rtx rt
= rtx_alloc (CONST_INT
);
137 /* Queue PATTERN on LIST_TAIL. */
140 queue_pattern (rtx pattern
, struct queue_elem
***list_tail
,
141 const char *filename
, int lineno
)
143 struct queue_elem
*e
= xmalloc (sizeof (*e
));
145 e
->filename
= filename
;
149 *list_tail
= &e
->next
;
152 /* Recursively remove constraints from an rtx. */
155 remove_constraints (rtx part
)
158 const char *format_ptr
;
163 if (GET_CODE (part
) == MATCH_OPERAND
)
165 else if (GET_CODE (part
) == MATCH_SCRATCH
)
168 format_ptr
= GET_RTX_FORMAT (GET_CODE (part
));
170 for (i
= 0; i
< GET_RTX_LENGTH (GET_CODE (part
)); i
++)
171 switch (*format_ptr
++)
175 remove_constraints (XEXP (part
, i
));
178 if (XVEC (part
, i
) != NULL
)
179 for (j
= 0; j
< XVECLEN (part
, i
); j
++)
180 remove_constraints (XVECEXP (part
, i
, j
));
185 /* Process an include file assuming that it lives in gcc/config/{target}/
186 if the include looks like (include "file"). */
189 process_include (rtx desc
, int lineno
)
191 const char *filename
= XSTR (desc
, 0);
192 const char *old_filename
;
197 /* If specified file name is absolute, skip the include stack. */
198 if (! IS_ABSOLUTE_PATH (filename
))
200 struct file_name_list
*stackp
;
202 /* Search directory path, trying to open the file. */
203 for (stackp
= first_dir_md_include
; stackp
; stackp
= stackp
->next
)
205 static const char sep
[2] = { DIR_SEPARATOR
, '\0' };
207 pathname
= concat (stackp
->fname
, sep
, filename
, NULL
);
208 input_file
= fopen (pathname
, "r");
209 if (input_file
!= NULL
)
216 pathname
= concat (base_dir
, filename
, NULL
);
218 pathname
= xstrdup (filename
);
219 input_file
= fopen (pathname
, "r");
220 if (input_file
== NULL
)
223 message_with_line (lineno
, "include file `%s' not found", filename
);
229 /* Save old cursor; setup new for the new file. Note that "lineno" the
230 argument to this function is the beginning of the include statement,
231 while read_rtx_lineno has already been advanced. */
232 old_filename
= read_rtx_filename
;
233 old_lineno
= read_rtx_lineno
;
234 read_rtx_filename
= pathname
;
237 /* Read the entire file. */
243 c
= read_skip_spaces (input_file
);
247 ungetc (c
, input_file
);
248 lineno
= read_rtx_lineno
;
249 desc
= read_rtx (input_file
);
250 process_rtx (desc
, lineno
);
253 /* Do not free pathname. It is attached to the various rtx queue
256 read_rtx_filename
= old_filename
;
257 read_rtx_lineno
= old_lineno
;
262 /* Process a top level rtx in some way, queuing as appropriate. */
265 process_rtx (rtx desc
, int lineno
)
267 switch (GET_CODE (desc
))
270 queue_pattern (desc
, &define_insn_tail
, read_rtx_filename
, lineno
);
273 case DEFINE_COND_EXEC
:
274 queue_pattern (desc
, &define_cond_exec_tail
, read_rtx_filename
, lineno
);
278 queue_pattern (desc
, &define_attr_tail
, read_rtx_filename
, lineno
);
282 process_include (desc
, lineno
);
285 case DEFINE_INSN_AND_SPLIT
:
287 const char *split_cond
;
292 /* Create a split with values from the insn_and_split. */
293 split
= rtx_alloc (DEFINE_SPLIT
);
295 i
= XVECLEN (desc
, 1);
296 XVEC (split
, 0) = rtvec_alloc (i
);
299 XVECEXP (split
, 0, i
) = copy_rtx (XVECEXP (desc
, 1, i
));
300 remove_constraints (XVECEXP (split
, 0, i
));
303 /* If the split condition starts with "&&", append it to the
304 insn condition to create the new split condition. */
305 split_cond
= XSTR (desc
, 4);
306 if (split_cond
[0] == '&' && split_cond
[1] == '&')
307 split_cond
= concat (XSTR (desc
, 2), split_cond
, NULL
);
308 XSTR (split
, 1) = split_cond
;
309 XVEC (split
, 2) = XVEC (desc
, 5);
310 XSTR (split
, 3) = XSTR (desc
, 6);
312 /* Fix up the DEFINE_INSN. */
313 attr
= XVEC (desc
, 7);
314 PUT_CODE (desc
, DEFINE_INSN
);
315 XVEC (desc
, 4) = attr
;
318 queue_pattern (desc
, &define_insn_tail
, read_rtx_filename
, lineno
);
319 queue_pattern (split
, &other_tail
, read_rtx_filename
, lineno
);
324 queue_pattern (desc
, &other_tail
, read_rtx_filename
, lineno
);
329 /* Return true if attribute PREDICABLE is true for ELEM, which holds
333 is_predicable (struct queue_elem
*elem
)
335 rtvec vec
= XVEC (elem
->data
, 4);
340 return predicable_default
;
342 for (i
= GET_NUM_ELEM (vec
) - 1; i
>= 0; --i
)
344 rtx sub
= RTVEC_ELT (vec
, i
);
345 switch (GET_CODE (sub
))
348 if (strcmp (XSTR (sub
, 0), "predicable") == 0)
350 value
= XSTR (sub
, 1);
355 case SET_ATTR_ALTERNATIVE
:
356 if (strcmp (XSTR (sub
, 0), "predicable") == 0)
358 message_with_line (elem
->lineno
,
359 "multiple alternatives for `predicable'");
366 if (GET_CODE (SET_DEST (sub
)) != ATTR
367 || strcmp (XSTR (SET_DEST (sub
), 0), "predicable") != 0)
370 if (GET_CODE (sub
) == CONST_STRING
)
372 value
= XSTR (sub
, 0);
376 /* ??? It would be possible to handle this if we really tried.
377 It's not easy though, and I'm not going to bother until it
378 really proves necessary. */
379 message_with_line (elem
->lineno
,
380 "non-constant value for `predicable'");
389 return predicable_default
;
392 /* Verify that predicability does not vary on the alternative. */
393 /* ??? It should be possible to handle this by simply eliminating
394 the non-predicable alternatives from the insn. FRV would like
395 to do this. Delay this until we've got the basics solid. */
396 if (strchr (value
, ',') != NULL
)
398 message_with_line (elem
->lineno
,
399 "multiple alternatives for `predicable'");
404 /* Find out which value we're looking at. */
405 if (strcmp (value
, predicable_true
) == 0)
407 if (strcmp (value
, predicable_false
) == 0)
410 message_with_line (elem
->lineno
,
411 "unknown value `%s' for `predicable' attribute",
417 /* Examine the attribute "predicable"; discover its boolean values
421 identify_predicable_attribute (void)
423 struct queue_elem
*elem
;
424 char *p_true
, *p_false
;
427 /* Look for the DEFINE_ATTR for `predicable', which must exist. */
428 for (elem
= define_attr_queue
; elem
; elem
= elem
->next
)
429 if (strcmp (XSTR (elem
->data
, 0), "predicable") == 0)
432 message_with_line (define_cond_exec_queue
->lineno
,
433 "attribute `predicable' not defined");
438 value
= XSTR (elem
->data
, 1);
439 p_false
= xstrdup (value
);
440 p_true
= strchr (p_false
, ',');
441 if (p_true
== NULL
|| strchr (++p_true
, ',') != NULL
)
443 message_with_line (elem
->lineno
,
444 "attribute `predicable' is not a boolean");
450 predicable_true
= p_true
;
451 predicable_false
= p_false
;
453 switch (GET_CODE (XEXP (elem
->data
, 2)))
456 value
= XSTR (XEXP (elem
->data
, 2), 0);
460 message_with_line (elem
->lineno
,
461 "attribute `predicable' cannot be const");
466 message_with_line (elem
->lineno
,
467 "attribute `predicable' must have a constant default");
472 if (strcmp (value
, p_true
) == 0)
473 predicable_default
= 1;
474 else if (strcmp (value
, p_false
) == 0)
475 predicable_default
= 0;
478 message_with_line (elem
->lineno
,
479 "unknown value `%s' for `predicable' attribute",
485 /* Return the number of alternatives in constraint S. */
488 n_alternatives (const char *s
)
499 /* Determine how many alternatives there are in INSN, and how many
503 collect_insn_data (rtx pattern
, int *palt
, int *pmax
)
509 code
= GET_CODE (pattern
);
513 i
= n_alternatives (XSTR (pattern
, 2));
514 *palt
= (i
> *palt
? i
: *palt
);
521 i
= XINT (pattern
, 0);
530 fmt
= GET_RTX_FORMAT (code
);
531 len
= GET_RTX_LENGTH (code
);
532 for (i
= 0; i
< len
; i
++)
537 collect_insn_data (XEXP (pattern
, i
), palt
, pmax
);
541 if (XVEC (pattern
, i
) == NULL
)
545 for (j
= XVECLEN (pattern
, i
) - 1; j
>= 0; --j
)
546 collect_insn_data (XVECEXP (pattern
, i
, j
), palt
, pmax
);
549 case 'i': case 'w': case '0': case 's': case 'S': case 'T':
559 alter_predicate_for_insn (rtx pattern
, int alt
, int max_op
, int lineno
)
565 code
= GET_CODE (pattern
);
570 const char *c
= XSTR (pattern
, 2);
572 if (n_alternatives (c
) != 1)
574 message_with_line (lineno
,
575 "too many alternatives for operand %d",
581 /* Replicate C as needed to fill out ALT alternatives. */
582 if (c
&& *c
&& alt
> 1)
584 size_t c_len
= strlen (c
);
585 size_t len
= alt
* (c_len
+ 1);
586 char *new_c
= xmalloc (len
);
588 memcpy (new_c
, c
, c_len
);
589 for (i
= 1; i
< alt
; ++i
)
591 new_c
[i
* (c_len
+ 1) - 1] = ',';
592 memcpy (&new_c
[i
* (c_len
+ 1)], c
, c_len
);
594 new_c
[len
- 1] = '\0';
595 XSTR (pattern
, 2) = new_c
;
604 XINT (pattern
, 0) += max_op
;
611 fmt
= GET_RTX_FORMAT (code
);
612 len
= GET_RTX_LENGTH (code
);
613 for (i
= 0; i
< len
; i
++)
620 r
= alter_predicate_for_insn (XEXP (pattern
, i
), alt
,
627 for (j
= XVECLEN (pattern
, i
) - 1; j
>= 0; --j
)
629 r
= alter_predicate_for_insn (XVECEXP (pattern
, i
, j
),
630 alt
, max_op
, lineno
);
636 case 'i': case 'w': case '0': case 's':
648 alter_test_for_insn (struct queue_elem
*ce_elem
,
649 struct queue_elem
*insn_elem
)
651 const char *ce_test
, *insn_test
;
653 ce_test
= XSTR (ce_elem
->data
, 1);
654 insn_test
= XSTR (insn_elem
->data
, 2);
655 if (!ce_test
|| *ce_test
== '\0')
657 if (!insn_test
|| *insn_test
== '\0')
660 return concat ("(", ce_test
, ") && (", insn_test
, ")", NULL
);
663 /* Adjust all of the operand numbers in OLD to match the shift they'll
664 get from an operand displacement of DISP. Return a pointer after the
668 shift_output_template (char *new, const char *old
, int disp
)
677 if (ISDIGIT ((unsigned char) c
))
679 else if (ISALPHA (c
))
692 alter_output_for_insn (struct queue_elem
*ce_elem
,
693 struct queue_elem
*insn_elem
,
696 const char *ce_out
, *insn_out
;
698 size_t len
, ce_len
, insn_len
;
700 /* ??? Could coordinate with genoutput to not duplicate code here. */
702 ce_out
= XSTR (ce_elem
->data
, 2);
703 insn_out
= XTMPL (insn_elem
->data
, 3);
704 if (!ce_out
|| *ce_out
== '\0')
707 ce_len
= strlen (ce_out
);
708 insn_len
= strlen (insn_out
);
710 if (*insn_out
== '*')
711 /* You must take care of the predicate yourself. */
714 if (*insn_out
== '@')
716 len
= (ce_len
+ 1) * alt
+ insn_len
+ 1;
717 p
= new = xmalloc (len
);
723 while (ISSPACE ((unsigned char) *insn_out
));
725 if (*insn_out
!= '#')
727 p
= shift_output_template (p
, ce_out
, max_op
);
733 while (*insn_out
&& *insn_out
!= '\n');
740 len
= ce_len
+ 1 + insn_len
+ 1;
743 p
= shift_output_template (new, ce_out
, max_op
);
745 memcpy (p
, insn_out
, insn_len
+ 1);
751 /* Replicate insns as appropriate for the given DEFINE_COND_EXEC. */
754 process_one_cond_exec (struct queue_elem
*ce_elem
)
756 struct queue_elem
*insn_elem
;
757 for (insn_elem
= define_insn_queue
; insn_elem
; insn_elem
= insn_elem
->next
)
759 int alternatives
, max_operand
;
760 rtx pred
, insn
, pattern
;
762 if (! is_predicable (insn_elem
))
767 collect_insn_data (insn_elem
->data
, &alternatives
, &max_operand
);
770 if (XVECLEN (ce_elem
->data
, 0) != 1)
772 message_with_line (ce_elem
->lineno
,
773 "too many patterns in predicate");
778 pred
= copy_rtx (XVECEXP (ce_elem
->data
, 0, 0));
779 pred
= alter_predicate_for_insn (pred
, alternatives
, max_operand
,
784 /* Construct a new pattern for the new insn. */
785 insn
= copy_rtx (insn_elem
->data
);
787 pattern
= rtx_alloc (COND_EXEC
);
788 XEXP (pattern
, 0) = pred
;
789 if (XVECLEN (insn
, 1) == 1)
791 XEXP (pattern
, 1) = XVECEXP (insn
, 1, 0);
792 XVECEXP (insn
, 1, 0) = pattern
;
793 PUT_NUM_ELEM (XVEC (insn
, 1), 1);
797 XEXP (pattern
, 1) = rtx_alloc (PARALLEL
);
798 XVEC (XEXP (pattern
, 1), 0) = XVEC (insn
, 1);
799 XVEC (insn
, 1) = rtvec_alloc (1);
800 XVECEXP (insn
, 1, 0) = pattern
;
803 XSTR (insn
, 2) = alter_test_for_insn (ce_elem
, insn_elem
);
804 XTMPL (insn
, 3) = alter_output_for_insn (ce_elem
, insn_elem
,
805 alternatives
, max_operand
);
807 /* ??? Set `predicable' to false. Not crucial since it's really
808 only used here, and we won't reprocess this new pattern. */
810 /* Put the new pattern on the `other' list so that it
811 (a) is not reprocessed by other define_cond_exec patterns
812 (b) appears after all normal define_insn patterns.
814 ??? B is debatable. If one has normal insns that match
815 cond_exec patterns, they will be preferred over these
816 generated patterns. Whether this matters in practice, or if
817 it's a good thing, or whether we should thread these new
818 patterns into the define_insn chain just after their generator
819 is something we'll have to experiment with. */
821 queue_pattern (insn
, &other_tail
, insn_elem
->filename
,
826 /* If we have any DEFINE_COND_EXEC patterns, expand the DEFINE_INSN
827 patterns appropriately. */
830 process_define_cond_exec (void)
832 struct queue_elem
*elem
;
834 identify_predicable_attribute ();
838 for (elem
= define_cond_exec_queue
; elem
; elem
= elem
->next
)
839 process_one_cond_exec (elem
);
843 save_string (const char *s
, int len
)
845 char *result
= xmalloc (len
+ 1);
847 memcpy (result
, s
, len
);
853 /* The entry point for initializing the reader. */
856 init_md_reader_args (int argc
, char **argv
)
859 const char *in_fname
;
863 for (i
= 1; i
< argc
; i
++)
865 if (argv
[i
][0] != '-')
867 if (in_fname
== NULL
)
875 case 'I': /* Add directory to path for includes. */
877 struct file_name_list
*dirtmp
;
879 dirtmp
= xmalloc (sizeof (struct file_name_list
));
880 dirtmp
->next
= 0; /* New one goes on the end */
881 if (first_dir_md_include
== 0)
882 first_dir_md_include
= dirtmp
;
884 last_dir_md_include
->next
= dirtmp
;
885 last_dir_md_include
= dirtmp
; /* Tail follows the last one */
886 if (argv
[i
][1] == 'I' && argv
[i
][2] != 0)
887 dirtmp
->fname
= argv
[i
] + 2;
888 else if (i
+ 1 == argc
)
889 fatal ("directory name missing after -I option");
891 dirtmp
->fname
= argv
[++i
];
892 if (strlen (dirtmp
->fname
) > max_include_len
)
893 max_include_len
= strlen (dirtmp
->fname
);
897 fatal ("invalid option `%s'", argv
[i
]);
902 return init_md_reader (in_fname
);
905 /* The entry point for initializing the reader. */
908 init_md_reader (const char *filename
)
915 lastsl
= strrchr (filename
, '/');
917 base_dir
= save_string (filename
, lastsl
- filename
+ 1 );
919 read_rtx_filename
= filename
;
920 input_file
= fopen (filename
, "r");
924 return FATAL_EXIT_CODE
;
927 /* Initialize the table of insn conditions. */
928 condition_table
= htab_create (n_insn_conditions
,
929 hash_c_test
, cmp_c_test
, NULL
);
931 for (i
= 0; i
< n_insn_conditions
; i
++)
932 *(htab_find_slot (condition_table
, &insn_conditions
[i
], INSERT
))
933 = (void *) &insn_conditions
[i
];
935 obstack_init (rtl_obstack
);
939 /* Read the entire file. */
945 c
= read_skip_spaces (input_file
);
949 ungetc (c
, input_file
);
950 lineno
= read_rtx_lineno
;
951 desc
= read_rtx (input_file
);
952 process_rtx (desc
, lineno
);
956 /* Process define_cond_exec patterns. */
957 if (define_cond_exec_queue
!= NULL
)
958 process_define_cond_exec ();
960 return errors
? FATAL_EXIT_CODE
: SUCCESS_EXIT_CODE
;
963 /* The entry point for reading a single rtx from an md file. */
966 read_md_rtx (int *lineno
, int *seqnr
)
968 struct queue_elem
**queue
, *elem
;
973 /* Read all patterns from a given queue before moving on to the next. */
974 if (define_attr_queue
!= NULL
)
975 queue
= &define_attr_queue
;
976 else if (define_insn_queue
!= NULL
)
977 queue
= &define_insn_queue
;
978 else if (other_queue
!= NULL
)
979 queue
= &other_queue
;
986 read_rtx_filename
= elem
->filename
;
987 *lineno
= elem
->lineno
;
988 *seqnr
= sequence_num
;
992 /* Discard insn patterns which we know can never match (because
993 their C test is provably always false). If insn_elision is
994 false, our caller needs to see all the patterns. Note that the
995 elided patterns are never counted by the sequence numbering; it
996 it is the caller's responsibility, when insn_elision is false, not
997 to use elided pattern numbers for anything. */
998 switch (GET_CODE (desc
))
1002 if (maybe_eval_c_test (XSTR (desc
, 2)) != 0)
1004 else if (insn_elision
)
1009 case DEFINE_PEEPHOLE
:
1010 case DEFINE_PEEPHOLE2
:
1011 if (maybe_eval_c_test (XSTR (desc
, 1)) != 0)
1013 else if (insn_elision
)
1024 /* Helper functions for insn elision. */
1026 /* Compute a hash function of a c_test structure, which is keyed
1027 by its ->expr field. */
1029 hash_c_test (const void *x
)
1031 const struct c_test
*a
= (const struct c_test
*) x
;
1032 const unsigned char *base
, *s
= (const unsigned char *) a
->expr
;
1040 while ((c
= *s
++) != '\0')
1042 hash
+= c
+ (c
<< 17);
1047 hash
+= len
+ (len
<< 17);
1053 /* Compare two c_test expression structures. */
1055 cmp_c_test (const void *x
, const void *y
)
1057 const struct c_test
*a
= (const struct c_test
*) x
;
1058 const struct c_test
*b
= (const struct c_test
*) y
;
1060 return !strcmp (a
->expr
, b
->expr
);
1063 /* Given a string representing a C test expression, look it up in the
1064 condition_table and report whether or not its value is known
1065 at compile time. Returns a tristate: 1 for known true, 0 for
1066 known false, -1 for unknown. */
1068 maybe_eval_c_test (const char *expr
)
1070 const struct c_test
*test
;
1071 struct c_test dummy
;
1076 if (insn_elision_unavailable
)
1080 test
= htab_find (condition_table
, &dummy
);
1087 /* Given a string, return the number of comma-separated elements in it.
1088 Return 0 for the null string. */
1090 n_comma_elts (const char *s
)
1097 for (n
= 1; *s
; s
++)
1104 /* Given a pointer to a (char *), return a pointer to the beginning of the
1105 next comma-separated element in the string. Advance the pointer given
1106 to the end of that element. Return NULL if at end of string. Caller
1107 is responsible for copying the string if necessary. White space between
1108 a comma and an element is ignored. */
1111 scan_comma_elt (const char **pstr
)
1114 const char *p
= *pstr
;
1126 while (*p
!= ',' && *p
!= '\0')