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: [PATCH]: alignment analysis, take 3


On Wed, Apr 27, 2005 at 01:11:51PM -0400, Daniel Berlin wrote:
> +  else if (TREE_CODE (rhs) == ADDR_EXPR
> +	   && DECL_P (TREE_OPERAND (rhs, 0)))
> +    {
> +      val = get_decl_alignment (TREE_OPERAND (rhs, 0));

This usage is ok.

> +      if (TREE_CODE (op1) == SSA_NAME && POINTER_TYPE_P (TREE_TYPE (op1)))
> +	op1val = get_value (op1);
> +      else if (DECL_P (op1) && POINTER_TYPE_P (TREE_TYPE (op1)))
> +	{
> +	  temp = get_decl_alignment (op1);

This one isn't.  Again you're applying the alignment of the pointer
to the alignment of the object.

> +      if (TREE_CODE (op2) == INTEGER_CST)
> +	newoffset = TREE_INT_CST_LOW (op2);
> +      if (op1val == NULL 
> +	  || newoffset == 0 || (op1val && op1val->lattice_val == UNDEFINED))
> +	{
> +	   val.lattice_val = KNOWN;
> +	   val.alignment.n = BITS_PER_UNIT;
> +	   val.alignment.offset = 0;

This is confused wrt constants.  Further, any time you find yourself
wanting to fall back to BITS_PER_UNIT is when you should use the 
get_default_value code.

> +	  val.alignment.offset = ((val.alignment.offset + 
> +				   BITS_PER_UNIT * newoffset) 
> +				  % val.alignment.n);

Doesn't handle MINUS_EXPR properly.



r~


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