This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

More insn_extract caching



Hi
This patch eliminates about 30-50% of extract_insn calls in the non-optimizing
compilation by catching few extra possibilities in caching.  Also removes one
extract_insn in the final_scan_insn, that is useless since cleanup_subreg_operands
does it itself.  The gains are roughly 3-5% on the insn-attrtab.c non-optimizing
compilation.

Honza

Wed Sep 20 21:16:31 CEST 2000  Jan Hubicka  <jh@suse.cz>
	* final.c (final_scan_insn): Remove extra extract_insn call;
	Use caching for constrain_operands.
	(cleanup_subreg_operands): Use caching for extract_insn.
	* recog.c (constrain_operands_cached): New.
	* recog.h (constrain_operands_cached): Declare.
	* i386.c (ix86_attr_length_immediate_default,
	ix86_attr_length_address_default, ix86_agi_dependant): Cache
	extract_insn call.

*** ../../egcs-20000918.orig/gcc/./final.c	Wed Sep 20 11:18:03 2000
--- ./final.c	Wed Sep 20 21:10:03 2000
*************** final_scan_insn (insn, file, optimize, p
*** 2919,2925 ****
  	   since `reload' should have changed them so that they do.  */
  
  	insn_code_number = recog_memoized (insn);
- 	extract_insn (insn);
  	cleanup_subreg_operands (insn);
  
         /* Dump the insn in the assembly for debugging.  */
--- 2919,2924 ----
*************** final_scan_insn (insn, file, optimize, p
*** 2930,2936 ****
             print_rtx_head = "";
           }
         
! 	if (! constrain_operands (1))
  	  fatal_insn_not_found (insn);
  
  	/* Some target machines need to prescan each insn before
--- 2929,2935 ----
             print_rtx_head = "";
           }
         
! 	if (! constrain_operands_cached (1))
  	  fatal_insn_not_found (insn);
  
  	/* Some target machines need to prescan each insn before
*************** cleanup_subreg_operands (insn)
*** 3138,3145 ****
       rtx insn;
  {
    int i;
! 
!   extract_insn (insn);
    for (i = 0; i < recog_data.n_operands; i++)
      {
        if (GET_CODE (recog_data.operand[i]) == SUBREG)
--- 3137,3143 ----
       rtx insn;
  {
    int i;
!   extract_insn_cached (insn);
    for (i = 0; i < recog_data.n_operands; i++)
      {
        if (GET_CODE (recog_data.operand[i]) == SUBREG)
*** ../../egcs-20000918.orig/gcc/./recog.c	Wed Sep 20 11:18:04 2000
--- ./recog.c	Wed Sep 20 17:30:32 2000
*************** extract_constrain_insn_cached (insn)
*** 2069,2074 ****
--- 2076,2091 ----
        && !constrain_operands (reload_completed))
      fatal_insn_not_found (insn);
  }
+ /* Do cached constrain_operand and complain about failures.  */
+ int
+ constrain_operands_cached (strict)
+ 	int strict;
+ {
+   if (which_alternative == -1)
+     return constrain_operands (strict);
+   else
+     return 1;
+ }
  
  /* Analyze INSN and fill in recog_data.  */
  
*** ../../egcs-20000918.orig/gcc/./recog.h	Wed Sep 20 11:18:04 2000
--- ./recog.h	Wed Sep 20 10:45:00 2000
*************** extern int apply_change_group		PARAMS ((
*** 77,82 ****
--- 78,84 ----
  extern int num_validated_changes	PARAMS ((void));
  extern void cancel_changes		PARAMS ((int));
  extern int constrain_operands		PARAMS ((int));
+ extern int constrain_operands_cached	PARAMS ((int));
  extern int memory_address_p		PARAMS ((enum machine_mode, rtx));
  extern int strict_memory_address_p	PARAMS ((enum machine_mode, rtx));
  extern int validate_replace_rtx_subexp	PARAMS ((rtx, rtx, rtx, rtx *));
*** ../../egcs-20000918.orig/gcc/./config/i386/i386.c	Wed Sep 20 11:18:02 2000
--- ./config/i386/i386.c	Wed Sep 20 11:09:05 2000
*************** ix86_attr_length_immediate_default (insn
*** 6277,6283 ****
  {
    int len = 0;
    int i;
!   extract_insn (insn);
    for (i = recog_data.n_operands - 1; i >= 0; --i)
      if (CONSTANT_P (recog_data.operand[i]))
        {
--- 6277,6283 ----
  {
    int len = 0;
    int i;
!   extract_insn_cached (insn);
    for (i = recog_data.n_operands - 1; i >= 0; --i)
      if (CONSTANT_P (recog_data.operand[i]))
        {
*************** ix86_attr_length_address_default (insn)
*** 6313,6319 ****
       rtx insn;
  {
    int i;
!   extract_insn (insn);
    for (i = recog_data.n_operands - 1; i >= 0; --i)
      if (GET_CODE (recog_data.operand[i]) == MEM)
        {
--- 6313,6319 ----
       rtx insn;
  {
    int i;
!   extract_insn_cached (insn);
    for (i = recog_data.n_operands - 1; i >= 0; --i)
      if (GET_CODE (recog_data.operand[i]) == MEM)
        {
*************** ix86_agi_dependant (insn, dep_insn, insn
*** 6414,6420 ****
    else
      {
        int i;
!       extract_insn (insn);
        for (i = recog_data.n_operands - 1; i >= 0; --i)
  	if (GET_CODE (recog_data.operand[i]) == MEM)
  	  {
--- 6414,6420 ----
    else
      {
        int i;
!       extract_insn_cached (insn);
        for (i = recog_data.n_operands - 1; i >= 0; --i)
  	if (GET_CODE (recog_data.operand[i]) == MEM)
  	  {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]