GCC Middle and Back End API Reference
genautomata.c File Reference
#include "bconfig.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "rtl.h"
#include "obstack.h"
#include "errors.h"
#include "gensupport.h"
#include <math.h>
#include "hashtab.h"
#include "vec.h"
#include "fnmatch.h"
Include dependency graph for genautomata.c:

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

Macros

#define CHAR_BIT   8
#define NO_MINIMIZATION_OPTION   "-no-minimization"
#define TIME_OPTION   "-time"
#define STATS_OPTION   "-stats"
#define V_OPTION   "-v"
#define W_OPTION   "-w"
#define NDFA_OPTION   "-ndfa"
#define COLLAPSE_OPTION   "-collapse-ndfa"
#define NO_COMB_OPTION   "-no-comb-vect"
#define PROGRESS_OPTION   "-progress"
#define DECL_UNIT(d)   (&(d)->decl.unit)
#define DECL_BYPASS(d)   (&(d)->decl.bypass)
#define DECL_AUTOMATON(d)   (&(d)->decl.automaton)
#define DECL_EXCL(d)   (&(d)->decl.excl)
#define DECL_PRESENCE(d)   (&(d)->decl.presence)
#define DECL_ABSENCE(d)   (&(d)->decl.absence)
#define DECL_RESERV(d)   (&(d)->decl.reserv)
#define DECL_INSN_RESERV(d)   (&(d)->decl.insn_reserv)
#define REGEXP_UNIT(r)   (&(r)->regexp.unit)
#define REGEXP_RESERV(r)   (&(r)->regexp.reserv)
#define REGEXP_SEQUENCE(r)   (&(r)->regexp.sequence)
#define REGEXP_REPEAT(r)   (&(r)->regexp.repeat)
#define REGEXP_ALLOF(r)   (&(r)->regexp.allof)
#define REGEXP_ONEOF(r)   (&(r)->regexp.oneof)
#define XCREATENODE(T)   ((T *) create_node (sizeof (T)))
#define XCREATENODEVEC(T, N)   ((T *) create_node (sizeof (T) * (N)))
#define XCREATENODEVAR(T, S)   ((T *) create_node ((S)))
#define XCOPYNODE(T, P)   ((T *) copy_node ((P), sizeof (T)))
#define XCOPYNODEVEC(T, P, N)   ((T *) copy_node ((P), sizeof (T) * (N)))
#define XCOPYNODEVAR(T, P, S)   ((T *) copy_node ((P), (S)))
#define NOTHING_NAME   "nothing"
#define bitmap_set_bit(bitstring, bitno)
#define CLEAR_BIT(bitstring, bitno)
#define bitmap_bit_p(bitstring, bitno)
#define MAX_FLOATING_POINT_VALUE_FOR_AUTOMATON_BOUND   1.0E37
#define CHIP_NAME   "DFA_chip"
#define ADVANCE_CYCLE_VALUE_NAME   "DFA__ADVANCE_CYCLE"
#define COLLAPSE_NDFA_VALUE_NAME   "NDFA__COLLAPSE"
#define CPU_UNITS_QUERY_MACRO_NAME   "CPU_UNITS_QUERY"
#define INTERNAL_MIN_ISSUE_DELAY_FUNC_NAME   "internal_min_issue_delay"
#define STATE_TYPE_NAME   "state_t"
#define INTERNAL_TRANSITION_FUNC_NAME   "internal_state_transition"
#define INTERNAL_RESET_FUNC_NAME   "internal_reset"
#define INTERNAL_DEAD_LOCK_FUNC_NAME   "internal_state_dead_lock_p"
#define INTERNAL_INSN_LATENCY_FUNC_NAME   "internal_insn_latency"
#define DFA_INSN_CODES_VARIABLE_NAME   "dfa_insn_codes"
#define DFA_INSN_CODES_LENGTH_VARIABLE_NAME   "dfa_insn_codes_length"
#define SIZE_FUNC_NAME   "state_size"
#define TRANSITION_FUNC_NAME   "state_transition"
#define MIN_ISSUE_DELAY_FUNC_NAME   "min_issue_delay"
#define MIN_INSN_CONFLICT_DELAY_FUNC_NAME   "min_insn_conflict_delay"
#define DEAD_LOCK_FUNC_NAME   "state_dead_lock_p"
#define RESET_FUNC_NAME   "state_reset"
#define INSN_LATENCY_FUNC_NAME   "insn_latency"
#define PRINT_RESERVATION_FUNC_NAME   "print_reservation"
#define GET_CPU_UNIT_CODE_FUNC_NAME   "get_cpu_unit_code"
#define CPU_UNIT_RESERVATION_P_FUNC_NAME   "cpu_unit_reservation_p"
#define INSN_HAS_DFA_RESERVATION_P_FUNC_NAME   "insn_has_dfa_reservation_p"
#define DFA_CLEAN_INSN_CACHE_FUNC_NAME   "dfa_clean_insn_cache"
#define DFA_CLEAR_SINGLE_INSN_CACHE_FUNC_NAME   "dfa_clear_single_insn_cache"
#define DFA_START_FUNC_NAME   "dfa_start"
#define DFA_FINISH_FUNC_NAME   "dfa_finish"
#define STATE_NAME   "state"
#define INSN_PARAMETER_NAME   "insn"
#define INSN2_PARAMETER_NAME   "insn2"
#define CHIP_PARAMETER_NAME   "chip"
#define FILE_PARAMETER_NAME   "f"
#define CPU_UNIT_NAME_PARAMETER_NAME   "cpu_unit_name"
#define CPU_CODE_PARAMETER_NAME   "cpu_unit_code"
#define INTERNAL_INSN_CODE_NAME   "insn_code"
#define INTERNAL_INSN2_CODE_NAME   "insn2_code"
#define TEMPORARY_VARIABLE_NAME   "temp"
#define I_VARIABLE_NAME   "i"
#define RESULT_VARIABLE_NAME   "res"
#define INTERNAL_DFA_INSN_CODE_FUNC_NAME   "internal_dfa_insn_code"
#define DFA_INSN_CODE_FUNC_NAME   "dfa_insn_code"
#define NAME_CODE_STRUCT_NAME   "name_code"
#define NAME_CODE_TABLE_NAME   "name_code_table"
#define NAME_MEMBER_NAME   "name"
#define CODE_MEMBER_NAME   "code"
#define CMP_VARIABLE_NAME   "cmp"
#define LOW_VARIABLE_NAME   "l"
#define MIDDLE_VARIABLE_NAME   "m"
#define HIGH_VARIABLE_NAME   "h"
#define MAX_LINE_LENGTH   70
#define STANDARD_OUTPUT_DESCRIPTION_FILE_SUFFIX   ".dfa"

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 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

Macro Definition Documentation

#define ADVANCE_CYCLE_VALUE_NAME   "DFA__ADVANCE_CYCLE"

This is name of macro value which is code of pseudo_insns representing advancing cpu cycle and collapsing the NDFA. Its value is used as internal code unknown insn.

