GCC Middle and Back End API Reference
genautomata.c File Reference

Data Structures

struct  ticker
struct  unit_decl
struct  bypass_decl
struct  automaton_decl
struct  excl_rel_decl
struct  unit_pattern_rel_decl
struct  reserv_decl
struct  insn_reserv_decl
struct  decl
struct  unit_regexp
struct  reserv_regexp
struct  nothing_regexp
struct  sequence_regexp
struct  repeat_regexp
struct  allof_regexp
struct  oneof_regexp
struct  regexp
struct  description
struct  unit_set_el
struct  pattern_set_el
struct  pattern_reserv
struct  state
struct  arc
struct  alt_state
struct  ainsn
struct  automaton
struct  automata_list_el
struct  state_ainsn_table
struct  unit_usage

Typedefs

typedef int pos_t
typedef unsigned HOST_WIDE_INT set_el_t
typedef set_el_treserv_sets_t
typedef const set_el_tconst_reserv_sets_t
typedef struct ticker ticker_t
typedef HOST_WIDE_INT vect_el_t
typedef struct unit_declunit_decl_t
typedef struct unit_declconst_unit_decl_t
typedef struct decldecl_t
typedef struct declconst_decl_t
typedef struct regexpregexp_t
typedef struct unit_set_elunit_set_el_t
typedef struct pattern_set_elpattern_set_el_t
typedef struct pattern_reservpattern_reserv_t
typedef struct alt_statealt_state_t
typedef struct statestate_t
typedef struct stateconst_state_t
typedef struct arcarc_t
typedef struct ainsnainsn_t
typedef struct automatonautomaton_t
typedef struct automata_list_elautomata_list_el_t
typedef struct automata_list_elconst_automata_list_el_t
typedef struct state_ainsn_tablestate_ainsn_table_t
typedef vec< vect_el_tvla_hwint_t
typedef struct unit_usageunit_usage_t

Enumerations

enum  decl_mode {
  dm_unit, dm_bypass, dm_automaton, dm_excl,
  dm_presence, dm_absence, dm_reserv, dm_insn_reserv
}
enum  regexp_mode {
  rm_unit, rm_reserv, rm_nothing, rm_sequence,
  rm_repeat, rm_allof, rm_oneof
}

Functions

static regexp_t gen_regexp_sequence (const char *)
static void reserv_sets_or (reserv_sets_t, reserv_sets_t, reserv_sets_t)
static reserv_sets_t get_excl_set (reserv_sets_t)
static int check_presence_pattern_sets (reserv_sets_t, reserv_sets_t, int)
static int check_absence_pattern_sets (reserv_sets_t, reserv_sets_t, int)
static arc_t first_out_arc (const_state_t)
static arc_t next_out_arc (arc_t)
static const char * decl_name (enum decl_mode)
static void decl_mode_check_failed (enum decl_mode, const char *, const char *, int, const char *) ATTRIBUTE_NORETURN
static const char * decl_name ()
static const char * regexp_name (enum regexp_mode)
static void regexp_mode_check_failed (enum regexp_mode, const char *, const char *, int, const char *) ATTRIBUTE_NORETURN
static const char * regexp_name ()
static void * create_node ()
static void * copy_node ()
static const char * check_name ()
static char * next_sep_el ()
static int n_sep_els ()
static char ** get_str_vect ()
static void gen_cpu_unit ()
static void gen_query_cpu_unit ()
static void gen_bypass ()
static void gen_excl_set ()
static void gen_presence_absence_set ()
static void gen_presence_set ()
static void gen_final_presence_set ()
static void gen_absence_set ()
static void gen_final_absence_set ()
static void gen_automaton ()
static void gen_automata_option ()
static regexp_t gen_regexp_el ()
static regexp_t gen_regexp_repeat ()
static regexp_t gen_regexp_allof ()
static regexp_t gen_regexp_oneof ()
static regexp_t gen_regexp_sequence ()
static regexp_t gen_regexp ()
static void gen_reserv ()
static void gen_insn_reserv ()
static unsigned string_hash ()
static hashval_t automaton_decl_hash ()
static int automaton_decl_eq_p (const void *automaton_decl_1, const void *automaton_decl_2)
static decl_t insert_automaton_decl ()
static decl_t find_automaton_decl ()
static void initiate_automaton_decl_table ()
static void finish_automaton_decl_table ()
static hashval_t insn_decl_hash ()
static int insn_decl_eq_p ()
static decl_t insert_insn_decl ()
static decl_t find_insn_decl ()
static void initiate_insn_decl_table ()
static void finish_insn_decl_table ()
static hashval_t decl_hash ()
static int decl_eq_p ()
static decl_t insert_decl ()
static decl_t find_decl ()
static void initiate_decl_table ()
static void finish_decl_table ()
static unit_set_el_t process_excls ()
static void add_excls (unit_set_el_t dest_list, unit_set_el_t source_list, pos_t excl_pos)
static unit_set_el_t process_presence_absence_names (char **names, int num, pos_t req_pos, int presence_p, int final_p)
static pattern_set_el_t process_presence_absence_patterns (char ***patterns, int num, pos_t req_pos, int presence_p, int final_p)
static void add_presence_absence (unit_set_el_t dest_list, pattern_set_el_t pattern_list, pos_t req_pos, int presence_p, int final_p)
static void insert_bypass ()
static void for_each_matching_insn (decl_t bypass, const char *pattern, void(*fn)(decl_t, decl_t, void *), void *data)
static void process_bypass_2 ()
static void process_bypass_1 (decl_t bypass, decl_t in_insn_reserv, void *data)
static void process_bypass ()
static void process_decls ()
static void check_automaton_usage ()
static regexp_t process_regexp ()
static void process_regexp_decls ()
static void check_usage ()
static int loop_in_regexp ()
static void check_loops_in_regexps ()
static void process_regexp_cycles (regexp_t regexp, int max_start_cycle, int min_start_cycle, int *max_finish_cycle, int *min_finish_cycle)
static void evaluate_max_reserv_cycles ()
static void check_all_description ()
static ticker_t create_ticker ()
static void ticker_off ()
static void ticker_on ()
static int active_time ()
static void print_active_time ()
static void add_advance_cycle_insn_decl ()
static void add_collapse_ndfa_insn_decl ()
static bool special_decl_p ()
static alt_state_t get_free_alt_state ()
static void free_alt_state ()
static void free_alt_states ()
static int alt_state_cmp ()
static alt_state_t uniq_sort_alt_states ()
static int alt_states_eq ()
static void initiate_alt_states ()
static void finish_alt_states ()
static reserv_sets_t alloc_empty_reserv_sets ()
static unsigned reserv_sets_hash_value ()
static int reserv_sets_cmp ()
static int reserv_sets_eq ()
static void set_unit_reserv ()
static int test_unit_reserv ()
static int reserv_sets_are_intersected (reserv_sets_t operand_1, reserv_sets_t operand_2)
static void reserv_sets_shift ()
static void reserv_sets_and (reserv_sets_t result, reserv_sets_t operand_1, reserv_sets_t operand_2)
static void output_cycle_reservs (FILE *f, reserv_sets_t reservs, int start_cycle, int repetition_num)
static void output_reserv_sets ()
static state_t get_free_state ()
static void free_state ()
static hashval_t state_hash ()
static int state_eq_p ()
static state_t insert_state ()
static void set_state_reserv ()
static int intersected_state_reservs_p ()
static state_t states_union ()
static state_t state_shift ()
static void initiate_states ()
static void finish_states ()
static void free_arc ()
static void remove_arc ()
static arc_t find_arc ()
static void add_arc ()
static arc_t first_out_arc ()
static arc_t next_out_arc ()
static void initiate_arcs ()
static void finish_arcs ()
static automata_list_el_t get_free_automata_list_el ()
static void free_automata_list_el ()
static void free_automata_list ()
static hashval_t automata_list_hash ()
static int automata_list_eq_p ()
static void initiate_automata_lists ()
static void automata_list_start ()
static void automata_list_add ()
static automata_list_el_t automata_list_finish ()
static void finish_automata_lists ()
static void initiate_excl_sets ()
static reserv_sets_t get_excl_set ()
static pattern_reserv_t form_reserv_sets_list ()
static void initiate_presence_absence_pattern_sets ()
static regexp_t copy_insn_regexp ()
static regexp_t transform_1 ()
static regexp_t transform_2 ()
static regexp_t transform_3 ()
static regexp_t regexp_transform_func (regexp_t regexp, regexp_t(*func)(regexp_t regexp))
static regexp_t transform_regexp ()
static void transform_insn_regexps ()
static void store_alt_unit_usage (regexp_t regexp, regexp_t unit, int cycle, int alt_num)
static bool unit_present_on_list_p ()
static bool equal_alternatives_p (int alt1, int alt2, int n_alts, struct automaton_decl *excluded_automaton_decl)
static void check_regexp_units_distribution (const char *insn_reserv_name, regexp_t regexp)
static void check_unit_distributions_to_automata ()
static int process_seq_for_forming_states (regexp_t regexp, automaton_t automaton, int curr_cycle)
static void finish_forming_alt_state (alt_state_t alt_state, automaton_t automaton)
static void process_alts_for_forming_states (regexp_t regexp, automaton_t automaton, int inside_oneof_p)
static void create_alt_states ()
static void form_ainsn_with_same_reservs ()
static reserv_sets_t form_reservs_matter ()
static void make_automaton ()
static void form_arcs_marked_by_insn ()
static int create_composed_state (state_t original_state, arc_t arcs_marked_by_insn, vec< state_t > *state_stack)
static void NDFA_to_DFA ()
static void pass_state_graph (state_t start_state, void(*applied_func)(state_t state))
static void pass_states (automaton_t automaton, void(*applied_func)(state_t state))
static void initiate_pass_states ()
static void add_achieved_state ()
static void set_out_arc_insns_equiv_num ()
static void clear_arc_insns_equiv_num ()
static int first_cycle_unit_presence ()
static void cache_presence ()
static int state_is_differed (state_t state, state_t another_state, int odd_iteration_flag)
static int compare_states_for_equiv (const void *state_ptr_1, const void *state_ptr_2)
static int init_equiv_class ()
static void copy_equiv_class ()
static int partition_equiv_class (state_t first_state, int odd_iteration_flag, vec< state_t > *next_iteration_classes, int *new_equiv_class_num_ptr)
static void evaluate_equiv_classes ()
static void merge_states ()
static void set_new_cycle_flags ()
static void minimize_DFA ()
static void incr_states_and_arcs_nums ()
static void count_states_and_arcs (automaton_t automaton, int *states_num, int *arcs_num)
static void build_automaton ()
static void set_order_state_num ()
static void enumerate_states ()
static ainsn_t insert_ainsn_into_equiv_class (ainsn_t ainsn, ainsn_t cyclic_equiv_class_insn_list)
static void delete_ainsn_from_equiv_class ()
static void process_insn_equiv_class ()
static void process_state_for_insn_equiv_partition ()
static void set_insn_equiv_classes ()
static double estimate_one_automaton_bound ()
static int compare_max_occ_cycle_nums (const void *unit_decl_1, const void *unit_decl_2)
static void units_to_automata_heuristic_distr ()
static void create_ainsns ()
static void units_to_automata_distr ()
static void create_automata ()
static void form_regexp ()
static const char * regexp_representation ()
static void finish_regexp_representation ()
static void output_range_type (FILE *f, long int min_range_value, long int max_range_value)
static void output_vect ()
static void output_chip_member_name ()
static void output_temp_chip_member_name ()
static void output_translate_vect_name ()
static void output_trans_full_vect_name ()
static void output_trans_comb_vect_name ()
static void output_trans_check_vect_name ()
static void output_trans_base_vect_name ()
static void output_min_issue_delay_vect_name ()
static void output_dead_lock_vect_name ()
static void output_reserved_units_table_name ()
static void output_state_member_type ()
static void output_chip_definitions ()
static void output_translate_vect ()
static int comb_vect_p ()
static state_ainsn_table_t create_state_ainsn_table ()
static void output_state_ainsn_table (state_ainsn_table_t tab, const char *table_name, void(*output_full_vect_name_func)(FILE *, automaton_t), void(*output_comb_vect_name_func)(FILE *, automaton_t), void(*output_check_vect_name_func)(FILE *, automaton_t), void(*output_base_vect_name_func)(FILE *, automaton_t))
static void add_vect ()
static int out_state_arcs_num ()
static int compare_transition_els_num (const void *state_ptr_1, const void *state_ptr_2)
static void add_vect_el ()
static void add_states_vect_el ()
static void output_trans_table ()
static void output_min_issue_delay_table ()
static void output_dead_lock_vect ()
static void output_reserved_units_table ()
static void output_tables ()
static void output_max_insn_queue_index_def ()
static void output_insn_code_cases ((automata_list_el_t)))
static void output_automata_list_min_issue_delay_code ()
static void output_internal_min_issue_delay_func ()
static void output_automata_list_transition_code ()
static void output_internal_trans_func ()
static void output_internal_insn_code_evaluation (const char *insn_name, const char *insn_code_name, int code)
static void output_dfa_insn_code_func ()
static void output_trans_func ()
static void output_min_issue_delay_func ()
static void output_internal_dead_lock_func ()
static void output_dead_lock_func ()
static void output_internal_reset_func ()
static void output_size_func ()
static void output_reset_func ()
static void output_min_insn_conflict_delay_func ()
static void output_default_latencies ()
static void output_internal_insn_latency_func ()
static void output_internal_maximal_insn_latency_func ()
static void output_insn_latency_func ()
static void output_maximal_insn_latency_func ()
static void output_print_reservation_func ()
static int units_cmp ()
static void output_get_cpu_unit_code_func ()
static void output_cpu_unit_reservation_p ()
static void output_insn_has_dfa_reservation_p ()
static void output_dfa_clean_insn_cache_func ()
static void output_dfa_start_func ()
static void output_dfa_finish_func ()
static void output_regexp ()
static void output_unit_set_el_list ()
static void output_pattern_set_el_list ()
static void output_description ()
static void output_automaton_name ()
static void output_automaton_units ()
static void add_state_reservs ()
static void output_state_arcs ()
static int state_reservs_cmp ()
static void remove_state_duplicate_reservs ()
static void output_state ()
static void output_automaton_descriptions ()
static void output_statistics ()
static void output_time_statistics ()
static void generate ()
static const char * file_name_suffix ()
static const char * base_file_name ()
static bool parse_automata_opt ()
static void initiate_automaton_gen ()
static void check_automata_insn_issues ()
static void add_automaton_state ()
static void form_important_insn_automata_lists ()
static void expand_automata ()
static void write_automata ()
int main ()

