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, PR50527] Don't assume alignment of vla-related allocas.


On 10/04/2011 09:28 AM, Tom de Vries wrote:
> Well, that was the idea. But now I wonder, isn't it better to do this in
> expand_builtin_alloca:
> ...
>    /* Compute the argument.  */
>    op0 = expand_normal (CALL_EXPR_ARG (exp, 0));
> 
> +  align =
> +    (DECL_FUNCTION_CODE (get_callee_fndecl (exp)) ==
> +     BUILT_IN_ALLOCA_WITH_ALIGN)
> +    ? TREE_INT_CST_LOW (CALL_EXPR_ARG (exp, 1))
> +    : BIGGEST_ALIGNMENT;
> +
> +
>    /* Allocate the desired space.  */
> -  result = allocate_dynamic_stack_space (op0, 0, BIGGEST_ALIGNMENT,
> -					 cannot_accumulate);
> +  result = allocate_dynamic_stack_space (op0, 0, align, cannot_accumulate);

Yes, this is better.

I've lost track of what you're trying to do with "folding" alloca?


r~


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