Ping: C-family stack check for threads

Ye Joey joey.ye.cc@gmail.com
Mon Sep 5 09:45:00 GMT 2011


On Mon, Sep 5, 2011 at 1:45 AM, Thomas Klein <th.r.klein@web.de> wrote:

> +static int
> +stack_check_work_registers (rtx *workreg)
> +{
> +  int reg, i, k, n, nregs;
> +
> +  if (crtl->args.info.pcs_variant <= ARM_PCS_AAPCS_LOCAL)
> +    {
> +      nregs = crtl->args.info.aapcs_next_ncrn;
> +    }
> +  else
> +    nregs = crtl->args.info.nregs;
Missing {} for else

> +  n = 0;
...
> +  /* check if we can use one of the argument registers r0..r3 as long as they
> +   * not holding data*/
> +  for (reg = 0; reg <= LAST_ARG_REGNUM && i < 2; reg++)
...
> +          n = (reg + 1) % 4;
Avoid immediate register number.
use ARG_REGISTER (1) to replace "reg 0"
use NUM_ARG_REGS to replace "4"

> +      if (is_non_opt_thumb2 || is_thumb2_hi_reg[0])
> +   	    arm_emit_movpair(reg[0], stack_limit_rtx);
> +      else
> +        emit_move_insn(reg[0], stack_limit_rtx);
and
> +	  rtx lr = gen_rtx_REG (SImode, LR_REGNUM);
> +      emit_push_regs (1, &lr);
Wrong indent



More information about the Gcc-patches mailing list