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]
Other format: [Raw text]

Re: SSA question


In message <Pine.LNX.4.30.0203141305130.6357-100000@nondot.org>, Chris Lattner 
writes:
 > Ok, I didn't think it was desirable either.  I think that renaming all
 > undefined incoming values should preserve the current semantics (that
 > undefined values are simply registers with no defs), with the added bonus
 > of breaking these loops.
[ ... ]

 > Yup, I agree, I think renaming is the best way to go, and seems simple
 > enough.
 > 
 > > Go ahead and cobble up a patch, I'll review it.
 > 
 > Does this look reasonable?  [My tree is very out of date, but it works for
 > me and should apply to a current tree with no problems]
It was pretty reasonable.  I took the opportunity to fix a style issue or two
in the surrounding code.  

For those who missed the thread, this patch is in response to this thread:

  http://gcc.gnu.org/ml/gcc/2002-03/msg00676.html

Sine we're not actively using the RTL SSA code, I have not gone through a 
bootstrap/regression test on this patch.  I did verify that I didn't introduce
any syntax errors by rebuilding a v850 cross compiler that I had handy :-)

For reference, here's the patch that I'm checking into the mainline sources:

	* ssa.c (rename_insn_1): Rename uses of undefined registers to
	prevent confusion if/when the register is defined.

Index: ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ssa.c,v
retrieving revision 1.49
diff -c -3 -p -r1.49 ssa.c
*** ssa.c	27 May 2002 13:45:44 -0000	1.49
--- ssa.c	29 May 2002 16:04:43 -0000
*************** rename_insn_1 (ptr, data)
*** 916,933 ****
        }
  
      case REG:
!       if (CONVERT_REGISTER_TO_SSA_P (REGNO (x)) &&
! 	  REGNO (x) < ssa_max_reg_num)
  	{
  	  rtx new_reg = ssa_rename_to_lookup (x);
  
! 	  if (new_reg != NULL_RTX && new_reg != RENAME_NO_RTX)
  	    {
! 	      if (GET_MODE (x) != GET_MODE (new_reg))
! 		abort ();
! 	      *ptr = new_reg;
  	    }
- 	  /* Else this is a use before a set.  Warn?  */
  	}
        return -1;
  
--- 916,941 ----
        }
  
      case REG:
!       if (CONVERT_REGISTER_TO_SSA_P (REGNO (x))
! 	  && REGNO (x) < ssa_max_reg_num)
  	{
  	  rtx new_reg = ssa_rename_to_lookup (x);
  
! 	  if (new_reg != RENAME_NO_RTX)
  	    {
! 	      if (new_reg != NULL_RTX)
! 		{
! 		  if (GET_MODE (x) != GET_MODE (new_reg))
! 		    abort ();
! 		  *ptr = new_reg;
! 		}
! 	      else
! 		{
! 		  /* Undefined value used, rename it to a new pseudo register so
! 		     that it cannot conflict with an existing register */
! 		  *ptr = gen_reg_rtx (GET_MODE(x));
! 		}
  	    }
  	}
        return -1;
  



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