This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[itanium-sched-branch] New interface function dfa_clean_insn_cache [patch]
- From: Vladimir Makarov <vmakarov at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 18 Sep 2002 17:43:43 -0400
- Subject: [itanium-sched-branch] New interface function dfa_clean_insn_cache [patch]
I am planning to use different descriptions for insn scheduling and
template generation on reorganization pass after each insn scheduled
EBB. Therefore I need the following patch.
Vlad
2002-09-18 Vladimir Makarov <vmakarov@redhat.com>
* genattr.c (main): Add output of prototype of new interface
function `dfa_clean_insn_cache'.
* genautomata.c (output_dfa_clean_insn_cache_func): New
function.
(DFA_CLEAN_INSN_CACHE_FUNC_NAME): New macro.
(output_dfa_start_func): Use function `dfa_clean_insn_cache' in
the generated code.
(write_automata): Call the new function.
Index: genattr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/genattr.c,v
retrieving revision 1.51
diff -c -p -r1.51 genattr.c
*** genattr.c 14 May 2002 00:15:51 -0000 1.51
--- genattr.c 18 Sep 2002 21:13:01 -0000
*************** main (argc, argv)
*** 439,444 ****
--- 439,449 ----
printf (" unit with given code is currently reserved in
given\n");
printf (" DFA state. */\n");
printf ("extern int cpu_unit_reservation_p PARAMS ((state_t,
int));\n");
+ printf ("/* Clean insn code cache. It should be called if
there\n");
+ printf (" is a chance that condition value in a\n");
+ printf (" define_insn_reservation will be changed after\n");
+ printf (" last call of dfa_start. */\n");
+ printf ("extern void dfa_clean_insn_cache PARAMS
((void));\n\n");
printf ("#endif\n\n");
printf ("/* Initiate and finish work with DFA. They should
be\n");
printf (" called as the first and the last interface\n");
Index: genautomata.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/genautomata.c,v
retrieving revision 1.24
diff -c -p -r1.24 genautomata.c
*** genautomata.c 21 Aug 2002 23:24:10 -0000 1.24
--- genautomata.c 18 Sep 2002 21:13:02 -0000
*************** static int units_cmp PARAMS
((
*** 481,486 ****
--- 481,487 ----
const void *));
static void output_get_cpu_unit_code_func PARAMS ((void));
static void output_cpu_unit_reservation_p PARAMS ((void));
+ static void output_dfa_clean_insn_cache_func PARAMS ((void));
static void output_dfa_start_func PARAMS ((void));
static void output_dfa_finish_func PARAMS ((void));
*************** output_reserved_units_table_name (f, aut
*** 7165,7170 ****
--- 7166,7173 ----
#define CPU_UNIT_RESERVATION_P_FUNC_NAME "cpu_unit_reservation_p"
+ #define DFA_CLEAN_INSN_CACHE_FUNC_NAME "dfa_clean_insn_cache"
+
#define DFA_START_FUNC_NAME "dfa_start"
#define DFA_FINISH_FUNC_NAME "dfa_finish"
*************** output_cpu_unit_reservation_p ()
*** 8744,8759 ****
fprintf (output_file, " return 0;\n}\n\n");
}
! /* The function outputs PHR interface function `dfa_start'. */
static void
! output_dfa_start_func ()
{
fprintf (output_file,
! "void\n%s ()\n{\n int %s;\n\n %s = get_max_uid ();\n",
! DFA_START_FUNC_NAME, I_VARIABLE_NAME,
! DFA_INSN_CODES_LENGTH_VARIABLE_NAME);
! fprintf (output_file, " %s = (int *) xmalloc (%s * sizeof
(int));\n",
! DFA_INSN_CODES_VARIABLE_NAME,
DFA_INSN_CODES_LENGTH_VARIABLE_NAME);
fprintf (output_file,
" for (%s = 0; %s < %s; %s++)\n %s [%s] = -1;\n}\n\n",
I_VARIABLE_NAME, I_VARIABLE_NAME,
--- 8747,8759 ----
fprintf (output_file, " return 0;\n}\n\n");
}
! /* The function outputs PHR interface function
`dfa_clean_insn_cache'. */
static void
! output_dfa_clean_insn_cache_func ()
{
fprintf (output_file,
! "void\n%s ()\n{\n int %s;\n\n",
! DFA_CLEAN_INSN_CACHE_FUNC_NAME, I_VARIABLE_NAME);
fprintf (output_file,
" for (%s = 0; %s < %s; %s++)\n %s [%s] = -1;\n}\n\n",
I_VARIABLE_NAME, I_VARIABLE_NAME,
*************** output_dfa_start_func ()
*** 8761,8766 ****
--- 8761,8778 ----
DFA_INSN_CODES_VARIABLE_NAME, I_VARIABLE_NAME);
}
+ /* The function outputs PHR interface function `dfa_start'. */
+ static void
+ output_dfa_start_func ()
+ {
+ fprintf (output_file,
+ "void\n%s ()\n{\n %s = get_max_uid ();\n",
+ DFA_START_FUNC_NAME, DFA_INSN_CODES_LENGTH_VARIABLE_NAME);
+ fprintf (output_file, " %s = (int *) xmalloc (%s * sizeof
(int));\n",
+ DFA_INSN_CODES_VARIABLE_NAME,
DFA_INSN_CODES_LENGTH_VARIABLE_NAME);
+ fprintf (output_file, " %s ();\n}\n\n",
DFA_CLEAN_INSN_CACHE_FUNC_NAME);
+ }
+
/* The function outputs PHR interface function `dfa_finish'. */
static void
output_dfa_finish_func ()
*************** write_automata ()
*** 9689,9694 ****
--- 9701,9707 ----
fprintf (output_file, "\n#endif /* #if %s */\n\n",
CPU_UNITS_QUERY_MACRO_NAME);
}
+ output_dfa_clean_insn_cache_func ();
output_dfa_start_func ();
output_dfa_finish_func ();
fprintf (stderr, "done\n");