Referenced by output_min_issue_delay_table().

#define bitmap_bit_p (   bitstring,
  bitno 
)
Value:
((bitstring)[(bitno) / (sizeof (*(bitstring)) * CHAR_BIT)] >> \
(bitno) % (sizeof (*(bitstring)) * CHAR_BIT) & 1)

Test if bit number bitno in the bitstring is set. The macro is not side effect proof.

Referenced by add_label_notes(), add_mem_for_addr(), add_new_name_mapping(), bitmap_insert_into_set_1(), bitmap_set_and(), bucket_allocno_compare_func(), cfg_blocks_empty_p(), check_va_list_escapes(), child_would_conflict_in_lacc(), compute_builtin_object_size(), cond_expr_object_size(), dead_debug_add(), dead_debug_global_insert(), delete_allocno_from_bucket(), determine_common_wider_type(), df_create_unused_note(), df_live_verify_solution_end(), df_rd_bb_local_compute_process_def(), df_remove_dead_eq_notes(), df_set_bb_dirty(), df_word_lr_add_problem(), do_coloring(), dse_step3(), dump_live_info(), dump_split_point(), dump_tm_memopt_sets(), elim_unvisited_predecessor(), eliminate_build(), find_identical_invariants(), find_if_case_2(), find_matching_predicate_in_rest_chains(), find_replaceable_in_bb(), find_src_set_src(), find_va_list_reference(), foll_in_subgraph(), get_constant_value_id(), get_local_debug_decl(), get_rtx_for_ssa_name(), implicit_set_cond_p(), initialize_root_vars_lm(), insert_store(), invalidate_insn_data_regno_info(), ipa_tm_create_version(), ipa_tm_scan_calls_transaction(), ipa_tm_scan_irr_block(), ipa_uninstrument_transaction(), link_roots(), live_track_remove_partition(), lower_omp_target(), lra_push_insn_and_update_insn_regno_info(), lra_push_insn_by_uid(), make_pass_build_ssa(), mark_ref_regs(), mark_use_interesting(), non_rewritable_mem_ref_base(), one_pre_gcse_pass(), phi_translate(), pre_and_rev_post_order_compute(), predict_paths_for_bb(), record_uses(), reg_classes_intersect_p(), register_edge_assert_for_1(), remap_decl_1(), remove_eh_landing_pad(), remove_pseudos(), reset_debug_uses(), resolve_reg_notes(), setup_reg_equiv(), split_function(), stmt_kills_ref_p_1(), substitute_pseudo(), thread_prologue_and_epilogue_insns(), tm_memopt_accumulate_memops(), try_replace_reg(), unchecked_make_edge(), unite_pointer_equivalences(), update_call_expr(), and vect_supported_load_permutation_p().

#define bitmap_set_bit (   bitstring,
  bitno 
)
Value:
((bitstring)[(bitno) / (sizeof (*(bitstring)) * CHAR_BIT)] |= \
(HOST_WIDE_INT)1 << (bitno) % (sizeof (*(bitstring)) * CHAR_BIT))

The page contains macros for work with bits strings. We could use standard gcc bitmap or sbitmap but it would result in difficulties of building canadian cross. Set bit number bitno in the bit string. The macro is not side effect proof.

Referenced by add_exit_phis(), add_stack_var_conflict(), alloc_cprop_mem(), build_access_from_expr_1(), build_and_add_sum(), build_succ_graph(), check_forbidden_calls(), coalesce_partitions(), coalesced_pseudo_reg_slot_compare(), compute_always_reached(), compute_builtin_object_size(), compute_code_hoist_vbeinout(), compute_out(), compute_partial_antic_aux(), cond_expr_object_size(), constraint_expr_less(), create_component_ref_by_pieces(), create_outofssa_var_map(), delete_dead_store_insn(), determine_common_wider_type(), df_chain_remove_problem(), df_get_bb_info(), df_get_regular_block_artificial_uses(), df_live_alloc(), df_live_verify_solution_end(), df_live_verify_solution_start(), df_mark_reg(), df_note_add_problem(), df_rd_bb_local_compute_process_def(), df_set_bb_dirty(), df_set_dead_notes_for_mw(), df_simulate_find_defs(), dfs_enumerate_from(), dfs_find_deadend(), disqualify_ops_if_throwing_stmt(), do_goto_redirection(), do_sd_constraint(), dse_optimize_stmt(), dump_split_point(), dump_update_ssa(), eliminate_build(), eq_rename_map_elts(), fill_sons_in_loop(), find_arc(), find_decomposable_subregs(), find_exits(), find_identical_invariants(), find_matching_predicate_in_rest_chains(), find_refs_for_sm(), find_same_succ(), find_src_set_src(), finish_states(), free_chain_data(), free_code_hoist_mem(), free_cprop_mem(), free_gcse_mem(), free_scc_info(), free_topo_info(), get_common_info(), get_continuation_for_phi(), get_free_alt_state(), inhibit_phi_insertion(), initialize_flags_in_bb(), insert_move_for_subreg(), insert_store(), invalidate_insn_data_regno_info(), ipa_reference_get_not_written_global(), ipa_tm_create_version(), ipa_tm_scan_calls_transaction(), ipa_uninstrument_transaction(), ira_create_object(), kill_expr(), loe_visit_block(), lra_setup_reg_renumber(), make_dependent_on_partition(), make_edges(), maybe_optimize_var(), merge_identical_invariants(), merge_node_constraints(), merge_pseudos(), new_live_track(), non_rewritable_mem_ref_base(), optimize_stmt(), partition_view_bitmap(), print_exprs(), print_insn_chains(), print_loop(), print_worklist(), propagate_rhs_into_lhs(), ref_indep_loop_p_1(), register_edge_assert_for(), register_edge_assert_for_1(), regstat_get_setjmp_crosses(), remove_pseudos(), remove_stmt_or_phi(), remove_uneccesary_loop_nodes_from_loop_tree(), rewrite_use_nonlinear_expr(), rtx_moveable_p(), same_phi_alternatives_1(), set_livein_block(), set_var_live_on_entry(), setup_reg_equiv(), setup_try_hard_regno_pseudos(), split_function(), ssa_conflicts_add_one(), stmt_kills_ref_p_1(), strlen_optimize_stmt(), thread_through_normal_block(), unchecked_make_edge(), update_lives(), update_profiling_info(), valid_in_sets(), vect_supported_load_permutation_p(), version_to_be_replaced_p(), vop_phi(), and vrp_operand_equal_p().

#define CHAR_BIT   8

Pipeline hazard description translator. Copyright (C) 2000-2013 Free Software Foundation, Inc.

Written by Vladimir Makarov vmaka.nosp@m.rov@.nosp@m.redha.nosp@m.t.co.nosp@m.m

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/. References:

  1. The finite state automaton based pipeline hazard recognizer and instruction scheduler in GCC. V. Makarov. Proceedings of GCC summit, 2003.
  1. Detecting pipeline structural hazards quickly. T. Proebsting, C. Fraser. Proceedings of ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 280–286, 1994.

    This article is a good start point to understand usage of finite state automata for pipeline hazard recognizers. But I'd recommend the 1st and 3rd article for more deep understanding.

  1. Efficient Instruction Scheduling Using Finite State Automata: V. Bala and N. Rubin, Proceedings of MICRO-28. This is the best article about usage of finite state automata for pipeline hazard recognizers.

