From 4005971c079cc76629a3646e817e7fac34968df1 Mon Sep 17 00:00:00 2001 From: Vladimir Makarov Date: Wed, 19 Jun 2002 22:37:30 +0000 Subject: [PATCH] genautomata.c (DECL_UNIT, [...]): New macros with checking and without it. 2002-06-19 Vladimir Makarov * genautomata.c (DECL_UNIT, DECL_BYPASS, DECL_AUTOMATON, DECL_EXCL, DECL_PRESENCE, DECL_ABSENCE, DECL_RESERV, DECL_INSN_RESERV, REGEXP_UNIT, REGEXP_RESERV, REGEXP_SEQUENCE, REGEXP_REPEAT, REGEXP_ALLOF, REGEXP_ONEOF): New macros with checking and without it. (decl_name, decl_mode_check_failed, regexp_name, regexp_mode_check_failed): New functions. (gen_cpu_unit, gen_query_cpu_unit, gen_bypass, gen_excl_set, gen_presence_set, gen_absence_set, gen_automaton, gen_regexp_repeat, gen_regexp_allof, gen_regexp_oneof, gen_regexp_sequence, gen_reserv, gen_insn_reserv, automaton_decl_hash, automaton_decl_eq_p): Use the macros. (find_automaton_decl): Ditto. Set up mode of work_automaton_decl. (insn_decl_hash, insn_decl_hash, insn_decl_eq_p): Use the macros. (find_insn_decl): Ditto. Set up mode of work_insn_decl. (decl_hash, decl_eq_p): Use the macros. (find_decl): Ditto. Set up mode of work_decl. (process_excls, process_presence_absence, process_decls, check_automaton_usage, process_regexp, process_regexp_decls, check_usage, loop_in_regexp, check_loops_in_regexps, process_regexp_cycles, add_advance_cycle_insn_decl, initiate_states, initiate_excl_sets, initiate_presence_absence_sets, copy_insn_regexp, transform_1, transform_2): Use the macros. (transform_3): Ditto. Check mode before making transformations of ALLOF. (regexp_transform_func, transform_insn_regexps, process_unit_to_form_the_same_automaton_unit_lists, form_the_same_automaton_unit_lists_from_regexp, form_the_same_automaton_unit_lists, process_seq_for_forming_states, process_alts_for_forming_states, create_alt_states, form_ainsn_with_same_reservs, make_automaton, form_arcs_marked_by_insn, NDFA_to_DFA, set_new_cycle_flags, estimate_one_automaton_bound, compare_max_occ_cycle_nums, units_to_automata_heuristic_distr, create_ainsns, units_to_automata_distr, create_automata): Use the macros. (form_regexp): Ditto. Fix typo in access to fields of ALLOF. (longest_path_length, min_issue_delay_pass_states, output_dead_lock_vect, output_tables, output_insn_code_cases, output_internal_insn_latency_func, output_print_reservation_func, output_description, output_automaton_units, generate): Use the macros. (make_insn_alts_attr): Ditto. Check case when there are not alternatives in the reservation. (make_internal_dfa_insn_code_attr, make_default_insn_latency_attr, make_bypass_attr, form_important_insn_automata_lists, expand_automata): Use the macros. From-SVN: r54802 --- gcc/ChangeLog | 50 ++ gcc/genautomata.c | 1269 +++++++++++++++++++++++++++------------------ 2 files changed, 810 insertions(+), 509 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 70782be6825..9de02b90124 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,53 @@ +2002-06-19 Vladimir Makarov + + * genautomata.c (DECL_UNIT, DECL_BYPASS, DECL_AUTOMATON, + DECL_EXCL, DECL_PRESENCE, DECL_ABSENCE, DECL_RESERV, + DECL_INSN_RESERV, REGEXP_UNIT, REGEXP_RESERV, REGEXP_SEQUENCE, + REGEXP_REPEAT, REGEXP_ALLOF, REGEXP_ONEOF): New macros with + checking and without it. + (decl_name, decl_mode_check_failed, regexp_name, + regexp_mode_check_failed): New functions. + (gen_cpu_unit, gen_query_cpu_unit, gen_bypass, gen_excl_set, + gen_presence_set, gen_absence_set, gen_automaton, + gen_regexp_repeat, gen_regexp_allof, gen_regexp_oneof, + gen_regexp_sequence, gen_reserv, gen_insn_reserv, + automaton_decl_hash, automaton_decl_eq_p): Use the macros. + (find_automaton_decl): Ditto. Set up mode of work_automaton_decl. + (insn_decl_hash, insn_decl_hash, insn_decl_eq_p): Use the macros. + (find_insn_decl): Ditto. Set up mode of work_insn_decl. + (decl_hash, decl_eq_p): Use the macros. + (find_decl): Ditto. Set up mode of work_decl. + (process_excls, process_presence_absence, process_decls, + check_automaton_usage, process_regexp, process_regexp_decls, + check_usage, loop_in_regexp, check_loops_in_regexps, + process_regexp_cycles, add_advance_cycle_insn_decl, + initiate_states, initiate_excl_sets, + initiate_presence_absence_sets, copy_insn_regexp, transform_1, + transform_2): Use the macros. + (transform_3): Ditto. Check mode before making transformations of + ALLOF. + (regexp_transform_func, transform_insn_regexps, + process_unit_to_form_the_same_automaton_unit_lists, + form_the_same_automaton_unit_lists_from_regexp, + form_the_same_automaton_unit_lists, + process_seq_for_forming_states, process_alts_for_forming_states, + create_alt_states, form_ainsn_with_same_reservs, make_automaton, + form_arcs_marked_by_insn, NDFA_to_DFA, set_new_cycle_flags, + estimate_one_automaton_bound, compare_max_occ_cycle_nums, + units_to_automata_heuristic_distr, create_ainsns, + units_to_automata_distr, create_automata): Use the macros. + (form_regexp): Ditto. Fix typo in access to fields of ALLOF. + (longest_path_length, min_issue_delay_pass_states, + output_dead_lock_vect, output_tables, output_insn_code_cases, + output_internal_insn_latency_func, output_print_reservation_func, + output_description, output_automaton_units, generate): Use the + macros. + (make_insn_alts_attr): Ditto. Check case when there are not + alternatives in the reservation. + (make_internal_dfa_insn_code_attr, make_default_insn_latency_attr, + make_bypass_attr, form_important_insn_automata_lists, + expand_automata): Use the macros. + 2002-06-20 Tim Josling * Makefile.in: Clean up code to check for misspecified languages diff --git a/gcc/genautomata.c b/gcc/genautomata.c index d32621a03a8..6eec55f4f9d 100644 --- a/gcc/genautomata.c +++ b/gcc/genautomata.c @@ -1238,6 +1238,228 @@ struct state_ainsn_table int min_base_vect_el_value, max_base_vect_el_value; }; +/* Macros to access members of unions. Use only them for access to + union members of declarations and regexps. */ + +#if defined ENABLE_CHECKING && (GCC_VERSION >= 2007) + +#define DECL_UNIT(d) __extension__ \ +(({ struct decl *_decl = (d); \ + if (_decl->mode != dm_unit) \ + decl_mode_check_failed (_decl->mode, "dm_unit", \ + __FILE__, __LINE__, __FUNCTION__); \ + &(_decl)->decl.unit; })) + +#define DECL_BYPASS(d) __extension__ \ +(({ struct decl *_decl = (d); \ + if (_decl->mode != dm_bypass) \ + decl_mode_check_failed (_decl->mode, "dm_bypass", \ + __FILE__, __LINE__, __FUNCTION__); \ + &(_decl)->decl.bypass; })) + +#define DECL_AUTOMATON(d) __extension__ \ +(({ struct decl *_decl = (d); \ + if (_decl->mode != dm_automaton) \ + decl_mode_check_failed (_decl->mode, "dm_automaton", \ + __FILE__, __LINE__, __FUNCTION__); \ + &(_decl)->decl.automaton; })) + +#define DECL_EXCL(d) __extension__ \ +(({ struct decl *_decl = (d); \ + if (_decl->mode != dm_excl) \ + decl_mode_check_failed (_decl->mode, "dm_excl", \ + __FILE__, __LINE__, __FUNCTION__); \ + &(_decl)->decl.excl; })) + +#define DECL_PRESENCE(d) __extension__ \ +(({ struct decl *_decl = (d); \ + if (_decl->mode != dm_presence) \ + decl_mode_check_failed (_decl->mode, "dm_presence", \ + __FILE__, __LINE__, __FUNCTION__); \ + &(_decl)->decl.presence; })) + +#define DECL_ABSENCE(d) __extension__ \ +(({ struct decl *_decl = (d); \ + if (_decl->mode != dm_absence) \ + decl_mode_check_failed (_decl->mode, "dm_absence", \ + __FILE__, __LINE__, __FUNCTION__); \ + &(_decl)->decl.absence; })) + +#define DECL_RESERV(d) __extension__ \ +(({ struct decl *_decl = (d); \ + if (_decl->mode != dm_reserv) \ + decl_mode_check_failed (_decl->mode, "dm_reserv", \ + __FILE__, __LINE__, __FUNCTION__); \ + &(_decl)->decl.reserv; })) + +#define DECL_INSN_RESERV(d) __extension__ \ +(({ struct decl *_decl = (d); \ + if (_decl->mode != dm_insn_reserv) \ + decl_mode_check_failed (_decl->mode, "dm_insn_reserv", \ + __FILE__, __LINE__, __FUNCTION__); \ + &(_decl)->decl.insn_reserv; })) + +static const char *decl_name PARAMS ((enum decl_mode)); +static void decl_mode_check_failed PARAMS ((enum decl_mode, const char *, + const char *, int, const char *)); + +/* Return string representation of declaration mode MODE. */ +static const char * +decl_name (mode) + enum decl_mode mode; +{ + static char str [100]; + + if (mode == dm_unit) + return "dm_unit"; + else if (mode == dm_bypass) + return "dm_bypass"; + else if (mode == dm_automaton) + return "dm_automaton"; + else if (mode == dm_excl) + return "dm_excl"; + else if (mode == dm_presence) + return "dm_presence"; + else if (mode == dm_absence) + return "dm_absence"; + else if (mode == dm_reserv) + return "dm_reserv"; + else if (mode == dm_insn_reserv) + return "dm_insn_reserv"; + else + sprintf (str, "unknown (%d)", (int) mode); + return str; +} + +/* The function prints message about unexpected declaration and finish + the program. */ +static void +decl_mode_check_failed (mode, expected_mode_str, file, line, func) + enum decl_mode mode; + const char *expected_mode_str; + const char *file; + int line; + const char *func; +{ + fprintf + (stderr, + "\n%s: %d: error in %s: DECL check: expected decl %s, have %s\n", + file, line, func, expected_mode_str, decl_name (mode)); + exit (1); +} + + +#define REGEXP_UNIT(r) __extension__ \ +(({ struct regexp *_regexp = (r); \ + if (_regexp->mode != rm_unit) \ + regexp_mode_check_failed (_regexp->mode, "rm_unit", \ + __FILE__, __LINE__, __FUNCTION__); \ + &(_regexp)->regexp.unit; })) + +#define REGEXP_RESERV(r) __extension__ \ +(({ struct regexp *_regexp = (r); \ + if (_regexp->mode != rm_reserv) \ + regexp_mode_check_failed (_regexp->mode, "rm_reserv", \ + __FILE__, __LINE__, __FUNCTION__); \ + &(_regexp)->regexp.reserv; })) + +#define REGEXP_SEQUENCE(r) __extension__ \ +(({ struct regexp *_regexp = (r); \ + if (_regexp->mode != rm_sequence) \ + regexp_mode_check_failed (_regexp->mode, "rm_sequence", \ + __FILE__, __LINE__, __FUNCTION__); \ + &(_regexp)->regexp.sequence; })) + +#define REGEXP_REPEAT(r) __extension__ \ +(({ struct regexp *_regexp = (r); \ + if (_regexp->mode != rm_repeat) \ + regexp_mode_check_failed (_regexp->mode, "rm_repeat", \ + __FILE__, __LINE__, __FUNCTION__); \ + &(_regexp)->regexp.repeat; })) + +#define REGEXP_ALLOF(r) __extension__ \ +(({ struct regexp *_regexp = (r); \ + if (_regexp->mode != rm_allof) \ + regexp_mode_check_failed (_regexp->mode, "rm_allof", \ + __FILE__, __LINE__, __FUNCTION__); \ + &(_regexp)->regexp.allof; })) + +#define REGEXP_ONEOF(r) __extension__ \ +(({ struct regexp *_regexp = (r); \ + if (_regexp->mode != rm_oneof) \ + regexp_mode_check_failed (_regexp->mode, "rm_oneof", \ + __FILE__, __LINE__, __FUNCTION__); \ + &(_regexp)->regexp.oneof; })) + +static const char *regexp_name PARAMS ((enum regexp_mode)); +static void regexp_mode_check_failed PARAMS ((enum regexp_mode, const char *, + const char *, int, + const char *)); + + +/* Return string representation of regexp mode MODE. */ +static const char * +regexp_name (mode) + enum regexp_mode mode; +{ + static char str [100]; + + if (mode == rm_unit) + return "rm_unit"; + else if (mode == rm_reserv) + return "rm_reserv"; + else if (mode == rm_nothing) + return "rm_nothing"; + else if (mode == rm_sequence) + return "rm_sequence"; + else if (mode == rm_repeat) + return "rm_repeat"; + else if (mode == rm_allof) + return "rm_allof"; + else if (mode == rm_oneof) + return "rm_oneof"; + else + sprintf (str, "unknown (%d)", (int) mode); + return str; +} + +/* The function prints message about unexpected regexp and finish the + program. */ +static void +regexp_mode_check_failed (mode, expected_mode_str, file, line, func) + enum regexp_mode mode; + const char *expected_mode_str; + const char *file; + int line; + const char *func; +{ + fprintf + (stderr, + "\n%s: %d: error in %s: REGEXP check: expected decl %s, have %s\n", + file, line, func, expected_mode_str, regexp_name (mode)); + exit (1); +} + +#else /* #if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007) */ + +#define DECL_UNIT(d) (&(d)->decl.unit) +#define DECL_BYPASS(d) (&(d)->decl.bypass) +#define DECL_AUTOMATON(d) (&(d)->decl.automaton) +#define DECL_EXCL(d) (&(d)->decl.excl) +#define DECL_PRESENCE(d) (&(d)->decl.presence) +#define DECL_ABSENCE(d) (&(d)->decl.absence) +#define DECL_RESERV(d) (&(d)->decl.reserv) +#define DECL_INSN_RESERV(d) (&(d)->decl.insn_reserv) + +#define REGEXP_UNIT(r) (&(r)->regexp.unit) +#define REGEXP_RESERV(r) (&(r)->regexp.reserv) +#define REGEXP_SEQUENCE(r) (&(r)->regexp.sequence) +#define REGEXP_REPEAT(r) (&(r)->regexp.repeat) +#define REGEXP_ALLOF(r) (&(r)->regexp.allof) +#define REGEXP_ONEOF(r) (&(r)->regexp.oneof) + +#endif /* #if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007) */ + /* Create IR structure (node). */ static void * create_node (size) @@ -1412,9 +1634,9 @@ gen_cpu_unit (def) decl = create_node (sizeof (struct decl)); decl->mode = dm_unit; decl->pos = 0; - decl->decl.unit.name = check_name (str_cpu_units [i], decl->pos); - decl->decl.unit.automaton_name = (char *) XSTR (def, 1); - decl->decl.unit.query_p = 0; + DECL_UNIT (decl)->name = check_name (str_cpu_units [i], decl->pos); + DECL_UNIT (decl)->automaton_name = (char *) XSTR (def, 1); + DECL_UNIT (decl)->query_p = 0; VLA_PTR_ADD (decls, decl); num_dfa_decls++; } @@ -1441,9 +1663,9 @@ gen_query_cpu_unit (def) decl = create_node (sizeof (struct decl)); decl->mode = dm_unit; decl->pos = 0; - decl->decl.unit.name = check_name (str_cpu_units [i], decl->pos); - decl->decl.unit.automaton_name = (char *) XSTR (def, 1); - decl->decl.unit.query_p = 1; + DECL_UNIT (decl)->name = check_name (str_cpu_units [i], decl->pos); + DECL_UNIT (decl)->automaton_name = (char *) XSTR (def, 1); + DECL_UNIT (decl)->query_p = 1; VLA_PTR_ADD (decls, decl); num_dfa_decls++; } @@ -1477,10 +1699,10 @@ gen_bypass (def) decl = create_node (sizeof (struct decl)); decl->mode = dm_bypass; decl->pos = 0; - decl->decl.bypass.latency = XINT (def, 0); - decl->decl.bypass.out_insn_name = out_insns [i]; - decl->decl.bypass.in_insn_name = in_insns [j]; - decl->decl.bypass.bypass_guard_name = (char *) XSTR (def, 3); + DECL_BYPASS (decl)->latency = XINT (def, 0); + DECL_BYPASS (decl)->out_insn_name = out_insns [i]; + DECL_BYPASS (decl)->in_insn_name = in_insns [j]; + DECL_BYPASS (decl)->bypass_guard_name = (char *) XSTR (def, 3); VLA_PTR_ADD (decls, decl); num_dfa_decls++; } @@ -1514,13 +1736,14 @@ gen_excl_set (def) decl = create_node (sizeof (struct decl) + (length - 1) * sizeof (char *)); decl->mode = dm_excl; decl->pos = 0; - decl->decl.excl.names_num = length; - decl->decl.excl.first_list_length = first_vect_length; + DECL_EXCL (decl)->names_num = length; + DECL_EXCL (decl)->first_list_length = first_vect_length; for (i = 0; i < length; i++) if (i < first_vect_length) - decl->decl.excl.names [i] = first_str_cpu_units [i]; + DECL_EXCL (decl)->names [i] = first_str_cpu_units [i]; else - decl->decl.excl.names [i] = second_str_cpu_units [i - first_vect_length]; + DECL_EXCL (decl)->names [i] + = second_str_cpu_units [i - first_vect_length]; VLA_PTR_ADD (decls, decl); num_dfa_decls++; } @@ -1553,13 +1776,13 @@ gen_presence_set (def) decl = create_node (sizeof (struct decl) + (length - 1) * sizeof (char *)); decl->mode = dm_presence; decl->pos = 0; - decl->decl.presence.names_num = length; - decl->decl.presence.first_list_length = first_vect_length; + DECL_PRESENCE (decl)->names_num = length; + DECL_PRESENCE (decl)->first_list_length = first_vect_length; for (i = 0; i < length; i++) if (i < first_vect_length) - decl->decl.presence.names [i] = first_str_cpu_units [i]; + DECL_PRESENCE (decl)->names [i] = first_str_cpu_units [i]; else - decl->decl.presence.names [i] + DECL_PRESENCE (decl)->names [i] = second_str_cpu_units [i - first_vect_length]; VLA_PTR_ADD (decls, decl); num_dfa_decls++; @@ -1593,13 +1816,13 @@ gen_absence_set (def) decl = create_node (sizeof (struct decl) + (length - 1) * sizeof (char *)); decl->mode = dm_absence; decl->pos = 0; - decl->decl.absence.names_num = length; - decl->decl.absence.first_list_length = first_vect_length; + DECL_ABSENCE (decl)->names_num = length; + DECL_ABSENCE (decl)->first_list_length = first_vect_length; for (i = 0; i < length; i++) if (i < first_vect_length) - decl->decl.absence.names [i] = first_str_cpu_units [i]; + DECL_ABSENCE (decl)->names [i] = first_str_cpu_units [i]; else - decl->decl.absence.names [i] + DECL_ABSENCE (decl)->names [i] = second_str_cpu_units [i - first_vect_length]; VLA_PTR_ADD (decls, decl); num_dfa_decls++; @@ -1627,7 +1850,7 @@ gen_automaton (def) decl = create_node (sizeof (struct decl)); decl->mode = dm_automaton; decl->pos = 0; - decl->decl.automaton.name = check_name (str_automata [i], decl->pos); + DECL_AUTOMATON (decl)->name = check_name (str_automata [i], decl->pos); VLA_PTR_ADD (decls, decl); num_dfa_decls++; } @@ -1687,7 +1910,7 @@ gen_regexp_el (str) { regexp = create_node (sizeof (struct decl)); regexp->mode = rm_unit; - regexp->regexp.unit.name = str; + REGEXP_UNIT (regexp)->name = str; } return regexp; } @@ -1713,9 +1936,9 @@ gen_regexp_repeat (str) { repeat = create_node (sizeof (struct regexp)); repeat->mode = rm_repeat; - repeat->regexp.repeat.regexp = regexp; - repeat->regexp.repeat.repeat_num = atoi (repeat_vect [i]); - if (repeat->regexp.repeat.repeat_num <= 1) + REGEXP_REPEAT (repeat)->regexp = regexp; + REGEXP_REPEAT (repeat)->repeat_num = atoi (repeat_vect [i]); + if (REGEXP_REPEAT (repeat)->repeat_num <= 1) fatal ("repetition `%s' <= 1 in reservation `%s'", str, reserv_str); regexp = repeat; @@ -1744,9 +1967,9 @@ gen_regexp_allof (str) allof = create_node (sizeof (struct regexp) + sizeof (regexp_t) * (els_num - 1)); allof->mode = rm_allof; - allof->regexp.allof.regexps_num = els_num; + REGEXP_ALLOF (allof)->regexps_num = els_num; for (i = 0; i < els_num; i++) - allof->regexp.allof.regexps [i] = gen_regexp_repeat (allof_vect [i]); + REGEXP_ALLOF (allof)->regexps [i] = gen_regexp_repeat (allof_vect [i]); return allof; } else @@ -1771,9 +1994,9 @@ gen_regexp_oneof (str) oneof = create_node (sizeof (struct regexp) + sizeof (regexp_t) * (els_num - 1)); oneof->mode = rm_oneof; - oneof->regexp.oneof.regexps_num = els_num; + REGEXP_ONEOF (oneof)->regexps_num = els_num; for (i = 0; i < els_num; i++) - oneof->regexp.oneof.regexps [i] = gen_regexp_allof (oneof_vect [i]); + REGEXP_ONEOF (oneof)->regexps [i] = gen_regexp_allof (oneof_vect [i]); return oneof; } else @@ -1796,9 +2019,9 @@ gen_regexp_sequence (str) sequence = create_node (sizeof (struct regexp) + sizeof (regexp_t) * (els_num - 1)); sequence->mode = rm_sequence; - sequence->regexp.sequence.regexps_num = els_num; + REGEXP_SEQUENCE (sequence)->regexps_num = els_num; for (i = 0; i < els_num; i++) - sequence->regexp.sequence.regexps [i] + REGEXP_SEQUENCE (sequence)->regexps [i] = gen_regexp_oneof (sequence_vect [i]); return sequence; } @@ -1829,8 +2052,8 @@ gen_reserv (def) decl = create_node (sizeof (struct decl)); decl->mode = dm_reserv; decl->pos = 0; - decl->decl.reserv.name = check_name ((char *) XSTR (def, 0), decl->pos); - decl->decl.reserv.regexp = gen_regexp ((char *) XSTR (def, 1)); + DECL_RESERV (decl)->name = check_name ((char *) XSTR (def, 0), decl->pos); + DECL_RESERV (decl)->regexp = gen_regexp ((char *) XSTR (def, 1)); VLA_PTR_ADD (decls, decl); num_dfa_decls++; } @@ -1849,10 +2072,11 @@ gen_insn_reserv (def) decl = create_node (sizeof (struct decl)); decl->mode = dm_insn_reserv; decl->pos = 0; - decl->decl.insn_reserv.name = check_name ((char *) XSTR (def, 0), decl->pos); - decl->decl.insn_reserv.default_latency = XINT (def, 1); - decl->decl.insn_reserv.condexp = XEXP (def, 2); - decl->decl.insn_reserv.regexp = gen_regexp ((char *) XSTR (def, 3)); + DECL_INSN_RESERV (decl)->name + = check_name ((char *) XSTR (def, 0), decl->pos); + DECL_INSN_RESERV (decl)->default_latency = XINT (def, 1); + DECL_INSN_RESERV (decl)->condexp = XEXP (def, 2); + DECL_INSN_RESERV (decl)->regexp = gen_regexp ((char *) XSTR (def, 3)); VLA_PTR_ADD (decls, decl); num_dfa_decls++; } @@ -1887,9 +2111,9 @@ automaton_decl_hash (automaton_decl) { const decl_t decl = (decl_t) automaton_decl; - if (decl->mode == dm_automaton && decl->decl.automaton.name == NULL) + if (decl->mode == dm_automaton && DECL_AUTOMATON (decl)->name == NULL) abort (); - return string_hash (decl->decl.automaton.name); + return string_hash (DECL_AUTOMATON (decl)->name); } /* The function tests automaton declarations on equality of their @@ -1904,10 +2128,11 @@ automaton_decl_eq_p (automaton_decl_1, automaton_decl_2) const decl_t decl1 = (decl_t) automaton_decl_1; const decl_t decl2 = (decl_t) automaton_decl_2; - if (decl1->mode != dm_automaton || decl1->decl.automaton.name == NULL - || decl2->mode != dm_automaton || decl2->decl.automaton.name == NULL) + if (decl1->mode != dm_automaton || DECL_AUTOMATON (decl1)->name == NULL + || decl2->mode != dm_automaton || DECL_AUTOMATON (decl2)->name == NULL) abort (); - return strcmp (decl1->decl.automaton.name, decl2->decl.automaton.name) == 0; + return strcmp (DECL_AUTOMATON (decl1)->name, + DECL_AUTOMATON (decl2)->name) == 0; } /* The automaton declaration table itself is represented by the @@ -1946,7 +2171,8 @@ find_automaton_decl (name) { void *entry; - work_automaton_decl.decl.automaton.name = name; + work_automaton_decl.mode = dm_automaton; + DECL_AUTOMATON (&work_automaton_decl)->name = name; entry = htab_find (automaton_decl_table, &work_automaton_decl); return (decl_t) entry; } @@ -1989,9 +2215,9 @@ insn_decl_hash (insn_decl) { const decl_t decl = (decl_t) insn_decl; - if (decl->mode != dm_insn_reserv || decl->decl.insn_reserv.name == NULL) + if (decl->mode != dm_insn_reserv || DECL_INSN_RESERV (decl)->name == NULL) abort (); - return string_hash (decl->decl.insn_reserv.name); + return string_hash (DECL_INSN_RESERV (decl)->name); } /* The function tests insn declarations on equality of their keys. @@ -2005,11 +2231,12 @@ insn_decl_eq_p (insn_decl_1, insn_decl_2) const decl_t decl1 = (decl_t) insn_decl_1; const decl_t decl2 = (decl_t) insn_decl_2; - if (decl1->mode != dm_insn_reserv || decl1->decl.insn_reserv.name == NULL - || decl2->mode != dm_insn_reserv || decl2->decl.insn_reserv.name == NULL) + if (decl1->mode != dm_insn_reserv || DECL_INSN_RESERV (decl1)->name == NULL + || decl2->mode != dm_insn_reserv + || DECL_INSN_RESERV (decl2)->name == NULL) abort (); - return strcmp (decl1->decl.insn_reserv.name, - decl2->decl.insn_reserv.name) == 0; + return strcmp (DECL_INSN_RESERV (decl1)->name, + DECL_INSN_RESERV (decl2)->name) == 0; } /* The insn declaration table itself is represented by the following @@ -2048,7 +2275,8 @@ find_insn_decl (name) { void *entry; - work_insn_decl.decl.insn_reserv.name = name; + work_insn_decl.mode = dm_insn_reserv; + DECL_INSN_RESERV (&work_insn_decl)->name = name; entry = htab_find (insn_decl_table, &work_insn_decl); return (decl_t) entry; } @@ -2090,11 +2318,11 @@ decl_hash (decl) { const decl_t d = (const decl_t) decl; - if ((d->mode != dm_unit || d->decl.unit.name == NULL) - && (d->mode != dm_reserv || d->decl.reserv.name == NULL)) + if ((d->mode != dm_unit || DECL_UNIT (d)->name == NULL) + && (d->mode != dm_reserv || DECL_RESERV (d)->name == NULL)) abort (); return string_hash (d->mode == dm_unit - ? d->decl.unit.name : d->decl.reserv.name); + ? DECL_UNIT (d)->name : DECL_RESERV (d)->name); } /* The function tests declarations on equality of their keys. The @@ -2108,15 +2336,15 @@ decl_eq_p (decl_1, decl_2) const decl_t d1 = (const decl_t) decl_1; const decl_t d2 = (const decl_t) decl_2; - if (((d1->mode != dm_unit || d1->decl.unit.name == NULL) - && (d1->mode != dm_reserv || d1->decl.reserv.name == NULL)) - || ((d2->mode != dm_unit || d2->decl.unit.name == NULL) - && (d2->mode != dm_reserv || d2->decl.reserv.name == NULL))) + if (((d1->mode != dm_unit || DECL_UNIT (d1)->name == NULL) + && (d1->mode != dm_reserv || DECL_RESERV (d1)->name == NULL)) + || ((d2->mode != dm_unit || DECL_UNIT (d2)->name == NULL) + && (d2->mode != dm_reserv || DECL_RESERV (d2)->name == NULL))) abort (); return strcmp ((d1->mode == dm_unit - ? d1->decl.unit.name : d1->decl.reserv.name), + ? DECL_UNIT (d1)->name : DECL_RESERV (d1)->name), (d2->mode == dm_unit - ? d2->decl.unit.name : d2->decl.reserv.name)) == 0; + ? DECL_UNIT (d2)->name : DECL_RESERV (d2)->name)) == 0; } /* The declaration table itself is represented by the following @@ -2154,7 +2382,8 @@ find_decl (name) { void *entry; - work_decl.decl.unit.name = name; + work_decl.mode = dm_unit; + DECL_UNIT (&work_decl)->name = name; entry = htab_find (decl_table, &work_decl); return (decl_t) entry; } @@ -2209,7 +2438,7 @@ process_excls (names, num, excl_pos) else { new_el = create_node (sizeof (struct unit_set_el)); - new_el->unit_decl = &decl_in_table->decl.unit; + new_el->unit_decl = DECL_UNIT (decl_in_table); new_el->next_unit_set_el = NULL; if (last_el == NULL) el_list = last_el = new_el; @@ -2305,7 +2534,7 @@ process_presence_absence (names, num, req_pos, presence_p) else { new_el = create_node (sizeof (struct unit_set_el)); - new_el->unit_decl = &decl_in_table->decl.unit; + new_el->unit_decl = DECL_UNIT (decl_in_table); new_el->next_unit_set_el = NULL; if (last_el == NULL) el_list = last_el = new_el; @@ -2471,10 +2700,10 @@ process_decls () { if (!w_flag) error ("repeated declaration of automaton `%s'", - decl->decl.automaton.name); + DECL_AUTOMATON (decl)->name); else warning ("repeated declaration of automaton `%s'", - decl->decl.automaton.name); + DECL_AUTOMATON (decl)->name); } } } @@ -2486,64 +2715,64 @@ process_decls () decl = description->decls [i]; if (decl->mode == dm_insn_reserv) { - decl->decl.insn_reserv.condexp - = check_attr_test (decl->decl.insn_reserv.condexp, 0, 0); - if (decl->decl.insn_reserv.default_latency < 0) + DECL_INSN_RESERV (decl)->condexp + = check_attr_test (DECL_INSN_RESERV (decl)->condexp, 0, 0); + if (DECL_INSN_RESERV (decl)->default_latency < 0) error ("define_insn_reservation `%s' has negative latency time", - decl->decl.insn_reserv.name); - decl->decl.insn_reserv.insn_num = description->insns_num; + DECL_INSN_RESERV (decl)->name); + DECL_INSN_RESERV (decl)->insn_num = description->insns_num; description->insns_num++; decl_in_table = insert_insn_decl (decl); if (decl_in_table != decl) error ("`%s' is already used as insn reservation name", - decl->decl.insn_reserv.name); + DECL_INSN_RESERV (decl)->name); } else if (decl->mode == dm_bypass) { - if (decl->decl.bypass.latency < 0) + if (DECL_BYPASS (decl)->latency < 0) error ("define_bypass `%s - %s' has negative latency time", - decl->decl.bypass.out_insn_name, - decl->decl.bypass.in_insn_name); + DECL_BYPASS (decl)->out_insn_name, + DECL_BYPASS (decl)->in_insn_name); } else if (decl->mode == dm_unit || decl->mode == dm_reserv) { if (decl->mode == dm_unit) { - decl->decl.unit.automaton_decl = NULL; - if (decl->decl.unit.automaton_name != NULL) + DECL_UNIT (decl)->automaton_decl = NULL; + if (DECL_UNIT (decl)->automaton_name != NULL) { automaton_decl - = find_automaton_decl (decl->decl.unit.automaton_name); + = find_automaton_decl (DECL_UNIT (decl)->automaton_name); if (automaton_decl == NULL) error ("automaton `%s' is not declared", - decl->decl.unit.automaton_name); + DECL_UNIT (decl)->automaton_name); else { - automaton_decl->decl.automaton.automaton_is_used = 1; - decl->decl.unit.automaton_decl - = &automaton_decl->decl.automaton; + DECL_AUTOMATON (automaton_decl)->automaton_is_used = 1; + DECL_UNIT (decl)->automaton_decl + = DECL_AUTOMATON (automaton_decl); } } else if (automaton_presence) error ("define_unit `%s' without automaton when one defined", - decl->decl.unit.name); - decl->decl.unit.unit_num = description->units_num; + DECL_UNIT (decl)->name); + DECL_UNIT (decl)->unit_num = description->units_num; description->units_num++; - if (strcmp (decl->decl.unit.name, NOTHING_NAME) == 0) + if (strcmp (DECL_UNIT (decl)->name, NOTHING_NAME) == 0) { error ("`%s' is declared as cpu unit", NOTHING_NAME); continue; } - decl_in_table = find_decl (decl->decl.unit.name); + decl_in_table = find_decl (DECL_UNIT (decl)->name); } else { - if (strcmp (decl->decl.reserv.name, NOTHING_NAME) == 0) + if (strcmp (DECL_RESERV (decl)->name, NOTHING_NAME) == 0) { error ("`%s' is declared as cpu reservation", NOTHING_NAME); continue; } - decl_in_table = find_decl (decl->decl.reserv.name); + decl_in_table = find_decl (DECL_RESERV (decl)->name); } if (decl_in_table == NULL) decl_in_table = insert_decl (decl); @@ -2551,10 +2780,10 @@ process_decls () { if (decl->mode == dm_unit) error ("repeated declaration of unit `%s'", - decl->decl.unit.name); + DECL_UNIT (decl)->name); else error ("repeated declaration of reservation `%s'", - decl->decl.reserv.name); + DECL_RESERV (decl)->name); } } } @@ -2565,49 +2794,49 @@ process_decls () decl = description->decls [i]; if (decl->mode == dm_bypass) { - out_insn_reserv = find_insn_decl (decl->decl.bypass.out_insn_name); - in_insn_reserv = find_insn_decl (decl->decl.bypass.in_insn_name); + out_insn_reserv = find_insn_decl (DECL_BYPASS (decl)->out_insn_name); + in_insn_reserv = find_insn_decl (DECL_BYPASS (decl)->in_insn_name); if (out_insn_reserv == NULL) error ("there is no insn reservation `%s'", - decl->decl.bypass.out_insn_name); + DECL_BYPASS (decl)->out_insn_name); else if (in_insn_reserv == NULL) error ("there is no insn reservation `%s'", - decl->decl.bypass.in_insn_name); + DECL_BYPASS (decl)->in_insn_name); else { - decl->decl.bypass.out_insn_reserv - = &out_insn_reserv->decl.insn_reserv; - decl->decl.bypass.in_insn_reserv - = &in_insn_reserv->decl.insn_reserv; + DECL_BYPASS (decl)->out_insn_reserv + = DECL_INSN_RESERV (out_insn_reserv); + DECL_BYPASS (decl)->in_insn_reserv + = DECL_INSN_RESERV (in_insn_reserv); bypass - = find_bypass (out_insn_reserv->decl.insn_reserv.bypass_list, - decl->decl.bypass.in_insn_reserv); + = find_bypass (DECL_INSN_RESERV (out_insn_reserv)->bypass_list, + DECL_BYPASS (decl)->in_insn_reserv); if (bypass != NULL) { - if (decl->decl.bypass.latency == bypass->latency) + if (DECL_BYPASS (decl)->latency == bypass->latency) { if (!w_flag) error ("the same bypass `%s - %s' is already defined", - decl->decl.bypass.out_insn_name, - decl->decl.bypass.in_insn_name); + DECL_BYPASS (decl)->out_insn_name, + DECL_BYPASS (decl)->in_insn_name); else warning ("the same bypass `%s - %s' is already defined", - decl->decl.bypass.out_insn_name, - decl->decl.bypass.in_insn_name); + DECL_BYPASS (decl)->out_insn_name, + DECL_BYPASS (decl)->in_insn_name); } else error ("bypass `%s - %s' is already defined", - decl->decl.bypass.out_insn_name, - decl->decl.bypass.in_insn_name); + DECL_BYPASS (decl)->out_insn_name, + DECL_BYPASS (decl)->in_insn_name); } else { - decl->decl.bypass.next - = out_insn_reserv->decl.insn_reserv.bypass_list; - out_insn_reserv->decl.insn_reserv.bypass_list - = &decl->decl.bypass; + DECL_BYPASS (decl)->next + = DECL_INSN_RESERV (out_insn_reserv)->bypass_list; + DECL_INSN_RESERV (out_insn_reserv)->bypass_list + = DECL_BYPASS (decl); } } } @@ -2623,13 +2852,13 @@ process_decls () unit_set_el_t unit_set_el_list_2; unit_set_el_list - = process_excls (decl->decl.excl.names, - decl->decl.excl.first_list_length, decl->pos); + = process_excls (DECL_EXCL (decl)->names, + DECL_EXCL (decl)->first_list_length, decl->pos); unit_set_el_list_2 - = process_excls (&decl->decl.excl.names - [decl->decl.excl.first_list_length], - decl->decl.excl.names_num - - decl->decl.excl.first_list_length, + = process_excls (&DECL_EXCL (decl)->names + [DECL_EXCL (decl)->first_list_length], + DECL_EXCL (decl)->names_num + - DECL_EXCL (decl)->first_list_length, decl->pos); add_excls (unit_set_el_list, unit_set_el_list_2, decl->pos); add_excls (unit_set_el_list_2, unit_set_el_list, decl->pos); @@ -2647,14 +2876,14 @@ process_decls () unit_set_el_list = process_presence_absence - (decl->decl.presence.names, - decl->decl.presence.first_list_length, decl->pos, 1); + (DECL_PRESENCE (decl)->names, + DECL_PRESENCE (decl)->first_list_length, decl->pos, 1); unit_set_el_list_2 = process_presence_absence - (&decl->decl.presence.names - [decl->decl.presence.first_list_length], - decl->decl.presence.names_num - - decl->decl.presence.first_list_length, + (&DECL_PRESENCE (decl)->names + [DECL_PRESENCE (decl)->first_list_length], + DECL_PRESENCE (decl)->names_num + - DECL_PRESENCE (decl)->first_list_length, decl->pos, 1); add_presence_absence (unit_set_el_list, unit_set_el_list_2, decl->pos, 1); @@ -2672,14 +2901,14 @@ process_decls () unit_set_el_list = process_presence_absence - (decl->decl.presence.names, - decl->decl.presence.first_list_length, decl->pos, 0); + (DECL_ABSENCE (decl)->names, + DECL_ABSENCE (decl)->first_list_length, decl->pos, 0); unit_set_el_list_2 = process_presence_absence - (&decl->decl.presence.names - [decl->decl.presence.first_list_length], - decl->decl.presence.names_num - - decl->decl.presence.first_list_length, + (&DECL_ABSENCE (decl)->names + [DECL_ABSENCE (decl)->first_list_length], + DECL_ABSENCE (decl)->names_num + - DECL_ABSENCE (decl)->first_list_length, decl->pos, 0); add_presence_absence (unit_set_el_list, unit_set_el_list_2, decl->pos, 0); @@ -2700,12 +2929,13 @@ check_automaton_usage () { decl = description->decls [i]; if (decl->mode == dm_automaton - && !decl->decl.automaton.automaton_is_used) + && !DECL_AUTOMATON (decl)->automaton_is_used) { if (!w_flag) - error ("automaton `%s' is not used", decl->decl.automaton.name); + error ("automaton `%s' is not used", DECL_AUTOMATON (decl)->name); else - warning ("automaton `%s' is not used", decl->decl.automaton.name); + warning ("automaton `%s' is not used", + DECL_AUTOMATON (decl)->name); } } } @@ -2725,43 +2955,44 @@ process_regexp (regexp) if (regexp->mode == rm_unit) { - decl_in_table = find_decl (regexp->regexp.unit.name); + decl_in_table = find_decl (REGEXP_UNIT (regexp)->name); if (decl_in_table == NULL) error ("undeclared unit or reservation `%s'", - regexp->regexp.unit.name); + REGEXP_UNIT (regexp)->name); else if (decl_in_table->mode == dm_unit) { - decl_in_table->decl.unit.unit_is_used = 1; - regexp->regexp.unit.unit_decl = &decl_in_table->decl.unit; + DECL_UNIT (decl_in_table)->unit_is_used = 1; + REGEXP_UNIT (regexp)->unit_decl = DECL_UNIT (decl_in_table); } else if (decl_in_table->mode == dm_reserv) { - decl_in_table->decl.reserv.reserv_is_used = 1; + DECL_RESERV (decl_in_table)->reserv_is_used = 1; new_regexp = create_node (sizeof (struct regexp)); new_regexp->mode = rm_reserv; new_regexp->pos = regexp->pos; - new_regexp->regexp.reserv.name = regexp->regexp.unit.name; - new_regexp->regexp.reserv.reserv_decl = &decl_in_table->decl.reserv; + REGEXP_RESERV (new_regexp)->name = REGEXP_UNIT (regexp)->name; + REGEXP_RESERV (new_regexp)->reserv_decl + = DECL_RESERV (decl_in_table); regexp = new_regexp; } else abort (); } else if (regexp->mode == rm_sequence) - for (i = 0; i < regexp->regexp.sequence.regexps_num; i++) - regexp->regexp.sequence.regexps [i] - = process_regexp (regexp->regexp.sequence.regexps [i]); + for (i = 0; i regexps_num; i++) + REGEXP_SEQUENCE (regexp)->regexps [i] + = process_regexp (REGEXP_SEQUENCE (regexp)->regexps [i]); else if (regexp->mode == rm_allof) - for (i = 0; i < regexp->regexp.allof.regexps_num; i++) - regexp->regexp.allof.regexps [i] - = process_regexp (regexp->regexp.allof.regexps [i]); + for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++) + REGEXP_ALLOF (regexp)->regexps [i] + = process_regexp (REGEXP_ALLOF (regexp)->regexps [i]); else if (regexp->mode == rm_oneof) - for (i = 0; i < regexp->regexp.oneof.regexps_num; i++) - regexp->regexp.oneof.regexps [i] - = process_regexp (regexp->regexp.oneof.regexps [i]); + for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++) + REGEXP_ONEOF (regexp)->regexps [i] + = process_regexp (REGEXP_ONEOF (regexp)->regexps [i]); else if (regexp->mode == rm_repeat) - regexp->regexp.repeat.regexp - = process_regexp (regexp->regexp.repeat.regexp); + REGEXP_REPEAT (regexp)->regexp + = process_regexp (REGEXP_REPEAT (regexp)->regexp); else if (regexp->mode != rm_nothing) abort (); return regexp; @@ -2780,10 +3011,11 @@ process_regexp_decls () { decl = description->decls [i]; if (decl->mode == dm_reserv) - decl->decl.reserv.regexp = process_regexp (decl->decl.reserv.regexp); + DECL_RESERV (decl)->regexp + = process_regexp (DECL_RESERV (decl)->regexp); else if (decl->mode == dm_insn_reserv) - decl->decl.insn_reserv.regexp - = process_regexp (decl->decl.insn_reserv.regexp); + DECL_INSN_RESERV (decl)->regexp + = process_regexp (DECL_INSN_RESERV (decl)->regexp); } } @@ -2800,19 +3032,19 @@ check_usage () for (i = 0; i < description->decls_num; i++) { decl = description->decls [i]; - if (decl->mode == dm_unit && !decl->decl.unit.unit_is_used) + if (decl->mode == dm_unit && !DECL_UNIT (decl)->unit_is_used) { if (!w_flag) - error ("unit `%s' is not used", decl->decl.unit.name); + error ("unit `%s' is not used", DECL_UNIT (decl)->name); else - warning ("unit `%s' is not used", decl->decl.unit.name); + warning ("unit `%s' is not used", DECL_UNIT (decl)->name); } - else if (decl->mode == dm_reserv && !decl->decl.reserv.reserv_is_used) + else if (decl->mode == dm_reserv && !DECL_RESERV (decl)->reserv_is_used) { if (!w_flag) - error ("reservation `%s' is not used", decl->decl.reserv.name); + error ("reservation `%s' is not used", DECL_RESERV (decl)->name); else - warning ("reservation `%s' is not used", decl->decl.reserv.name); + warning ("reservation `%s' is not used", DECL_RESERV (decl)->name); } } } @@ -2838,43 +3070,43 @@ loop_in_regexp (regexp, start_decl) else if (regexp->mode == rm_reserv) { if (start_decl->mode == dm_reserv - && regexp->regexp.reserv.reserv_decl == &start_decl->decl.reserv) + && REGEXP_RESERV (regexp)->reserv_decl == DECL_RESERV (start_decl)) return 1; - else if (regexp->regexp.reserv.reserv_decl->loop_pass_num + else if (REGEXP_RESERV (regexp)->reserv_decl->loop_pass_num == curr_loop_pass_num) /* declaration has been processed. */ return 0; else { - regexp->regexp.reserv.reserv_decl->loop_pass_num + REGEXP_RESERV (regexp)->reserv_decl->loop_pass_num = curr_loop_pass_num; - return loop_in_regexp (regexp->regexp.reserv.reserv_decl->regexp, + return loop_in_regexp (REGEXP_RESERV (regexp)->reserv_decl->regexp, start_decl); } } else if (regexp->mode == rm_sequence) { - for (i = 0; i < regexp->regexp.sequence.regexps_num; i++) - if (loop_in_regexp (regexp->regexp.sequence.regexps [i], start_decl)) + for (i = 0; i regexps_num; i++) + if (loop_in_regexp (REGEXP_SEQUENCE (regexp)->regexps [i], start_decl)) return 1; return 0; } else if (regexp->mode == rm_allof) { - for (i = 0; i < regexp->regexp.allof.regexps_num; i++) - if (loop_in_regexp (regexp->regexp.allof.regexps [i], start_decl)) + for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++) + if (loop_in_regexp (REGEXP_ALLOF (regexp)->regexps [i], start_decl)) return 1; return 0; } else if (regexp->mode == rm_oneof) { - for (i = 0; i < regexp->regexp.oneof.regexps_num; i++) - if (loop_in_regexp (regexp->regexp.oneof.regexps [i], start_decl)) + for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++) + if (loop_in_regexp (REGEXP_ONEOF (regexp)->regexps [i], start_decl)) return 1; return 0; } else if (regexp->mode == rm_repeat) - return loop_in_regexp (regexp->regexp.repeat.regexp, start_decl); + return loop_in_regexp (REGEXP_REPEAT (regexp)->regexp, start_decl); else { if (regexp->mode != rm_nothing) @@ -2895,7 +3127,7 @@ check_loops_in_regexps () { decl = description->decls [i]; if (decl->mode == dm_reserv) - decl->decl.reserv.loop_pass_num = 0; + DECL_RESERV (decl)->loop_pass_num = 0; } for (i = 0; i < description->decls_num; i++) { @@ -2904,13 +3136,13 @@ check_loops_in_regexps () if (decl->mode == dm_reserv) { - decl->decl.reserv.loop_pass_num = curr_loop_pass_num; - if (loop_in_regexp (decl->decl.reserv.regexp, decl)) + DECL_RESERV (decl)->loop_pass_num = curr_loop_pass_num; + if (loop_in_regexp (DECL_RESERV (decl)->regexp, decl)) { - if (decl->decl.reserv.regexp == NULL) + if (DECL_RESERV (decl)->regexp == NULL) abort (); error ("cycle in definition of reservation `%s'", - decl->decl.reserv.name); + DECL_RESERV (decl)->name); } } } @@ -2928,25 +3160,25 @@ process_regexp_cycles (regexp, start_cycle) if (regexp->mode == rm_unit) { - if (regexp->regexp.unit.unit_decl->max_occ_cycle_num < start_cycle) - regexp->regexp.unit.unit_decl->max_occ_cycle_num = start_cycle; + if (REGEXP_UNIT (regexp)->unit_decl->max_occ_cycle_num < start_cycle) + REGEXP_UNIT (regexp)->unit_decl->max_occ_cycle_num = start_cycle; return start_cycle; } else if (regexp->mode == rm_reserv) - return process_regexp_cycles (regexp->regexp.reserv.reserv_decl->regexp, + return process_regexp_cycles (REGEXP_RESERV (regexp)->reserv_decl->regexp, start_cycle); else if (regexp->mode == rm_repeat) { - for (i = 0; i < regexp->regexp.repeat.repeat_num; i++) - start_cycle = process_regexp_cycles (regexp->regexp.repeat.regexp, + for (i = 0; i < REGEXP_REPEAT (regexp)->repeat_num; i++) + start_cycle = process_regexp_cycles (REGEXP_REPEAT (regexp)->regexp, start_cycle) + 1; return start_cycle; } else if (regexp->mode == rm_sequence) { - for (i = 0; i < regexp->regexp.sequence.regexps_num; i++) + for (i = 0; i regexps_num; i++) start_cycle - = process_regexp_cycles (regexp->regexp.sequence.regexps [i], + = process_regexp_cycles (REGEXP_SEQUENCE (regexp)->regexps [i], start_cycle) + 1; return start_cycle; } @@ -2955,9 +3187,9 @@ process_regexp_cycles (regexp, start_cycle) int finish_cycle = 0; int cycle; - for (i = 0; i < regexp->regexp.allof.regexps_num; i++) + for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++) { - cycle = process_regexp_cycles (regexp->regexp.allof.regexps [i], + cycle = process_regexp_cycles (REGEXP_ALLOF (regexp)->regexps [i], start_cycle); if (finish_cycle < cycle) finish_cycle = cycle; @@ -2969,9 +3201,9 @@ process_regexp_cycles (regexp, start_cycle) int finish_cycle = 0; int cycle; - for (i = 0; i < regexp->regexp.oneof.regexps_num; i++) + for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++) { - cycle = process_regexp_cycles (regexp->regexp.oneof.regexps [i], + cycle = process_regexp_cycles (REGEXP_ONEOF (regexp)->regexps [i], start_cycle); if (finish_cycle < cycle) finish_cycle = cycle; @@ -3002,7 +3234,7 @@ evaluate_max_reserv_cycles () if (decl->mode == dm_insn_reserv) { max_insn_cycles_num - = process_regexp_cycles (decl->decl.insn_reserv.regexp, 0); + = process_regexp_cycles (DECL_INSN_RESERV (decl)->regexp, 0); if (description->max_insn_reserv_cycles < max_insn_cycles_num) description->max_insn_reserv_cycles = max_insn_cycles_num; } @@ -3148,9 +3380,10 @@ add_advance_cycle_insn_decl () advance_cycle_insn_decl = create_node (sizeof (struct decl)); advance_cycle_insn_decl->mode = dm_insn_reserv; advance_cycle_insn_decl->pos = no_pos; - advance_cycle_insn_decl->decl.insn_reserv.regexp = NULL; - advance_cycle_insn_decl->decl.insn_reserv.name = (char *) "$advance_cycle"; - advance_cycle_insn_decl->decl.insn_reserv.insn_num = description->insns_num; + DECL_INSN_RESERV (advance_cycle_insn_decl)->regexp = NULL; + DECL_INSN_RESERV (advance_cycle_insn_decl)->name = (char *) "$advance_cycle"; + DECL_INSN_RESERV (advance_cycle_insn_decl)->insn_num + = description->insns_num; description->decls [description->decls_num] = advance_cycle_insn_decl; description->decls_num++; description->insns_num++; @@ -3913,7 +4146,7 @@ initiate_states () { decl = description->decls [i]; if (decl->mode == dm_unit) - units_array [decl->decl.unit.unit_num] = &decl->decl.unit; + units_array [DECL_UNIT (decl)->unit_num] = DECL_UNIT (decl); } max_cycles_num = description->max_insn_reserv_cycles; els_in_cycle_reserv @@ -4263,11 +4496,11 @@ initiate_excl_sets () unit_excl_set = (reserv_sets_t) obstack_base (&irp); obstack_finish (&irp); memset (unit_excl_set, 0, els_in_cycle_reserv * sizeof (set_el_t)); - for (el = decl->decl.unit.excl_list; + for (el = DECL_UNIT (decl)->excl_list; el != NULL; el = el->next_unit_set_el) SET_BIT (unit_excl_set, el->unit_decl->unit_num); - unit_excl_set_table [decl->decl.unit.unit_num] = unit_excl_set; + unit_excl_set_table [DECL_UNIT (decl)->unit_num] = unit_excl_set; } } } @@ -4349,21 +4582,21 @@ initiate_presence_absence_sets () unit_set = (reserv_sets_t) obstack_base (&irp); obstack_finish (&irp); memset (unit_set, 0, els_in_cycle_reserv * sizeof (set_el_t)); - for (el = decl->decl.unit.presence_list; + for (el = DECL_UNIT (decl)->presence_list; el != NULL; el = el->next_unit_set_el) SET_BIT (unit_set, el->unit_decl->unit_num); - unit_presence_set_table [decl->decl.unit.unit_num] = unit_set; + unit_presence_set_table [DECL_UNIT (decl)->unit_num] = unit_set; obstack_blank (&irp, els_in_cycle_reserv * sizeof (set_el_t)); unit_set = (reserv_sets_t) obstack_base (&irp); obstack_finish (&irp); memset (unit_set, 0, els_in_cycle_reserv * sizeof (set_el_t)); - for (el = decl->decl.unit.absence_list; + for (el = DECL_UNIT (decl)->absence_list; el != NULL; el = el->next_unit_set_el) SET_BIT (unit_set, el->unit_decl->unit_num); - unit_absence_set_table [decl->decl.unit.unit_num] = unit_set; + unit_absence_set_table [DECL_UNIT (decl)->unit_num] = unit_set; } } } @@ -4426,41 +4659,41 @@ copy_insn_regexp (regexp) int i; if (regexp->mode == rm_reserv) - result = copy_insn_regexp (regexp->regexp.reserv.reserv_decl->regexp); + result = copy_insn_regexp (REGEXP_RESERV (regexp)->reserv_decl->regexp); else if (regexp->mode == rm_unit) result = copy_node (regexp, sizeof (struct regexp)); else if (regexp->mode == rm_repeat) { result = copy_node (regexp, sizeof (struct regexp)); - result->regexp.repeat.regexp - = copy_insn_regexp (regexp->regexp.repeat.regexp); + REGEXP_REPEAT (result)->regexp + = copy_insn_regexp (REGEXP_REPEAT (regexp)->regexp); } else if (regexp->mode == rm_sequence) { result = copy_node (regexp, sizeof (struct regexp) + sizeof (regexp_t) - * (regexp->regexp.sequence.regexps_num - 1)); - for (i = 0; i < regexp->regexp.sequence.regexps_num; i++) - result->regexp.sequence.regexps [i] - = copy_insn_regexp (regexp->regexp.sequence.regexps [i]); + * (REGEXP_SEQUENCE (regexp)->regexps_num - 1)); + for (i = 0; i regexps_num; i++) + REGEXP_SEQUENCE (result)->regexps [i] + = copy_insn_regexp (REGEXP_SEQUENCE (regexp)->regexps [i]); } else if (regexp->mode == rm_allof) { result = copy_node (regexp, sizeof (struct regexp) + sizeof (regexp_t) - * (regexp->regexp.allof.regexps_num - 1)); - for (i = 0; i < regexp->regexp.allof.regexps_num; i++) - result->regexp.allof.regexps [i] - = copy_insn_regexp (regexp->regexp.allof.regexps [i]); + * (REGEXP_ALLOF (regexp)->regexps_num - 1)); + for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++) + REGEXP_ALLOF (result)->regexps [i] + = copy_insn_regexp (REGEXP_ALLOF (regexp)->regexps [i]); } else if (regexp->mode == rm_oneof) { result = copy_node (regexp, sizeof (struct regexp) + sizeof (regexp_t) - * (regexp->regexp.oneof.regexps_num - 1)); - for (i = 0; i < regexp->regexp.oneof.regexps_num; i++) - result->regexp.oneof.regexps [i] - = copy_insn_regexp (regexp->regexp.oneof.regexps [i]); + * (REGEXP_ONEOF (regexp)->regexps_num - 1)); + for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++) + REGEXP_ONEOF (result)->regexps [i] + = copy_insn_regexp (REGEXP_ONEOF (regexp)->regexps [i]); } else { @@ -4488,18 +4721,18 @@ transform_1 (regexp) if (regexp->mode == rm_repeat) { - repeat_num = regexp->regexp.repeat.repeat_num; + repeat_num = REGEXP_REPEAT (regexp)->repeat_num; if (repeat_num <= 1) abort (); - operand = regexp->regexp.repeat.regexp; + operand = REGEXP_REPEAT (regexp)->regexp; pos = regexp->mode; regexp = create_node (sizeof (struct regexp) + sizeof (regexp_t) * (repeat_num - 1)); regexp->mode = rm_sequence; regexp->pos = pos; - regexp->regexp.sequence.regexps_num = repeat_num; + REGEXP_SEQUENCE (regexp)->regexps_num = repeat_num; for (i = 0; i < repeat_num; i++) - regexp->regexp.sequence.regexps [i] = copy_insn_regexp (operand); + REGEXP_SEQUENCE (regexp)->regexps [i] = copy_insn_regexp (operand); regexp_transformed_p = 1; } return regexp; @@ -4520,40 +4753,40 @@ transform_2 (regexp) int sequence_index = 0; int i, j; - for (i = 0; i < regexp->regexp.sequence.regexps_num; i++) - if (regexp->regexp.sequence.regexps [i]->mode == rm_sequence) + for (i = 0; i < REGEXP_SEQUENCE (regexp)->regexps_num; i++) + if (REGEXP_SEQUENCE (regexp)->regexps [i]->mode == rm_sequence) { sequence_index = i; - sequence = regexp->regexp.sequence.regexps [i]; + sequence = REGEXP_SEQUENCE (regexp)->regexps [i]; break; } - if (i < regexp->regexp.sequence.regexps_num) + if (i < REGEXP_SEQUENCE (regexp)->regexps_num) { - if (sequence->regexp.sequence.regexps_num <= 1 - || regexp->regexp.sequence.regexps_num <= 1) + if ( REGEXP_SEQUENCE (sequence)->regexps_num <= 1 + || REGEXP_SEQUENCE (regexp)->regexps_num <= 1) abort (); result = create_node (sizeof (struct regexp) + sizeof (regexp_t) - * (regexp->regexp.sequence.regexps_num - + sequence->regexp.sequence.regexps_num + * (REGEXP_SEQUENCE (regexp)->regexps_num + + REGEXP_SEQUENCE (sequence)->regexps_num - 2)); result->mode = rm_sequence; result->pos = regexp->pos; - result->regexp.sequence.regexps_num - = (regexp->regexp.sequence.regexps_num - + sequence->regexp.sequence.regexps_num - 1); - for (i = 0; i < regexp->regexp.sequence.regexps_num; i++) + REGEXP_SEQUENCE (result)->regexps_num + = (REGEXP_SEQUENCE (regexp)->regexps_num + + REGEXP_SEQUENCE (sequence)->regexps_num - 1); + for (i = 0; i < REGEXP_SEQUENCE (regexp)->regexps_num; i++) if (i < sequence_index) - result->regexp.sequence.regexps [i] - = copy_insn_regexp (regexp->regexp.sequence.regexps [i]); + REGEXP_SEQUENCE (result)->regexps [i] + = copy_insn_regexp (REGEXP_SEQUENCE (regexp)->regexps [i]); else if (i > sequence_index) - result->regexp.sequence.regexps - [i + sequence->regexp.sequence.regexps_num - 1] - = copy_insn_regexp (regexp->regexp.sequence.regexps [i]); + REGEXP_SEQUENCE (result)->regexps + [i + REGEXP_SEQUENCE (sequence)->regexps_num - 1] + = copy_insn_regexp (REGEXP_SEQUENCE (regexp)->regexps [i]); else - for (j = 0; j < sequence->regexp.sequence.regexps_num; j++) - result->regexp.sequence.regexps [i + j] - = copy_insn_regexp (sequence->regexp.sequence.regexps [j]); + for (j = 0; j < REGEXP_SEQUENCE (sequence)->regexps_num; j++) + REGEXP_SEQUENCE (result)->regexps [i + j] + = copy_insn_regexp (REGEXP_SEQUENCE (sequence)->regexps [j]); regexp_transformed_p = 1; regexp = result; } @@ -4565,39 +4798,39 @@ transform_2 (regexp) int allof_index = 0; int i, j; - for (i = 0; i < regexp->regexp.allof.regexps_num; i++) - if (regexp->regexp.allof.regexps [i]->mode == rm_allof) + for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++) + if (REGEXP_ALLOF (regexp)->regexps [i]->mode == rm_allof) { allof_index = i; - allof = regexp->regexp.allof.regexps [i]; + allof = REGEXP_ALLOF (regexp)->regexps [i]; break; } - if (i < regexp->regexp.allof.regexps_num) + if (i < REGEXP_ALLOF (regexp)->regexps_num) { - if (allof->regexp.allof.regexps_num <= 1 - || regexp->regexp.allof.regexps_num <= 1) + if (REGEXP_ALLOF (allof)->regexps_num <= 1 + || REGEXP_ALLOF (regexp)->regexps_num <= 1) abort (); result = create_node (sizeof (struct regexp) + sizeof (regexp_t) - * (regexp->regexp.allof.regexps_num - + allof->regexp.allof.regexps_num - 2)); + * (REGEXP_ALLOF (regexp)->regexps_num + + REGEXP_ALLOF (allof)->regexps_num - 2)); result->mode = rm_allof; result->pos = regexp->pos; - result->regexp.allof.regexps_num - = (regexp->regexp.allof.regexps_num - + allof->regexp.allof.regexps_num - 1); - for (i = 0; i < regexp->regexp.allof.regexps_num; i++) + REGEXP_ALLOF (result)->regexps_num + = (REGEXP_ALLOF (regexp)->regexps_num + + REGEXP_ALLOF (allof)->regexps_num - 1); + for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++) if (i < allof_index) - result->regexp.allof.regexps [i] - = copy_insn_regexp (regexp->regexp.allof.regexps [i]); + REGEXP_ALLOF (result)->regexps [i] + = copy_insn_regexp (REGEXP_ALLOF (regexp)->regexps [i]); else if (i > allof_index) - result->regexp.allof.regexps - [i + allof->regexp.allof.regexps_num - 1] - = copy_insn_regexp (regexp->regexp.allof.regexps [i]); + REGEXP_ALLOF (result)->regexps + [i + REGEXP_ALLOF (allof)->regexps_num - 1] + = copy_insn_regexp (REGEXP_ALLOF (regexp)->regexps [i]); else - for (j = 0; j < allof->regexp.allof.regexps_num; j++) - result->regexp.allof.regexps [i + j] - = copy_insn_regexp (allof->regexp.allof.regexps [j]); + for (j = 0; j < REGEXP_ALLOF (allof)->regexps_num; j++) + REGEXP_ALLOF (result)->regexps [i + j] + = copy_insn_regexp (REGEXP_ALLOF (allof)->regexps [j]); regexp_transformed_p = 1; regexp = result; } @@ -4609,39 +4842,39 @@ transform_2 (regexp) int oneof_index = 0; int i, j; - for (i = 0; i < regexp->regexp.oneof.regexps_num; i++) - if (regexp->regexp.oneof.regexps [i]->mode == rm_oneof) + for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++) + if (REGEXP_ONEOF (regexp)->regexps [i]->mode == rm_oneof) { oneof_index = i; - oneof = regexp->regexp.oneof.regexps [i]; + oneof = REGEXP_ONEOF (regexp)->regexps [i]; break; } - if (i < regexp->regexp.oneof.regexps_num) + if (i < REGEXP_ONEOF (regexp)->regexps_num) { - if (oneof->regexp.oneof.regexps_num <= 1 - || regexp->regexp.oneof.regexps_num <= 1) + if (REGEXP_ONEOF (oneof)->regexps_num <= 1 + || REGEXP_ONEOF (regexp)->regexps_num <= 1) abort (); result = create_node (sizeof (struct regexp) + sizeof (regexp_t) - * (regexp->regexp.oneof.regexps_num - + oneof->regexp.oneof.regexps_num - 2)); + * (REGEXP_ONEOF (regexp)->regexps_num + + REGEXP_ONEOF (oneof)->regexps_num - 2)); result->mode = rm_oneof; result->pos = regexp->pos; - result->regexp.oneof.regexps_num - = (regexp->regexp.oneof.regexps_num - + oneof->regexp.oneof.regexps_num - 1); - for (i = 0; i < regexp->regexp.oneof.regexps_num; i++) + REGEXP_ONEOF (result)->regexps_num + = (REGEXP_ONEOF (regexp)->regexps_num + + REGEXP_ONEOF (oneof)->regexps_num - 1); + for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++) if (i < oneof_index) - result->regexp.oneof.regexps [i] - = copy_insn_regexp (regexp->regexp.oneof.regexps [i]); + REGEXP_ONEOF (result)->regexps [i] + = copy_insn_regexp (REGEXP_ONEOF (regexp)->regexps [i]); else if (i > oneof_index) - result->regexp.oneof.regexps - [i + oneof->regexp.oneof.regexps_num - 1] - = copy_insn_regexp (regexp->regexp.oneof.regexps [i]); + REGEXP_ONEOF (result)->regexps + [i + REGEXP_ONEOF (oneof)->regexps_num - 1] + = copy_insn_regexp (REGEXP_ONEOF (regexp)->regexps [i]); else - for (j = 0; j < oneof->regexp.oneof.regexps_num; j++) - result->regexp.oneof.regexps [i + j] - = copy_insn_regexp (oneof->regexp.oneof.regexps [j]); + for (j = 0; j < REGEXP_ONEOF (oneof)->regexps_num; j++) + REGEXP_ONEOF (result)->regexps [i + j] + = copy_insn_regexp (REGEXP_ONEOF (oneof)->regexps [j]); regexp_transformed_p = 1; regexp = result; } @@ -4666,42 +4899,43 @@ transform_3 (regexp) regexp_t sequence; int i, j; - for (i = 0; i < regexp->regexp.sequence.regexps_num; i++) - if (regexp->regexp.sequence.regexps [i]->mode == rm_oneof) + for (i = 0; i regexps_num; i++) + if (REGEXP_SEQUENCE (regexp)->regexps [i]->mode == rm_oneof) { oneof_index = i; - oneof = regexp->regexp.sequence.regexps [i]; + oneof = REGEXP_SEQUENCE (regexp)->regexps [i]; break; } - if (i < regexp->regexp.sequence.regexps_num) + if (i < REGEXP_SEQUENCE (regexp)->regexps_num) { - if (oneof->regexp.oneof.regexps_num <= 1 - || regexp->regexp.sequence.regexps_num <= 1) + if (REGEXP_ONEOF (oneof)->regexps_num <= 1 + || REGEXP_SEQUENCE (regexp)->regexps_num <= 1) abort (); result = create_node (sizeof (struct regexp) + sizeof (regexp_t) - * (oneof->regexp.oneof.regexps_num - 1)); + * (REGEXP_ONEOF (oneof)->regexps_num - 1)); result->mode = rm_oneof; result->pos = regexp->pos; - result->regexp.oneof.regexps_num = oneof->regexp.oneof.regexps_num; - for (i = 0; i < result->regexp.oneof.regexps_num; i++) + REGEXP_ONEOF (result)->regexps_num + = REGEXP_ONEOF (oneof)->regexps_num; + for (i = 0; i < REGEXP_ONEOF (result)->regexps_num; i++) { sequence = create_node (sizeof (struct regexp) + sizeof (regexp_t) - * (regexp->regexp.sequence.regexps_num - 1)); + * (REGEXP_SEQUENCE (regexp)->regexps_num - 1)); sequence->mode = rm_sequence; sequence->pos = regexp->pos; - sequence->regexp.sequence.regexps_num - = regexp->regexp.sequence.regexps_num; - result->regexp.oneof.regexps [i] = sequence; - for (j = 0; j < sequence->regexp.sequence.regexps_num; j++) + REGEXP_SEQUENCE (sequence)->regexps_num + = REGEXP_SEQUENCE (regexp)->regexps_num; + REGEXP_ONEOF (result)->regexps [i] = sequence; + for (j = 0; j < REGEXP_SEQUENCE (sequence)->regexps_num; j++) if (j != oneof_index) - sequence->regexp.sequence.regexps [j] - = copy_insn_regexp (regexp->regexp.sequence.regexps [j]); + REGEXP_SEQUENCE (sequence)->regexps [j] + = copy_insn_regexp (REGEXP_SEQUENCE (regexp)->regexps [j]); else - sequence->regexp.sequence.regexps [j] - = copy_insn_regexp (oneof->regexp.oneof.regexps [i]); + REGEXP_SEQUENCE (sequence)->regexps [j] + = copy_insn_regexp (REGEXP_ONEOF (oneof)->regexps [i]); } regexp_transformed_p = 1; regexp = result; @@ -4712,91 +4946,95 @@ transform_3 (regexp) regexp_t oneof = NULL, seq; int oneof_index = 0, max_seq_length, allof_length; regexp_t result; - regexp_t allof = NULL, allof_op; + regexp_t allof = NULL, allof_op = NULL; int i, j; - for (i = 0; i < regexp->regexp.allof.regexps_num; i++) - if (regexp->regexp.allof.regexps [i]->mode == rm_oneof) + for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++) + if (REGEXP_ALLOF (regexp)->regexps [i]->mode == rm_oneof) { oneof_index = i; - oneof = regexp->regexp.allof.regexps [i]; + oneof = REGEXP_ALLOF (regexp)->regexps [i]; break; } - if (i < regexp->regexp.allof.regexps_num) + if (i < REGEXP_ALLOF (regexp)->regexps_num) { - if (oneof->regexp.oneof.regexps_num <= 1 - || regexp->regexp.allof.regexps_num <= 1) + if (REGEXP_ONEOF (oneof)->regexps_num <= 1 + || REGEXP_ALLOF (regexp)->regexps_num <= 1) abort (); result = create_node (sizeof (struct regexp) + sizeof (regexp_t) - * (oneof->regexp.oneof.regexps_num - 1)); + * (REGEXP_ONEOF (oneof)->regexps_num - 1)); result->mode = rm_oneof; result->pos = regexp->pos; - result->regexp.oneof.regexps_num = oneof->regexp.oneof.regexps_num; - for (i = 0; i < result->regexp.oneof.regexps_num; i++) + REGEXP_ONEOF (result)->regexps_num + = REGEXP_ONEOF (oneof)->regexps_num; + for (i = 0; i < REGEXP_ONEOF (result)->regexps_num; i++) { allof = create_node (sizeof (struct regexp) + sizeof (regexp_t) - * (regexp->regexp.allof.regexps_num - 1)); + * (REGEXP_ALLOF (regexp)->regexps_num - 1)); allof->mode = rm_allof; allof->pos = regexp->pos; - allof->regexp.allof.regexps_num - = regexp->regexp.allof.regexps_num; - result->regexp.oneof.regexps [i] = allof; - for (j = 0; j < allof->regexp.allof.regexps_num; j++) + REGEXP_ALLOF (allof)->regexps_num + = REGEXP_ALLOF (regexp)->regexps_num; + REGEXP_ONEOF (result)->regexps [i] = allof; + for (j = 0; j < REGEXP_ALLOF (allof)->regexps_num; j++) if (j != oneof_index) - allof->regexp.allof.regexps [j] - = copy_insn_regexp (regexp->regexp.allof.regexps [j]); + REGEXP_ALLOF (allof)->regexps [j] + = copy_insn_regexp (REGEXP_ALLOF (regexp)->regexps [j]); else - allof->regexp.allof.regexps [j] - = copy_insn_regexp (oneof->regexp.oneof.regexps [i]); + REGEXP_ALLOF (allof)->regexps [j] + = copy_insn_regexp (REGEXP_ONEOF (oneof)->regexps [i]); } regexp_transformed_p = 1; regexp = result; } max_seq_length = 0; - for (i = 0; i < regexp->regexp.allof.regexps_num; i++) - if (regexp->regexp.allof.regexps [i]->mode == rm_sequence) - { - seq = regexp->regexp.allof.regexps [i]; - if (max_seq_length < seq->regexp.sequence.regexps_num) - max_seq_length = seq->regexp.sequence.regexps_num; - } - else if (regexp->regexp.allof.regexps [i]->mode != rm_unit) - { - max_seq_length = 0; - break; - } + if (regexp->mode == rm_allof) + for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++) + if (REGEXP_ALLOF (regexp)->regexps [i]->mode == rm_sequence) + { + seq = REGEXP_ALLOF (regexp)->regexps [i]; + if (max_seq_length < REGEXP_SEQUENCE (seq)->regexps_num) + max_seq_length = REGEXP_SEQUENCE (seq)->regexps_num; + } + else if (REGEXP_ALLOF (regexp)->regexps [i]->mode != rm_unit) + { + max_seq_length = 0; + break; + } if (max_seq_length != 0) { - if (max_seq_length == 1 || regexp->regexp.allof.regexps_num <= 1) + if (max_seq_length == 1 || REGEXP_ALLOF (regexp)->regexps_num <= 1) abort (); result = create_node (sizeof (struct regexp) + sizeof (regexp_t) * (max_seq_length - 1)); result->mode = rm_sequence; result->pos = regexp->pos; - result->regexp.sequence.regexps_num = max_seq_length; + REGEXP_SEQUENCE (result)->regexps_num = max_seq_length; for (i = 0; i < max_seq_length; i++) { allof_length = 0; - for (j = 0; j < regexp->regexp.allof.regexps_num; j++) - if (regexp->regexp.allof.regexps [j]->mode == rm_sequence - && (i < (regexp->regexp.allof.regexps [j] - ->regexp.sequence.regexps_num))) + for (j = 0; j < REGEXP_ALLOF (regexp)->regexps_num; j++) + if (REGEXP_ALLOF (regexp)->regexps [j]->mode == rm_sequence + && (i < (REGEXP_SEQUENCE (REGEXP_ALLOF (regexp) + ->regexps [j])->regexps_num))) { - allof_op = (regexp->regexp.allof.regexps [j] - ->regexp.sequence.regexps [i]); + allof_op + = (REGEXP_SEQUENCE (REGEXP_ALLOF (regexp)->regexps [j]) + ->regexps [i]); allof_length++; } else if (i == 0 - && regexp->regexp.allof.regexps [j]->mode == rm_unit) + && (REGEXP_ALLOF (regexp)->regexps [j]->mode + == rm_unit)) { - allof_op = regexp->regexp.allof.regexps [j]; + allof_op = REGEXP_ALLOF (regexp)->regexps [j]; allof_length++; } if (allof_length == 1) - result->regexp.sequence.regexps [i] = allof_op; + REGEXP_SEQUENCE (result)->regexps [i] = allof_op; else { allof = create_node (sizeof (struct regexp) @@ -4804,26 +5042,29 @@ transform_3 (regexp) * (allof_length - 1)); allof->mode = rm_allof; allof->pos = regexp->pos; - allof->regexp.allof.regexps_num = allof_length; - result->regexp.sequence.regexps [i] = allof; + REGEXP_ALLOF (allof)->regexps_num = allof_length; + REGEXP_SEQUENCE (result)->regexps [i] = allof; allof_length = 0; - for (j = 0; j < regexp->regexp.allof.regexps_num; j++) - if (regexp->regexp.allof.regexps [j]->mode == rm_sequence - && (i < (regexp->regexp.allof.regexps [j] - ->regexp.sequence.regexps_num))) + for (j = 0; j < REGEXP_ALLOF (regexp)->regexps_num; j++) + if (REGEXP_ALLOF (regexp)->regexps [j]->mode == rm_sequence + && (i < + (REGEXP_SEQUENCE (REGEXP_ALLOF (regexp) + ->regexps [j])->regexps_num))) { - allof_op = (regexp->regexp.allof.regexps [j] - ->regexp.sequence.regexps [i]); - allof->regexp.allof.regexps [allof_length] = allof_op; - + allof_op = (REGEXP_SEQUENCE (REGEXP_ALLOF (regexp) + ->regexps [j]) + ->regexps [i]); + REGEXP_ALLOF (allof)->regexps [allof_length] + = allof_op; allof_length++; } else if (i == 0 - && (regexp->regexp.allof.regexps [j]->mode + && (REGEXP_ALLOF (regexp)->regexps [j]->mode == rm_unit)) { - allof_op = regexp->regexp.allof.regexps [j]; - allof->regexp.allof.regexps [allof_length] = allof_op; + allof_op = REGEXP_ALLOF (regexp)->regexps [j]; + REGEXP_ALLOF (allof)->regexps [allof_length] + = allof_op; allof_length++; } } @@ -4845,20 +5086,20 @@ regexp_transform_func (regexp, func) int i; if (regexp->mode == rm_sequence) - for (i = 0; i < regexp->regexp.sequence.regexps_num; i++) - regexp->regexp.sequence.regexps [i] - = regexp_transform_func (regexp->regexp.sequence.regexps [i], func); + for (i = 0; i < REGEXP_SEQUENCE (regexp)->regexps_num; i++) + REGEXP_SEQUENCE (regexp)->regexps [i] + = regexp_transform_func (REGEXP_SEQUENCE (regexp)->regexps [i], func); else if (regexp->mode == rm_allof) - for (i = 0; i < regexp->regexp.allof.regexps_num; i++) - regexp->regexp.allof.regexps [i] - = regexp_transform_func (regexp->regexp.allof.regexps [i], func); + for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++) + REGEXP_ALLOF (regexp)->regexps [i] + = regexp_transform_func (REGEXP_ALLOF (regexp)->regexps [i], func); else if (regexp->mode == rm_oneof) - for (i = 0; i < regexp->regexp.oneof.regexps_num; i++) - regexp->regexp.oneof.regexps [i] - = regexp_transform_func (regexp->regexp.oneof.regexps [i], func); + for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++) + REGEXP_ONEOF (regexp)->regexps [i] + = regexp_transform_func (REGEXP_ONEOF (regexp)->regexps [i], func); else if (regexp->mode == rm_repeat) - regexp->regexp.repeat.regexp - = regexp_transform_func (regexp->regexp.repeat.regexp, func); + REGEXP_REPEAT (regexp)->regexp + = regexp_transform_func (REGEXP_REPEAT (regexp)->regexp, func); else if (regexp->mode != rm_nothing && regexp->mode != rm_unit) abort (); return (*func) (regexp); @@ -4897,9 +5138,9 @@ transform_insn_regexps () { decl = description->decls [i]; if (decl->mode == dm_insn_reserv && decl != advance_cycle_insn_decl) - decl->decl.insn_reserv.transformed_regexp + DECL_INSN_RESERV (decl)->transformed_regexp = transform_regexp (copy_insn_regexp - (decl->decl.insn_reserv.regexp)); + (DECL_INSN_RESERV (decl)->regexp)); } fprintf (stderr, "done\n"); ticker_off (&transform_time); @@ -4929,42 +5170,43 @@ process_unit_to_form_the_same_automaton_unit_lists (unit, regexp, cycle) if (regexp == NULL || regexp->mode != rm_oneof) abort (); - unit_decl = unit->regexp.unit.unit_decl; - for (i = regexp->regexp.oneof.regexps_num - 1; i >= 0; i--) + unit_decl = REGEXP_UNIT (unit)->unit_decl; + for (i = REGEXP_ONEOF (regexp)->regexps_num - 1; i >= 0; i--) { - seq = regexp->regexp.oneof.regexps [i]; + seq = REGEXP_ONEOF (regexp)->regexps [i]; if (seq->mode == rm_sequence) { - if (cycle >= seq->regexp.sequence.regexps_num) + if (cycle >= REGEXP_SEQUENCE (seq)->regexps_num) break; - allof = seq->regexp.sequence.regexps [cycle]; + allof = REGEXP_SEQUENCE (seq)->regexps [cycle]; if (allof->mode == rm_allof) { - for (k = 0; k < allof->regexp.allof.regexps_num; k++) - if (allof->regexp.allof.regexps [k]->mode == rm_unit - && (allof->regexp.allof.regexps [k]->regexp.unit.unit_decl - == unit_decl)) + for (k = 0; k < REGEXP_ALLOF (allof)->regexps_num; k++) + if (REGEXP_ALLOF (allof)->regexps [k]->mode == rm_unit + && (REGEXP_UNIT (REGEXP_ALLOF (allof)->regexps [k]) + ->unit_decl == unit_decl)) break; - if (k >= allof->regexp.allof.regexps_num) + if (k >= REGEXP_ALLOF (allof)->regexps_num) break; } else if (allof->mode == rm_unit - && allof->regexp.unit.unit_decl != unit_decl) + && REGEXP_UNIT (allof)->unit_decl != unit_decl) break; } else if (cycle != 0) break; else if (seq->mode == rm_allof) { - for (k = 0; k < seq->regexp.allof.regexps_num; k++) - if (seq->regexp.allof.regexps [k]->mode == rm_unit - && (seq->regexp.allof.regexps [k]->regexp.unit.unit_decl + for (k = 0; k < REGEXP_ALLOF (seq)->regexps_num; k++) + if (REGEXP_ALLOF (seq)->regexps [k]->mode == rm_unit + && (REGEXP_UNIT (REGEXP_ALLOF (seq)->regexps [k])->unit_decl == unit_decl)) break; - if (k >= seq->regexp.allof.regexps_num) + if (k >= REGEXP_ALLOF (seq)->regexps_num) break; } - else if (seq->mode == rm_unit && seq->regexp.unit.unit_decl != unit_decl) + else if (seq->mode == rm_unit + && REGEXP_UNIT (seq)->unit_decl != unit_decl) break; } if (i >= 0) @@ -5002,17 +5244,17 @@ form_the_same_automaton_unit_lists_from_regexp (regexp) return; for (i = 0; i < description->max_insn_reserv_cycles; i++) the_same_automaton_lists [i] = NULL; - for (i = regexp->regexp.oneof.regexps_num - 1; i >= 0; i--) + for (i = REGEXP_ONEOF (regexp)->regexps_num - 1; i >= 0; i--) { - seq = regexp->regexp.oneof.regexps [i]; + seq = REGEXP_ONEOF (regexp)->regexps [i]; if (seq->mode == rm_sequence) - for (j = 0; j < seq->regexp.sequence.regexps_num; j++) + for (j = 0; j < REGEXP_SEQUENCE (seq)->regexps_num; j++) { - allof = seq->regexp.sequence.regexps [j]; + allof = REGEXP_SEQUENCE (seq)->regexps [j]; if (allof->mode == rm_allof) - for (k = 0; k < allof->regexp.allof.regexps_num; k++) + for (k = 0; k < REGEXP_ALLOF (allof)->regexps_num; k++) { - unit = allof->regexp.allof.regexps [k]; + unit = REGEXP_ALLOF (allof)->regexps [k]; if (unit->mode == rm_unit) process_unit_to_form_the_same_automaton_unit_lists (unit, regexp, j); @@ -5026,9 +5268,9 @@ form_the_same_automaton_unit_lists_from_regexp (regexp) abort (); } else if (seq->mode == rm_allof) - for (k = 0; k < seq->regexp.allof.regexps_num; k++) + for (k = 0; k < REGEXP_ALLOF (seq)->regexps_num; k++) { - unit = seq->regexp.allof.regexps [k]; + unit = REGEXP_ALLOF (seq)->regexps [k]; if (unit->mode == rm_unit) process_unit_to_form_the_same_automaton_unit_lists (unit, regexp, 0); @@ -5060,8 +5302,8 @@ form_the_same_automaton_unit_lists () decl = description->decls [i]; if (decl->mode == dm_unit) { - decl->decl.unit.the_same_automaton_message_reported_p = FALSE; - decl->decl.unit.the_same_automaton_unit = &decl->decl.unit; + DECL_UNIT (decl)->the_same_automaton_message_reported_p = FALSE; + DECL_UNIT (decl)->the_same_automaton_unit = DECL_UNIT (decl); } } for (i = 0; i < description->decls_num; i++) @@ -5069,7 +5311,7 @@ form_the_same_automaton_unit_lists () decl = description->decls [i]; if (decl->mode == dm_insn_reserv) form_the_same_automaton_unit_lists_from_regexp - (decl->decl.insn_reserv.transformed_regexp); + (DECL_INSN_RESERV (decl)->transformed_regexp); } free (the_same_automaton_lists); } @@ -5089,7 +5331,7 @@ check_unit_distributions_to_automata () decl = description->decls [i]; if (decl->mode == dm_unit) { - start_unit_decl = &decl->decl.unit; + start_unit_decl = DECL_UNIT (decl); if (!start_unit_decl->the_same_automaton_message_reported_p) for (unit_decl = start_unit_decl->the_same_automaton_unit; unit_decl != start_unit_decl; @@ -5131,18 +5373,18 @@ process_seq_for_forming_states (regexp, automaton, curr_cycle) return curr_cycle; else if (regexp->mode == rm_unit) { - if (regexp->regexp.unit.unit_decl->corresponding_automaton_num + if (REGEXP_UNIT (regexp)->unit_decl->corresponding_automaton_num == automaton->automaton_order_num) set_state_reserv (state_being_formed, curr_cycle, - regexp->regexp.unit.unit_decl->unit_num); + REGEXP_UNIT (regexp)->unit_decl->unit_num); return curr_cycle; } else if (regexp->mode == rm_sequence) { - for (i = 0; i < regexp->regexp.sequence.regexps_num; i++) + for (i = 0; i < REGEXP_SEQUENCE (regexp)->regexps_num; i++) curr_cycle = process_seq_for_forming_states - (regexp->regexp.sequence.regexps [i], automaton, curr_cycle) + 1; + (REGEXP_SEQUENCE (regexp)->regexps [i], automaton, curr_cycle) + 1; return curr_cycle; } else if (regexp->mode == rm_allof) @@ -5150,11 +5392,11 @@ process_seq_for_forming_states (regexp, automaton, curr_cycle) int finish_cycle = 0; int cycle; - for (i = 0; i < regexp->regexp.allof.regexps_num; i++) + for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++) { - cycle - = process_seq_for_forming_states (regexp->regexp.allof.regexps [i], - automaton, curr_cycle); + cycle = process_seq_for_forming_states (REGEXP_ALLOF (regexp) + ->regexps [i], + automaton, curr_cycle); if (finish_cycle < cycle) finish_cycle = cycle; } @@ -5222,8 +5464,8 @@ process_alts_for_forming_states (regexp, automaton, inside_oneof_p) /* We processes it in reverse order to get list with the same order as in the description. See also the previous commentary. */ - for (i = regexp->regexp.oneof.regexps_num - 1; i >= 0; i--) - process_alts_for_forming_states (regexp->regexp.oneof.regexps [i], + for (i = REGEXP_ONEOF (regexp)->regexps_num - 1; i >= 0; i--) + process_alts_for_forming_states (REGEXP_ONEOF (regexp)->regexps [i], automaton, 1); } } @@ -5240,7 +5482,7 @@ create_alt_states (automaton) curr_ainsn = curr_ainsn->next_ainsn) { reserv_decl = curr_ainsn->insn_reserv_decl; - if (reserv_decl != &advance_cycle_insn_decl->decl.insn_reserv) + if (reserv_decl != DECL_INSN_RESERV (advance_cycle_insn_decl)) { curr_ainsn->alt_states = NULL; process_alts_for_forming_states (reserv_decl->transformed_regexp, @@ -5273,7 +5515,7 @@ form_ainsn_with_same_reservs (automaton) curr_ainsn != NULL; curr_ainsn = curr_ainsn->next_ainsn) if (curr_ainsn->insn_reserv_decl - == &advance_cycle_insn_decl->decl.insn_reserv) + == DECL_INSN_RESERV (advance_cycle_insn_decl)) { curr_ainsn->next_same_reservs_insn = NULL; curr_ainsn->first_insn_with_same_reservs = 1; @@ -5337,7 +5579,7 @@ make_automaton (automaton) if (ainsn->first_insn_with_same_reservs) { insn_reserv_decl = ainsn->insn_reserv_decl; - if (insn_reserv_decl != &advance_cycle_insn_decl->decl.insn_reserv) + if (insn_reserv_decl != DECL_INSN_RESERV (advance_cycle_insn_decl)) { /* We process alt_states in the same order as they are present in the description. */ @@ -5404,7 +5646,7 @@ form_arcs_marked_by_insn (state) { decl = description->decls [i]; if (decl->mode == dm_insn_reserv) - decl->decl.insn_reserv.arcs_marked_by_insn = NULL; + DECL_INSN_RESERV (decl)->arcs_marked_by_insn = NULL; } for (arc = first_out_arc (state); arc != NULL; arc = next_out_arc (arc)) { @@ -5536,7 +5778,7 @@ NDFA_to_DFA (automaton) decl = description->decls [i]; if (decl->mode == dm_insn_reserv) create_composed_state - (state, decl->decl.insn_reserv.arcs_marked_by_insn, + (state, DECL_INSN_RESERV (decl)->arcs_marked_by_insn, &state_stack); } } @@ -5917,7 +6159,7 @@ set_new_cycle_flags (state) for (arc = first_out_arc (state); arc != NULL; arc = next_out_arc (arc)) if (arc->insn->insn_reserv_decl - == &advance_cycle_insn_decl->decl.insn_reserv) + == DECL_INSN_RESERV (advance_cycle_insn_decl)) arc->to_state->new_cycle_p = 1; } @@ -6207,7 +6449,7 @@ estimate_one_automaton_bound () decl = description->decls [i]; if (decl->mode == dm_unit) { - root_value = exp (log (decl->decl.unit.max_occ_cycle_num + 1.0) + root_value = exp (log (DECL_UNIT (decl)->max_occ_cycle_num + 1.0) / automata_num); if (MAX_FLOATING_POINT_VALUE_FOR_AUTOMATON_BOUND / root_value > one_automaton_estimation_bound) @@ -6224,11 +6466,11 @@ compare_max_occ_cycle_nums (unit_decl_1, unit_decl_2) const void *unit_decl_1; const void *unit_decl_2; { - if (((*(decl_t *) unit_decl_1)->decl.unit.max_occ_cycle_num) - < ((*(decl_t *) unit_decl_2)->decl.unit.max_occ_cycle_num)) + if ((DECL_UNIT (*(decl_t *) unit_decl_1)->max_occ_cycle_num) + < (DECL_UNIT (*(decl_t *) unit_decl_2)->max_occ_cycle_num)) return 1; - else if (((*(decl_t *) unit_decl_1)->decl.unit.max_occ_cycle_num) - == ((*(decl_t *) unit_decl_2)->decl.unit.max_occ_cycle_num)) + else if ((DECL_UNIT (*(decl_t *) unit_decl_1)->max_occ_cycle_num) + == (DECL_UNIT (*(decl_t *) unit_decl_2)->max_occ_cycle_num)) return 0; else return -1; @@ -6262,8 +6504,8 @@ units_to_automata_heuristic_distr () sizeof (decl_t), compare_max_occ_cycle_nums); automaton_num = 0; unit_decl_ptr = VLA_PTR_BEGIN (unit_decls); - bound_value = (*unit_decl_ptr)->decl.unit.max_occ_cycle_num; - (*unit_decl_ptr)->decl.unit.corresponding_automaton_num = automaton_num; + bound_value = DECL_UNIT (*unit_decl_ptr)->max_occ_cycle_num; + DECL_UNIT (*unit_decl_ptr)->corresponding_automaton_num = automaton_num; for (unit_decl_ptr++; unit_decl_ptr <= (decl_t *) VLA_PTR_LAST (unit_decls); unit_decl_ptr++) @@ -6276,14 +6518,14 @@ units_to_automata_heuristic_distr () && ((automata_num - automaton_num - 1 == rest_units_num) || (bound_value > (estimation_bound - / ((*unit_decl_ptr)->decl.unit.max_occ_cycle_num))))) + / (DECL_UNIT (*unit_decl_ptr)->max_occ_cycle_num))))) { - bound_value = (*unit_decl_ptr)->decl.unit.max_occ_cycle_num; + bound_value = DECL_UNIT (*unit_decl_ptr)->max_occ_cycle_num; automaton_num++; } else - bound_value *= (*unit_decl_ptr)->decl.unit.max_occ_cycle_num; - (*unit_decl_ptr)->decl.unit.corresponding_automaton_num = automaton_num; + bound_value *= DECL_UNIT (*unit_decl_ptr)->max_occ_cycle_num; + DECL_UNIT (*unit_decl_ptr)->corresponding_automaton_num = automaton_num; } if (automaton_num != automata_num - 1) abort (); @@ -6310,7 +6552,7 @@ create_ainsns () if (decl->mode == dm_insn_reserv) { curr_ainsn = create_node (sizeof (struct ainsn)); - curr_ainsn->insn_reserv_decl = &decl->decl.insn_reserv; + curr_ainsn->insn_reserv_decl = DECL_INSN_RESERV (decl); curr_ainsn->important_p = FALSE; curr_ainsn->next_ainsn = NULL; if (prev_ainsn == NULL) @@ -6336,14 +6578,14 @@ units_to_automata_distr () decl = description->decls [i]; if (decl->mode == dm_unit) { - if (decl->decl.unit.automaton_decl == NULL - || (decl->decl.unit.automaton_decl->corresponding_automaton + if (DECL_UNIT (decl)->automaton_decl == NULL + || (DECL_UNIT (decl)->automaton_decl->corresponding_automaton == NULL)) /* Distribute to the first automaton. */ - decl->decl.unit.corresponding_automaton_num = 0; + DECL_UNIT (decl)->corresponding_automaton_num = 0; else - decl->decl.unit.corresponding_automaton_num - = (decl->decl.unit.automaton_decl + DECL_UNIT (decl)->corresponding_automaton_num + = (DECL_UNIT (decl)->automaton_decl ->corresponding_automaton->automaton_order_num); } } @@ -6386,14 +6628,14 @@ create_automata () { decl = description->decls [i]; if (decl->mode == dm_automaton - && decl->decl.automaton.automaton_is_used) + && DECL_AUTOMATON (decl)->automaton_is_used) { curr_automaton = create_node (sizeof (struct automaton)); curr_automaton->ainsn_list = create_ainsns (); curr_automaton->corresponding_automaton_decl - = &decl->decl.automaton; + = DECL_AUTOMATON (decl); curr_automaton->next_automaton = NULL; - decl->decl.automaton.corresponding_automaton = curr_automaton; + DECL_AUTOMATON (decl)->corresponding_automaton = curr_automaton; curr_automaton->automaton_order_num = curr_automaton_num; if (prev_automaton == NULL) description->first_automaton = curr_automaton; @@ -6459,60 +6701,60 @@ form_regexp (regexp) if (regexp->mode == rm_unit || regexp->mode == rm_reserv) { const char *name = (regexp->mode == rm_unit - ? regexp->regexp.unit.name - : regexp->regexp.reserv.name); + ? REGEXP_UNIT (regexp)->name + : REGEXP_RESERV (regexp)->name); obstack_grow (&irp, name, strlen (name)); } else if (regexp->mode == rm_sequence) - for (i = 0; i < regexp->regexp.sequence.regexps_num; i++) + for (i = 0; i < REGEXP_SEQUENCE (regexp)->regexps_num; i++) { if (i != 0) obstack_1grow (&irp, ','); - form_regexp (regexp->regexp.sequence.regexps [i]); + form_regexp (REGEXP_SEQUENCE (regexp)->regexps [i]); } else if (regexp->mode == rm_allof) { obstack_1grow (&irp, '('); - for (i = 0; i < regexp->regexp.allof.regexps_num; i++) + for (i = 0; i < REGEXP_ALLOF (regexp)->regexps_num; i++) { if (i != 0) obstack_1grow (&irp, '+'); - if (regexp->regexp.allof.regexps[i]->mode == rm_sequence - || regexp->regexp.oneof.regexps[i]->mode == rm_oneof) + if (REGEXP_ALLOF (regexp)->regexps[i]->mode == rm_sequence + || REGEXP_ALLOF (regexp)->regexps[i]->mode == rm_oneof) obstack_1grow (&irp, '('); - form_regexp (regexp->regexp.allof.regexps [i]); - if (regexp->regexp.allof.regexps[i]->mode == rm_sequence - || regexp->regexp.oneof.regexps[i]->mode == rm_oneof) + form_regexp (REGEXP_ALLOF (regexp)->regexps [i]); + if (REGEXP_ALLOF (regexp)->regexps[i]->mode == rm_sequence + || REGEXP_ALLOF (regexp)->regexps[i]->mode == rm_oneof) obstack_1grow (&irp, ')'); } obstack_1grow (&irp, ')'); } else if (regexp->mode == rm_oneof) - for (i = 0; i < regexp->regexp.oneof.regexps_num; i++) + for (i = 0; i < REGEXP_ONEOF (regexp)->regexps_num; i++) { if (i != 0) obstack_1grow (&irp, '|'); - if (regexp->regexp.oneof.regexps[i]->mode == rm_sequence) + if (REGEXP_ONEOF (regexp)->regexps[i]->mode == rm_sequence) obstack_1grow (&irp, '('); - form_regexp (regexp->regexp.oneof.regexps [i]); - if (regexp->regexp.oneof.regexps[i]->mode == rm_sequence) + form_regexp (REGEXP_ONEOF (regexp)->regexps [i]); + if (REGEXP_ONEOF (regexp)->regexps[i]->mode == rm_sequence) obstack_1grow (&irp, ')'); } else if (regexp->mode == rm_repeat) { char digits [30]; - if (regexp->regexp.repeat.regexp->mode == rm_sequence - || regexp->regexp.repeat.regexp->mode == rm_allof - || regexp->regexp.repeat.regexp->mode == rm_oneof) + if (REGEXP_REPEAT (regexp)->regexp->mode == rm_sequence + || REGEXP_REPEAT (regexp)->regexp->mode == rm_allof + || REGEXP_REPEAT (regexp)->regexp->mode == rm_oneof) obstack_1grow (&irp, '('); - form_regexp (regexp->regexp.repeat.regexp); - if (regexp->regexp.repeat.regexp->mode == rm_sequence - || regexp->regexp.repeat.regexp->mode == rm_allof - || regexp->regexp.repeat.regexp->mode == rm_oneof) + form_regexp (REGEXP_REPEAT (regexp)->regexp); + if (REGEXP_REPEAT (regexp)->regexp->mode == rm_sequence + || REGEXP_REPEAT (regexp)->regexp->mode == rm_allof + || REGEXP_REPEAT (regexp)->regexp->mode == rm_oneof) obstack_1grow (&irp, ')'); - sprintf (digits, "*%d", regexp->regexp.repeat.repeat_num); + sprintf (digits, "*%d", REGEXP_REPEAT (regexp)->repeat_num); obstack_grow (&irp, digits, strlen (digits)); } else if (regexp->mode == rm_nothing) @@ -6602,7 +6844,7 @@ longest_path_length (state) /* Ignore cycles containing one state and `cycle advance' arcs. */ if (arc->to_state != state && (arc->insn->insn_reserv_decl - != &advance_cycle_insn_decl->decl.insn_reserv)) + != DECL_INSN_RESERV (advance_cycle_insn_decl))) { length = longest_path_length (arc->to_state); if (length > result) @@ -7457,7 +7699,7 @@ min_issue_delay_pass_states (state, ainsn) if (insn_issue_delay != -1) { if (arc->insn->insn_reserv_decl - == &advance_cycle_insn_decl->decl.insn_reserv) + == DECL_INSN_RESERV (advance_cycle_insn_decl)) insn_issue_delay++; if (min_insn_issue_delay == -1 || min_insn_issue_delay > insn_issue_delay) @@ -7614,7 +7856,7 @@ output_dead_lock_vect (automaton) VLA_HWINT (dead_lock_vect, (*state_ptr)->order_state_num) = (next_out_arc (arc) == NULL && (arc->insn->insn_reserv_decl - == &advance_cycle_insn_decl->decl.insn_reserv) ? 1 : 0); + == DECL_INSN_RESERV (advance_cycle_insn_decl)) ? 1 : 0); #ifndef NDEBUG if (VLA_HWINT (dead_lock_vect, (*state_ptr)->order_state_num)) locked_states_num++; @@ -7715,7 +7957,7 @@ output_tables () } } fprintf (output_file, "\n#define %s %d\n\n", ADVANCE_CYCLE_VALUE_NAME, - advance_cycle_insn_decl->decl.insn_reserv.insn_num); + DECL_INSN_RESERV (advance_cycle_insn_decl)->insn_num); } /* The function outputs definition and value of PHR interface variable @@ -7739,35 +7981,36 @@ static void output_insn_code_cases (output_automata_list_code) void (*output_automata_list_code) (automata_list_el_t); { - decl_t decl, decl_2; + decl_t decl, decl2; int i, j; for (i = 0; i < description->decls_num; i++) { decl = description->decls [i]; if (decl->mode == dm_insn_reserv) - decl->decl.insn_reserv.processed_p = FALSE; + DECL_INSN_RESERV (decl)->processed_p = FALSE; } for (i = 0; i < description->decls_num; i++) { decl = description->decls [i]; - if (decl->mode == dm_insn_reserv && !decl->decl.insn_reserv.processed_p) + if (decl->mode == dm_insn_reserv + && !DECL_INSN_RESERV (decl)->processed_p) { for (j = i; j < description->decls_num; j++) { - decl_2 = description->decls [j]; - if (decl_2->mode == dm_insn_reserv - && (decl_2->decl.insn_reserv.important_automata_list - == decl->decl.insn_reserv.important_automata_list)) + decl2 = description->decls [j]; + if (decl2->mode == dm_insn_reserv + && (DECL_INSN_RESERV (decl2)->important_automata_list + == DECL_INSN_RESERV (decl)->important_automata_list)) { - decl_2->decl.insn_reserv.processed_p = TRUE; + DECL_INSN_RESERV (decl2)->processed_p = TRUE; fprintf (output_file, " case %d: /* %s */\n", - decl_2->decl.insn_reserv.insn_num, - decl_2->decl.insn_reserv.name); + DECL_INSN_RESERV (decl2)->insn_num, + DECL_INSN_RESERV (decl2)->name); } } (*output_automata_list_code) - (decl->decl.insn_reserv.important_automata_list); + (DECL_INSN_RESERV (decl)->important_automata_list); } } } @@ -8278,16 +8521,16 @@ output_internal_insn_latency_func () if (decl->mode == dm_insn_reserv) { fprintf (output_file, " case %d:\n", - decl->decl.insn_reserv.insn_num); - if (decl->decl.insn_reserv.bypass_list == NULL) + DECL_INSN_RESERV (decl)->insn_num); + if (DECL_INSN_RESERV (decl)->bypass_list == NULL) fprintf (output_file, " return (%s != %s ? %d : 0);\n", INTERNAL_INSN2_CODE_NAME, ADVANCE_CYCLE_VALUE_NAME, - decl->decl.insn_reserv.default_latency); + DECL_INSN_RESERV (decl)->default_latency); else { fprintf (output_file, " switch (%s)\n {\n", INTERNAL_INSN2_CODE_NAME); - for (bypass = decl->decl.insn_reserv.bypass_list; + for (bypass = DECL_INSN_RESERV (decl)->bypass_list; bypass != NULL; bypass = bypass->next) { @@ -8301,13 +8544,13 @@ output_internal_insn_latency_func () " return (%s (%s, %s) ? %d : %d);\n", bypass->bypass_guard_name, INSN_PARAMETER_NAME, INSN2_PARAMETER_NAME, bypass->latency, - decl->decl.insn_reserv.default_latency); + DECL_INSN_RESERV (decl)->default_latency); } fprintf (output_file, " default:\n"); fprintf (output_file, " return (%s != %s ? %d : 0);\n }\n", INTERNAL_INSN2_CODE_NAME, ADVANCE_CYCLE_VALUE_NAME, - decl->decl.insn_reserv.default_latency); + DECL_INSN_RESERV (decl)->default_latency); } } @@ -8366,11 +8609,11 @@ output_print_reservation_func () if (decl->mode == dm_insn_reserv && decl != advance_cycle_insn_decl) { fprintf (output_file, - " case %d:\n", decl->decl.insn_reserv.insn_num); + " case %d:\n", DECL_INSN_RESERV (decl)->insn_num); fprintf (output_file, " fprintf (%s, \"%s\");\n break;\n", FILE_PARAMETER_NAME, - regexp_representation (decl->decl.insn_reserv.regexp)); + regexp_representation (DECL_INSN_RESERV (decl)->regexp)); finish_regexp_representation (); } } @@ -8557,25 +8800,25 @@ output_description () decl = description->decls [i]; if (decl->mode == dm_unit) { - if (decl->decl.unit.excl_list != NULL) + if (DECL_UNIT (decl)->excl_list != NULL) { fprintf (output_description_file, "unit %s exlusion_set: ", - decl->decl.unit.name); - output_unit_set_el_list (decl->decl.unit.excl_list); + DECL_UNIT (decl)->name); + output_unit_set_el_list (DECL_UNIT (decl)->excl_list); fprintf (output_description_file, "\n"); } - if (decl->decl.unit.presence_list != NULL) + if (DECL_UNIT (decl)->presence_list != NULL) { fprintf (output_description_file, "unit %s presence_set: ", - decl->decl.unit.name); - output_unit_set_el_list (decl->decl.unit.presence_list); + DECL_UNIT (decl)->name); + output_unit_set_el_list (DECL_UNIT (decl)->presence_list); fprintf (output_description_file, "\n"); } - if (decl->decl.unit.absence_list != NULL) + if (DECL_UNIT (decl)->absence_list != NULL) { fprintf (output_description_file, "unit %s absence_set: ", - decl->decl.unit.name); - output_unit_set_el_list (decl->decl.unit.absence_list); + DECL_UNIT (decl)->name); + output_unit_set_el_list (DECL_UNIT (decl)->absence_list); fprintf (output_description_file, "\n"); } } @@ -8587,24 +8830,26 @@ output_description () if (decl->mode == dm_reserv) { fprintf (output_description_file, "reservation "); - fprintf (output_description_file, decl->decl.reserv.name); + fprintf (output_description_file, DECL_RESERV (decl)->name); fprintf (output_description_file, ": "); - output_regexp (decl->decl.reserv.regexp); + output_regexp (DECL_RESERV (decl)->regexp); fprintf (output_description_file, "\n"); } else if (decl->mode == dm_insn_reserv && decl != advance_cycle_insn_decl) { fprintf (output_description_file, "insn reservation %s ", - decl->decl.insn_reserv.name); - print_rtl (output_description_file, decl->decl.insn_reserv.condexp); + DECL_INSN_RESERV (decl)->name); + print_rtl (output_description_file, + DECL_INSN_RESERV (decl)->condexp); fprintf (output_description_file, ": "); - output_regexp (decl->decl.insn_reserv.regexp); + output_regexp (DECL_INSN_RESERV (decl)->regexp); fprintf (output_description_file, "\n"); } else if (decl->mode == dm_bypass) fprintf (output_description_file, "bypass %d %s %s\n", - decl->decl.bypass.latency, decl->decl.bypass.out_insn_name, - decl->decl.bypass.in_insn_name); + DECL_BYPASS (decl)->latency, + DECL_BYPASS (decl)->out_insn_name, + DECL_BYPASS (decl)->in_insn_name); } fprintf (output_description_file, "\n\f\n"); } @@ -8644,11 +8889,11 @@ output_automaton_units (automaton) { decl = description->decls [i]; if (decl->mode == dm_unit - && (decl->decl.unit.corresponding_automaton_num + && (DECL_UNIT (decl)->corresponding_automaton_num == automaton->automaton_order_num)) { there_is_an_automaton_unit = 1; - name = decl->decl.unit.name; + name = DECL_UNIT (decl)->name; if (curr_line_length + strlen (name) + 1 > MAX_LINE_LENGTH ) { curr_line_length = strlen (name) + 4; @@ -8953,8 +9198,8 @@ generate () -/* The following function creates attribute which order number of insn - in pipeline hazard description translator. */ +/* The following function creates insn attribute whose values are + number alternatives in insn reservations. */ static void make_insn_alts_attr () { @@ -8970,10 +9215,13 @@ make_insn_alts_attr () decl = description->decls [i]; if (decl->mode == dm_insn_reserv && decl != advance_cycle_insn_decl) { - XVECEXP (condexp, 0, 2 * insn_num) = decl->decl.insn_reserv.condexp; + XVECEXP (condexp, 0, 2 * insn_num) + = DECL_INSN_RESERV (decl)->condexp; XVECEXP (condexp, 0, 2 * insn_num + 1) - = make_numeric_value (decl->decl.insn_reserv.transformed_regexp - ->regexp.oneof.regexps_num); + = make_numeric_value + (DECL_INSN_RESERV (decl)->transformed_regexp->mode != rm_oneof + ? 1 : REGEXP_ONEOF (DECL_INSN_RESERV (decl) + ->transformed_regexp)->regexps_num); insn_num++; } } @@ -8998,16 +9246,18 @@ make_internal_dfa_insn_code_attr () condexp = rtx_alloc (COND); XVEC (condexp, 0) = rtvec_alloc ((description->insns_num - 1) * 2); - XEXP (condexp, 1) = make_numeric_value (advance_cycle_insn_decl - ->decl.insn_reserv.insn_num + 1); + XEXP (condexp, 1) + = make_numeric_value (DECL_INSN_RESERV (advance_cycle_insn_decl) + ->insn_num + 1); for (i = insn_num = 0; i < description->decls_num; i++) { decl = description->decls [i]; if (decl->mode == dm_insn_reserv && decl != advance_cycle_insn_decl) { - XVECEXP (condexp, 0, 2 * insn_num) = decl->decl.insn_reserv.condexp; + XVECEXP (condexp, 0, 2 * insn_num) + = DECL_INSN_RESERV (decl)->condexp; XVECEXP (condexp, 0, 2 * insn_num + 1) - = make_numeric_value (decl->decl.insn_reserv.insn_num); + = make_numeric_value (DECL_INSN_RESERV (decl)->insn_num); insn_num++; } } @@ -9039,9 +9289,10 @@ make_default_insn_latency_attr () decl = description->decls [i]; if (decl->mode == dm_insn_reserv && decl != advance_cycle_insn_decl) { - XVECEXP (condexp, 0, 2 * insn_num) = decl->decl.insn_reserv.condexp; + XVECEXP (condexp, 0, 2 * insn_num) + = DECL_INSN_RESERV (decl)->condexp; XVECEXP (condexp, 0, 2 * insn_num + 1) - = make_numeric_value (decl->decl.insn_reserv.default_latency); + = make_numeric_value (DECL_INSN_RESERV (decl)->default_latency); insn_num++; } } @@ -9069,8 +9320,8 @@ make_bypass_attr () { decl = description->decls [i]; if (decl->mode == dm_insn_reserv - && decl->decl.insn_reserv.condexp != NULL - && decl->decl.insn_reserv.bypass_list != NULL) + && DECL_INSN_RESERV (decl)->condexp != NULL + && DECL_INSN_RESERV (decl)->bypass_list != NULL) bypass_insns_num++; } if (bypass_insns_num == 0) @@ -9085,11 +9336,11 @@ make_bypass_attr () { decl = description->decls [i]; if (decl->mode == dm_insn_reserv - && decl->decl.insn_reserv.condexp != NULL - && decl->decl.insn_reserv.bypass_list != NULL) + && DECL_INSN_RESERV (decl)->condexp != NULL + && DECL_INSN_RESERV (decl)->bypass_list != NULL) { XVECEXP (result_rtx, 0, 2 * bypass_insn) - = decl->decl.insn_reserv.condexp; + = DECL_INSN_RESERV (decl)->condexp; XVECEXP (result_rtx, 0, 2 * bypass_insn + 1) = make_numeric_value (1); bypass_insn++; @@ -9310,12 +9561,12 @@ form_important_insn_automata_lists () ainsn != NULL; ainsn = ainsn->next_ainsn) if (ainsn->important_p - && ainsn->insn_reserv_decl == &decl->decl.insn_reserv) + && ainsn->insn_reserv_decl == DECL_INSN_RESERV (decl)) { automata_list_add (automaton); break; } - decl->decl.insn_reserv.important_automata_list + DECL_INSN_RESERV (decl)->important_automata_list = automata_list_finish (); } } @@ -9338,8 +9589,8 @@ expand_automata () { description->decls [i] = VLA_PTR (decls, i); if (description->decls [i]->mode == dm_unit - && description->decls [i]->decl.unit.query_p) - description->decls [i]->decl.unit.query_num + && DECL_UNIT (description->decls [i])->query_p) + DECL_UNIT (description->decls [i])->query_num = description->query_units_num++; } all_time = create_ticker (); -- 2.30.2