Variables

static pos_t no_pos = 0
static struct obstack irp
static int ndfa_flag
static int collapse_flag
static int no_minimization_flag
static int no_comb_flag
static int split_argument
static int time_flag
static int stats_flag
static int v_flag
static int progress_flag
static int w_flag
static FILE * output_file
static FILE * output_description_file
static char * output_description_file_name
static struct descriptiondescription
static vec< decl_tdecls
static const char * reserv_str
static htab_t automaton_decl_table
static struct decl work_automaton_decl
static htab_t insn_decl_table
static struct decl work_insn_decl
static htab_t decl_table
static struct decl work_decl
static int curr_loop_pass_num
static int automata_num
static ticker_t transform_time
static ticker_t NDFA_time
static ticker_t NDFA_to_DFA_time
static ticker_t minimize_time
static ticker_t equiv_time
static ticker_t automaton_generation_time
static ticker_t output_time
static ticker_t check_time
static ticker_t generation_time
static ticker_t all_time
static decl_t advance_cycle_insn_decl
static decl_t collapse_ndfa_insn_decl
static alt_state_t first_free_alt_state
static int allocated_alt_states_num = 0
static int max_cycles_num
static int els_in_cycle_reserv
static int els_in_reservs
static unit_decl_tunits_array
static reserv_sets_t temp_reserv
static htab_t state_table
static state_t first_free_state
static int curr_unique_state_num
static int allocated_states_num = 0
static arc_t first_free_arc
static int allocated_arcs_num = 0
static automata_list_el_t first_free_automata_list_el
static automata_list_el_t current_automata_list
static htab_t automata_list_table
static reserv_sets_t excl_set
static reserv_sets_tunit_excl_set_table
static pattern_reserv_tunit_presence_set_table
static pattern_reserv_tunit_final_presence_set_table
static pattern_reserv_tunit_absence_set_table
static pattern_reserv_tunit_final_absence_set_table
static int regexp_transformed_p
static int annotation_message_reported_p
static vec< decl_tautomaton_decls
static struct obstack unit_usages
static vec< unit_usage_tcycle_alt_unit_usages
static state_t state_being_formed
static alt_state_t alt_state_being_formed
static ainsn_t curr_ainsn
static int curr_state_graph_pass_num
static vec< state_tall_achieved_states
static int curr_counted_states_num
static int curr_counted_arcs_num
static int curr_state_order_num
static int undefined_vect_el_value
static vec< state_toutput_states_vect
static vec< reserv_sets_tstate_reservs
static vec< state_tautomaton_states

Typedef Documentation

typedef struct ainsn* ainsn_t
typedef struct alt_state* alt_state_t
typedef struct arc* arc_t
typedef struct automaton* automaton_t
typedef struct decl* const_decl_t
typedef const set_el_t* const_reserv_sets_t
typedef struct state* const_state_t
typedef struct unit_decl* const_unit_decl_t
typedef struct decl* decl_t
typedef int pos_t
Positions in machine description file.  Now they are not used.  But
   they could be used in the future for better diagnostic messages.   
typedef struct regexp* regexp_t
Reservations of function units are represented by value of the following
   type.   
typedef unsigned HOST_WIDE_INT set_el_t
The following is element of vector of current (and planned in the
   future) functional unit reservations.   
typedef struct state* state_t
typedef struct ticker ticker_t
The ticker is represented by the following type.   
typedef struct unit_decl* unit_decl_t
The following typedefs are for brevity.   
typedef struct unit_set_el* unit_set_el_t
typedef struct unit_usage* unit_usage_t
The following type describes elements of output vectors.   
Declare vector types for various data structures:  

Enumeration Type Documentation

enum decl_mode
This page contains description of IR structure (nodes).   
Enumerator:
dm_unit 
dm_bypass 
dm_automaton 
dm_excl 
dm_presence 
dm_absence 
dm_reserv 
dm_insn_reserv 
The following structures represent parsed reservation strings.   
Enumerator:
rm_unit 
rm_reserv 
rm_nothing 
rm_sequence 
rm_repeat 
rm_allof 
rm_oneof 

Function Documentation

static int active_time ( )
static
The following function returns current time in milliseconds since
   the moment when given ticker was created.   

References ticker::incremented_off_time, and ticker::modified_creation_time.

Referenced by print_active_time().

static void add_achieved_state ( )
static
This function is called by function pass_states to add an achieved
   STATE.   

Referenced by evaluate_equiv_classes().

static void add_advance_cycle_insn_decl ( )
static
Create and record a decl for the special advance-cycle transition.   

References advance_cycle_insn_decl, description::decls, description::decls_num, dm_insn_reserv, description::insns_num, decl::mode, no_pos, and decl::pos.

Referenced by transform_insn_regexps().

static void add_arc ( )
static
The function adds arc from FROM_STATE to TO_STATE marked by AINSN,
   unless such an arc already exists.   

References ainsn::arc_exists_p, find_arc(), first_free_arc, state::first_out_arc, and state::num_out_arcs.

Referenced by create_composed_state(), make_automaton(), merge_states(), and NDFA_to_DFA().

static void add_automaton_state ( )
static
This function is called by function pass_states to add an achieved
   STATE.   

Referenced by form_important_insn_automata_lists().

static void add_collapse_ndfa_insn_decl ( )
static
Create and record a decl for the special collapse-NDFA transition.   

References collapse_ndfa_insn_decl, description::decls, description::decls_num, dm_insn_reserv, description::insns_num, decl::mode, no_pos, and decl::pos.

Referenced by transform_insn_regexps().

static void add_excls ( unit_set_el_t  dest_list,
unit_set_el_t  source_list,
pos_t  excl_pos 
)
static
The function adds each element from SOURCE_LIST to the exclusion
   list of the each element from DEST_LIST.  Checking situation "unit
   excludes itself".   

References unit_decl::automaton_name, copy(), error(), unit_decl::excl_list, unit_decl::name, unit_set_el::next_unit_set_el, and unit_set_el::unit_decl.

Referenced by process_decls().

static void add_presence_absence ( unit_set_el_t  dest_list,
pattern_set_el_t  pattern_list,
pos_t  req_pos,
int  presence_p,
int  final_p 
)
static
The function adds each element from PATTERN_LIST to presence (if
   PRESENCE_P) or absence list of the each element from DEST_LIST.
   Checking situations "unit requires own absence", and "unit excludes
   and requires presence of ...", "unit requires absence and presence
   of ...", "units in (final) presence set belong to different
   automata", and "units in (final) absence set belong to different
   automata".  Remember that we process absence sets only after all
   presence sets.   

References unit_decl::absence_list, unit_decl::automaton_name, copy(), error(), unit_decl::excl_list, unit_decl::final_absence_list, unit_decl::final_presence_list, unit_decl::name, pattern_set_el::next_pattern_set_el, unit_set_el::next_unit_set_el, unit_decl::presence_list, unit_set_el::unit_decl, pattern_set_el::unit_decls, pattern_set_el::units_num, w_flag, and warning().

Referenced by process_decls().

static void add_state_reservs ( )
static
The function forms `state_reservs' for STATE.   

References state::component_states, alt_state::next_sorted_alt_state, state::reservs, and alt_state::state.

Referenced by output_state().

static void add_states_vect_el ( )
static
The function is called by function pass_states.  The function adds
   STATE to `output_states_vect'.   

Referenced by output_dead_lock_vect(), output_min_issue_delay_table(), output_reserved_units_table(), and output_trans_table().

static void add_vect_el ( )
static
The function adds element EL_VALUE to vector VECT for a table state
   x AINSN.   

References insn_reserv_decl::equiv_class_num, and ainsn::insn_equiv_class_num.

Referenced by output_trans_table().

static reserv_sets_t alloc_empty_reserv_sets ( )
static
Allocate new reservation set.   

References irp, and memset().

Referenced by form_reserv_sets_list(), form_reservs_matter(), get_free_state(), and initiate_states().

static int alt_state_cmp ( )
static
The function compares unique numbers of alt states.   

References state::unique_num.

Referenced by alt_states_eq(), and uniq_sort_alt_states().

static int alt_states_eq ( )
static
The function checks equality of alt state lists.  Remember that the
   lists must be already sorted by the previous function.   

References alt_state_cmp(), and alt_state::next_sorted_alt_state.

Referenced by form_ainsn_with_same_reservs().

static void automata_list_add ( )
static
static int automata_list_eq_p ( )
static
Return nonzero value if the automata_lists are the same.   

References automata_list_el::automaton, and automata_list_el::next_automata_list_el.

Referenced by initiate_automata_lists().

static automata_list_el_t automata_list_finish ( )
static
The following function finishes forming the current list, inserts
   it into the table and returns it.   

References free_automata_list().

Referenced by form_important_insn_automata_lists().

static hashval_t automata_list_hash ( )
static
static void automata_list_start ( )
static
The following function starts new automata list and makes it the
   current one.   

Referenced by form_important_insn_automata_lists().

static int automaton_decl_eq_p ( const void *  automaton_decl_1,
const void *  automaton_decl_2 
)
static
The function tests automaton declarations on equality of their
   keys.  The function is used by abstract data `hashtab'.  The
   function returns 1 if the declarations have the same key, 0
   otherwise.   

References dm_automaton, and decl::mode.

Referenced by initiate_automaton_decl_table().

static hashval_t automaton_decl_hash ( )
static
This page contains abstract data `table of automaton declarations'.
   Elements of the table is nodes representing automaton declarations.
   Key of the table elements is name of given automaton.  Remember
   that automaton names have own space.   
The function evaluates hash value of an automaton declaration.  The
   function is used by abstract data `hashtab'.  The function returns
   hash value (0..UINT_MAX) of given automaton declaration.   

References dm_automaton, decl::mode, and string_hash().

Referenced by initiate_automaton_decl_table().

static const char* base_file_name ( )
static
The function returns base name of given file name, i.e. pointer to
   first char after last `/' (or `\' for WIN32) in given file name,
   given file name itself if the directory name is absent.  The
   returned string can not be changed.   

References strlen().

