regclass tweak 2

Jan Hubicka hubicka@atrey.karlin.mff.cuni.cz
Mon Nov 22 07:48:00 GMT 1999


Hi
The cost calculation in record_reg_classes are not quite correct for INOUT operands.
Note that the change is not really necesarry in the first case, that is done

Mon Nov 22 16:46:41 MET 1999  Jan Hubicka  <hubicka@freesoft.cz>

	* regclass.c (record_reg_classes): Handle INOUT operands propertly.

*** regclass.c	1999/11/22 13:43:39	1.72
--- regclass.c	1999/11/22 15:30:19
*************** record_reg_classes (n_alts, n_ops, ops, 
*** 1287,1304 ****
  
  		  for (class = 0; class < N_REG_CLASSES; class++)
  		    pp->cost[class]
! 		      = (recog_data.operand_type[i] == OP_IN
! 			 ? may_move_in_cost[class][(int) classes[i]]
! 			 : may_move_out_cost[(int) classes[i]][class]);
  		  
  		  /* If the alternative actually allows memory, make things
  		     a bit cheaper since we won't need an extra insn to
  		     load it.  */
  
  		  pp->mem_cost
! 		    = (MEMORY_MOVE_COST (mode, classes[i], 
! 					 recog_data.operand_type[i] == OP_IN)
! 		       - allows_mem[i]);
  
  		  /* If we have assigned a class to this register in our
  		     first pass, add a cost to this alternative corresponding
--- 1932,1955 ----
  
  		  for (class = 0; class < N_REG_CLASSES; class++)
  		    pp->cost[class]
! 		      = ((recog_data.operand_type[i] != OP_OUT
! 			  ? may_move_in_cost[class][(int) classes[i]]
! 			  : 0)
! 			 + (recog_data.operand_type[i] != OP_IN
! 			    ? may_move_out_cost[(int) classes[i]][class]
! 			    : 0));
  		  
  		  /* If the alternative actually allows memory, make things
  		     a bit cheaper since we won't need an extra insn to
  		     load it.  */
  
  		  pp->mem_cost
! 		    = ((recog_data.operand_type[i] != OP_IN
! 		        ? MEMORY_MOVE_COST (mode, classes[i], 0)
! 			: 0)
! 		       + (recog_data.operand_type[i] != OP_OUT
! 			  ? MEMORY_MOVE_COST (mode, classes[i], 1)
! 			  : 0) - allows_mem[i]);
  
  		  /* If we have assigned a class to this register in our
  		     first pass, add a cost to this alternative corresponding
*************** record_reg_classes (n_alts, n_ops, ops, 
*** 1508,1525 ****
  
  		  for (class = 0; class < N_REG_CLASSES; class++)
  		    pp->cost[class]
! 		      = (recog_data.operand_type[i] == OP_IN
! 			 ? may_move_in_cost[class][(int) classes[i]]
! 			 : may_move_out_cost[(int) classes[i]][class]);
  
  		  /* If the alternative actually allows memory, make things
  		     a bit cheaper since we won't need an extra insn to
  		     load it.  */
  
  		  pp->mem_cost
! 		    = (MEMORY_MOVE_COST (mode, classes[i], 
! 					 recog_data.operand_type[i] == OP_IN)
! 		       - allows_mem[i]);
  
  		  /* If we have assigned a class to this register in our
  		     first pass, add a cost to this alternative corresponding
--- 2159,2182 ----
  
  		  for (class = 0; class < N_REG_CLASSES; class++)
  		    pp->cost[class]
! 		      = ((recog_data.operand_type[i] != OP_OUT
! 			  ? may_move_in_cost[class][(int) classes[i]]
! 			  : 0)
! 			 + (recog_data.operand_type[i] != OP_IN
! 			    ? may_move_out_cost[(int) classes[i]][class]
! 			    : 0));
  
  		  /* If the alternative actually allows memory, make things
  		     a bit cheaper since we won't need an extra insn to
  		     load it.  */
  
  		  pp->mem_cost
! 		    = ((recog_data.operand_type[i] != OP_IN
! 		        ? MEMORY_MOVE_COST (mode, classes[i], 0)
! 			: 0)
! 		       + (recog_data.operand_type[i] != OP_OUT
! 			  ? MEMORY_MOVE_COST (mode, classes[i], 1)
! 			  : 0) - allows_mem[i]);
  
  		  /* If we have assigned a class to this register in our
  		     first pass, add a cost to this alternative corresponding


More information about the Gcc-patches mailing list