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]

Patch to improve register elimination


This patch improves register elimination by realizing that it doesn't
matter when the offset for a register can't be determined at the beginning
of the last basic block if the register isn't mentioned in the block and
there are no jumps to previous blocks.

ChangeLog:

Wed Feb  3 13:06:06 EST 1999  John Wehle  (john@feith.com)

	* reload1.c (set_label_offsets): Don't disable the elimination
	when the offsets don't agree at a CODE_LABEL if it's the last
	basic block, the register isn't mentioned, and there are no jumps
	to previous blocks.

Enjoy!

-- John Wehle
------------------8<------------------------8<------------------------
*** gcc/reload1.c.ORIGINAL	Wed Jan 27 22:22:32 1999
--- gcc/reload1.c	Wed Feb  3 00:50:26 1999
*************** set_label_offsets (x, insn, initial_p)
*** 2571,2577 ****
  	  if (offsets_at[CODE_LABEL_NUMBER (x)][i]
  	      != (initial_p ? reg_eliminate[i].initial_offset
  		  : reg_eliminate[i].offset))
! 	    reg_eliminate[i].can_eliminate = 0;
  
        return;
  
--- 2571,2593 ----
  	  if (offsets_at[CODE_LABEL_NUMBER (x)][i]
  	      != (initial_p ? reg_eliminate[i].initial_offset
  		  : reg_eliminate[i].offset))
! 	    if (insn == BLOCK_HEAD (n_basic_blocks - 1))
! 	      {
! 		/* If the register being eliminated isn't mentioned
! 		   in the last block and there are no jumps to other
! 		   blocks, then it doesn't matter if the offset can't
! 		   be determined since the value isn't used.  */
! 
! 		for (tem = insn; tem; tem = NEXT_INSN (tem))
! 		  if (GET_CODE (tem) == JUMP_INSN
! 		      || reg_overlap_mentioned_for_reload_p (
! 					reg_eliminate[i].from_rtx, tem))
! 		    break;
! 		if (tem)
! 		  reg_eliminate[i].can_eliminate = 0;
! 	      }
! 	    else
! 	      reg_eliminate[i].can_eliminate = 0;
  
        return;
  
-------------------------------------------------------------------------
|   Feith Systems  |   Voice: 1-215-646-8000  |  Email: john@feith.com  |
|    John Wehle    |     Fax: 1-215-540-5495  |                         |
-------------------------------------------------------------------------



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