Referenced by initiate_automaton_gen().

static void cache_presence ( )
static
This fills in the presence_signature[] member of STATE.   

References first_cycle_unit_presence(), state::presence_signature, description::query_units_num, and description::units_num.

Referenced by evaluate_equiv_classes().

static int check_absence_pattern_sets ( reserv_sets_t  checked_set,
reserv_sets_t  original_set,
int  final_p 
)
static
The function checks that CHECKED_SET satisfies all absence pattern
   sets for units in ORIGINAL_SET.  The function returns TRUE if it
   is ok.   

References els_in_cycle_reserv, pattern_reserv::next_pattern_reserv, pattern_reserv::reserv, and description::units_num.

Referenced by reserv_sets_are_intersected().

static void check_all_description ( )
static
The following function calls functions for checking all
   description.   

References check_automaton_usage(), check_loops_in_regexps(), check_usage(), evaluate_max_reserv_cycles(), have_error, process_decls(), and process_regexp_decls().

Referenced by expand_automata().

static void check_automaton_usage ( )
static
The following function checks that declared automaton is used.  If
   the automaton is not used, the function fixes error/warning.  The
   following function must be called only after `process_decls'.   

References description::decls, description::decls_num, dm_automaton, error(), decl::mode, w_flag, and warning().

Referenced by check_all_description().

static void check_loops_in_regexps ( )
static
The following function fixes errors "cycle in definition ...".  The
   function uses function `loop_in_regexp' for that.   

References curr_loop_pass_num, description::decls, description::decls_num, dm_reserv, error(), loop_in_regexp(), and decl::mode.

Referenced by check_all_description().

