Lines Matching refs:regexp

171 struct regexp;
186 typedef struct regexp *regexp_t;
332 regexp. */
365 correct distributions of units to automata in a regexp. */
405 an regexp definition. */
441 regexp_t regexp;
446 regexp. */
458 regexp_t regexp;
472 /* The following field is the insn regexp transformed that
473 the regexp has not optional regexp, repetition regexp, and an
475 corresponding regexp) and all alternations are the topest level
476 of the regexp. The value can be NULL only if it is special
559 regexp_t regexp;
579 struct regexp
593 } regexp;
992 (({ struct regexp *const _regexp = (r); \
996 &(_regexp)->regexp.unit; }))
999 (({ struct regexp *const _regexp = (r); \
1003 &(_regexp)->regexp.reserv; }))
1006 (({ struct regexp *const _regexp = (r); \
1010 &(_regexp)->regexp.sequence; }))
1013 (({ struct regexp *const _regexp = (r); \
1017 &(_regexp)->regexp.repeat; }))
1020 (({ struct regexp *const _regexp = (r); \
1024 &(_regexp)->regexp.allof; }))
1027 (({ struct regexp *const _regexp = (r); \
1031 &(_regexp)->regexp.oneof; }))
1039 /* Return string representation of regexp mode MODE. */
1064 /* The function prints message about unexpected regexp and finish the
1089 #define REGEXP_UNIT(r) (&(r)->regexp.unit)
1090 #define REGEXP_RESERV(r) (&(r)->regexp.reserv)
1091 #define REGEXP_SEQUENCE(r) (&(r)->regexp.sequence)
1092 #define REGEXP_REPEAT(r) (&(r)->regexp.repeat)
1093 #define REGEXP_ALLOF(r) (&(r)->regexp.allof)
1094 #define REGEXP_ONEOF(r) (&(r)->regexp.oneof)
1541 regexp_t regexp;
1553 regexp = gen_regexp_sequence (dstr);
1557 regexp = create_node (sizeof (struct decl));
1558 regexp->mode = rm_nothing;
1562 regexp = create_node (sizeof (struct decl));
1563 regexp->mode = rm_unit;
1564 REGEXP_UNIT (regexp)->name = str;
1566 return regexp;
1573 regexp_t regexp;
1584 regexp = gen_regexp_el (repeat_vect [0]);
1587 repeat = create_node (sizeof (struct regexp));
1589 REGEXP_REPEAT (repeat)->regexp = regexp;
1594 regexp = repeat;
1596 return regexp;
1616 allof = create_node (sizeof (struct regexp)
1642 oneof = create_node (sizeof (struct regexp)
1666 sequence = create_node (sizeof (struct regexp)
1701 DECL_RESERV (decl)->regexp = gen_regexp (XSTR (def, 1));
1722 DECL_INSN_RESERV (decl)->regexp = gen_regexp (XSTR (def, 3));
2651 /* The following recursive function processes all regexp in order to
2657 process_regexp (regexp_t regexp)
2663 switch (regexp->mode)
2666 decl_in_table = find_decl (REGEXP_UNIT (regexp)->name);
2669 REGEXP_UNIT (regexp)->name);
2675 REGEXP_UNIT (regexp)->unit_decl = DECL_UNIT (decl_in_table);
2680 new_regexp = create_node (sizeof (struct regexp));
2682 new_regexp->pos = regexp->pos;
2683 REGEXP_RESERV (new_regexp)->name = REGEXP_UNIT (regexp)->name;
2686 regexp = new_regexp;
2694 for (i = 0; i <REGEXP_SEQUENCE (regexp)->regexps_num; i++)
2695 REGEXP_SEQUENCE (regexp)->regexps [i]
2696 = process_regexp (REGEXP_SEQUENCE (regexp)->regexps [i]);
2699 for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
2700 REGEXP_ALLOF (regexp)->regexps [i]
2701 = process_regexp (REGEXP_ALLOF (regexp)->regexps [i]);
2704 for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++)
2705 REGEXP_ONEOF (regexp)->regexps [i]
2706 = process_regexp (REGEXP_ONEOF (regexp)->regexps [i]);
2709 REGEXP_REPEAT (regexp)->regexp
2710 = process_regexp (REGEXP_REPEAT (regexp)->regexp);
2717 return regexp;
2720 /* The following function processes regexp of define_reservation and
2733 DECL_RESERV (decl)->regexp
2734 = process_regexp (DECL_RESERV (decl)->regexp);
2736 DECL_INSN_RESERV (decl)->regexp
2737 = process_regexp (DECL_INSN_RESERV (decl)->regexp);
2776 contains given decl or reservations in given regexp refers for
2779 loop_in_regexp (regexp_t regexp, decl_t start_decl)
2783 if (regexp == NULL)
2785 switch (regexp->mode)
2792 && REGEXP_RESERV (regexp)->reserv_decl == DECL_RESERV (start_decl))
2794 else if (REGEXP_RESERV (regexp)->reserv_decl->loop_pass_num
2800 REGEXP_RESERV (regexp)->reserv_decl->loop_pass_num
2802 return loop_in_regexp (REGEXP_RESERV (regexp)->reserv_decl->regexp,
2807 for (i = 0; i <REGEXP_SEQUENCE (regexp)->regexps_num; i++)
2808 if (loop_in_regexp (REGEXP_SEQUENCE (regexp)->regexps [i], start_decl))
2813 for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
2814 if (loop_in_regexp (REGEXP_ALLOF (regexp)->regexps [i], start_decl))
2819 for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++)
2820 if (loop_in_regexp (REGEXP_ONEOF (regexp)->regexps [i], start_decl))
2825 return loop_in_regexp (REGEXP_REPEAT (regexp)->regexp, start_decl);
2857 if (loop_in_regexp (DECL_RESERV (decl)->regexp, decl))
2859 gcc_assert (DECL_RESERV (decl)->regexp);
2870 process_regexp_cycles (regexp_t regexp, int max_start_cycle,
2876 switch (regexp->mode)
2879 if (REGEXP_UNIT (regexp)->unit_decl->max_occ_cycle_num < max_start_cycle)
2880 REGEXP_UNIT (regexp)->unit_decl->max_occ_cycle_num = max_start_cycle;
2881 if (REGEXP_UNIT (regexp)->unit_decl->min_occ_cycle_num > min_start_cycle
2882 || REGEXP_UNIT (regexp)->unit_decl->min_occ_cycle_num == -1)
2883 REGEXP_UNIT (regexp)->unit_decl->min_occ_cycle_num = min_start_cycle;
2889 process_regexp_cycles (REGEXP_RESERV (regexp)->reserv_decl->regexp,
2895 for (i = 0; i < REGEXP_REPEAT (regexp)->repeat_num; i++)
2897 process_regexp_cycles (REGEXP_REPEAT (regexp)->regexp,
2906 for (i = 0; i <REGEXP_SEQUENCE (regexp)->regexps_num; i++)
2908 process_regexp_cycles (REGEXP_SEQUENCE (regexp)->regexps [i],
2921 for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
2923 process_regexp_cycles (REGEXP_ALLOF (regexp)->regexps [i],
2941 for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++)
2943 process_regexp_cycles (REGEXP_ONEOF (regexp)->regexps [i],
2982 process_regexp_cycles (DECL_INSN_RESERV (decl)->regexp, 0, 0,
3127 DECL_INSN_RESERV (advance_cycle_insn_decl)->regexp = NULL;
4379 copy_insn_regexp (regexp_t regexp)
4384 switch (regexp->mode)
4387 result = copy_insn_regexp (REGEXP_RESERV (regexp)->reserv_decl->regexp);
4391 result = copy_node (regexp, sizeof (struct regexp));
4395 result = copy_node (regexp, sizeof (struct regexp));
4396 REGEXP_REPEAT (result)->regexp
4397 = copy_insn_regexp (REGEXP_REPEAT (regexp)->regexp);
4401 result = copy_node (regexp,
4402 sizeof (struct regexp) + sizeof (regexp_t)
4403 * (REGEXP_SEQUENCE (regexp)->regexps_num - 1));
4404 for (i = 0; i <REGEXP_SEQUENCE (regexp)->regexps_num; i++)
4406 = copy_insn_regexp (REGEXP_SEQUENCE (regexp)->regexps [i]);
4410 result = copy_node (regexp,
4411 sizeof (struct regexp) + sizeof (regexp_t)
4412 * (REGEXP_ALLOF (regexp)->regexps_num - 1));
4413 for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
4415 = copy_insn_regexp (REGEXP_ALLOF (regexp)->regexps [i]);
4419 result = copy_node (regexp,
4420 sizeof (struct regexp) + sizeof (regexp_t)
4421 * (REGEXP_ONEOF (regexp)->regexps_num - 1));
4422 for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++)
4424 = copy_insn_regexp (REGEXP_ONEOF (regexp)->regexps [i]);
4428 result = copy_node (regexp, sizeof (struct regexp));
4444 transform_1 (regexp_t regexp)
4451 if (regexp->mode == rm_repeat)
4453 repeat_num = REGEXP_REPEAT (regexp)->repeat_num;
4455 operand = REGEXP_REPEAT (regexp)->regexp;
4456 pos = regexp->mode;
4457 regexp = create_node (sizeof (struct regexp) + sizeof (regexp_t)
4459 regexp->mode = rm_sequence;
4460 regexp->pos = pos;
4461 REGEXP_SEQUENCE (regexp)->regexps_num = repeat_num;
4463 REGEXP_SEQUENCE (regexp)->regexps [i] = copy_insn_regexp (operand);
4466 return regexp;
4474 transform_2 (regexp_t regexp)
4476 if (regexp->mode == rm_sequence)
4483 for (i = 0; i < REGEXP_SEQUENCE (regexp)->regexps_num; i++)
4484 if (REGEXP_SEQUENCE (regexp)->regexps [i]->mode == rm_sequence)
4487 sequence = REGEXP_SEQUENCE (regexp)->regexps [i];
4490 if (i < REGEXP_SEQUENCE (regexp)->regexps_num)
4493 && REGEXP_SEQUENCE (regexp)->regexps_num > 1);
4494 result = create_node (sizeof (struct regexp)
4496 * (REGEXP_SEQUENCE (regexp)->regexps_num
4500 result->pos = regexp->pos;
4502 = (REGEXP_SEQUENCE (regexp)->regexps_num
4504 for (i = 0; i < REGEXP_SEQUENCE (regexp)->regexps_num; i++)
4507 = copy_insn_regexp (REGEXP_SEQUENCE (regexp)->regexps [i]);
4511 = copy_insn_regexp (REGEXP_SEQUENCE (regexp)->regexps [i]);
4517 regexp = result;
4520 else if (regexp->mode == rm_allof)
4527 for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
4528 if (REGEXP_ALLOF (regexp)->regexps [i]->mode == rm_allof)
4531 allof = REGEXP_ALLOF (regexp)->regexps [i];
4534 if (i < REGEXP_ALLOF (regexp)->regexps_num)
4537 && REGEXP_ALLOF (regexp)->regexps_num > 1);
4538 result = create_node (sizeof (struct regexp)
4540 * (REGEXP_ALLOF (regexp)->regexps_num
4543 result->pos = regexp->pos;
4545 = (REGEXP_ALLOF (regexp)->regexps_num
4547 for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
4550 = copy_insn_regexp (REGEXP_ALLOF (regexp)->regexps [i]);
4554 = copy_insn_regexp (REGEXP_ALLOF (regexp)->regexps [i]);
4560 regexp = result;
4563 else if (regexp->mode == rm_oneof)
4570 for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++)
4571 if (REGEXP_ONEOF (regexp)->regexps [i]->mode == rm_oneof)
4574 oneof = REGEXP_ONEOF (regexp)->regexps [i];
4577 if (i < REGEXP_ONEOF (regexp)->regexps_num)
4580 && REGEXP_ONEOF (regexp)->regexps_num > 1);
4581 result = create_node (sizeof (struct regexp)
4583 * (REGEXP_ONEOF (regexp)->regexps_num
4586 result->pos = regexp->pos;
4588 = (REGEXP_ONEOF (regexp)->regexps_num
4590 for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++)
4593 = copy_insn_regexp (REGEXP_ONEOF (regexp)->regexps [i]);
4597 = copy_insn_regexp (REGEXP_ONEOF (regexp)->regexps [i]);
4603 regexp = result;
4606 return regexp;
4615 transform_3 (regexp_t regexp)
4617 if (regexp->mode == rm_sequence)
4625 for (i = 0; i <REGEXP_SEQUENCE (regexp)->regexps_num; i++)
4626 if (REGEXP_SEQUENCE (regexp)->regexps [i]->mode == rm_oneof)
4629 oneof = REGEXP_SEQUENCE (regexp)->regexps [i];
4632 if (i < REGEXP_SEQUENCE (regexp)->regexps_num)
4635 && REGEXP_SEQUENCE (regexp)->regexps_num > 1);
4636 result = create_node (sizeof (struct regexp)
4640 result->pos = regexp->pos;
4646 = create_node (sizeof (struct regexp)
4648 * (REGEXP_SEQUENCE (regexp)->regexps_num - 1));
4650 sequence->pos = regexp->pos;
4652 = REGEXP_SEQUENCE (regexp)->regexps_num;
4657 = copy_insn_regexp (REGEXP_SEQUENCE (regexp)->regexps [j]);
4663 regexp = result;
4666 else if (regexp->mode == rm_allof)
4677 for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
4678 if (REGEXP_ALLOF (regexp)->regexps [i]->mode == rm_oneof)
4681 oneof = REGEXP_ALLOF (regexp)->regexps [i];
4684 if (i < REGEXP_ALLOF (regexp)->regexps_num)
4687 && REGEXP_ALLOF (regexp)->regexps_num > 1);
4688 result = create_node (sizeof (struct regexp)
4692 result->pos = regexp->pos;
4698 = create_node (sizeof (struct regexp)
4700 * (REGEXP_ALLOF (regexp)->regexps_num - 1));
4702 allof->pos = regexp->pos;
4704 = REGEXP_ALLOF (regexp)->regexps_num;
4709 = copy_insn_regexp (REGEXP_ALLOF (regexp)->regexps [j]);
4715 regexp = result;
4718 if (regexp->mode == rm_allof)
4719 for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
4721 switch (REGEXP_ALLOF (regexp)->regexps [i]->mode)
4724 seq = REGEXP_ALLOF (regexp)->regexps [i];
4742 && REGEXP_ALLOF (regexp)->regexps_num > 1);
4743 result = create_node (sizeof (struct regexp)
4746 result->pos = regexp->pos;
4751 for (j = 0; j < REGEXP_ALLOF (regexp)->regexps_num; j++)
4752 switch (REGEXP_ALLOF (regexp)->regexps [j]->mode)
4755 if (i < (REGEXP_SEQUENCE (REGEXP_ALLOF (regexp)
4759 = (REGEXP_SEQUENCE (REGEXP_ALLOF (regexp)
4769 allof_op = REGEXP_ALLOF (regexp)->regexps [j];
4781 allof = create_node (sizeof (struct regexp)
4785 allof->pos = regexp->pos;
4789 for (j = 0; j < REGEXP_ALLOF (regexp)->regexps_num; j++)
4790 if (REGEXP_ALLOF (regexp)->regexps [j]->mode == rm_sequence
4792 (REGEXP_SEQUENCE (REGEXP_ALLOF (regexp)
4795 allof_op = (REGEXP_SEQUENCE (REGEXP_ALLOF (regexp)
4803 && (REGEXP_ALLOF (regexp)->regexps [j]->mode
4805 || (REGEXP_ALLOF (regexp)->regexps [j]->mode
4808 allof_op = REGEXP_ALLOF (regexp)->regexps [j];
4816 regexp = result;
4819 return regexp;
4825 regexp_transform_func (regexp_t regexp, regexp_t (*func) (regexp_t regexp))
4829 switch (regexp->mode)
4832 for (i = 0; i < REGEXP_SEQUENCE (regexp)->regexps_num; i++)
4833 REGEXP_SEQUENCE (regexp)->regexps [i]
4834 = regexp_transform_func (REGEXP_SEQUENCE (regexp)->regexps [i],
4839 for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
4840 REGEXP_ALLOF (regexp)->regexps [i]
4841 = regexp_transform_func (REGEXP_ALLOF (regexp)->regexps [i], func);
4845 for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++)
4846 REGEXP_ONEOF (regexp)->regexps [i]
4847 = regexp_transform_func (REGEXP_ONEOF (regexp)->regexps [i], func);
4851 REGEXP_REPEAT (regexp)->regexp
4852 = regexp_transform_func (REGEXP_REPEAT (regexp)->regexp, func);
4862 return (*func) (regexp);
4868 transform_regexp (regexp_t regexp)
4870 regexp = regexp_transform_func (regexp, transform_1);
4874 regexp = regexp_transform_func (regexp, transform_2);
4875 regexp = regexp_transform_func (regexp, transform_3);
4878 return regexp;
4899 (DECL_INSN_RESERV (decl)->regexp));
4933 index equals to the cycle * number of all alternatives in the regexp
4941 store_alt_unit_usage (regexp_t regexp, regexp_t unit, int cycle,
4949 gcc_assert (regexp && regexp->mode == rm_oneof
4950 && alt_num < REGEXP_ONEOF (regexp)->regexps_num);
4953 length = (cycle + 1) * REGEXP_ONEOF (regexp)->regexps_num;
4961 index = cycle * REGEXP_ONEOF (regexp)->regexps_num + alt_num;
4971 regexp_t regexp)
4977 if (regexp == NULL || regexp->mode != rm_oneof)
4979 /* Store all unit usages in the regexp: */
4983 for (i = REGEXP_ONEOF (regexp)->regexps_num - 1; i >= 0; i--)
4985 seq = REGEXP_ONEOF (regexp)->regexps [i];
4999 store_alt_unit_usage (regexp, unit, j, i);
5006 store_alt_unit_usage (regexp, allof, j, i);
5025 store_alt_unit_usage (regexp, unit, 0, i);
5038 store_alt_unit_usage (regexp, seq, 0, i);
5051 cycle = i / REGEXP_ONEOF (regexp)->regexps_num;
5058 for (k = cycle * REGEXP_ONEOF (regexp)->regexps_num;
5060 && k == cycle * REGEXP_ONEOF (regexp)->regexps_num;
5076 && k == cycle * REGEXP_ONEOF (regexp)->regexps_num)
5135 process_seq_for_forming_states (regexp_t regexp, automaton_t automaton,
5140 if (regexp == NULL)
5143 switch (regexp->mode)
5146 if (REGEXP_UNIT (regexp)->unit_decl->corresponding_automaton_num
5149 REGEXP_UNIT (regexp)->unit_decl->unit_num);
5153 for (i = 0; i < REGEXP_SEQUENCE (regexp)->regexps_num; i++)
5156 (REGEXP_SEQUENCE (regexp)->regexps [i], automaton, curr_cycle) + 1;
5164 for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
5166 cycle = process_seq_for_forming_states (REGEXP_ALLOF (regexp)
5209 process_alts_for_forming_states (regexp_t regexp, automaton_t automaton,
5214 if (regexp->mode != rm_oneof)
5224 (void) process_seq_for_forming_states (regexp, automaton, 0);
5233 for (i = REGEXP_ONEOF (regexp)->regexps_num - 1; i >= 0; i--)
5234 process_alts_for_forming_states (REGEXP_ONEOF (regexp)->regexps [i],
6572 regexp. The representation is formed on IR obstack. So you should
6576 /* This recursive function forms string representation of regexp
6579 form_regexp (regexp_t regexp)
6583 switch (regexp->mode)
6587 const char *name = (regexp->mode == rm_unit
6588 ? REGEXP_UNIT (regexp)->name
6589 : REGEXP_RESERV (regexp)->name);
6596 for (i = 0; i < REGEXP_SEQUENCE (regexp)->regexps_num; i++)
6600 form_regexp (REGEXP_SEQUENCE (regexp)->regexps [i]);
6606 for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++)
6610 if (REGEXP_ALLOF (regexp)->regexps[i]->mode == rm_sequence
6611 || REGEXP_ALLOF (regexp)->regexps[i]->mode == rm_oneof)
6613 form_regexp (REGEXP_ALLOF (regexp)->regexps [i]);
6614 if (REGEXP_ALLOF (regexp)->regexps[i]->mode == rm_sequence
6615 || REGEXP_ALLOF (regexp)->regexps[i]->mode == rm_oneof)
6622 for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++)
6626 if (REGEXP_ONEOF (regexp)->regexps[i]->mode == rm_sequence)
6628 form_regexp (REGEXP_ONEOF (regexp)->regexps [i]);
6629 if (REGEXP_ONEOF (regexp)->regexps[i]->mode == rm_sequence)
6638 if (REGEXP_REPEAT (regexp)->regexp->mode == rm_sequence
6639 || REGEXP_REPEAT (regexp)->regexp->mode == rm_allof
6640 || REGEXP_REPEAT (regexp)->regexp->mode == rm_oneof)
6642 form_regexp (REGEXP_REPEAT (regexp)->regexp);
6643 if (REGEXP_REPEAT (regexp)->regexp->mode == rm_sequence
6644 || REGEXP_REPEAT (regexp)->regexp->mode == rm_allof
6645 || REGEXP_REPEAT (regexp)->regexp->mode == rm_oneof)
6647 sprintf (digits, "*%d", REGEXP_REPEAT (regexp)->repeat_num);
6664 regexp_representation (regexp_t regexp)
6666 form_regexp (regexp);
6672 representation of regexp. */
8289 regexp_representation (DECL_INSN_RESERV (decl)->regexp));
8478 output_regexp (regexp_t regexp)
8480 fprintf (output_description_file, "%s", regexp_representation (regexp));
8575 output_regexp (DECL_RESERV (decl)->regexp);
8585 output_regexp (DECL_INSN_RESERV (decl)->regexp);