Example #1
0
int
crx_initial_elimination_offset (int from, int to)
{
  /* Compute this since we need to use sum_regs.  */
  crx_compute_save_regs ();

  /* Compute this since we need to use local_vars_size.  */
  crx_compute_frame ();

  if ((from) == FRAME_POINTER_REGNUM && (to) == STACK_POINTER_REGNUM)
    return (ACCUMULATE_OUTGOING_ARGS ?
	    current_function_outgoing_args_size : 0);
  else if ((from) == ARG_POINTER_REGNUM && (to) == FRAME_POINTER_REGNUM)
    return (sum_regs + local_vars_size);
  else if ((from) == ARG_POINTER_REGNUM && (to) == STACK_POINTER_REGNUM)
    return (sum_regs + local_vars_size +
	    (ACCUMULATE_OUTGOING_ARGS ?
	     current_function_outgoing_args_size : 0));
  else
    abort ();
}
void
crx_expand_prologue (void)
{
  crx_compute_frame ();
  crx_compute_save_regs ();

  /* If there is no need in push and adjustment to sp, return. */
  if (size_for_adjusting_sp + sum_regs == 0)
    return;

  if (last_reg_to_save != -1)
    /* If there are registers to push.  */
    emit_insn (gen_push_for_prologue (GEN_INT (sum_regs)));

  if (size_for_adjusting_sp > 0)
    emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx,
			   GEN_INT (-size_for_adjusting_sp)));

  if (frame_pointer_needed)
    /* Initialize the frame pointer with the value of the stack pointer
     * pointing now to the locals. */
    emit_move_insn (frame_pointer_rtx, stack_pointer_rtx);
}