static const char* check_name ( )
static
The function checks that NAME does not contain quotes (`"').   

References error().

Referenced by gen_automaton(), gen_cpu_unit(), gen_insn_reserv(), gen_query_cpu_unit(), and gen_reserv().

static int check_presence_pattern_sets ( reserv_sets_t  checked_set,
reserv_sets_t  original_set,
int  final_p 
)
static
The function checks that CHECKED_SET satisfies all presence pattern
   sets for units in ORIGINAL_SET.  The function returns TRUE if it
   is ok.   

References els_in_cycle_reserv, pattern_reserv::next_pattern_reserv, pattern_reserv::reserv, and description::units_num.

Referenced by reserv_sets_are_intersected().

static void check_regexp_units_distribution ( const char *  insn_reserv_name,
regexp_t  regexp 
)
static
static void check_unit_distributions_to_automata ( )
static
The function finds units which violates units to automata
   distribution rule.  If the units exist, report about them.   

References check_regexp_units_distribution(), description::decls, description::decls_num, dm_automaton, dm_insn_reserv, decl::mode, and progress_flag.

Referenced by expand_automata().

static void check_usage ( )
static
The following function checks that declared unit is used.  If the
   unit is not used, the function fixes errors/warnings.  The
   following function must be called only after `process_decls',
   `process_regexp_decls'.   

References description::decls, description::decls_num, dm_reserv, dm_unit, error(), decl::mode, w_flag, and warning().

Referenced by check_all_description().

static void clear_arc_insns_equiv_num ( )
static
The function clears equivalence numbers and alt_states in all insns
   which mark all out arcs of STATE.   

References first_out_arc(), and next_out_arc().

Referenced by partition_equiv_class().

static int comb_vect_p ( )
static
The following function returns nonzero value if the best
   representation of the table is comb vector.   

References state_ainsn_table::comb_vect, state_ainsn_table::full_vect, and no_comb_flag.

Referenced by output_automata_list_transition_code(), output_state_ainsn_table(), and output_statistics().

static int compare_max_occ_cycle_nums ( const void *  unit_decl_1,
const void *  unit_decl_2 
)
static
The function compares unit declarations according to their maximal
   cycle in reservations.   

Referenced by units_to_automata_heuristic_distr().

static int compare_states_for_equiv ( const void *  state_ptr_1,
const void *  state_ptr_2 
)
static
Compares two states pointed to by STATE_PTR_1 and STATE_PTR_2
   and return -1, 0 or 1.  This function can be used as predicate for
   qsort().  It requires the member presence_signature[] of both
   states be filled.   

References state::num_out_arcs, state::presence_signature, description::query_units_num, and si.

Referenced by evaluate_equiv_classes(), and init_equiv_class().

static int compare_transition_els_num ( const void *  state_ptr_1,
const void *  state_ptr_2 
)
static
Compare number of possible transitions from the states.   

References out_state_arcs_num().

Referenced by output_trans_table().

static void copy_equiv_class ( )
static
The function copies pointers to equivalent states from vla FROM
   into vla TO.   

Referenced by evaluate_equiv_classes().

static regexp_t copy_insn_regexp ( )
static
This page contains code for transformation of original reservations
   described in .md file.  The main goal of transformations is
   simplifying reservation and lifting up all `|' on the top of IR
   reservation representation.   
The following function makes copy of IR representation of
   reservation.  The function also substitutes all reservations
   defined by define_reservation by corresponding value during making
   the copy.   

References regexp::mode, reserv_decl::regexp, rm_allof, rm_nothing, rm_oneof, rm_repeat, rm_reserv, rm_sequence, and rm_unit.

Referenced by transform_1(), transform_2(), transform_3(), and transform_insn_regexps().

static void count_states_and_arcs ( automaton_t  automaton,
int *  states_num,
int *  arcs_num 
)
static
The function counts states and arcs of AUTOMATON.   

References curr_counted_arcs_num, curr_counted_states_num, incr_states_and_arcs_nums(), and pass_states().

Referenced by build_automaton().

static void create_ainsns ( )
static
The functions creates automaton insns for each automata.  Automaton
   insn is simply insn for given automaton which makes reservation
   only of units of the automaton.   

References automaton::advance_ainsn, automaton::ainsn_list, automaton::collapse_ainsn, curr_ainsn, description::decls, description::decls_num, dm_insn_reserv, ainsn::important_p, ainsn::insn_reserv_decl, decl::mode, and ainsn::next_ainsn.

Referenced by create_automata().

static int create_composed_state ( state_t  original_state,
arc_t  arcs_marked_by_insn,
vec< state_t > *  state_stack 
)
static
The function creates composed state (see comments for IR) from
   ORIGINAL_STATE and list of arcs ARCS_MARKED_BY_INSN marked by the
   same insn.  If the composed state is not in STATE_STACK yet, it is
   pushed into STATE_STACK.   

References add_arc(), collapse_flag, state::component_states, first_out_arc(), free_state(), get_free_alt_state(), get_free_state(), insert_state(), state::it_was_placed_in_stack_for_DFA_forming, ndfa_flag, alt_state::next_alt_state, next_out_arc(), alt_state::next_sorted_alt_state, remove_arc(), alt_state::state, and uniq_sort_alt_states().

Referenced by NDFA_to_DFA().

static void* create_node ( )
static
Create IR structure (node).   

References irp, and memset().

Referenced by copy_node().

static ticker_t create_ticker ( )
static
The page contains abstract data `ticker'.  This data is used to
   report time of different phases of building automata.  It is
   possibly to write a description for which automata will be built
   during several minutes even on fast machine.   
The following function creates ticker and makes it active.   

References ticker::incremented_off_time, and ticker::modified_creation_time.

Referenced by create_automata(), expand_automata(), generate(), transform_insn_regexps(), and write_automata().

static int decl_eq_p ( )
static
The function tests declarations on equality of their keys.  The
   function is used by abstract data 'hashtab'.  The function
   returns 1 if the declarations have the same key, 0 otherwise.   

References d1, d2, dm_reserv, dm_unit, and decl::mode.

Referenced by initiate_decl_table().

static hashval_t decl_hash ( )
static
This page contains abstract data `table of declarations'.  Elements
   of the table is nodes representing declarations (of units and
   reservations).  Key of the table elements is names of given
   declarations.   
The function evaluates hash value of a declaration.  The function
   is used by abstract data `hashtab'.  The function returns hash
   value (0..UINT_MAX) of given declaration.   

References dm_reserv, dm_unit, decl::mode, and string_hash().

Referenced by initiate_decl_table().

static void decl_mode_check_failed ( enum decl_mode  mode,
const char *  expected_mode_str,
const char *  file,
int  line,
const char *  func 
)
static
The function prints message about unexpected declaration and finish
   the program.   

References decl_name().

static const char* decl_name ( enum  decl_mode)
static
static const char* decl_name ( )
static
Return string representation of declaration mode MODE.   

References dm_absence, dm_automaton, dm_bypass, dm_excl, dm_insn_reserv, dm_presence, dm_reserv, and dm_unit.

static void delete_ainsn_from_equiv_class ( )
static
The function deletes equiv_class_insn into cyclic list of
   equivalent ainsns.   

References ainsn::next_equiv_class_insn.

Referenced by process_insn_equiv_class().

static void enumerate_states ( )
static
The function enumerates all states of AUTOMATON.   

References automaton::achieved_states_num, curr_state_order_num, pass_states(), and set_order_state_num().

Referenced by create_automata().

static bool equal_alternatives_p ( int  alt1,
int  alt2,
int  n_alts,
struct automaton_decl excluded_automaton_decl 
)
static
The function returns true if reservations of alternatives ALT1 and
   ALT2 are equal after excluding reservations of units of
   EXCLUDED_AUTOMATON_DECL.   

References unit_decl::automaton_decl, unit_usage::next, and unit_usage::unit_decl.

Referenced by check_regexp_units_distribution().

static double estimate_one_automaton_bound ( )
static
The function estimate size of the single DFA used by PHR (pipeline
   hazards recognizer).   

References description::decls, description::decls_num, dm_unit, exp(), log(), and decl::mode.

Referenced by units_to_automata_heuristic_distr().

static void evaluate_equiv_classes ( )
static
static void evaluate_max_reserv_cycles ( )
static
The following function is called only for correct program.  The
   function defines max reservation of insns in cycles.   

References description::decls, description::decls_num, dm_insn_reserv, description::max_insn_reserv_cycles, decl::mode, and process_regexp_cycles().

Referenced by check_all_description().

static const char* file_name_suffix ( )
static
The function returns suffix of given file name.  The returned
   string can not be changed.   

Referenced by initiate_automaton_gen().

static arc_t find_arc ( )
static
The functions returns arc with given characteristics (or NULL if
   the arc does not exist).   

References collapse_flag, first_out_arc(), ainsn::insn_reserv_decl, and next_out_arc().

Referenced by add_arc().

static decl_t find_automaton_decl ( )
static
The function searches for automaton declaration in the table with
   the same key as node representing name of the automaton
   declaration.  The function returns node found in the table, NULL if
   such node does not exist in the table.   

References automaton_decl_table, dm_automaton, decl::mode, and work_automaton_decl.

Referenced by process_decls().

static decl_t find_decl ( )
static
The function searches for declaration in the table with the same
   key as node representing name of the declaration.  The function
   returns node found in the table, NULL if such node does not exist
   in the table.   

References decl_table, dm_unit, decl::mode, and work_decl.

Referenced by process_decls(), process_excls(), process_presence_absence_names(), process_presence_absence_patterns(), and process_regexp().

static decl_t find_insn_decl ( )
static
The function searches for insn reservation declaration in the table
   with the same key as node representing name of the insn reservation
   declaration.  The function returns node found in the table, NULL if
   such node does not exist in the table.   

References dm_insn_reserv, insn_decl_table, decl::mode, and work_insn_decl.

Referenced by for_each_matching_insn().

static void finish_alt_states ( )
static
Finishing work with the abstract data.   

Referenced by finish_states().

static void finish_arcs ( )
static
Finishing work with the abstract data.   

Referenced by write_automata().

static void finish_automata_lists ( )
static
Finishing work with the abstract data.   

Referenced by write_automata().

static void finish_automaton_decl_table ( )
static
The function deletes the automaton declaration table.  Only call of
   function `initiate_automaton_decl_table' is possible immediately
   after this function call.   

References automaton_decl_table.

Referenced by write_automata().

static void finish_decl_table ( )
static
The function deletes the declaration table.  Only call of function
   `initiate_declaration_table' is possible immediately after this
   function call.   

References decl_table.

Referenced by write_automata().

static void finish_forming_alt_state ( alt_state_t  alt_state,
automaton_t  automaton 
)
static
This recursive function finishes forming ALT_STATE of AUTOMATON and
   inserts alt_state into the table.   

References free_state(), insert_state(), and alt_state::state.

Referenced by process_alts_for_forming_states().

static void finish_insn_decl_table ( )
static
The function deletes the insn declaration table.  Only call of
   function `initiate_insn_decl_table' is possible immediately after
   this function call.   

References insn_decl_table.

Referenced by write_automata().

static void finish_regexp_representation ( )
static
The function frees memory allocated for last formed string
   representation of regexp.   

References irp.

Referenced by output_print_reservation_func(), and output_regexp().

static void finish_states ( )
static
Finishing work with the abstract data.   

References finish_alt_states(), and free().

Referenced by write_automata().

static int first_cycle_unit_presence ( )
static
The following function returns TRUE if STATE reserves the unit with
   UNIT_NUM on the first cycle.   

References state::component_states, alt_state::next_sorted_alt_state, state::reservs, alt_state::state, and test_unit_reserv().

Referenced by cache_presence(), and output_reserved_units_table().

static arc_t first_out_arc ( )
static
The function returns the first arc starting from STATE.   

References state::first_out_arc.

static void for_each_matching_insn ( decl_t  bypass,
const char *  pattern,
void(*)(decl_t, decl_t, void *)  fn,
void *  data 
)
static
BYPASS is a define_bypass decl that includes glob pattern PATTERN.
   Call FN (BYPASS, INSN, DATA) for each matching instruction INSN.   

References description::decls, description::decls_num, dm_insn_reserv, error(), find_insn_decl(), decl::mode, and insn_reserv_decl::name.

Referenced by process_bypass(), and process_bypass_1().

static void form_ainsn_with_same_reservs ( )
static
The page contains major code for building DFA(s) for fast pipeline
   hazards recognition.   
The function forms list of ainsns of AUTOMATON with the same
   reservation.   

References automaton::ainsn_list, alt_states_eq(), curr_ainsn, ainsn::first_insn_with_same_reservs, ainsn::insn_reserv_decl, ainsn::next_ainsn, ainsn::next_same_reservs_insn, ainsn::sorted_alt_states, and special_decl_p().

Referenced by create_automata().

static void form_arcs_marked_by_insn ( )
static
Form lists of all arcs of STATE marked by the same ainsn.   

References description::decls, description::decls_num, dm_insn_reserv, first_out_arc(), decl::mode, and next_out_arc().

Referenced by NDFA_to_DFA().

static void form_important_insn_automata_lists ( )
static
static void form_regexp ( )
static
This page contains code for forming string representation of
   regexp.  The representation is formed on IR obstack.  So you should
   not work with IR obstack between regexp_representation and
   finish_regexp_representation calls.   
This recursive function forms string representation of regexp
   (without tailing '\0').   

References irp, regexp::mode, insn_reserv_decl::name, rm_allof, rm_nothing, rm_oneof, rm_repeat, rm_reserv, rm_sequence, rm_unit, and strlen().

Referenced by regexp_representation().

static reserv_sets_t form_reservs_matter ( )
static
Forming unit reservations which can affect creating the automaton
   states achieved from a given state.  It permits to build smaller
   automata in many cases.  We would have the same automata after
   the minimization without such optimization, but the automaton
   right after the building could be huge.  So in other words, usage
   of reservs_matter means some minimization during building the
   automaton.   

References alloc_empty_reserv_sets(), automaton::corresponding_automaton_decl, unit_decl::in_set_p, max_cycles_num, unit_decl::min_occ_cycle_num, unit_decl::query_p, set_unit_reserv(), and description::units_num.

Referenced by make_automaton().

static void free_alt_state ( )
static
The function frees node ALT_STATE.   

References first_free_alt_state, and alt_state::next_alt_state.

Referenced by free_alt_states().

static void free_alt_states ( )
static
The function frees list started with node ALT_STATE_LIST.   

References free_alt_state(), and alt_state::next_alt_state.

Referenced by free_state().

static void free_arc ( )
static
The function frees node ARC.   

References first_free_arc.

Referenced by merge_states(), and remove_arc().

static void free_automata_list ( )
static
The function frees list AUTOMATA_LIST.   

References free_automata_list_el(), and automata_list_el::next_automata_list_el.

Referenced by automata_list_finish().

static void free_automata_list_el ( )
static
The function frees node AUTOMATA_LIST_EL.   

References first_free_automata_list_el, and automata_list_el::next_automata_list_el.

Referenced by free_automata_list().

static void free_state ( )
static
static void gen_absence_set ( )
static
Process an ABSENCE_SET.

   This gives information about a cpu unit reservation requirements.
   We fill a struct unit_pattern_rel_decl (absence) with information
   used later by `expand_automata'.   

References gen_presence_absence_set().

Referenced by main().

static void gen_automata_option ( )
static
Process an AUTOMATA_OPTION.

   This gives information how to generate finite state automaton used
   for recognizing pipeline hazards.   

References collapse_flag, fatal(), ndfa_flag, no_comb_flag, no_minimization_flag, progress_flag, stats_flag, time_flag, v_flag, and w_flag.

Referenced by main().

static void gen_automaton ( )
static
Process a DEFINE_AUTOMATON.

   This gives information about a finite state automaton used for
   recognizing pipeline hazards.  We fill a struct automaton_decl
   with information used later by `expand_automata'.   

References check_name(), dm_automaton, fatal(), get_str_vect(), decl::mode, and decl::pos.

Referenced by main().

static void gen_bypass ( )
static
Process a DEFINE_BYPASS.

   This gives information about a unit contained in the CPU.  We fill
   in a struct bypass_decl with information used later by
   `expand_automata'.   

References dm_bypass, fatal(), get_str_vect(), decl::mode, and decl::pos.

Referenced by main().

static void gen_cpu_unit ( )
static
Process a DEFINE_CPU_UNIT.

   This gives information about a unit contained in CPU.  We fill a
   struct unit_decl with information used later by `expand_automata'.   

References check_name(), dm_unit, fatal(), get_str_vect(), decl::mode, and decl::pos.

Referenced by main().

static void gen_excl_set ( )
static
Process an EXCLUSION_SET.

   This gives information about a cpu unit conflicts.  We fill a
   struct excl_rel_decl (excl) with information used later by
   `expand_automata'.   

References dm_excl, fatal(), get_str_vect(), decl::mode, and decl::pos.

Referenced by main().

static void gen_final_absence_set ( )
static
Process a FINAL_ABSENCE_SET.

   This gives information about a cpu unit reservation requirements.
   We fill a struct unit_pattern_rel_decl (absence) with information
   used later by `expand_automata'.   

References gen_presence_absence_set().

Referenced by main().

static void gen_final_presence_set ( )
static
Process a FINAL_PRESENCE_SET.

   This gives information about a cpu unit reservation requirements.
   We fill a struct unit_pattern_rel_decl (presence) with information
   used later by `expand_automata'.   

References gen_presence_absence_set().

Referenced by main().

static void gen_insn_reserv ( )
static
Process a DEFINE_INSN_RESERVATION.

   This gives information about the reservation of cpu units by an
   insn.  We fill a struct insn_reserv_decl with information used
   later by `expand_automata'.   

References check_name(), dm_insn_reserv, gen_regexp(), decl::mode, and decl::pos.

Referenced by main().

static void gen_presence_absence_set ( )
static
Process a PRESENCE_SET, a FINAL_PRESENCE_SET, an ABSENCE_SET,
   FINAL_ABSENCE_SET (it is depended on PRESENCE_P and FINAL_P).

   This gives information about a cpu unit reservation requirements.
   We fill a struct unit_pattern_rel_decl with information used later
   by `expand_automata'.   

References dm_absence, dm_presence, fatal(), get_str_vect(), irp, decl::mode, and decl::pos.

Referenced by gen_absence_set(), gen_final_absence_set(), gen_final_presence_set(), and gen_presence_set().

static void gen_presence_set ( )
static
Process a PRESENCE_SET.

    This gives information about a cpu unit reservation requirements.
   We fill a struct unit_pattern_rel_decl (presence) with information
   used later by `expand_automata'.   

References gen_presence_absence_set().

Referenced by main().

static void gen_query_cpu_unit ( )
static
Process a DEFINE_QUERY_CPU_UNIT.

   This gives information about a unit contained in CPU.  We fill a
   struct unit_decl with information used later by `expand_automata'.   

References check_name(), dm_unit, fatal(), get_str_vect(), decl::mode, and decl::pos.

Referenced by main().

static regexp_t gen_regexp ( )
static
Parse construction reservation STR.   

References gen_regexp_sequence(), and reserv_str.

Referenced by gen_insn_reserv(), and gen_reserv().

static regexp_t gen_regexp_allof ( )
static
Parse reservation STR which possibly contains separator '+'.   

References fatal(), gen_regexp_repeat(), get_str_vect(), regexp::mode, reserv_str, and rm_allof.

Referenced by gen_regexp_oneof().

static regexp_t gen_regexp_el ( )
static
Parse an element in STR.   

References fatal(), gen_regexp_sequence(), len, memcpy(), regexp::mode, reserv_str, rm_nothing, rm_unit, and strlen().

Referenced by gen_regexp_repeat().

static regexp_t gen_regexp_oneof ( )
static
Parse reservation STR which possibly contains separator '|'.   

References fatal(), gen_regexp_allof(), get_str_vect(), regexp::mode, reserv_str, and rm_oneof.

Referenced by gen_regexp_sequence().

static regexp_t gen_regexp_repeat ( )
static
Parse construction `repeat' in STR.   

References fatal(), gen_regexp_el(), get_str_vect(), regexp::mode, reserv_str, and rm_repeat.

Referenced by gen_regexp_allof().

static regexp_t gen_regexp_sequence ( const char *  )
static
Forward declarations of functions used before their definitions, only.   

Referenced by gen_regexp(), and gen_regexp_el().

static regexp_t gen_regexp_sequence ( )
static
Parse reservation STR which possibly contains separator ','.   

References fatal(), gen_regexp_oneof(), get_str_vect(), regexp::mode, and rm_sequence.

static void gen_reserv ( )
static
Process a DEFINE_RESERVATION.

   This gives information about a reservation of cpu units.  We fill
   in a struct reserv_decl with information used later by
   `expand_automata'.   

References check_name(), dm_reserv, gen_regexp(), decl::mode, and decl::pos.

Referenced by main().

static void generate ( )
static
The function generates DFA (deterministic finite state automaton)
   for fast recognition of pipeline hazards.  No errors during
   checking must be fixed before this function call.   

References create_automata(), create_ticker(), initiate_arcs(), initiate_automata_lists(), initiate_excl_sets(), initiate_pass_states(), initiate_presence_absence_pattern_sets(), initiate_states(), split_argument, ticker_off(), and description::units_num.

Referenced by expand_automata().

static reserv_sets_t get_excl_set ( reserv_sets_t  )
static
static reserv_sets_t get_excl_set ( )
static
The function sets up and return EXCL_SET which is union of
   exclusion sets for each unit in IN_SET.   

References els_in_cycle_reserv, excl_set, memset(), and description::units_num.

static alt_state_t get_free_alt_state ( )
static
The following function returns free node alt_state.  It may be new
   allocated node or node freed earlier.   

References first_free_alt_state, alt_state::next_alt_state, alt_state::next_sorted_alt_state, and alt_state::state.

Referenced by create_composed_state(), merge_states(), and process_alts_for_forming_states().

static automata_list_el_t get_free_automata_list_el ( )
static
The following function returns free automata list el.  It may be
   new allocated node or node freed earlier.   

References automata_list_el::automaton, first_free_automata_list_el, and automata_list_el::next_automata_list_el.

Referenced by automata_list_add().

static state_t get_free_state ( )
static
The following function returns free node state for AUTOMATON.  It
   may be new allocated node or node freed earlier.  The function also
   allocates reservation set if WITH_RESERVS has nonzero value.   

References alloc_empty_reserv_sets(), state::automaton, state::component_states, curr_unique_state_num, first_free_state, state::first_out_arc, state::it_was_placed_in_stack_for_DFA_forming, state::it_was_placed_in_stack_for_NDFA_forming, memset(), state::next_equiv_class_state, state::reservs, and state::unique_num.

Referenced by create_composed_state(), make_automaton(), merge_states(), process_alts_for_forming_states(), state_shift(), and states_union().

static char** get_str_vect ( )
static
Given a string and a separator, return vector of strings which are
   elements in the string and number of elements through els_num.
   Take parentheses into account if PAREN_P has nonzero value.  The
   function also inserts the end marker NULL at the end of vector.
   Return 0 for the null string, -1 if parentheses are not balanced.   

References irp, n_sep_els(), and next_sep_el().

Referenced by gen_automaton(), gen_bypass(), gen_cpu_unit(), gen_excl_set(), gen_presence_absence_set(), gen_query_cpu_unit(), gen_regexp_allof(), gen_regexp_oneof(), gen_regexp_repeat(), and gen_regexp_sequence().

static void incr_states_and_arcs_nums ( )
static
The function is called by function `pass_states' to count states
   and arcs of an automaton.   

References first_out_arc(), and next_out_arc().

Referenced by count_states_and_arcs().

static int init_equiv_class ( )
static
The function makes initial partition of STATES on equivalent
   classes and saves it into CLASSES.  This function requires the input
   to be sorted via compare_states_for_equiv().   

References compare_states_for_equiv(), state::equiv_class_num_1, and state::next_equiv_class_state.

Referenced by evaluate_equiv_classes().

static void initiate_alt_states ( )
static
Initialization of the abstract data.   

Referenced by initiate_states().

static void initiate_arcs ( )
static
Initialization of the abstract data.   

Referenced by generate().

static void initiate_automata_lists ( )
static
Initialization of the abstract data.   

References automata_list_eq_p(), and automata_list_hash().

Referenced by generate().

static void initiate_automaton_decl_table ( )
static
The function creates empty automaton declaration table and node
   representing automaton declaration and used for searching automaton
   declaration with given name.  The function must be called only once
   before any work with the automaton declaration table.   

References automaton_decl_eq_p(), automaton_decl_hash(), automaton_decl_table, dm_automaton, decl::mode, and work_automaton_decl.

Referenced by initiate_automaton_gen().

static void initiate_automaton_gen ( )
static
The following is top level function to initialize the work of
   pipeline hazards description translator.   

References base_file_name(), file_name_suffix(), initiate_automaton_decl_table(), initiate_decl_table(), initiate_insn_decl_table(), irp, output_description_file, output_description_file_name, output_file, and strlen().

Referenced by main().

static void initiate_decl_table ( )
static
The function creates empty declaration table and node representing
   declaration and used for searching declaration with given name.
   The function must be called only once before any work with the
   declaration table.   

References decl_eq_p(), decl_hash(), decl_table, dm_unit, decl::mode, and work_decl.

Referenced by initiate_automaton_gen().

static void initiate_excl_sets ( )
static
static void initiate_insn_decl_table ( )
static
The function creates empty insn declaration table and node
   representing insn declaration and used for searching insn
   declaration with given name.  The function must be called only once
   before any work with the insn declaration table.   

References dm_insn_reserv, insn_decl_eq_p(), insn_decl_hash(), insn_decl_table, decl::mode, and work_insn_decl.

Referenced by initiate_automaton_gen().

static void initiate_pass_states ( )
static
The function initializes code for passing of all states.   

Referenced by generate().

static void initiate_presence_absence_pattern_sets ( )
static
static ainsn_t insert_ainsn_into_equiv_class ( ainsn_t  ainsn,
ainsn_t  cyclic_equiv_class_insn_list 
)
static
The page contains code for finding equivalent automaton insns
   (ainsns).   
The function inserts AINSN into cyclic list
   CYCLIC_EQUIV_CLASS_INSN_LIST of ainsns.   

References ainsn::next_equiv_class_insn.

Referenced by process_insn_equiv_class(), and set_insn_equiv_classes().

static decl_t insert_automaton_decl ( )
static
The function inserts automaton declaration into the table.  The
   function does nothing if an automaton declaration with the same key
   exists already in the table.  The function returns automaton
   declaration node in the table with the same key as given automaton
   declaration node.   

References automaton_decl_table.

Referenced by process_decls().

static void insert_bypass ( )
static
The function inserts BYPASS in the list of bypasses of the
   corresponding output insn.  The order of bypasses in the list is
   described in a comment for member `bypass_list' (see above).  If
   there is already the same bypass in the list the function reports
   this and does nothing.   

References bypass_decl::bypass_guard_name, insn_reserv_decl::bypass_list, error(), bypass_decl::in_insn_reserv, bypass_decl::in_pattern, last, bypass_decl::next, bypass_decl::out_insn_reserv, bypass_decl::out_pattern, w_flag, and warning().

Referenced by process_bypass_2().

static decl_t insert_decl ( )
static
The function inserts declaration into the table.  The function does
   nothing if a declaration with the same key exists already in the
   table.  The function returns declaration node in the table with the
   same key as given declaration node.   

References decl_table.

Referenced by process_decls().

static decl_t insert_insn_decl ( )
static
The function inserts insn declaration into the table.  The function
   does nothing if an insn declaration with the same key exists
   already in the table.  The function returns insn declaration node
   in the table with the same key as given insn declaration node.   

References insn_decl_table.

Referenced by process_decls().

static state_t insert_state ( )
static
Insert STATE into the state table.   

Referenced by create_composed_state(), finish_forming_alt_state(), make_automaton(), state_shift(), and states_union().

static int insn_decl_eq_p ( )
static
The function tests insn declarations on equality of their keys.
   The function is used by abstract data `hashtab'.  The function
   returns 1 if declarations have the same key, 0 otherwise.   

References dm_insn_reserv, and decl::mode.

Referenced by initiate_insn_decl_table().

static hashval_t insn_decl_hash ( )
static
This page contains abstract data `table of insn declarations'.
   Elements of the table is nodes representing insn declarations.  Key
   of the table elements is name of given insn (in corresponding
   define_insn_reservation).  Remember that insn names have own
   space.   
The function evaluates hash value of an insn declaration.  The
   function is used by abstract data `hashtab'.  The function returns
   hash value (0..UINT_MAX) of given insn declaration.   

References dm_insn_reserv, decl::mode, and string_hash().

Referenced by initiate_insn_decl_table().

static int intersected_state_reservs_p ( )
static
Return nonzero value if the deterministic states contains a
   reservation of the same cpu unit on the same cpu cycle.   

References state::automaton, reserv_sets_are_intersected(), and state::reservs.

Referenced by make_automaton().

static int loop_in_regexp ( )
static
The following recursive function returns nonzero value if REGEXP
   contains given decl or reservations in given regexp refers for
   given decl.   

References curr_loop_pass_num, dm_reserv, reserv_decl::loop_pass_num, decl::mode, regexp::mode, reserv_decl::regexp, rm_allof, rm_nothing, rm_oneof, rm_repeat, rm_reserv, rm_sequence, and rm_unit.

Referenced by check_loops_in_regexps().

static void minimize_DFA ( )
static
The top level function for minimization of deterministic
   AUTOMATON.   

References evaluate_equiv_classes(), merge_states(), pass_states(), set_new_cycle_flags(), and vNULL.

Referenced by build_automaton().

static int n_sep_els ( )
static
Given a string and a separator, return the number of separated
   elements in it, taking parentheses into account if PAR_FLAG has
   nonzero value.  Return 0 for the null string, -1 if parentheses is
   not balanced.   

Referenced by get_str_vect().

static arc_t next_out_arc ( )
static
The function returns next out arc after ARC.   
static char* next_sep_el ( )
static
Given a pointer to a (char *) and a separator, return an alloc'ed
   string containing the next separated element, taking parentheses
   into account if PAR_FLAG has nonzero value.  Advance the pointer to
   after the string scanned, or the end-of-string.  Return NULL if at
   end of string.   

References irp.

Referenced by get_str_vect().

static int out_state_arcs_num ( )
static
Return number of out arcs of STATE.   

References first_out_arc(), and next_out_arc().

Referenced by compare_transition_els_num().

static void output_automata_list_min_issue_delay_code ( )
static
static void output_automaton_descriptions ( )
static
The following function output readable representation of
   DFAs used for fast recognition of pipeline hazards.   

References description::first_automaton, automaton::next_automaton, output_automaton_name(), output_automaton_units(), output_description_file, output_state(), and pass_states().

Referenced by write_automata().

static void output_automaton_name ( )
static
static void output_automaton_units ( )
static
The function outputs units name belonging to AUTOMATON.   

References automaton::automaton_order_num, description::decls, description::decls_num, dm_unit, decl::mode, output_description_file, and strlen().

Referenced by output_automaton_descriptions().

static void output_chip_definitions ( )
static
Output definition of the structure representing current DFA(s)
   state(s).   

References description::first_automaton, automaton::next_automaton, output_chip_member_name(), output_file, and output_state_member_type().

Referenced by write_automata().

static void output_cpu_unit_reservation_p ( )
static
The following function outputs function to check reservation of cpu
   unit (its internal code will be passed as the function argument) in
   given cpu state.   

References description::first_automaton, automaton::next_automaton, output_chip_member_name(), output_file, output_reserved_units_table_name(), and description::query_units_num.

Referenced by write_automata().

static void output_cycle_reservs ( FILE *  f,
reserv_sets_t  reservs,
int  start_cycle,
int  repetition_num 
)
static
The function outputs string representation of units reservation on
   cycle START_CYCLE in the reservation set.  The function uses repeat
   construction if REPETITION_NUM > 1.   

References bitmap_bit_p(), and description::units_num.

Referenced by output_reserv_sets().

static void output_dead_lock_func ( )
static
The function outputs PHR interface function `state_dead_lock_p'.   

References output_file.

Referenced by write_automata().

static void output_dead_lock_vect ( )
static
static void output_dead_lock_vect_name ( )
static
Output name of deadlock vector for given automaton.   

References automaton::automaton_order_num, automaton::corresponding_automaton_decl, and automaton_decl::name.

Referenced by output_dead_lock_vect(), and output_internal_dead_lock_func().

static void output_default_latencies ( )
static
Output the array holding default latency values.  These are used in
   insn_latency and maximal_insn_latency function implementations.   

References collapse_flag, description::decls, description::decls_num, insn_reserv_decl::default_latency, dm_insn_reserv, insn_reserv_decl::insn_num, description::insns_num, decl::mode, description::normal_decls_num, and output_file.

Referenced by write_automata().

static void output_description ( )
static
static void output_dfa_clean_insn_cache_func ( )
static
The function outputs PHR interface functions `dfa_clean_insn_cache'
   and 'dfa_clear_single_insn_cache'.   

References output_file.

Referenced by write_automata().

static void output_dfa_finish_func ( )
static
The function outputs PHR interface function `dfa_finish'.   

References output_file.

Referenced by write_automata().

static void output_dfa_insn_code_func ( )
static
This function outputs `dfa_insn_code' and its helper function
   `dfa_insn_code_enlarge'.   

References output_file.

Referenced by write_automata().

static void output_dfa_start_func ( )
static
The function outputs PHR interface function `dfa_start'.   

References output_file.

Referenced by write_automata().

static void output_get_cpu_unit_code_func ( )
static
The following function outputs function to obtain internal cpu unit
   code by the cpu unit name.   

References free(), memcpy(), output_file, units_cmp(), and description::units_num.

Referenced by write_automata().

static void output_insn_code_cases ( (automata_list_el_t )
static
static void output_insn_has_dfa_reservation_p ( )
static
The following function outputs a function to check if insn
   has a dfa reservation.   

References output_file.

Referenced by write_automata().

static void output_insn_latency_func ( )
static
The function outputs PHR interface function `insn_latency'.   

References output_file, and output_internal_insn_code_evaluation().

Referenced by write_automata().

static void output_internal_dead_lock_func ( )
static
static void output_internal_insn_code_evaluation ( const char *  insn_name,
const char *  insn_code_name,
int  code 
)
static
Output code

  if (insn != 0)
    {
      insn_code = dfa_insn_code (insn);
      if (insn_code > DFA__ADVANCE_CYCLE)
        return code;
    }
  else
    insn_code = DFA__ADVANCE_CYCLE;

  where insn denotes INSN_NAME, insn_code denotes INSN_CODE_NAME, and
  code denotes CODE.   

References collapse_flag, and output_file.

Referenced by output_insn_latency_func(), output_maximal_insn_latency_func(), output_min_insn_conflict_delay_func(), and output_trans_func().

static void output_internal_insn_latency_func ( )
static
static void output_internal_maximal_insn_latency_func ( )
static
Output function `internal_maximum_insn_latency'.   

References description::decls, description::decls_num, dm_insn_reserv, bypass_decl::latency, decl::mode, bypass_decl::next, and output_file.

Referenced by write_automata().

static void output_internal_min_issue_delay_func ( )
static
Output function `internal_min_issue_delay'.   

References output_automata_list_min_issue_delay_code(), output_file, and output_insn_code_cases().

Referenced by write_automata().

static void output_internal_reset_func ( )
static
Output function `internal_reset'.   

References output_file.

Referenced by write_automata().

static void output_internal_trans_func ( )
static
Output function `internal_state_transition'.   

References output_automata_list_transition_code(), output_file, and output_insn_code_cases().

Referenced by write_automata().

static void output_max_insn_queue_index_def ( )
static
The function outputs definition and value of PHR interface variable
   `max_insn_queue_index'.  Its value is not less than maximal queue
   length needed for the insn scheduler.   

References description::decls, description::decls_num, dm_bypass, dm_insn_reserv, description::max_insn_reserv_cycles, decl::mode, and output_file.

Referenced by write_automata().

static void output_maximal_insn_latency_func ( )
static
The function outputs PHR interface function `maximal_insn_latency'.   

References output_file, and output_internal_insn_code_evaluation().

Referenced by write_automata().

static void output_min_insn_conflict_delay_func ( )
static
Output function `min_insn_conflict_delay'.   

References output_file, and output_internal_insn_code_evaluation().

Referenced by write_automata().

static void output_min_issue_delay_func ( )
static
Output function `min_issue_delay'.   

References output_file.

Referenced by write_automata().

static void output_min_issue_delay_vect_name ( )
static
static void output_pattern_set_el_list ( )
static
static void output_print_reservation_func ( )
static
static void output_range_type ( FILE *  f,
long int  min_range_value,
long int  max_range_value 
)
static
This page contains code for output PHR (pipeline hazards recognizer).   
The function outputs minimal C type which is sufficient for
   representation numbers in range min_range_value and
   max_range_value.  Because host machine and build machine may be
   different, we use here minimal values required by ANSI C standard
   instead of UCHAR_MAX, SHRT_MAX, SHRT_MIN, etc.  This is a good
   approximation.   

Referenced by output_dead_lock_vect(), output_min_issue_delay_table(), output_reserved_units_table(), output_state_ainsn_table(), output_state_member_type(), and output_translate_vect().

static void output_regexp ( )
static
The page contains code for output description file (readable
   representation of original description and generated DFA(s).   
The function outputs string representation of IR reservation.   

References finish_regexp_representation(), output_description_file, and regexp_representation().

Referenced by output_description().

static void output_reserv_sets ( )
static
The function outputs string representation of units reservation in
   the reservation set.   

References max_cycles_num, and output_cycle_reservs().

Referenced by output_state().

static void output_reserved_units_table ( )
static
static void output_reserved_units_table_name ( )
static
Output name of reserved units table for AUTOMATON into file F.   

References automaton::automaton_order_num, automaton::corresponding_automaton_decl, and automaton_decl::name.

Referenced by output_cpu_unit_reservation_p(), and output_reserved_units_table().

static void output_reset_func ( )
static
The function outputs PHR interface function `state_reset'.   

References output_file.

Referenced by write_automata().

static void output_size_func ( )
static
The function outputs PHR interface function `state_size'.   

References output_file.

Referenced by write_automata().

static void output_state ( )
static
The following function output readable representation of DFA(s)
   state used for fast recognition of pipeline hazards.  State is
   described by possible (current and scheduled) cpu unit
   reservations.   

References add_state_reservs(), state::new_cycle_p, state::order_state_num, output_description_file, output_reserv_sets(), output_state_arcs(), remove_state_duplicate_reservs(), and state_reservs_cmp().

Referenced by output_automaton_descriptions().

static void output_state_ainsn_table ( state_ainsn_table_t  tab,
const char *  table_name,
void(*)(FILE *, automaton_t output_full_vect_name_func,
void(*)(FILE *, automaton_t output_comb_vect_name_func,
void(*)(FILE *, automaton_t output_check_vect_name_func,
void(*)(FILE *, automaton_t output_base_vect_name_func 
)
static
static void output_state_arcs ( )
static
static void output_state_member_type ( )
static
Output C type which is used for representation of codes of states
   of AUTOMATON.   

References automaton::achieved_states_num, and output_range_type().

Referenced by output_automata_list_transition_code(), and output_chip_definitions().

static void output_tables ( )
static
static void output_temp_chip_member_name ( )
static
The following is name of temporary variable which stores state of a
   DFA for PHR.   

References output_chip_member_name().

Referenced by output_automata_list_transition_code().

static void output_time_statistics ( )
static
The function output times of work of different phases of DFA
   generator.   

References ndfa_flag, and print_active_time().

Referenced by write_automata().

static void output_trans_base_vect_name ( )
static
Output name of base vector of the transition table for given
   automaton.   

References automaton::automaton_order_num, automaton::corresponding_automaton_decl, and automaton_decl::name.

Referenced by output_automata_list_transition_code(), and output_trans_table().

static void output_trans_check_vect_name ( )
static
Output name of check vector of the transition table for given
   automaton.   

References automaton::automaton_order_num, automaton::corresponding_automaton_decl, and automaton_decl::name.

Referenced by output_automata_list_transition_code(), and output_trans_table().

static void output_trans_comb_vect_name ( )
static
Output name of comb vector of the transition table for given
   automaton.   

References automaton::automaton_order_num, automaton::corresponding_automaton_decl, and automaton_decl::name.

Referenced by output_automata_list_transition_code(), and output_trans_table().

static void output_trans_full_vect_name ( )
static
Output name for simple transition table representation.   

References automaton::automaton_order_num, automaton::corresponding_automaton_decl, and automaton_decl::name.

Referenced by output_automata_list_transition_code(), and output_trans_table().

static void output_trans_func ( )
static
The function outputs PHR interface function `state_transition'.   

References output_file, and output_internal_insn_code_evaluation().

Referenced by write_automata().

static void output_translate_vect ( )
static
The function outputs translate vector of internal insn code into
   insn equivalence class number.  The equivalence class number is
   used to access to table and vectors representing DFA(s).   

References automaton::ainsn_list, ainsn::insn_equiv_class_num, automaton::insn_equiv_classes_num, insn_reserv_decl::insn_num, ainsn::insn_reserv_decl, description::insns_num, ainsn::next_ainsn, output_file, output_range_type(), output_translate_vect_name(), and output_vect().

Referenced by output_tables().

static void output_translate_vect_name ( )
static
static void output_unit_set_el_list ( )
static
Output names of units in LIST separated by comma.   

References unit_decl::name, unit_set_el::next_unit_set_el, output_description_file, and unit_set_el::unit_decl.

Referenced by output_description().

static void output_vect ( )
static
The function outputs all initialization values of VECT.   

References output_file.

Referenced by output_dead_lock_vect(), output_min_issue_delay_table(), output_reserved_units_table(), output_state_ainsn_table(), and output_translate_vect().

static bool parse_automata_opt ( )
static
A function passed as argument to init_rtx_reader_args_cb.  It parses the
   options available for genautomata.  Returns true if the option was
   recognized.   

References collapse_flag, fatal(), ndfa_flag, no_minimization_flag, progress_flag, stats_flag, time_flag, v_flag, and w_flag.

Referenced by main().

static int partition_equiv_class ( state_t  first_state,
int  odd_iteration_flag,
vec< state_t > *  next_iteration_classes,
int *  new_equiv_class_num_ptr 
)
static
The function processes equivalence class given by its first state,
   FIRST_STATE, on odd iteration if ODD_ITERATION_FLAG.  If there
   are not equivalent states, the function partitions the class
   removing nonequivalent states and placing them in
   *NEXT_ITERATION_CLASSES, increments *NEW_EQUIV_CLASS_NUM_PTR ans
   assigns it to the state equivalence number.  If the class has been
   partitioned, the function returns nonzero value.   

References clear_arc_insns_equiv_num(), curr_state, state::equiv_class_num_1, state::equiv_class_num_2, state::next_equiv_class_state, set_out_arc_insns_equiv_num(), and state_is_differed().

Referenced by evaluate_equiv_classes().

static void pass_state_graph ( state_t  start_state,
void(*)(state_t state applied_func 
)
static
This recursive function passes all states achieved from START_STATE
   and applies APPLIED_FUNC to them.   

References curr_state_graph_pass_num, first_out_arc(), next_out_arc(), and state::pass_num.

Referenced by pass_states().

static void pass_states ( automaton_t  automaton,
void(*)(state_t state applied_func 
)
static
static void print_active_time ( )
static
The following function returns string representation of active time
   of given ticker.  The result is string representation of seconds
   with accuracy of 1/100 second.  Only result of the last call of the
   function exists.  Therefore the following code is not correct

      printf ("parser time: %s\ngeneration time: %s\n",
              active_time_string (parser_ticker),
              active_time_string (generation_ticker));

   Correct code has to be the following

      printf ("parser time: %s\n", active_time_string (parser_ticker));
      printf ("generation time: %s\n",
              active_time_string (generation_ticker));

References active_time().

Referenced by output_time_statistics(), and write_automata().

static void process_alts_for_forming_states ( regexp_t  regexp,
automaton_t  automaton,
int  inside_oneof_p 
)
static
This recursive function processes `|' in reservation REGEXP for
   forming alt_states of AUTOMATON.  List of the alt states should
   have the same order as in the description.   

References alt_state_being_formed, ainsn::alt_states, finish_forming_alt_state(), get_free_alt_state(), get_free_state(), regexp::mode, alt_state::next_alt_state, process_seq_for_forming_states(), rm_oneof, alt_state::state, and state_being_formed.

Referenced by create_alt_states().

static void process_bypass ( )
static
Process define_bypass decl BYPASS, inserting a bypass for each specific
   pair of insn reservations.   

References for_each_matching_insn(), bypass_decl::in_pattern, and process_bypass_1().

Referenced by process_decls().

static void process_bypass_1 ( decl_t  bypass,
decl_t  in_insn_reserv,
void *  data 
)
static
A subroutine of process_bypass that is called for each input
   instruction IN_INSN_RESERV.   

References for_each_matching_insn(), bypass_decl::out_pattern, and process_bypass_2().

Referenced by process_bypass().

static void process_bypass_2 ( )
static
A subroutine of process_bypass that is called for each pair
   of matching instructions.  OUT_INSN_RESERV is the output
   instruction and DATA is the input instruction.   

References bypass_decl::bypass_guard_name, bypass_decl::in_insn_reserv, bypass_decl::in_pattern, insert_bypass(), bypass_decl::latency, bypass_decl::out_insn_reserv, and bypass_decl::out_pattern.

Referenced by process_bypass_1().

static unit_set_el_t process_excls ( )
static
This page contains checker of pipeline hazard description.   
Checking NAMES in an exclusion clause vector and returning formed
   unit_set_el_list.   

References dm_unit, error(), find_decl(), decl::mode, unit_set_el::next_unit_set_el, and unit_set_el::unit_decl.

Referenced by process_decls().

static void process_insn_equiv_class ( )
static
The function processes AINSN of a state in order to find equivalent
   ainsns.  INSN_ARCS_ARRAY is table: code of insn -> out arc of the
   state.   

References curr_insn, delete_ainsn_from_equiv_class(), insert_ainsn_into_equiv_class(), insn_reserv_decl::insn_num, ainsn::insn_reserv_decl, ainsn::next_equiv_class_insn, and next_insn().

Referenced by process_state_for_insn_equiv_partition().

static unit_set_el_t process_presence_absence_names ( char **  names,
int  num,
pos_t  req_pos,
int  presence_p,
int  final_p 
)
static
Checking NAMES in presence/absence clause and returning the
   formed unit_set_el_list.  The function is called only after
   processing all exclusion sets.   

References dm_unit, error(), find_decl(), decl::mode, unit_set_el::next_unit_set_el, and unit_set_el::unit_decl.

Referenced by process_decls().

static pattern_set_el_t process_presence_absence_patterns ( char ***  patterns,
int  num,
pos_t  req_pos,
int  presence_p,
int  final_p 
)
static
Checking NAMES in patterns of a presence/absence clause and
   returning the formed pattern_set_el_list.  The function is called
   only after processing all exclusion sets.   

References dm_unit, error(), find_decl(), decl::mode, pattern_set_el::next_pattern_set_el, pattern_set_el::unit_decls, and pattern_set_el::units_num.

Referenced by process_decls().

static regexp_t process_regexp ( )
static
The following recursive function processes all regexp in order to
   fix usage of units or reservations and to fix errors of undeclared
   name.  The function may change unit_regexp onto reserv_regexp.
   Remember that reserv_regexp does not exist before the function
   call.   

References dm_reserv, dm_unit, error(), find_decl(), decl::mode, regexp::mode, regexp::pos, rm_allof, rm_nothing, rm_oneof, rm_repeat, rm_reserv, rm_sequence, and rm_unit.

Referenced by process_regexp_decls().

static void process_regexp_cycles ( regexp_t  regexp,
int  max_start_cycle,
int  min_start_cycle,
int *  max_finish_cycle,
int *  min_finish_cycle 
)
static
The function recursively processes IR of reservation and defines
   max and min cycle for reservation of unit.   

References unit_decl::max_occ_cycle_num, unit_decl::min_occ_cycle_num, regexp::mode, reserv_decl::regexp, rm_allof, rm_nothing, rm_oneof, rm_repeat, rm_reserv, rm_sequence, and rm_unit.

Referenced by evaluate_max_reserv_cycles().

static void process_regexp_decls ( )
static
The following function processes regexp of define_reservation and
   define_insn_reservation with the aid of function
   `process_regexp'.   

References description::decls, description::decls_num, dm_insn_reserv, dm_reserv, decl::mode, and process_regexp().

Referenced by check_all_description().

static int process_seq_for_forming_states ( regexp_t  regexp,
automaton_t  automaton,
int  curr_cycle 
)
static
This recursive function processes `,' and units in reservation
   REGEXP for forming alt_states of AUTOMATON.  It is believed that
   CURR_CYCLE is start cycle of all reservation REGEXP.   

References automaton::automaton_order_num, unit_decl::corresponding_automaton_num, regexp::mode, rm_allof, rm_nothing, rm_sequence, rm_unit, set_state_reserv(), and unit_decl::unit_num.

Referenced by process_alts_for_forming_states().

static void process_state_for_insn_equiv_partition ( )
static
The function processes STATE in order to find equivalent ainsns.   

References first_out_arc(), free(), description::insns_num, next_out_arc(), and process_insn_equiv_class().

Referenced by set_insn_equiv_classes().

static void regexp_mode_check_failed ( enum regexp_mode  mode,
const char *  expected_mode_str,
const char *  file,
int  line,
const char *  func 
)
static
The function prints message about unexpected regexp and finish the
   program.   

References regexp_name().

static const char* regexp_name ( enum  regexp_mode)
static
static const char* regexp_name ( )
static
Return string representation of regexp mode MODE.   

References rm_allof, rm_nothing, rm_oneof, rm_repeat, rm_reserv, rm_sequence, and rm_unit.

static const char* regexp_representation ( )
static
The function returns string representation of REGEXP on IR
   obstack.   

References form_regexp(), and irp.

Referenced by output_print_reservation_func(), and output_regexp().

static regexp_t regexp_transform_func ( regexp_t  regexp,
regexp_t(*)(regexp_t regexp func 
)
static
The function traverses IR of reservation and applies transformations
   implemented by FUNC.   

References regexp::mode, rm_allof, rm_nothing, rm_oneof, rm_repeat, rm_sequence, and rm_unit.

Referenced by transform_regexp().

static void remove_arc ( )
static
The function removes and frees ARC staring from FROM_STATE.   

References state::first_out_arc, free_arc(), and state::num_out_arcs.

Referenced by create_composed_state().

static void remove_state_duplicate_reservs ( )
static
The following function is used for sorting possible cpu unit
   reservation of a DFA state.   

References reserv_sets_cmp().

Referenced by output_state().

static void reserv_sets_and ( reserv_sets_t  result,
reserv_sets_t  operand_1,
reserv_sets_t  operand_2 
)
static
AND of the reservation sets.   

References els_in_reservs.

Referenced by state_shift(), and states_union().

static int reserv_sets_are_intersected ( reserv_sets_t  operand_1,
reserv_sets_t  operand_2 
)
static
The function checks that the reservation sets are intersected,
   i.e. there is a unit reservation on a cycle in both reservation
   sets.   

References check_absence_pattern_sets(), check_presence_pattern_sets(), els_in_cycle_reserv, els_in_reservs, get_excl_set(), and reserv_sets_or().

Referenced by intersected_state_reservs_p().

static int reserv_sets_cmp ( )
static
Comparison of given reservation sets.   

References els_in_reservs.

Referenced by remove_state_duplicate_reservs(), reserv_sets_eq(), and state_reservs_cmp().

static int reserv_sets_eq ( )
static
The function checks equality of the reservation sets.   

References reserv_sets_cmp().

Referenced by state_eq_p().

static unsigned reserv_sets_hash_value ( )
static
Hash value of reservation set.   

References els_in_reservs.

Referenced by state_hash().

static void reserv_sets_or ( reserv_sets_t  result,
reserv_sets_t  operand_1,
reserv_sets_t  operand_2 
)
static
OR of the reservation sets.   

References els_in_reservs.

Referenced by reserv_sets_are_intersected(), and states_union().

static void reserv_sets_shift ( )
static
The function sets up RESULT bits by bits of OPERAND shifted on one
   cpu cycle.  The remaining bits of OPERAND (representing the last
   cycle unit reservations) are not changed.   

References els_in_reservs.

Referenced by state_shift().

static void set_new_cycle_flags ( )
static
The function sets up new_cycle_p for states if there is arc to the
   state marked by advance_cycle_insn_decl.   

References first_out_arc(), and next_out_arc().

Referenced by minimize_DFA().

static void set_order_state_num ( )
static
The function is called by function `pass_states' for enumerating
   states.   

References curr_state_order_num, and state::order_state_num.

Referenced by enumerate_states().

static void set_out_arc_insns_equiv_num ( )
static
The function sets up equivalence numbers of insns which mark all
   out arcs of STATE by equiv_class_num_1 (if ODD_ITERATION_FLAG has
   nonzero value) or by equiv_class_num_2 of the destination state.   

References first_out_arc(), and next_out_arc().

Referenced by partition_equiv_class().

static void set_state_reserv ( )
static
Add reservation of unit with UNIT_NUM on cycle CYCLE_NUM to
   deterministic STATE.   

References state::reservs, and set_unit_reserv().

Referenced by process_seq_for_forming_states().

static void set_unit_reserv ( )
static
Set up in the reservation set that unit with UNIT_NUM is used on
   CYCLE_NUM.   

References bitmap_set_bit().

Referenced by form_reservs_matter(), and set_state_reserv().

static bool special_decl_p ( )
static
True if DECL is either of the two special decls we created.   

References collapse_flag.

Referenced by create_alt_states(), form_ainsn_with_same_reservs(), and make_automaton().

static int state_eq_p ( )
static
Return nonzero value if the states are the same.   

References alt_state::next_sorted_alt_state, reserv_sets_eq(), and alt_state::state.

Referenced by initiate_states().

static hashval_t state_hash ( )
static
Hash value of STATE.  If STATE represents deterministic state it is
   simply hash value of the corresponding reservation set.  Otherwise
   it is formed from hash values of the component deterministic
   states.  One more key is order number of state automaton.   

References automaton::automaton_order_num, alt_state::next_sorted_alt_state, reserv_sets_hash_value(), alt_state::state, and state::unique_num.

Referenced by initiate_states().

static int state_is_differed ( state_t  state,
state_t  another_state,
int  odd_iteration_flag 
)
static
The function returns nonzero value if STATE is not equivalent to
   ANOTHER_STATE from the same current partition on equivalence
   classes.  Another state has ANOTHER_STATE_OUT_ARCS_NUM number of
   output arcs.  Iteration of making equivalence partition is defined
   by ODD_ITERATION_FLAG.   

References first_out_arc(), next_out_arc(), state::num_out_arcs, state::presence_signature, description::query_units_num, and si.

Referenced by partition_equiv_class().

static int state_reservs_cmp ( )
static
The following function is used for sorting possible cpu unit
   reservation of a DFA state.   

References reserv_sets_cmp().

Referenced by output_state().

static state_t state_shift ( )
static
Return deterministic state (inserted into the table) which
   represent the automaton state is obtained from deterministic STATE
   by advancing cpu cycle and masking by RESERVS.   

References state::automaton, free_state(), get_free_state(), insert_state(), reserv_sets_and(), reserv_sets_shift(), and state::reservs.

Referenced by make_automaton().

static state_t states_union ( )
static
Return deterministic state (inserted into the table) which
   representing the automaton state which is union of reservations of
   the deterministic states masked by RESERVS.   

References state::automaton, free_state(), get_free_state(), insert_state(), reserv_sets_and(), reserv_sets_or(), and state::reservs.

Referenced by make_automaton().

static void store_alt_unit_usage ( regexp_t  regexp,
regexp_t  unit,
int  cycle,
int  alt_num 
)
static
The following function creates the structure unit_usage for UNIT on
   CYCLE in REGEXP alternative with ALT_NUM.  The structure is made
   accessed through cycle_alt_unit_usages.   

References unit_decl::last_distribution_check_cycle, regexp::mode, unit_usage::next, rm_oneof, unit_usage::unit_decl, and unit_usages.

Referenced by check_regexp_units_distribution().

static unsigned string_hash ( )
static
The function evaluates hash value (0..UINT_MAX) of string.   

Referenced by automaton_decl_hash(), decl_hash(), and insn_decl_hash().

static int test_unit_reserv ( )
static
Set up in the reservation set RESERVS that unit with UNIT_NUM is
   used on CYCLE_NUM.   

References bitmap_bit_p().

Referenced by first_cycle_unit_presence().

static void ticker_off ( )
static
The following function switches off given ticker.   

References ticker::incremented_off_time.

Referenced by build_automaton(), create_automata(), expand_automata(), generate(), transform_insn_regexps(), and write_automata().

static void ticker_on ( )
static
The following function switches on given ticker.   

References ticker::incremented_off_time, and ticker::modified_creation_time.

Referenced by build_automaton(), and create_automata().

static regexp_t transform_1 ( )
static
The function makes transformation
   A*N -> A, A, ...   

References copy_insn_regexp(), regexp::mode, regexp::pos, regexp::regexp, rm_repeat, and rm_sequence.

Referenced by transform_regexp().

static regexp_t transform_2 ( )
static
The function makes transformations
   ...,(A,B,...),C,... -> ...,A,B,...,C,...
   ...+(A+B+...)+C+... -> ...+A+B+...+C+...
   ...|(A|B|...)|C|... -> ...|A|B|...|C|...   

References copy_insn_regexp(), regexp::mode, regexp::pos, rm_allof, rm_oneof, and rm_sequence.

Referenced by transform_regexp().

static regexp_t transform_3 ( )
static
The function makes transformations
   ...,A|B|...,C,... -> (...,A,C,...)|(...,B,C,...)|...
   ...+(A|B|...)+C+... -> (...+A+C+...)|(...+B+C+...)|...
   ...+(A,B,...)+C+... -> (...+A+C+...),B,...
   ...+(A,B,...)+(C,D,...) -> (A+C),(B+D),...   

References copy_insn_regexp(), regexp::mode, regexp::pos, rm_allof, rm_nothing, rm_oneof, rm_sequence, and rm_unit.

Referenced by transform_regexp().

static void transform_insn_regexps ( )
static
static regexp_t transform_regexp ( )
static
The function applies all transformations for IR representation of
   reservation REGEXP.   

References regexp_transform_func(), transform_1(), transform_2(), and transform_3().

Referenced by transform_insn_regexps().

static alt_state_t uniq_sort_alt_states ( )
static
The function sorts ALT_STATES_LIST and removes duplicated alt
   states from the list.  The comparison key is alt state unique
   number.   

References alt_state_cmp(), and alt_state::next_alt_state.

Referenced by create_alt_states(), create_composed_state(), and merge_states().

static bool unit_present_on_list_p ( )
static
Return true if unit UNIT_DECL is present on the LIST.   

References unit_usage::next, and unit_usage::unit_decl.

Referenced by check_regexp_units_distribution().

static int units_cmp ( )
static
The following function is used to sort unit declaration by their
   names.   

References unit_decl::name.

Referenced by output_get_cpu_unit_code_func().

static void units_to_automata_distr ( )
static
The function assigns automata to units according to constructions
   `define_automaton' in the description.   

References automaton_decl::corresponding_automaton, description::decls, description::decls_num, dm_unit, and decl::mode.

Referenced by create_automata().

static void units_to_automata_heuristic_distr ( )
static
The function makes heuristic assigning automata to units.  Actually
   efficacy of the algorithm has been checked yet???  

References compare_max_occ_cycle_nums(), unit_decl::corresponding_automaton_num, description::decls, description::decls_num, dm_unit, estimate_one_automaton_bound(), free(), unit_decl::max_occ_cycle_num, decl::mode, and description::units_num.

Referenced by create_automata().


Variable Documentation

decl_t advance_cycle_insn_decl
static
Pseudo insn decl which denotes advancing cycle.   

Referenced by add_advance_cycle_insn_decl().

vec<state_t> all_achieved_states
static
The following vla is used for storing pointers to all achieved
   states.   
ticker_t all_time
static

Referenced by print_time().

int allocated_alt_states_num = 0
static
The following variables is maximal number of allocated nodes
   alt_state.   
int allocated_arcs_num = 0
static
The following variables is maximal number of allocated nodes
   `arc'.   
int allocated_states_num = 0
static
The following variables is maximal number of allocated nodes
   `state'.   
alt_state_t alt_state_being_formed
static
Current alt_state being formed.   

Referenced by process_alts_for_forming_states().

int annotation_message_reported_p
static
The following variable value is TRUE if the first annotated message
   about units to automata distribution has been output.   
htab_t automata_list_table
static
Hash table of automata lists.   
int automata_num
static
The following variable value is number of automaton which are
   really being created.  This value is defined on the base of
   argument of option `-split'.  If the variable has zero value the
   number of automata is defined by the constructions `%automaton'.
   This case occurs when option `-split' is absent or has zero
   argument.  If constructions `define_automaton' is absent only one
   automaton is created.   

Referenced by create_automata().

htab_t automaton_decl_table
static
The automaton declaration table itself is represented by the
   following variable.   

Referenced by find_automaton_decl(), finish_automaton_decl_table(), initiate_automaton_decl_table(), and insert_automaton_decl().

vec<decl_t> automaton_decls
static
The vector contains all decls which are automata.   
ticker_t automaton_generation_time
static
vec<state_t> automaton_states
static
The following vla is used for storing pointers to all achieved
   states.   
ticker_t check_time
static
The following variable values are times of
       all checking
       all generation
       all pipeline hazard translator work  
int collapse_flag
static
When making an NDFA, produce additional transitions that collapse
   NDFA state into a deterministic one suitable for querying CPU units.
   Provide avance-state transitions only for deterministic states.   

Referenced by create_composed_state(), find_arc(), gen_automata_option(), NDFA_to_DFA(), output_default_latencies(), output_internal_insn_code_evaluation(), output_print_reservation_func(), output_tables(), parse_automata_opt(), special_decl_p(), and transform_insn_regexps().

decl_t collapse_ndfa_insn_decl
static
Pseudo insn decl which denotes collapsing the NDFA state.   

Referenced by add_collapse_ndfa_insn_decl().

ainsn_t curr_ainsn
static
The following variable value is current automaton insn for whose
   reservation the alt states are created.   

Referenced by create_ainsns(), and form_ainsn_with_same_reservs().

int curr_counted_arcs_num
static

Referenced by count_states_and_arcs().

int curr_counted_states_num
static
Values of two variables are counted number of states and arcs in an
   automaton.   

Referenced by count_states_and_arcs().

int curr_loop_pass_num
static
The following variable value is number of reservation being
   processed on loop recognition.   

Referenced by check_loops_in_regexps(), and loop_in_regexp().

int curr_state_graph_pass_num
static
The following variable value is current number (1, 2, ...) of passing
   graph of states.   

Referenced by pass_state_graph().

int curr_state_order_num
static
The page contains code for enumeration  of all states of an automaton.   
Variable used for enumeration of all states of an automaton.  Its
   value is current number of automaton states.   

Referenced by enumerate_states(), and set_order_state_num().

int curr_unique_state_num
static

Referenced by get_free_state().

automata_list_el_t current_automata_list
static
The list being formed.   

Referenced by automata_list_add().

vec<unit_usage_t> cycle_alt_unit_usages
static
VLA for representation of array of pointers to unit usage
   structures.  There is an element for each combination of
   (alternative number, cycle).  Unit usages on given cycle in
   alternative with given number are referred through element with
   index equals to the cycle * number of all alternatives in the
   regexp + the alternative number.   
htab_t decl_table
static
The declaration table itself is represented by the following
   variable.   

Referenced by copy_decls_for_unworthy_types(), find_decl(), finish_decl_table(), initiate_decl_table(), and insert_decl().

vec<decl_t> decls
static
Pointers to all declarations during IR generation are stored in the
   following.   
struct description* description
static
Value of the following variable is node representing description
   being processed.  This is start point of IR.   
int els_in_cycle_reserv
static
Number of set elements (see type set_el_t) needed for
   representation of one cycle reservation.  It is depended on units
   number.   

Referenced by check_absence_pattern_sets(), check_presence_pattern_sets(), get_excl_set(), and reserv_sets_are_intersected().

int els_in_reservs
static
Number of set elements (see type set_el_t) needed for
   representation of maximal length reservation.  Deterministic
   reservation is stored as set (bit string) of length equal to the
   variable value * number of bits in set_el_t.   

Referenced by reserv_sets_and(), reserv_sets_are_intersected(), reserv_sets_cmp(), reserv_sets_hash_value(), reserv_sets_or(), and reserv_sets_shift().

ticker_t equiv_time
static
reserv_sets_t excl_set
static
The page contains abstract data for work with exclusion sets (see
   exclusion_set in file rtl.def).   
The following variable refers to an exclusion set returned by
   get_excl_set.  This is bit string of length equal to cpu units
   number.  If exclusion set for given unit contains 1 for a unit,
   then simultaneous reservation of the units is prohibited.   

Referenced by get_excl_set().

alt_state_t first_free_alt_state
static
Abstract data `alternative states' which represents
   nondeterministic nature of the description (see comments for
   structures alt_state and state).   
List of free states.   

Referenced by free_alt_state(), and get_free_alt_state().

arc_t first_free_arc
static
Abstract data `arcs'.   
List of free arcs.   

Referenced by add_arc(), and free_arc().

automata_list_el_t first_free_automata_list_el
static
Abstract data `automata lists'.   
List of free states.   

Referenced by free_automata_list_el(), and get_free_automata_list_el().

state_t first_free_state
static
Linked list of free 'state' structures to be recycled.  The
   next_equiv_class_state pointer is borrowed for a free list.   

Referenced by free_state(), and get_free_state().

ticker_t generation_time
static
htab_t insn_decl_table
static
The insn declaration table itself is represented by the following
   variable.  The table does not contain insn reservation
   declarations.   

Referenced by find_insn_decl(), finish_insn_decl_table(), initiate_insn_decl_table(), and insert_insn_decl().

int max_cycles_num
static
This page contains abstract data `state'.   
Maximal length of reservations in cycles (>= 1).   

Referenced by form_reservs_matter(), initiate_states(), and output_reserv_sets().

ticker_t minimize_time
static
int ndfa_flag
static
The following flags are set up by function `initiate_automaton_gen'.   
Make automata with nondeterministic reservation by insns (`-ndfa').   

Referenced by create_composed_state(), gen_automata_option(), make_automaton(), output_time_statistics(), and parse_automata_opt().

ticker_t NDFA_time
static
ticker_t NDFA_to_DFA_time
static
int no_comb_flag
static
Do not try to generate a comb vector (`-no-comb-vect').   

Referenced by add_vect(), comb_vect_p(), and gen_automata_option().

int no_minimization_flag
static
Do not make minimization of DFA (`-no-minimization').   

Referenced by build_automaton(), gen_automata_option(), output_statistics(), and parse_automata_opt().

pos_t no_pos = 0
static
Undefined position.   

Referenced by add_advance_cycle_insn_decl(), and add_collapse_ndfa_insn_decl().

FILE* output_description_file
static
char* output_description_file_name
static
PHR description file name.   

Referenced by initiate_automaton_gen(), and write_automata().

vec<state_t> output_states_vect
static
This is for forming vector of states of an automaton.   
ticker_t output_time
static
int progress_flag
static
Flag of output of a progress bar showing how many states were
   generated so far for automaton being processed (`-progress').   

Referenced by build_automaton(), check_unit_distributions_to_automata(), create_automata(), expand_automata(), gen_automata_option(), make_automaton(), NDFA_to_DFA(), parse_automata_opt(), transform_insn_regexps(), and write_automata().

int regexp_transformed_p
static
The following variable is set up 1 if a transformation has been
   applied.   
const char* reserv_str
static
The following string contains original reservation string being
   parsed.   

Referenced by gen_regexp(), gen_regexp_allof(), gen_regexp_el(), gen_regexp_oneof(), and gen_regexp_repeat().

int split_argument
static
Value of this variable is number of automata being generated.  The
   actual number of automata may be less this value if there is not
   sufficient number of units.  This value is defined by argument of
   option `-split' or by constructions automaton if the value is zero
   (it is default value of the argument).   

Referenced by generate().

state_t state_being_formed
static
The page contains code for building alt_states (see comments for
   IR) describing all possible insns reservations of an automaton.   
Current state being formed for which the current alt_state
   refers.   

Referenced by process_alts_for_forming_states().

vec<reserv_sets_t> state_reservs
static
The following variable is used for forming array of all possible cpu unit
   reservations described by the current DFA state.   
htab_t state_table
static
The state table itself is represented by the following variable.   
int stats_flag
static
Flag of automata statistics (`-stats').   

Referenced by gen_automata_option(), parse_automata_opt(), and write_automata().

reserv_sets_t temp_reserv
static
Temporary reservation of maximal length.   
int time_flag
static
Flag of output time statistics (`-time').   

Referenced by gen_automata_option(), parse_automata_opt(), and write_automata().

ticker_t transform_time
static
The following variable values are times of
       o transformation of regular expressions
       o building NDFA (DFA if !ndfa_flag)
       o NDFA -> DFA   (simply the same automaton if !ndfa_flag)
       o DFA minimization
       o building insn equivalence classes
       o all previous ones
       o code output  
int undefined_vect_el_value
static
The value in a table state x ainsn -> something which represents
   undefined value.   

Referenced by add_vect().

pattern_reserv_t* unit_absence_set_table
static
reserv_sets_t* unit_excl_set_table
static
The array contains exclusion sets for each unit.   
pattern_reserv_t* unit_final_absence_set_table
static
pattern_reserv_t* unit_final_presence_set_table
static
pattern_reserv_t* unit_presence_set_table
static
The page contains abstract data for work with presence/absence
   pattern sets (see presence_set/absence_set in file rtl.def).   
The following arrays contain correspondingly presence, final
   presence, absence, and final absence patterns for each unit.   
struct obstack unit_usages
static
Obstack for unit_usage structures.   

Referenced by check_regexp_units_distribution(), and store_alt_unit_usage().

unit_decl_t* units_array
static
Array of pointers to unit declarations.   
int v_flag
static
Flag of creation of description file which contains description of
   result automaton and statistics information (`-v').   

Referenced by gen_automata_option(), parse_automata_opt(), and write_automata().

int w_flag
static
Flag of generating warning instead of error for non-critical errors
   (`-w').   

Referenced by add_presence_absence(), check_automata_insn_issues(), check_automaton_usage(), check_usage(), gen_automata_option(), insert_bypass(), parse_automata_opt(), and process_decls().

struct decl work_automaton_decl
static
The following variable value is node representing automaton
   declaration.  The node used for searching automaton declaration
   with given name.   

Referenced by find_automaton_decl(), and initiate_automaton_decl_table().

struct decl work_decl
static
The following variable value is node representing declaration.  The
   node used for searching declaration with given name.   

Referenced by find_decl(), and initiate_decl_table().

struct decl work_insn_decl
static
The following variable value is node representing insn reservation
   declaration.  The node used for searching insn reservation
   declaration with given name.   

Referenced by find_insn_decl(), and initiate_insn_decl_table().