summaryrefslogtreecommitdiff
path: root/gcc/genattrtab.c
diff options
context:
space:
mode:
authorVladimir Makarov <vmakarov@touchme.toronto.redhat.com>2001-08-27 18:13:42 +0000
committerVladimir Makarov <vmakarov@gcc.gnu.org>2001-08-27 18:13:42 +0000
commitacd7baf7297545ff01b3a0a24d9025de8cd479fc (patch)
tree372ccbbb0fc88e781ecea047646a15f1cd4d2586 /gcc/genattrtab.c
parent95005c210a14c56a0d86abaae40f61b723ebf5dc (diff)
downloadgcc-acd7baf7297545ff01b3a0a24d9025de8cd479fc.tar.gz
rtl.def (DEFINE_CPU_UNIT, [...]): New RTL constructions.
2001-08-27 Vladimir Makarov <vmakarov@touchme.toronto.redhat.com> * rtl.def (DEFINE_CPU_UNIT, DEFINE_QUERY_CPU_UNIT, EXCLUSION_SET, PRESENCE_SET, ABSENCE_SET, DEFINE_BYPASS, DEFINE_AUTOMATON, AUTOMATA_OPTION, DEFINE_RESERVATION, DEFINE_INSN_RESERVATION): New RTL constructions. * genattr.c (main): New variable num_insn_reservations. Increase it if there is DEFINE_INSN_RESERVATION. Output automaton based pipeline hazard recognizer interface. * genattrtab.h: New file. * genattrtab.c: Include genattrtab.h. (attr_printf, check_attr_test, make_internal_attr, make_numeric_value): Move protypes into genattrtab.h. Define them as external. (num_dfa_decls): New global variable. (main): Process DEFINE_CPU_UNIT, DEFINE_QUERY_CPU_UNIT, DEFINE_BYPASS, EXCLUSION_SET, PRESENCE_SET, ABSENCE_SET, DEFINE_AUTOMATON, AUTOMATA_OPTION, DEFINE_RESERVATION, DEFINE_INSN_RESERVATION. Call expand_automata and write_automata. * genautomata.c: New file. * rtl.h (LINK_COST_ZERO, LINK_COST_FREE): Remove them. * sched-int.h: (curr_state): Add the external definition for automaton pipeline interface. (haifa_insn_data): Add comments for members blockage and units. * target-def.h (TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE, TARGET_SCHED_INIT_DFA_PRE_CYCLE_INSN, TARGET_SCHED_DFA_PRE_CYCLE_INSN, TARGET_SCHED_INIT_DFA_POST_CYCLE_INSN, TARGET_SCHED_DFA_POST_CYCLE_INSN, TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD, TARGET_SCHED_INIT_DFA_BUBBLES, TARGET_SCHED_DFA_BUBBLE): New macros. (TARGET_SCHED): Use the new macros. * target.h (use_dfa_pipeline_interface, init_dfa_pre_cycle_insn, dfa_pre_cycle_insn, init_dfa_post_cycle_insn, dfa_post_cycle_insn, first_cycle_multipass_dfa_lookahead, init_dfa_bubbles, dfa_bubble): New members in gcc_target.sched. * haifa-sched.c (insert_schedule_bubbles_p): New variable. (MAX_INSN_QUEUE_INDEX): New macro for automaton interface. (insn_queue): Redefine it as pointer to array. (NEXT_Q, NEXT_Q_AFTER): Use MAX_INSN_QUEUE_INDEX instead of INSN_QUEUE_SIZE. (max_insn_queue_index_macro_value): New variable. (curr_state, dfa_state_size, ready_try): New varaibles for automaton interface. (ready_element, ready_remove, max_issue): New function prototypes for automaton interface. (choose_ready): New function prototype. (insn_unit, blockage_range): Add comments. (unit_last_insn, unit_tick, unit_n_insns): Define them for case FUNCTION_UNITS_SIZE == 0. (insn_issue_delay, actual_hazard_this_instance, schedule_unit, actual_hazard, potential_hazard): Add comments. (insn_cost): Use cost -1 as undefined value. Remove LINK_COST_ZERO and LINK_COST_FREE. Add new code for automaton pipeline interface. (ready_element, ready_remove): New functions for automaton interface. (schedule_insn): Add new code for automaton pipeline interface. (queue_to_ready): Add new code for automaton pipeline interface. Use MAX_INSN_QUEUE_INDEX instead of INSN_QUEUE_SIZE. (debug_ready_list): Print newline when the queue is empty. (max_issue): New function for automaton pipeline interface. (choose_ready): New function. (schedule_block): Add new code for automaton pipeline interface. Print ready list before scheduling each insn. (sched_init): Add new code for automaton pipeline interface. Initiate insn cost by -1. (sched_finish): Free the current automaton state and finalize automaton pipeline interface. * sched-rgn.c: Include target.h. (init_ready_list, new_ready, debug_dependencies): Add new code for automaton pipeline interface. * sched-vis.c: Include target.h. (get_visual_tbl_length): Add code for automaton interface. (target_units, print_block_visualization): Add comments. * Makefile.in (GETRUNTIME, HASHTAB, HOST_GETRUNTIME, HOST_HASHTAB, USE_HOST_GETRUNTIME, USE_HOST_HASHTAB, HOST_VARRAY): New variables. (sched-rgn.o, sched-vis.o): Add new dependency file target.h. (getruntime.o, genautomata.o): New entries. (genattrtab.o): Add new dependency file genattrtab.h. (genattrtab): Add new dependencies. Link it with `libm.a'. (getruntime.o, hashtab.o): New entries for canadian cross. * doc/md.texi: Description of automaton based model. * doc/tm.texi (TARGET_SCHED_ISSUE_RATE, TARGET_SCHED_ADJUST_COST): Add comments. (TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE, TARGET_SCHED_DFA_PRE_CYCLE_INSN, TARGET_SCHED_INIT_DFA_PRE_CYCLE_INSN, TARGET_SCHED_DFA_POST_CYCLE_INSN, TARGET_SCHED_INIT_DFA_POST_CYCLE_INSN, TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD, TARGET_SCHED_INIT_DFA_BUBBLES, TARGET_SCHED_DFA_BUBBLE): The new hook descriptions. (TRADITIONAL_PIPELINE_INTERFACE, DFA_PIPELINE_INTERFACE, MAX_DFA_ISSUE_RATE): New macro descriptions. * doc/contrib.texi: Add dfa based scheduler contribution. * doc/gcc.texi: Add more information about genattrtab. From-SVN: r45202
Diffstat (limited to 'gcc/genattrtab.c')
-rw-r--r--gcc/genattrtab.c80
1 files changed, 65 insertions, 15 deletions
diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c
index 94f18e390e2..2a7b7579c16 100644
--- a/gcc/genattrtab.c
+++ b/gcc/genattrtab.c
@@ -110,6 +110,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "obstack.h"
#include "errors.h"
+#include "genattrtab.h"
+
static struct obstack obstack1, obstack2;
struct obstack *hash_obstack = &obstack1;
struct obstack *temp_obstack = &obstack2;
@@ -304,6 +306,8 @@ static int have_annul_true, have_annul_false;
static int num_units, num_unit_opclasses;
static int num_insn_ents;
+int num_dfa_decls;
+
/* Used as operand to `operate_exp': */
enum operator {PLUS_OP, MINUS_OP, POS_MINUS_OP, EQ_OP, OR_OP, ORX_OP, MAX_OP, MIN_OP, RANGE_OP};
@@ -365,10 +369,7 @@ rtx pic_offset_table_rtx;
static void attr_hash_add_rtx PARAMS ((int, rtx));
static void attr_hash_add_string PARAMS ((int, char *));
static rtx attr_rtx PARAMS ((enum rtx_code, ...));
-static char *attr_printf PARAMS ((int, const char *, ...))
- ATTRIBUTE_PRINTF_2;
static char *attr_string PARAMS ((const char *, int));
-static rtx check_attr_test PARAMS ((rtx, int, int));
static rtx check_attr_value PARAMS ((rtx, struct attr_desc *));
static rtx convert_set_attr_alternative PARAMS ((rtx, struct insn_def *));
static rtx convert_set_attr PARAMS ((rtx, struct insn_def *));
@@ -452,10 +453,8 @@ static void write_const_num_delay_slots PARAMS ((void));
static int n_comma_elts PARAMS ((const char *));
static char *next_comma_elt PARAMS ((const char **));
static struct attr_desc *find_attr PARAMS ((const char *, int));
-static void make_internal_attr PARAMS ((const char *, rtx, int));
static struct attr_value *find_most_used PARAMS ((struct attr_desc *));
static rtx find_single_value PARAMS ((struct attr_desc *));
-static rtx make_numeric_value PARAMS ((int));
static void extend_range PARAMS ((struct range *, int, int));
static rtx attr_eq PARAMS ((const char *, const char *));
static const char *attr_numeral PARAMS ((int));
@@ -742,7 +741,7 @@ attr_rtx VPARAMS ((enum rtx_code code, ...))
rtx attr_printf (len, format, [arg1, ..., argn]) */
-static char *
+char *
attr_printf VPARAMS ((register int len, const char *fmt, ...))
{
#ifndef ANSI_PROTOTYPES
@@ -930,7 +929,7 @@ attr_copy_rtx (orig)
Return the new expression, if any. */
-static rtx
+rtx
check_attr_test (exp, is_const, lineno)
rtx exp;
int is_const;
@@ -5885,7 +5884,7 @@ find_attr (name, create)
/* Create internal attribute with the given default value. */
-static void
+void
make_internal_attr (name, value, special)
const char *name;
rtx value;
@@ -5952,7 +5951,7 @@ find_single_value (attr)
/* Return (attr_value "n") */
-static rtx
+rtx
make_numeric_value (n)
int n;
{
@@ -6102,6 +6101,7 @@ from the machine description file `md'. */\n\n");
/* Read the machine description. */
+ initiate_automaton_gen (argc, argv);
while (1)
{
int lineno;
@@ -6130,6 +6130,46 @@ from the machine description file `md'. */\n\n");
gen_unit (desc, lineno);
break;
+ case DEFINE_CPU_UNIT:
+ gen_cpu_unit (desc);
+ break;
+
+ case DEFINE_QUERY_CPU_UNIT:
+ gen_query_cpu_unit (desc);
+ break;
+
+ case DEFINE_BYPASS:
+ gen_bypass (desc);
+ break;
+
+ case EXCLUSION_SET:
+ gen_excl_set (desc);
+ break;
+
+ case PRESENCE_SET:
+ gen_presence_set (desc);
+ break;
+
+ case ABSENCE_SET:
+ gen_absence_set (desc);
+ break;
+
+ case DEFINE_AUTOMATON:
+ gen_automaton (desc);
+ break;
+
+ case AUTOMATA_OPTION:
+ gen_automata_option (desc);
+ break;
+
+ case DEFINE_RESERVATION:
+ gen_reserv (desc);
+ break;
+
+ case DEFINE_INSN_RESERVATION:
+ gen_insn_reserv (desc);
+ break;
+
default:
break;
}
@@ -6154,9 +6194,14 @@ from the machine description file `md'. */\n\n");
if (num_delays)
expand_delays ();
- /* Expand DEFINE_FUNCTION_UNIT information into new attributes. */
- if (num_units)
- expand_units ();
+ if (num_units || num_dfa_decls)
+ {
+ /* Expand DEFINE_FUNCTION_UNIT information into new attributes. */
+ expand_units ();
+ /* Build DFA, output some functions and expand DFA information
+ into new attributes. */
+ expand_automata ();
+ }
printf ("#include \"config.h\"\n");
printf ("#include \"system.h\"\n");
@@ -6231,9 +6276,14 @@ from the machine description file `md'. */\n\n");
write_eligible_delay ("annul_false");
}
- /* Write out information about function units. */
- if (num_units)
- write_function_unit_info ();
+ if (num_units || num_dfa_decls)
+ {
+ /* Write out information about function units. */
+ write_function_unit_info ();
+ /* Output code for pipeline hazards recognition based on DFA
+ (deterministic finite state automata. */
+ write_automata ();
+ }
/* Write out constant delay slot info */
write_const_num_delay_slots ();