The current implementation is described in the 1st article and it is different from the 3rd article in the following:

  1. New operator `|' (alternative) is permitted in functional unit reservation which can be treated deterministically and non-deterministically.
  1. Possibility of usage of nondeterministic automata too.
  1. Possibility to query functional unit reservations for given automaton state.
  1. Several constructions to describe impossible reservations (`exclusion_set', `presence_set', `final_presence_set', `absence_set', and `final_absence_set').
  1. No reverse automata are generated. Trace instruction scheduling requires this. It can be easily added in the future if we really need this.
  1. Union of automaton states are not generated yet. It is planned to be implemented. Such feature is needed to make more accurate interlock insn scheduling to get state describing functional unit reservation in a joint CFG point. This file code processes constructions of machine description file which describes automaton used for recognition of processor pipeline hazards by insn scheduler and can be used for other tasks (such as VLIW insn packing.

The translator functions `gen_cpu_unit', `gen_query_cpu_unit', `gen_bypass', `gen_excl_set', `gen_presence_set', `gen_final_presence_set', `gen_absence_set', `gen_final_absence_set', `gen_automaton', `gen_automata_option', `gen_reserv', `gen_insn_reserv' are called from file `genattrtab.c'. They transform RTL constructions describing automata in .md file into internal representation convenient for further processing.

The translator major function `expand_automata' processes the description internal representation into finite state automaton. It can be divided on:

o checking correctness of the automaton pipeline description (major function is `check_all_description').

o generating automaton (automata) from the description (major function is `make_automaton').

o optional transformation of nondeterministic finite state automata into deterministic ones if the alternative operator `|' is treated nondeterministically in the description (major function is NDFA_to_DFA).

o optional minimization of the finite state automata by merging equivalent automaton states (major function is `minimize_DFA').

o forming tables (some as comb vectors) and attributes representing the automata (functions output_..._table).

Function `write_automata' outputs the created finite state automaton as different tables and functions which works with the automata to inquire automaton state and to change its state. These function are used by gcc instruction scheduler and may be some other gcc code.

Referenced by add_advance_cycle_insn_decl(), constant_pointer_difference(), ffs_hwi(), fold_builtin_sprintf_chk_1(), form_reservs_matter(), free_automata_list_el(), gen_regexp_el(), get_free_alt_state(), and insert_float().

#define CHIP_NAME   "DFA_chip"

The following is name of the structure which represents DFA(s) for PHR.

Referenced by output_internal_insn_code_evaluation().

#define CHIP_PARAMETER_NAME   "chip"
#define CLEAR_BIT (   bitstring,
  bitno 
)
Value:
((bitstring)[(bitno) / (sizeof (*(bitstring)) * CHAR_BIT)] &= \
~((HOST_WIDE_INT)1 << (bitno) % (sizeof (*(bitstring)) * CHAR_BIT)))
#define CMP_VARIABLE_NAME   "cmp"

The following macro values are local variable names for function `get_cpu_unit_code'.

#define CODE_MEMBER_NAME   "code"
#define COLLAPSE_NDFA_VALUE_NAME   "NDFA__COLLAPSE"
#define COLLAPSE_OPTION   "-collapse-ndfa"
#define CPU_CODE_PARAMETER_NAME   "cpu_unit_code"
#define CPU_UNIT_NAME_PARAMETER_NAME   "cpu_unit_name"
#define CPU_UNIT_RESERVATION_P_FUNC_NAME   "cpu_unit_reservation_p"
#define CPU_UNITS_QUERY_MACRO_NAME   "CPU_UNITS_QUERY"

Name of the PHR interface macro.

#define DEAD_LOCK_FUNC_NAME   "state_dead_lock_p"
#define DECL_ABSENCE (   d)    (&(d)->decl.absence)
#define DECL_AUTOMATON (   d)    (&(d)->decl.automaton)
#define DECL_BYPASS (   d)    (&(d)->decl.bypass)
#define DECL_EXCL (   d)    (&(d)->decl.excl)
#define DECL_INSN_RESERV (   d)    (&(d)->decl.insn_reserv)
#define DECL_PRESENCE (   d)    (&(d)->decl.presence)
#define DECL_RESERV (   d)    (&(d)->decl.reserv)
#define DECL_UNIT (   d)    (&(d)->decl.unit)

Macros to access members of unions. Use only them for access to union members of declarations and regexps.

Referenced by add_arc(), evaluate_equiv_classes(), output_internal_insn_latency_func(), output_internal_reset_func(), output_reset_func(), and process_bypass().

#define DFA_CLEAN_INSN_CACHE_FUNC_NAME   "dfa_clean_insn_cache"

Referenced by output_trans_func().

#define DFA_CLEAR_SINGLE_INSN_CACHE_FUNC_NAME   "dfa_clear_single_insn_cache"
#define DFA_FINISH_FUNC_NAME   "dfa_finish"
#define DFA_INSN_CODE_FUNC_NAME   "dfa_insn_code"

Name of function (attribute) to translate insn into internal insn code with caching.

Referenced by output_min_issue_delay_table().

#define DFA_INSN_CODES_LENGTH_VARIABLE_NAME   "dfa_insn_codes_length"

Name of length of cache of insn dfa codes.

Referenced by output_trans_func().

#define DFA_INSN_CODES_VARIABLE_NAME   "dfa_insn_codes"

Name of cache of insn dfa codes.

Referenced by output_min_issue_delay_func(), and output_trans_func().

#define DFA_START_FUNC_NAME   "dfa_start"

Referenced by output_trans_func().

#define FILE_PARAMETER_NAME   "f"
#define GET_CPU_UNIT_CODE_FUNC_NAME   "get_cpu_unit_code"
#define HIGH_VARIABLE_NAME   "h"
#define I_VARIABLE_NAME   "i"
#define INSN2_PARAMETER_NAME   "insn2"
#define INSN_HAS_DFA_RESERVATION_P_FUNC_NAME   "insn_has_dfa_reservation_p"
#define INSN_LATENCY_FUNC_NAME   "insn_latency"
#define INSN_PARAMETER_NAME   "insn"
#define INTERNAL_DEAD_LOCK_FUNC_NAME   "internal_state_dead_lock_p"
#define INTERNAL_DFA_INSN_CODE_FUNC_NAME   "internal_dfa_insn_code"

Name of function (attribute) to translate insn into internal insn code.

#define INTERNAL_INSN2_CODE_NAME   "insn2_code"
#define INTERNAL_INSN_CODE_NAME   "insn_code"

Names of the variables whose values are internal insn code of rtx insn.

#define INTERNAL_INSN_LATENCY_FUNC_NAME   "internal_insn_latency"
#define INTERNAL_MIN_ISSUE_DELAY_FUNC_NAME   "internal_min_issue_delay"

Names of an internal functions:

#define INTERNAL_RESET_FUNC_NAME   "internal_reset"
#define INTERNAL_TRANSITION_FUNC_NAME   "internal_state_transition"
#define LOW_VARIABLE_NAME   "l"
#define MAX_FLOATING_POINT_VALUE_FOR_AUTOMATON_BOUND   1.0E37

This page contains code for creating DFA(s) and calls functions building them. The following value is used to prevent floating point overflow for estimating an automaton bound. The value should be less DBL_MAX on the host machine. We use here approximate minimum of maximal double floating point value required by ANSI C standard. It will work for non ANSI sun compiler too.

Referenced by evaluate_equiv_classes().

#define MAX_LINE_LENGTH   70

Maximal length of line for pretty printing into description file.

Referenced by output_internal_insn_latency_func().

#define MIDDLE_VARIABLE_NAME   "m"
#define MIN_INSN_CONFLICT_DELAY_FUNC_NAME   "min_insn_conflict_delay"
#define MIN_ISSUE_DELAY_FUNC_NAME   "min_issue_delay"
#define NAME_CODE_STRUCT_NAME   "name_code"

The following macro value is name of struct containing unit name and unit code.

#define NAME_CODE_TABLE_NAME   "name_code_table"

The following macro value is name of table of struct name_code.

#define NAME_MEMBER_NAME   "name"

The following macro values are member names for struct name_code.

#define NDFA_OPTION   "-ndfa"
#define NO_COMB_OPTION   "-no-comb-vect"
#define NO_MINIMIZATION_OPTION   "-no-minimization"

Options with the following names can be set up in automata_option construction. Because the strings occur more one time we use the macros.

#define NOTHING_NAME   "nothing"

Name in reservation to denote absence reservation.

Referenced by output_internal_min_issue_delay_func().

#define PRINT_RESERVATION_FUNC_NAME   "print_reservation"
#define PROGRESS_OPTION   "-progress"
#define REGEXP_ALLOF (   r)    (&(r)->regexp.allof)
#define REGEXP_ONEOF (   r)    (&(r)->regexp.oneof)
#define REGEXP_REPEAT (   r)    (&(r)->regexp.repeat)

Referenced by automata_list_finish().

#define REGEXP_RESERV (   r)    (&(r)->regexp.reserv)

Referenced by automata_list_hash().

#define REGEXP_SEQUENCE (   r)    (&(r)->regexp.sequence)
#define REGEXP_UNIT (   r)    (&(r)->regexp.unit)
#define RESET_FUNC_NAME   "state_reset"
#define RESULT_VARIABLE_NAME   "res"

Name of result variable in some functions.

#define SIZE_FUNC_NAME   "state_size"

Names of the PHR interface functions:

#define STANDARD_OUTPUT_DESCRIPTION_FILE_SUFFIX   ".dfa"

This page mainly contains top level functions of pipeline hazards description translator. The following macro value is suffix of name of description file of pipeline hazards description translator.

#define STATE_NAME   "state"

Names of parameters of the PHR interface functions.

Referenced by output_internal_insn_code_evaluation().

#define STATE_TYPE_NAME   "state_t"

This is external type of DFA(s) state.

#define STATS_OPTION   "-stats"
#define TEMPORARY_VARIABLE_NAME   "temp"

Names of temporary variables in some functions.

#define TIME_OPTION   "-time"
#define TRANSITION_FUNC_NAME   "state_transition"
#define V_OPTION   "-v"
#define W_OPTION   "-w"
#define XCOPYNODE (   T,
 
)    ((T *) copy_node ((P), sizeof (T)))
#define XCOPYNODEVAR (   T,
  P,
  S 
)    ((T *) copy_node ((P), (S)))
#define XCOPYNODEVEC (   T,
  P,
  N 
)    ((T *) copy_node ((P), sizeof (T) * (N)))
#define XCREATENODEVAR (   T,
  S 
)    ((T *) create_node ((S)))
#define XCREATENODEVEC (   T,
  N 
)    ((T *) create_node (sizeof (T) * (N)))

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.

