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]

Reglcass cleanup 2


Hi
This optimization is IMO useless. When there is two address insn as
it is shooting for, that have operand0 input, operand1 maching operand0,
it's predicate ought not to allow immediate to get to operand1.
Or am I missing something?
It don't match in bootstrap on x86.

It probably comes from some pre-predicates era of gcc.

Thu Dec 16 11:37:53 MET 1999  Jan Hubicka  <hubicka@freesoft.cz>
	* regclass.c (scan_one_insn): Do not try to optimize two address
	insns.

Index: egcs/gcc/regclass.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/regclass.c,v
retrieving revision 1.81
diff -c -3 -p -r1.81 regclass.c
*** regclass.c	1999/12/16 10:35:14	1.81
--- regclass.c	1999/12/16 10:36:49
*************** scan_one_insn (insn, pass)
*** 857,916 ****
        return insn;
      }
  
-   /* Improve handling of two-address insns such as
-      (set X (ashift CONST Y)) where CONST must be made to
-      match X. Change it into two insns: (set X CONST)
-      (set X (ashift X Y)).  If we left this for reloading, it
-      would probably get three insns because X and Y might go
-      in the same place. This prevents X and Y from receiving
-      the same hard reg.
- 
-      We can only do this if the modes of operands 0 and 1
-      (which might not be the same) are tieable and we only need
-      do this during our first pass.  */
- 
-   if (pass == 0 && optimize
-       && recog_data.n_operands >= 3
-       && recog_data.constraints[1][0] == '0'
-       && recog_data.constraints[1][1] == 0
-       && CONSTANT_P (recog_data.operand[1])
-       && ! rtx_equal_p (recog_data.operand[0], recog_data.operand[1])
-       && ! rtx_equal_p (recog_data.operand[0], recog_data.operand[2])
-       && GET_CODE (recog_data.operand[0]) == REG
-       && MODES_TIEABLE_P (GET_MODE (recog_data.operand[0]),
- 			  recog_data.operand_mode[1]))
-     {
-       rtx previnsn = prev_real_insn (insn);
-       rtx dest
- 	= gen_lowpart (recog_data.operand_mode[1],
- 		       recog_data.operand[0]);
-       rtx newinsn
- 	= emit_insn_before (gen_move_insn (dest, recog_data.operand[1]), insn);
- 
-       /* If this insn was the start of a basic block,
- 	 include the new insn in that block.
- 	 We need not check for code_label here;
- 	 while a basic block can start with a code_label,
- 	 INSN could not be at the beginning of that block.  */
-       if (previnsn == 0 || GET_CODE (previnsn) == JUMP_INSN)
- 	{
- 	  int b;
- 	  for (b = 0; b < n_basic_blocks; b++)
- 	    if (insn == BLOCK_HEAD (b))
- 	      BLOCK_HEAD (b) = newinsn;
- 	}
- 
-       /* This makes one more setting of new insns's dest.  */
-       REG_N_SETS (REGNO (recog_data.operand[0]))++;
- 
-       *recog_data.operand_loc[1] = recog_data.operand[0];
-       for (i = recog_data.n_dups - 1; i >= 0; i--)
- 	if (recog_data.dup_num[i] == 1)
- 	  *recog_data.dup_loc[i] = recog_data.operand[0];
- 
-       return PREV_INSN (newinsn);
-     }
- 
    /* If we get here, we are set up to record the costs of all the
       operands for this insn.  Start by initializing the costs.
       Then handle any address registers.  Finally record the desired
--- 857,862 ----


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