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 i386]: Change stack probing and allocation implementation


On 08/21/2010 08:23 AM, Kai Tietz wrote:
> +	addq	$0x7, %rax	/* Make sure stack is on alignment of 8.  */
> +	pushq	%rcx		/* save temp */
> +	andq	$0xfffffffffffffff8, %rax

Why the forced alignment?  First, it's to the wrong alignment (8 vs 16).
Second, I see no reason not to rely on the compiler passing a valid value.

> -      if (m->fs.cfa_reg == stack_pointer_rtx)
> -	{
> -	  m->fs.cfa_offset += allocate;
> -	  t = gen_rtx_PLUS (Pmode, stack_pointer_rtx, GEN_INT (-allocate));
> -	  t = gen_rtx_SET (VOIDmode, stack_pointer_rtx, t);
> -	  add_reg_note (insn, REG_CFA_ADJUST_CFA, t);
> -	  RTX_FRAME_RELATED_P (insn) = 1;
> -	}
> -      m->fs.sp_offset += allocate;
> +      pro_epilogue_adjust_stack (stack_pointer_rtx, stack_pointer_rtx,
> +			         GEN_INT (-allocate), -1,
> +			         m->fs.cfa_reg == stack_pointer_rtx);

FWIW,

	subq	%eax, %esp

is going to be a smaller instruction than

	subq	$large, %esp

Is there a good reason not to use the known value of eax,
and keep the existing REG_CFA_ADJUST_CFA note, but attach
it to a different insn?

> +        emit_insn (gen_allocate_stack_worker_probe_32 (x, x));
> +      x = expand_simple_binop (Pmode, MINUS, stack_pointer_rtx, x,
> +			       stack_pointer_rtx, 0, OPTAB_DIRECT);
> +      if (x != stack_pointer_rtx)
> +	emit_move_insn (stack_pointer_rtx, x);

Likewise.


r~


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