static void add_achieved_state ( )
static

This function is called by function pass_states to add an achieved STATE.

static void add_advance_cycle_insn_decl ( )
static

Create and record a decl for the special advance-cycle transition.

References CHAR_BIT.

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 DECL_UNIT, description::decls, description::decls_num, dm_unit, form_reserv_sets_list(), irp, decl::mode, and description::units_num.

static void add_automaton_state ( )
static

This function is called by function pass_states to add an achieved STATE.

Referenced by output_pattern_set_el_list().

static void add_collapse_ndfa_insn_decl ( )
static

Create and record a decl for the special collapse-NDFA transition.

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".

Element not found - insert.

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.

static void add_state_reservs ( )
static

The function forms `state_reservs' for STATE.

Referenced by output_insn_latency_func().

static void add_states_vect_el ( )
static

The function is called by function pass_states. The function adds STATE to `output_states_vect'.

static void add_vect ( )
static

The following function adds vector VECT to table TAB as its line with number VECT_NUM.

 Form full vector in the table:  
 The comb_vect min/max values are also used for the full vector, so
 compute them now.   
 Form comb vector in the table:  
 Search for the place in comb vect for the inserted vect.   
 Slow case.   
 Fast case.   
 Search for the place in comb vect for the inserted vect.   
 Slot was found.   
 Expand comb and check vectors.   
 Fill comb and check vectors.   
static void add_vect_el ( )
static

The function adds element EL_VALUE to vector VECT for a table state x AINSN.

static reserv_sets_t alloc_empty_reserv_sets ( )
static

Allocate new reservation set.

References NULL, and state::reservs.

Referenced by find_arc().

static int alt_state_cmp ( )
static

The function compares unique numbers of alt states.

Referenced by ticker_off().

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.

Referenced by equal_alternatives_p().

static void automata_list_add ( )
static

The following function adds AUTOMATON to the current list.

static int automata_list_eq_p ( )
static

Return nonzero value if the automata_lists are the same.

Referenced by set_state_reserv().

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 gcc_assert, regexp::mode, REGEXP_REPEAT, rm_repeat, rm_sequence, and XCREATENODEVAR.

static hashval_t automata_list_hash ( )
static

Hash value of AUTOMATA_LIST.

References copy_insn_regexp(), regexp::mode, reserv_decl::regexp, REGEXP_RESERV, and rm_reserv.

Referenced by set_state_reserv().

static void automata_list_start ( )
static

The following function starts new automata list and makes it the current one.

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.

Referenced by gen_regexp_oneof().

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.

Referenced by gen_regexp_oneof().

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.

static void build_automaton ( )
static

The function builds one DFA AUTOMATON for fast pipeline hazards recognition after checking and simplifying IR of the description.

static void cache_presence ( )
static

This fills in the presence_signature[] member of STATE.

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.

static void check_all_description ( )
static

The following function calls functions for checking all description.

