Lines Matching refs:regexp
173 struct regexp;
190 typedef struct regexp *regexp_t;
335 regexp. */
368 correct distributions of units to automata in a regexp. */
408 an regexp definition. */
444 regexp_t regexp;
449 regexp. */
461 regexp_t regexp;
478 /* The following field is the insn regexp transformed that
479 the regexp has not optional regexp, repetition regexp, and an
481 corresponding regexp) and all alternations are the top level
482 of the regexp. The value can be NULL only if it is special
565 regexp_t regexp;
585 struct regexp
599 } regexp;
991 (({ struct regexp *const _regexp = (r); \
995 &(_regexp)->regexp.unit; }))
998 (({ struct regexp *const _regexp = (r); \
1002 &(_regexp)->regexp.reserv; }))
1005 (({ struct regexp *const _regexp = (r); \
1009 &(_regexp)->regexp.sequence; }))
1012 (({ struct regexp *const _regexp = (r); \
1016 &(_regexp)->regexp.repeat; }))
1019 (({ struct regexp *const _regexp = (r); \
1023 &(_regexp)->regexp.allof; }))
1026 (({ struct regexp *const _regexp = (r); \
1030 &(_regexp)->regexp.oneof; }))
1038 /* Return string representation of regexp mode MODE. */
1063 /* The function prints message about unexpected regexp and finish the
1072 "\n%s: %d: error in %s: REGEXP check: expected decl %s, have %s\n",
1088 #define REGEXP_UNIT(r) (&(r)->regexp.unit)
1089 #define REGEXP_RESERV(r) (&(r)->regexp.reserv)
1090 #define REGEXP_SEQUENCE(r) (&(r)->regexp.sequence)
1091 #define REGEXP_REPEAT(r) (&(r)->regexp.repeat)
1092 #define REGEXP_ALLOF(r) (&(r)->regexp.allof)
1093 #define REGEXP_ONEOF(r) (&(r)->regexp.oneof)
1559 regexp_t regexp;
1571 regexp = gen_regexp_sequence (dstr);
1575 regexp = XCREATENODE (struct regexp);
1576 regexp->mode = rm_nothing;
1580 regexp = XCREATENODE (struct regexp);
1581 regexp->mode = rm_unit;
1582 REGEXP_UNIT (regexp)->name = str;
1584 return regexp;
1591 regexp_t regexp;
1602 regexp = gen_regexp_el (repeat_vect [0]);
1605 repeat = XCREATENODE (struct regexp);
1607 REGEXP_REPEAT (repeat)->regexp = regexp;
1612 regexp = repeat;
1614 return regexp;
1634 allof = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
1660 oneof = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
1688 sequence = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
1724 DECL_RESERV (decl)->regexp = gen_regexp (XSTR (def, 1));
1746 DECL_INSN_RESERV (decl)->regexp = gen_regexp (XSTR (def, 3));
2759 /* The following recursive function processes all regexp in order to
2765 process_regexp (regexp_t regexp)
2771 switch (regexp->mode)
2774 decl_in_table = find_decl (REGEXP_UNIT (regexp)->name);
2777 REGEXP_UNIT (regexp)->name);
2783 REGEXP_UNIT (regexp)->unit_decl = DECL_UNIT (decl_in_table);
2788 new_regexp = XCREATENODE (struct regexp);
2790 new_regexp->pos = regexp->pos;
2791 REGEXP_RESERV (new_regexp)->name = REGEXP_UNIT (regexp)->name;
2794 regexp = new_regexp;
2802 for (i = 0; i <REGEXP_SEQUENCE (regexp)->regexps_num; i++)
2803 REGEXP_SEQUENCE (regexp)->regexps [i]
2804 = process_regexp (REGEXP_SEQUENCE (regexp)->regexps [i]);
2807 for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
2808 REGEXP_ALLOF (regexp)->regexps [i]
2809 = process_regexp (REGEXP_ALLOF (regexp)->regexps [i]);
2812 for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++)
2813 REGEXP_ONEOF (regexp)->regexps [i]
2814 = process_regexp (REGEXP_ONEOF (regexp)->regexps [i]);
2817 REGEXP_REPEAT (regexp)->regexp
2818 = process_regexp (REGEXP_REPEAT (regexp)->regexp);
2825 return regexp;
2828 /* The following function processes regexp of define_reservation and
2841 DECL_RESERV (decl)->regexp
2842 = process_regexp (DECL_RESERV (decl)->regexp);
2844 DECL_INSN_RESERV (decl)->regexp
2845 = process_regexp (DECL_INSN_RESERV (decl)->regexp);
2883 /* The following recursive function returns nonzero value if REGEXP
2884 contains given decl or reservations in given regexp refers for
2887 loop_in_regexp (regexp_t regexp, decl_t start_decl)
2891 if (regexp == NULL)
2893 switch (regexp->mode)
2900 && REGEXP_RESERV (regexp)->reserv_decl == DECL_RESERV (start_decl))
2902 else if (REGEXP_RESERV (regexp)->reserv_decl->loop_pass_num
2908 REGEXP_RESERV (regexp)->reserv_decl->loop_pass_num
2910 return loop_in_regexp (REGEXP_RESERV (regexp)->reserv_decl->regexp,
2915 for (i = 0; i <REGEXP_SEQUENCE (regexp)->regexps_num; i++)
2916 if (loop_in_regexp (REGEXP_SEQUENCE (regexp)->regexps [i], start_decl))
2921 for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
2922 if (loop_in_regexp (REGEXP_ALLOF (regexp)->regexps [i], start_decl))
2927 for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++)
2928 if (loop_in_regexp (REGEXP_ONEOF (regexp)->regexps [i], start_decl))
2933 return loop_in_regexp (REGEXP_REPEAT (regexp)->regexp, start_decl);
2965 if (loop_in_regexp (DECL_RESERV (decl)->regexp, decl))
2967 gcc_assert (DECL_RESERV (decl)->regexp);
2978 process_regexp_cycles (regexp_t regexp, int max_start_cycle,
2984 switch (regexp->mode)
2987 if (REGEXP_UNIT (regexp)->unit_decl->max_occ_cycle_num < max_start_cycle)
2988 REGEXP_UNIT (regexp)->unit_decl->max_occ_cycle_num = max_start_cycle;
2989 if (REGEXP_UNIT (regexp)->unit_decl->min_occ_cycle_num > min_start_cycle
2990 || REGEXP_UNIT (regexp)->unit_decl->min_occ_cycle_num == -1)
2991 REGEXP_UNIT (regexp)->unit_decl->min_occ_cycle_num = min_start_cycle;
2997 process_regexp_cycles (REGEXP_RESERV (regexp)->reserv_decl->regexp,
3003 for (i = 0; i < REGEXP_REPEAT (regexp)->repeat_num; i++)
3005 process_regexp_cycles (REGEXP_REPEAT (regexp)->regexp,
3014 for (i = 0; i <REGEXP_SEQUENCE (regexp)->regexps_num; i++)
3016 process_regexp_cycles (REGEXP_SEQUENCE (regexp)->regexps [i],
3029 for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
3031 process_regexp_cycles (REGEXP_ALLOF (regexp)->regexps [i],
3049 for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++)
3051 process_regexp_cycles (REGEXP_ONEOF (regexp)->regexps [i],
3090 process_regexp_cycles (DECL_INSN_RESERV (decl)->regexp, 0, 0,
3239 DECL_INSN_RESERV (advance_cycle_insn_decl)->regexp = NULL;
3255 DECL_INSN_RESERV (collapse_ndfa_insn_decl)->regexp = NULL;
4509 copy_insn_regexp (regexp_t regexp)
4514 switch (regexp->mode)
4517 result = copy_insn_regexp (REGEXP_RESERV (regexp)->reserv_decl->regexp);
4521 result = XCOPYNODE (struct regexp, regexp);
4525 result = XCOPYNODE (struct regexp, regexp);
4526 REGEXP_REPEAT (result)->regexp
4527 = copy_insn_regexp (REGEXP_REPEAT (regexp)->regexp);
4531 result = XCOPYNODEVAR (struct regexp, regexp,
4532 sizeof (struct regexp) + sizeof (regexp_t)
4533 * (REGEXP_SEQUENCE (regexp)->regexps_num - 1));
4534 for (i = 0; i <REGEXP_SEQUENCE (regexp)->regexps_num; i++)
4536 = copy_insn_regexp (REGEXP_SEQUENCE (regexp)->regexps [i]);
4540 result = XCOPYNODEVAR (struct regexp, regexp,
4541 sizeof (struct regexp) + sizeof (regexp_t)
4542 * (REGEXP_ALLOF (regexp)->regexps_num - 1));
4543 for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
4545 = copy_insn_regexp (REGEXP_ALLOF (regexp)->regexps [i]);
4549 result = XCOPYNODEVAR (struct regexp, regexp,
4550 sizeof (struct regexp) + sizeof (regexp_t)
4551 * (REGEXP_ONEOF (regexp)->regexps_num - 1));
4552 for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++)
4554 = copy_insn_regexp (REGEXP_ONEOF (regexp)->regexps [i]);
4558 result = XCOPYNODE (struct regexp, regexp);
4574 transform_1 (regexp_t regexp)
4581 if (regexp->mode == rm_repeat)
4583 repeat_num = REGEXP_REPEAT (regexp)->repeat_num;
4585 operand = REGEXP_REPEAT (regexp)->regexp;
4586 pos = regexp->mode;
4587 regexp = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
4589 regexp->mode = rm_sequence;
4590 regexp->pos = pos;
4591 REGEXP_SEQUENCE (regexp)->regexps_num = repeat_num;
4593 REGEXP_SEQUENCE (regexp)->regexps [i] = copy_insn_regexp (operand);
4596 return regexp;
4604 transform_2 (regexp_t regexp)
4606 if (regexp->mode == rm_sequence)
4613 for (i = 0; i < REGEXP_SEQUENCE (regexp)->regexps_num; i++)
4614 if (REGEXP_SEQUENCE (regexp)->regexps [i]->mode == rm_sequence)
4617 sequence = REGEXP_SEQUENCE (regexp)->regexps [i];
4620 if (i < REGEXP_SEQUENCE (regexp)->regexps_num)
4623 && REGEXP_SEQUENCE (regexp)->regexps_num > 1);
4624 result = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
4626 * (REGEXP_SEQUENCE (regexp)->regexps_num
4630 result->pos = regexp->pos;
4632 = (REGEXP_SEQUENCE (regexp)->regexps_num
4634 for (i = 0; i < REGEXP_SEQUENCE (regexp)->regexps_num; i++)
4637 = copy_insn_regexp (REGEXP_SEQUENCE (regexp)->regexps [i]);
4641 = copy_insn_regexp (REGEXP_SEQUENCE (regexp)->regexps [i]);
4647 regexp = result;
4650 else if (regexp->mode == rm_allof)
4657 for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
4658 if (REGEXP_ALLOF (regexp)->regexps [i]->mode == rm_allof)
4661 allof = REGEXP_ALLOF (regexp)->regexps [i];
4664 if (i < REGEXP_ALLOF (regexp)->regexps_num)
4667 && REGEXP_ALLOF (regexp)->regexps_num > 1);
4668 result = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
4670 * (REGEXP_ALLOF (regexp)->regexps_num
4673 result->pos = regexp->pos;
4675 = (REGEXP_ALLOF (regexp)->regexps_num
4677 for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
4680 = copy_insn_regexp (REGEXP_ALLOF (regexp)->regexps [i]);
4684 = copy_insn_regexp (REGEXP_ALLOF (regexp)->regexps [i]);
4690 regexp = result;
4693 else if (regexp->mode == rm_oneof)
4700 for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++)
4701 if (REGEXP_ONEOF (regexp)->regexps [i]->mode == rm_oneof)
4704 oneof = REGEXP_ONEOF (regexp)->regexps [i];
4707 if (i < REGEXP_ONEOF (regexp)->regexps_num)
4710 && REGEXP_ONEOF (regexp)->regexps_num > 1);
4711 result = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
4713 * (REGEXP_ONEOF (regexp)->regexps_num
4716 result->pos = regexp->pos;
4718 = (REGEXP_ONEOF (regexp)->regexps_num
4720 for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++)
4723 = copy_insn_regexp (REGEXP_ONEOF (regexp)->regexps [i]);
4727 = copy_insn_regexp (REGEXP_ONEOF (regexp)->regexps [i]);
4733 regexp = result;
4736 return regexp;
4745 transform_3 (regexp_t regexp)
4747 if (regexp->mode == rm_sequence)
4755 for (i = 0; i <REGEXP_SEQUENCE (regexp)->regexps_num; i++)
4756 if (REGEXP_SEQUENCE (regexp)->regexps [i]->mode == rm_oneof)
4759 oneof = REGEXP_SEQUENCE (regexp)->regexps [i];
4762 if (i < REGEXP_SEQUENCE (regexp)->regexps_num)
4765 && REGEXP_SEQUENCE (regexp)->regexps_num > 1);
4766 result = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
4770 result->pos = regexp->pos;
4776 = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
4778 * (REGEXP_SEQUENCE (regexp)->regexps_num - 1));
4780 sequence->pos = regexp->pos;
4782 = REGEXP_SEQUENCE (regexp)->regexps_num;
4787 = copy_insn_regexp (REGEXP_SEQUENCE (regexp)->regexps [j]);
4793 regexp = result;
4796 else if (regexp->mode == rm_allof)
4807 for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
4808 if (REGEXP_ALLOF (regexp)->regexps [i]->mode == rm_oneof)
4811 oneof = REGEXP_ALLOF (regexp)->regexps [i];
4814 if (i < REGEXP_ALLOF (regexp)->regexps_num)
4817 && REGEXP_ALLOF (regexp)->regexps_num > 1);
4818 result = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
4822 result->pos = regexp->pos;
4828 = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
4830 * (REGEXP_ALLOF (regexp)->regexps_num - 1));
4832 allof->pos = regexp->pos;
4834 = REGEXP_ALLOF (regexp)->regexps_num;
4839 = copy_insn_regexp (REGEXP_ALLOF (regexp)->regexps [j]);
4845 regexp = result;
4848 if (regexp->mode == rm_allof)
4849 for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
4851 switch (REGEXP_ALLOF (regexp)->regexps [i]->mode)
4854 seq = REGEXP_ALLOF (regexp)->regexps [i];
4872 && REGEXP_ALLOF (regexp)->regexps_num > 1);
4873 result = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
4876 result->pos = regexp->pos;
4881 for (j = 0; j < REGEXP_ALLOF (regexp)->regexps_num; j++)
4882 switch (REGEXP_ALLOF (regexp)->regexps [j]->mode)
4885 if (i < (REGEXP_SEQUENCE (REGEXP_ALLOF (regexp)
4889 = (REGEXP_SEQUENCE (REGEXP_ALLOF (regexp)
4899 allof_op = REGEXP_ALLOF (regexp)->regexps [j];
4911 allof = XCREATENODEVAR (struct regexp, sizeof (struct regexp)
4915 allof->pos = regexp->pos;
4919 for (j = 0; j < REGEXP_ALLOF (regexp)->regexps_num; j++)
4920 if (REGEXP_ALLOF (regexp)->regexps [j]->mode == rm_sequence
4922 (REGEXP_SEQUENCE (REGEXP_ALLOF (regexp)
4925 allof_op = (REGEXP_SEQUENCE (REGEXP_ALLOF (regexp)
4933 && (REGEXP_ALLOF (regexp)->regexps [j]->mode
4935 || (REGEXP_ALLOF (regexp)->regexps [j]->mode
4938 allof_op = REGEXP_ALLOF (regexp)->regexps [j];
4946 regexp = result;
4949 return regexp;
4955 regexp_transform_func (regexp_t regexp, regexp_t (*func) (regexp_t regexp))
4959 switch (regexp->mode)
4962 for (i = 0; i < REGEXP_SEQUENCE (regexp)->regexps_num; i++)
4963 REGEXP_SEQUENCE (regexp)->regexps [i]
4964 = regexp_transform_func (REGEXP_SEQUENCE (regexp)->regexps [i],
4969 for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
4970 REGEXP_ALLOF (regexp)->regexps [i]
4971 = regexp_transform_func (REGEXP_ALLOF (regexp)->regexps [i], func);
4975 for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++)
4976 REGEXP_ONEOF (regexp)->regexps [i]
4977 = regexp_transform_func (REGEXP_ONEOF (regexp)->regexps [i], func);
4981 REGEXP_REPEAT (regexp)->regexp
4982 = regexp_transform_func (REGEXP_REPEAT (regexp)->regexp, func);
4992 return (*func) (regexp);
4996 reservation REGEXP. */
4998 transform_regexp (regexp_t regexp)
5000 regexp = regexp_transform_func (regexp, transform_1);
5004 regexp = regexp_transform_func (regexp, transform_2);
5005 regexp = regexp_transform_func (regexp, transform_3);
5008 return regexp;
5031 (DECL_INSN_RESERV (decl)->regexp));
5069 regexp + the alternative number. */
5073 CYCLE in REGEXP alternative with ALT_NUM. The structure is made
5076 store_alt_unit_usage (regexp_t regexp, regexp_t unit, int cycle,
5084 gcc_assert (regexp && regexp->mode == rm_oneof
5085 && alt_num < REGEXP_ONEOF (regexp)->regexps_num);
5088 length = (cycle + 1) * REGEXP_ONEOF (regexp)->regexps_num;
5092 index = cycle * REGEXP_ONEOF (regexp)->regexps_num + alt_num;
5165 /* The function processes given REGEXP to find units with the wrong
5169 regexp_t regexp)
5176 if (regexp == NULL || regexp->mode != rm_oneof)
5178 /* Store all unit usages in the regexp: */
5182 for (i = REGEXP_ONEOF (regexp)->regexps_num - 1; i >= 0; i--)
5184 seq = REGEXP_ONEOF (regexp)->regexps [i];
5198 store_alt_unit_usage (regexp, unit, j, i);
5205 store_alt_unit_usage (regexp, allof, j, i);
5224 store_alt_unit_usage (regexp, unit, 0, i);
5237 store_alt_unit_usage (regexp, seq, 0, i);
5253 n_alts = REGEXP_ONEOF (regexp)->regexps_num;
5372 REGEXP for forming alt_states of AUTOMATON. It is believed that
5373 CURR_CYCLE is start cycle of all reservation REGEXP. */
5375 process_seq_for_forming_states (regexp_t regexp, automaton_t automaton,
5380 if (regexp == NULL)
5383 switch (regexp->mode)
5386 if (REGEXP_UNIT (regexp)->unit_decl->corresponding_automaton_num
5389 REGEXP_UNIT (regexp)->unit_decl->unit_num);
5393 for (i = 0; i < REGEXP_SEQUENCE (regexp)->regexps_num; i++)
5396 (REGEXP_SEQUENCE (regexp)->regexps [i], automaton, curr_cycle) + 1;
5404 for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
5406 cycle = process_seq_for_forming_states (REGEXP_ALLOF (regexp)
5445 /* This recursive function processes `|' in reservation REGEXP for
5449 process_alts_for_forming_states (regexp_t regexp, automaton_t automaton,
5454 if (regexp->mode != rm_oneof)
5464 (void) process_seq_for_forming_states (regexp, automaton, 0);
5473 for (i = REGEXP_ONEOF (regexp)->regexps_num - 1; i >= 0; i--)
5474 process_alts_for_forming_states (REGEXP_ONEOF (regexp)->regexps [i],
6812 regexp. The representation is formed on IR obstack. So you should
6816 /* This recursive function forms string representation of regexp
6819 form_regexp (regexp_t regexp)
6823 switch (regexp->mode)
6827 const char *name = (regexp->mode == rm_unit
6828 ? REGEXP_UNIT (regexp)->name
6829 : REGEXP_RESERV (regexp)->name);
6836 for (i = 0; i < REGEXP_SEQUENCE (regexp)->regexps_num; i++)
6840 form_regexp (REGEXP_SEQUENCE (regexp)->regexps [i]);
6846 for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
6850 if (REGEXP_ALLOF (regexp)->regexps[i]->mode == rm_sequence
6851 || REGEXP_ALLOF (regexp)->regexps[i]->mode == rm_oneof)
6853 form_regexp (REGEXP_ALLOF (regexp)->regexps [i]);
6854 if (REGEXP_ALLOF (regexp)->regexps[i]->mode == rm_sequence
6855 || REGEXP_ALLOF (regexp)->regexps[i]->mode == rm_oneof)
6862 for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++)
6866 if (REGEXP_ONEOF (regexp)->regexps[i]->mode == rm_sequence)
6868 form_regexp (REGEXP_ONEOF (regexp)->regexps [i]);
6869 if (REGEXP_ONEOF (regexp)->regexps[i]->mode == rm_sequence)
6878 if (REGEXP_REPEAT (regexp)->regexp->mode == rm_sequence
6879 || REGEXP_REPEAT (regexp)->regexp->mode == rm_allof
6880 || REGEXP_REPEAT (regexp)->regexp->mode == rm_oneof)
6882 form_regexp (REGEXP_REPEAT (regexp)->regexp);
6883 if (REGEXP_REPEAT (regexp)->regexp->mode == rm_sequence
6884 || REGEXP_REPEAT (regexp)->regexp->mode == rm_allof
6885 || REGEXP_REPEAT (regexp)->regexp->mode == rm_oneof)
6887 sprintf (digits, "*%d", REGEXP_REPEAT (regexp)->repeat_num);
6901 /* The function returns string representation of REGEXP on IR
6904 regexp_representation (regexp_t regexp)
6906 form_regexp (regexp);
6912 representation of regexp. */
8573 regexp_representation (DECL_INSN_RESERV (decl)->regexp));
8798 output_regexp (regexp_t regexp)
8800 fprintf (output_description_file, "%s", regexp_representation (regexp));
8895 output_regexp (DECL_RESERV (decl)->regexp);
8905 output_regexp (DECL_INSN_RESERV (decl)->regexp);