static void check_automata_insn_issues ( )
static

The following function checks existence at least one arc marked by each insn.

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'.

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 XCREATENODE.

static const char* check_name ( )
static

The function checks that NAME does not contain quotes (`"').

Referenced by gen_automata_option(), and gen_bypass().

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 copy_insn_regexp(), regexp::mode, regexp::pos, REGEXP_ONEOF, REGEXP_SEQUENCE, rm_sequence, and XCREATENODEVAR.

static void check_regexp_units_distribution ( const char *  insn_reserv_name,
regexp_t  regexp 
)
static

The function processes given REGEXP to find units with the wrong distribution.

Store all unit usages in the regexp:

 Check distribution:   
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.

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'.

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 automaton::corresponding_automaton_decl, NULL, progress_flag, and ticker_on().

Referenced by create_composed_state().

static int comb_vect_p ( )
static

The following function returns nonzero value if the best representation of the table is comb vector.

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.

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

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 ainsn::next_equiv_class_insn, and NULL.

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.

static void copy_equiv_class ( )
static

The function copies pointers to equivalent states from vla FROM into vla TO.

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 gcc_assert, regexp::mode, regexp::pos, REGEXP_ALLOF, REGEXP_SEQUENCE, rm_allof, rm_nothing, rm_sequence, rm_unit, and XCREATENODEVAR.

Referenced by automata_list_hash(), and check_presence_pattern_sets().

static void* copy_node ( )
static

Copy IR structure (node).

static void count_states_and_arcs ( automaton_t  automaton,
int *  states_num,
int *  arcs_num 
)
static
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.

Referenced by count_states_and_arcs().

static void create_alt_states ( )
static

Create nodes alt_state for all AUTOMATON insns.

static void create_automata ( )
static

The function creates DFA(s) for fast pipeline hazards recognition after checking and simplifying IR of the description.

References automaton::achieved_states_num, and output_range_type().

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.

     Create composed state.   
     There are not identical sets in the alt state list.   
                     When producing collapse-NDFA transitions, we
                     only add advance-cycle transitions to the
                     collapsed states.   

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

static void* create_node ( )
static

Create IR structure (node).

Default values of members are NULL and zero.

References dm_unit, FALSE, fatal(), get_str_vect(), decl::mode, NULL, XCREATENODE, and XSTR.

static state_ainsn_table_t create_state_ainsn_table ( )
static

The following function creates new table for AUTOMATON.

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.

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 NULL, pattern_set_el::unit_decls, and XCREATENODEVAR.

Referenced by find_automaton_decl().

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.

Referenced by find_automaton_decl().

static void delete_ainsn_from_equiv_class ( )
static

The function deletes equiv_class_insn into cyclic list of equivalent ainsns.

static void enumerate_states ( )
static

The function enumerates all states of AUTOMATON.

References form_regexp(), irp, REGEXP_ALLOF, rm_oneof, and rm_sequence.

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 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, NULL, ainsn::sorted_alt_states, and special_decl_p().

static double estimate_one_automaton_bound ( )
static

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

static void evaluate_equiv_classes ( )
static

The function finds equivalent states of AUTOMATON.

Transfer equiv numbers for the next iteration.

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

Referenced by initiate_pass_states().

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 state::unique_num.

static void expand_automata ( )
static

The following is top level function to generate automat(a,on) for fast recognition of pipeline hazards.

Two entries for special insns.

static const char* file_name_suffix ( )
static

The function returns suffix of given file name. The returned string can not be changed.

static arc_t find_arc ( )
static

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

Any arc is good enough for a collapse-ndfa transition.

References alloc_empty_reserv_sets(), bitmap_set_bit, unit_decl::in_set_p, pattern_reserv::next_pattern_reserv, NULL, pattern_reserv::reserv, TRUE, pattern_set_el::unit_decls, unit_decl::unit_num, pattern_set_el::units_num, and XCREATENODE.

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 decl_eq_p(), decl_hash(), dm_unit, decl::mode, and work_decl.

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.

Referenced by finish_automaton_decl_table(), initiate_insn_decl_table(), insert_decl(), and process_bypass_1().

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.

static void finish_alt_states ( )
static

Finishing work with the abstract data.

Referenced by reserv_sets_and().

static void finish_arcs ( )
static

Finishing work with the abstract data.

static void finish_automata_lists ( )
static

Finishing work with the abstract data.

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 dm_unit, error(), find_decl(), decl::mode, and NULL.

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 pattern_set_el::units_num.

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 progress_flag.

Referenced by store_alt_unit_usage().

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.

static void finish_regexp_representation ( )
static

The function frees memory allocated for last formed string representation of regexp.

static void finish_states ( )
static

Finishing work with the abstract data.

References bitmap_set_bit, unit_decl::in_set_p, TRUE, unit_set_el::unit_decl, and unit_decl::unit_num.

static int first_cycle_unit_presence ( )
static

The following function returns TRUE if STATE reserves the unit with UNIT_NUM on the first cycle.

Referenced by form_reservs_matter().

static arc_t first_out_arc ( )
static

The function returns the first arc starting from STATE.

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.

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.

static void form_arcs_marked_by_insn ( )
static

Form lists of all arcs of STATE marked by the same ainsn.

static void form_important_insn_automata_lists ( )
static

The following function forms list of important automata (whose states may be changed after the insn issue) for each insn.

Mark important ainsns.

 Create automata sets for the insns.   
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').

Referenced by enumerate_states(), and process_insn_equiv_class().

static pattern_reserv_t form_reserv_sets_list ( )
static

The following function forms list of reservation sets for given PATTERN_LIST.

References REGEXP_ONEOF.

Referenced by add_arc().

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.

We can not remove queried unit from reservations.

             We can not remove units which are used
             `exclusion_set', `presence_set',
             `final_presence_set', `absence_set', and
             `final_absence_set'.   

References CHAR_BIT, first_cycle_unit_presence(), and state::presence_signature.

static void free_alt_state ( )
static

The function frees node ALT_STATE.

References els_in_reservs, and gcc_assert.

static void free_alt_states ( )
static

The function frees list started with node ALT_STATE_LIST.

static void free_arc ( )
static

The function frees node ARC.

static void free_automata_list ( )
static

The function frees list AUTOMATA_LIST.

static void free_automata_list_el ( )
static

The function frees node AUTOMATA_LIST_EL.

References CHAR_BIT, els_in_cycle_reserv, pattern_reserv::next_pattern_reserv, NULL, and description::units_num.

Referenced by state_eq_p().

static void free_state ( )
static

The function frees node STATE.

References NULL.

Referenced by reserv_sets_are_intersected().

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'.

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 check_name(), DECL_RESERV, dm_reserv, gen_regexp(), decl::mode, decl::pos, XCREATENODE, and XSTR.

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'.

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 check_name(), DECL_AUTOMATON, dm_automaton, FALSE, fatal(), get_str_vect(), decl::mode, NULL, decl::pos, XCREATENODE, and XSTR.

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'.

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'.

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'.

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'.

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'.

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'.

Referenced by gen_query_cpu_unit().

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'.

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 gen_presence_absence_set(), and TRUE.

static regexp_t gen_regexp ( )
static

Parse construction reservation STR.

Referenced by gen_automata_option().

static regexp_t gen_regexp_allof ( )
static

Parse reservation STR which possibly contains separator '+'.

static regexp_t gen_regexp_el ( )
static

Parse an element in STR.

References CHAR_BIT.

static regexp_t gen_regexp_oneof ( )
static

Parse reservation STR which possibly contains separator '|'.

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

static regexp_t gen_regexp_repeat ( )
static

Parse construction `repeat' in STR.

References DECL_AUTOMATON, dm_automaton, gcc_assert, and decl::mode.

static regexp_t gen_regexp_sequence ( const char *  )
static

Forward declarations of functions used before their definitions, only.

static regexp_t gen_regexp_sequence ( )
static

Parse reservation STR which possibly contains separator ','.

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

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'.

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.

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 REGEXP_ALLOF.

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 bitmap_set_bit, CHAR_BIT, and gcc_assert.

Referenced by NDFA_to_DFA(), and store_alt_unit_usage().

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.

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.

Referenced by reserv_sets_are_intersected(), and store_alt_unit_usage().

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.

Referenced by create_node(), gen_bypass(), and n_sep_els().

static void incr_states_and_arcs_nums ( )
static

The function is called by function `pass_states' to count states and arcs of an automaton.

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().

static void initiate_alt_states ( )
static

Initialization of the abstract data.

static void initiate_arcs ( )
static

Initialization of the abstract data.

static void initiate_automata_lists ( )
static

Initialization of the abstract data.

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.

static void initiate_automaton_gen ( )
static

The following is top level function to initialize the work of pipeline hazards description translator.

Initialize IR storage.

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.

static void initiate_excl_sets ( )
static

The following function forms the array containing exclusion sets for each unit.

Evaluate unit exclusion sets.

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 error(), find_decl(), and NULL.

static void initiate_pass_states ( )
static

The function initializes code for passing of all states.

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

static void initiate_presence_absence_pattern_sets ( )
static

The following function forms the array containing presence and absence pattern sets for each unit.

Evaluate unit presence/absence sets.

static void initiate_states ( )
static

Initialization of the abstract data.

References description::decls, description::decls_num, dm_unit, irp, decl::mode, and description::units_num.

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.

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.

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.

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 error(), find_decl(), and NULL.

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 error(), unit_decl::name, and unit_set_el::unit_decl.

static state_t insert_state ( )
static

Insert STATE into the state table.

Referenced by reserv_sets_are_intersected().

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 copy(), unit_set_el::next_unit_set_el, and NULL.

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.

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 NULL.

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.

declaration has been processed.

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

int main ( )

FIXME: emit-rtl.h can go away once crtl is in rtl.h.

static void make_automaton ( )
static

The following function creates all states of nondeterministic AUTOMATON.

 Create the start state (empty state).   
               We process alt_states in the same order as they are
               present in the description.   
     Add transition to advance cycle.   
static void merge_states ( )
static

The function merges equivalent states of AUTOMATON.

 Create states corresponding to equivalence classes containing two
 or more states.   
         There are more one states in the class equivalence.   
         Create new compound state.   
         Its is important that alt states were sorted before and
         after merging to have the same querying results.   
         Create new arcs output from the state corresponding to
         equiv class.   
         Delete output arcs from states of given class equivalence.   
             Delete the state and its output arcs.   
         Change `to_state' of arcs output from the state of given
         equivalence class.   

Referenced by initiate_pass_states().

static void minimize_DFA ( )
static

The top level function for minimization of deterministic AUTOMATON.

References automata_num, NULL, and units_to_automata_heuristic_distr().

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.

References FALSE, fatal(), get_str_vect(), NULL, and XSTR.

static void NDFA_to_DFA ( )
static

The function transforms nondeterministic AUTOMATON into deterministic.

Create the start state (empty state).

     Add a transition to collapse the NDFA.   

References state::component_states, state::equiv_class_state, get_free_alt_state(), alt_state::next_alt_state, alt_state::next_sorted_alt_state, NULL, and alt_state::state.

static arc_t next_out_arc ( arc_t  )
static
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.

Remove leading whitespaces.

static int out_state_arcs_num ( )
static

Return number of out arcs of STATE.

static void output_automata_list_min_issue_delay_code ( )
static

The function outputs a code for evaluation of a minimal delay of issue of insns which have reservations in given AUTOMATA_LIST.

References bypass_decl::latency.

static void output_automata_list_transition_code ( )
static

The function outputs a code changing state after issue of insns which have reservations in given AUTOMATA_LIST.

static void output_automaton_descriptions ( )
static

The following function output readable representation of DFAs used for fast recognition of pipeline hazards.

static void output_automaton_name ( )
static

The function outputs name of AUTOMATON.

Referenced by output_print_reservation_func().

static void output_automaton_units ( )
static

The function outputs units name belonging to AUTOMATON.

Referenced by output_print_reservation_func().

static void output_chip_definitions ( )
static

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

static void output_chip_member_name ( )
static

The following is name of member which represents state of a DFA for PHR.

References state_ainsn_table::comb_vect, and undefined_vect_el_value.

Referenced by output_internal_insn_code_evaluation().

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.

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 first_free_arc.

static void output_dead_lock_func ( )
static

The function outputs PHR interface function `state_dead_lock_p'.

static void output_dead_lock_vect ( )
static

Form and output vector representing the locked states of AUTOMATON.

Create vect of pointers to states ordered by num of transitions from the state (state with the maximum num is the first).

static void output_dead_lock_vect_name ( )
static

Output name of deadlock vector for given automaton.

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.

Find the smallest integer type that can hold all the default latency values.

static void output_description ( )
static

The function outputs string representation of IR define_reservation and define_insn_reservation.

References gcc_assert, ainsn::important_p, ainsn::next_same_reservs_insn, NULL, and TRUE.

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'.

static void output_dfa_finish_func ( )
static

The function outputs PHR interface function `dfa_finish'.

static void output_dfa_insn_code_func ( )
static

This function outputs `dfa_insn_code' and its helper function `dfa_insn_code_enlarge'.

Emacs c-mode gets really confused if there's a { or } in column 0 inside a string, so don't do that.

References output_file.

static void output_dfa_start_func ( )
static
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.

static void output_insn_code_cases ( (automata_list_el_t )
static

The function outputs switch cases for insn reservations using function *output_automata_list_code.

static void output_insn_has_dfa_reservation_p ( )
static

The following function outputs a function to check if insn has a dfa reservation.

References fatal().

static void output_insn_latency_func ( )
static
static void output_internal_dead_lock_func ( )
static

Output function `internal_dead_lock'.

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

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 CHIP_NAME, CPU_CODE_PARAMETER_NAME, output_chip_member_name(), output_file, output_reserved_units_table_name(), description::query_units_num, and STATE_NAME.

static void output_internal_insn_latency_func ( )
static
static void output_internal_maximal_insn_latency_func ( )
static

Output function `internal_maximum_insn_latency'.

References output_description_file.

static void output_internal_min_issue_delay_func ( )
static

Output function `internal_min_issue_delay'.

References FILE_PARAMETER_NAME, NOTHING_NAME, and output_file.

static void output_internal_reset_func ( )
static

Output function `internal_reset'.

References DECL_UNIT, description::decls, dm_unit, decl::mode, NULL, output_description_file, and output_unit_set_el_list().

static void output_internal_trans_func ( )
static

Output function `internal_state_transition'.

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 bypass_decl::bypass_guard_name, DECL_INSN_RESERV, gcc_assert, bypass_decl::in_insn_reserv, INSN2_PARAMETER_NAME, insn_reserv_decl::insn_num, INSN_PARAMETER_NAME, bypass_decl::latency, bypass_decl::next, NULL, and output_file.

static void output_maximal_insn_latency_func ( )
static

The function outputs PHR interface function `maximal_insn_latency'.

static void output_min_insn_conflict_delay_func ( )
static

Output function `min_insn_conflict_delay'.

static void output_min_issue_delay_func ( )
static

Output function `min_issue_delay'.

References DFA_FINISH_FUNC_NAME, DFA_INSN_CODES_VARIABLE_NAME, and output_file.

static void output_min_issue_delay_table ( )
static

Form and output vectors representing minimal issue delay table of AUTOMATON. The table is state x ainsn -> minimal issue delay of the ainsn.

Create vect of pointers to states ordered by num of transitions from the state (state with the maximum num is the first).

 Compress the vector.   

References ADVANCE_CYCLE_VALUE_NAME, collapse_flag, COLLAPSE_NDFA_VALUE_NAME, DFA_INSN_CODE_FUNC_NAME, and output_file.

static void output_min_issue_delay_vect_name ( )
static

Output name of simple min issue delay table representation.

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

static void output_pattern_set_el_list ( )
static

Output patterns in LIST separated by comma.

References add_automaton_state(), first_out_arc(), NULL, and pass_states().

Referenced by output_reset_func().

static void output_print_reservation_func ( )
static

The function outputs PHR interface function `print_reservation'.

References output_automaton_name(), output_automaton_units(), output_description_file, output_state(), and pass_states().

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.

References state_ainsn_table::comb_vect.

Referenced by create_automata().

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.

static void output_reserv_sets ( )
static

The function outputs string representation of units reservation in the reservation set.

static void output_reserved_units_table ( )
static

Form and output vector representing reserved units of the states of AUTOMATON.

Create vect of pointers to states.

 Create vector.   
static void output_reserved_units_table_name ( )
static

Output name of reserved units table for AUTOMATON into file F.

Referenced by output_internal_insn_code_evaluation().

static void output_reset_func ( )
static

The function outputs PHR interface function `state_reset'.

References DECL_UNIT, output_description_file, and output_pattern_set_el_list().

static void output_size_func ( )
static

The function outputs PHR interface function `state_size'.

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.

Referenced by output_print_reservation_func().

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

The following function outputs the best C representation of the table TAB of given TABLE_NAME.

static void output_state_arcs ( )
static

The function outputs readable representation of all out arcs of STATE.

static void output_state_member_type ( )
static

Output C type which is used for representation of codes of states of AUTOMATON.

static void output_statistics ( )
static

The page contains top level function for generation DFA(s) used for PHR. The function outputs statistics about work of different phases of DFA generator.

static void output_tables ( )
static

The function outputs all tables representing DFA(s) used for fast pipeline hazards recognition.

static void output_temp_chip_member_name ( )
static

The following is name of temporary variable which stores state of a DFA for PHR.

static void output_time_statistics ( )
static

The function output times of work of different phases of DFA generator.

static void output_trans_base_vect_name ( )
static

Output name of base vector of the transition table for given automaton.

static void output_trans_check_vect_name ( )
static

Output name of check vector of the transition table for given automaton.

static void output_trans_comb_vect_name ( )
static

Output name of comb vector of the transition table for given automaton.

References first_out_arc(), gcc_assert, next_out_arc(), and NULL.

static void output_trans_full_vect_name ( )
static

Output name for simple transition table representation.

static void output_trans_func ( )
static

The function outputs PHR interface function `state_transition'.

References DFA_CLEAN_INSN_CACHE_FUNC_NAME, DFA_INSN_CODES_LENGTH_VARIABLE_NAME, DFA_INSN_CODES_VARIABLE_NAME, DFA_START_FUNC_NAME, and output_file.

static void output_trans_table ( )
static

Form and output vectors (comb, check, base or full vector) representing transition table of AUTOMATON.

Create vect of pointers to states ordered by num of transitions from the state (state with the maximum num is the first).

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).

Undefined value

static void output_translate_vect_name ( )
static

Output name of translate vector for given automaton.

References state_ainsn_table::check_vect, state_ainsn_table::comb_vect, and gcc_assert.

static void output_unit_set_el_list ( )
static

Output names of units in LIST separated by comma.

Referenced by output_internal_reset_func().

static void output_vect ( )
static

The function outputs all initialization values of 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.

split_argument = atoi (argument_vect [i + 1]);

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.

         There are more one states in the class equivalence.   
                 Remove curr state from the class equivalence.   
                 Add curr state to the new class equivalence.   
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 first_out_arc(), next_out_arc(), and NULL.

static void pass_states ( automaton_t  automaton,
void(*)(state_t state applied_func 
)
static

This recursive function passes all states of AUTOMATON and applies APPLIED_FUNC to them.

Referenced by initiate_pass_states(), output_pattern_set_el_list(), and output_print_reservation_func().

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));

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.

We inserts in reverse order but we process alternatives also in reverse order. So we have the same order of alternative as in the description.

     We processes it in reverse order to get list with the same
     order as in the description.  See also the previous
     commentary.   

Referenced by store_alt_unit_usage(), and unit_present_on_list_p().

static void process_bypass ( )
static

Process define_bypass decl BYPASS, inserting a bypass for each specific pair of insn reservations.

References DECL_RESERV, DECL_UNIT, dm_reserv, dm_unit, REGEXP_UNIT, and XCREATENODE.

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 error(), find_decl(), NULL, REGEXP_UNIT, and rm_unit.

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 DECL_AUTOMATON, description::decls, description::decls_num, dm_automaton, error(), decl::mode, w_flag, and warning().

static void process_decls ( )
static

The function processes pipeline description declarations, checks their correctness, and forms exclusion/presence/absence sets.

 Checking repeated automata declarations.   
 Checking undeclared automata, repeated declarations (except for
 automata) and correctness of their attributes (insn latency times
 etc.).   
 Check bypasses and form list of bypasses for each (output)
 insn.   
 Check exclusion set declarations and form exclusion sets.   
 Check presence set declarations and form presence sets.   
 Check absence set declarations and form absence sets.   
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 error(), and unit_decl::name.

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.

New class of ainsns which are not equivalent to given ainsn.

References form_regexp(), and irp.

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.

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.

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 process_regexp_cycles(), and REGEXP_SEQUENCE.

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.

Referenced by process_regexp(), and process_regexp_decls().

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 DECL_INSN_RESERV, description::decls, dm_insn_reserv, description::max_insn_reserv_cycles, decl::mode, and process_regexp_cycles().

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.

Referenced by store_alt_unit_usage(), and transform_insn_regexps().

static void process_state_for_insn_equiv_partition ( )
static

The function processes STATE in order to find equivalent ainsns.

Process insns of the arcs.

static const char* regexp_representation ( )
static

The function returns string representation of REGEXP on IR obstack.

References gcc_assert, state_ainsn_table::max_comb_vect_el_value, and state_ainsn_table::min_comb_vect_el_value.

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.

static void remove_arc ( )
static

The function removes and frees ARC staring from FROM_STATE.

static void remove_state_duplicate_reservs ( )
static

The following function is used for sorting possible cpu unit reservation of a DFA state.

Referenced by output_insn_latency_func().

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 finish_alt_states(), and NULL.

Referenced by reserv_sets_are_intersected().

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 state::automaton, free_state(), gcc_assert, get_free_state(), insert_state(), reserv_sets_and(), reserv_sets_or(), and state::reservs.

static int reserv_sets_cmp ( )
static

Comparison of given reservation sets.

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

static int reserv_sets_eq ( )
static

The function checks equality of the reservation sets.

Referenced by reserv_sets_cmp().

static unsigned reserv_sets_hash_value ( )
static

Hash value of reservation set.

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.

Referenced by reserv_sets_are_intersected().

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 description::decls_num, and description::units_num.

static void set_insn_equiv_classes ( )
static

The function searches for equivalent ainsns of AUTOMATON.

 All insns are included in one equivalence class.   
 Process insns in order to make equivalence partition.   
 Enumerate equiv classes.   
   Set undefined value.   
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.

Referenced by initiate_pass_states().

static void set_order_state_num ( )
static

The function is called by function `pass_states' for enumerating 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.

Referenced by create_composed_state().

static void set_state_reserv ( )
static

Add reservation of unit with UNIT_NUM on cycle CYCLE_NUM to deterministic STATE.

References automata_list_eq_p(), automata_list_hash(), and NULL.

Referenced by transform_insn_regexps().

static void set_unit_reserv ( )
static

Set up in the reservation set that unit with UNIT_NUM is used on CYCLE_NUM.

static bool special_decl_p ( )
static

True if DECL is either of the two special decls we created.

Referenced by equal_alternatives_p().

static int state_eq_p ( )
static

Return nonzero value if the states are the same.

All state in the list must be already in the hash table. Also the lists must be sorted.

References free_automata_list_el(), and automata_list_el::next_automata_list_el.

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.

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.

Referenced by create_composed_state().

static int state_reservs_cmp ( )
static

The following function is used for sorting possible cpu unit reservation of a DFA state.

Referenced by output_insn_latency_func().

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.

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.

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 alt_state_being_formed, ainsn::alt_states, finish_forming_alt_state(), gcc_assert, get_free_alt_state(), get_free_state(), regexp::mode, alt_state::next_alt_state, process_alts_for_forming_states(), process_seq_for_forming_states(), REGEXP_ONEOF, rm_oneof, alt_state::state, and state_being_formed.

static unsigned string_hash ( )
static

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

Referenced by gen_regexp_sequence().

static int test_unit_reserv ( )
static

Set up in the reservation set RESERVS that unit with UNIT_NUM is used on CYCLE_NUM.

static void ticker_off ( )
static

The following function switches off given ticker.

References alt_state_cmp(), and NULL.

static void ticker_on ( )
static

The following function switches on given ticker.

Referenced by clear_arc_insns_equiv_num().

static regexp_t transform_1 ( )
static

The function makes transformation A*N -> A, A, ...

References REGEXP_ALLOF.

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|...

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),...

static void transform_insn_regexps ( )
static
static regexp_t transform_regexp ( )
static

The function applies all transformations for IR representation of reservation REGEXP.

References NULL.

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.

Referenced by unit_present_on_list_p().

static bool unit_present_on_list_p ( )
static
static int units_cmp ( )
static

The following function is used to sort unit declaration by their names.

static void units_to_automata_distr ( )
static

The function assigns automata to units according to constructions `define_automaton' in the description.

Distribute to the first automaton.

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???

Referenced by minimize_DFA().

static void write_automata ( )
static

The following is top level function to output PHR and to finish work with pipeline description translator.

 Cache of insn dfa codes:  
 Output function get_cpu_unit_code.   
 Finish all work.   

Variable Documentation

decl_t advance_cycle_insn_decl
static

Pseudo insn decl which denotes advancing cycle.

vec<state_t> all_achieved_states
static

The following vla is used for storing pointers to all achieved states.

ticker_t all_time
static
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 store_alt_unit_usage().

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 minimize_DFA().

htab_t automaton_decl_table
static

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

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 output_min_issue_delay_table().

decl_t collapse_ndfa_insn_decl
static

Pseudo insn decl which denotes collapsing the NDFA state.

ainsn_t curr_ainsn
static

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

Referenced by equal_alternatives_p().

int curr_counted_arcs_num
static
int curr_counted_states_num
static

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

int curr_loop_pass_num
static

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

int curr_state_graph_pass_num
static

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

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.

int curr_unique_state_num
static
automata_list_el_t current_automata_list
static

The list being formed.

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_ancestor_tree().

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 free_automata_list_el().

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 free_alt_state().

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.

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.

arc_t first_free_arc
static

Abstract data `arcs'. List of free arcs.

Referenced by output_cycle_reservs().

automata_list_el_t first_free_automata_list_el
static

Abstract data `automata lists'. List of free states.

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.

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.

struct obstack irp
static

All IR is stored in the following obstack.

Referenced by add_arc(), enumerate_states(), initiate_states(), and process_insn_equiv_class().

int max_cycles_num
static

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

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').

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').

int no_minimization_flag
static

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

pos_t no_pos = 0
static

Undefined position.

char* output_description_file_name
static

PHR description file name.

FILE* output_file
static

Output file for pipeline hazard recognizer (PHR) being generated. The value is NULL if the file is not defined.

Referenced by output_dfa_insn_code_func(), output_internal_insn_code_evaluation(), output_internal_min_issue_delay_func(), output_max_insn_queue_index_def(), output_min_issue_delay_func(), output_min_issue_delay_table(), and output_trans_func().

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 clear_arc_insns_equiv_num(), and finish_forming_alt_state().

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.

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).

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 store_alt_unit_usage().

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').

reserv_sets_t temp_reserv
static

Temporary reservation of maximal length.

int time_flag
static

Flag of output time statistics (`-time').

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 output_chip_member_name().

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.

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').

int w_flag
static

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

Referenced by output_dfa_start_func(), and process_bypass_2().

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 gen_regexp_oneof().

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_automaton_decl().

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.