Commit c21953c3 by Richard Stallman

(clipper_builtin_saveregs): Changes to go with va-clipper.h changes.

From-SVN: r4895
parent 9e91edce
...@@ -366,57 +366,81 @@ rev_cond_name (op) ...@@ -366,57 +366,81 @@ rev_cond_name (op)
/* Do what is necessary for `va_start'. The argument is ignored; /* Do what is necessary for `va_start'. The argument is ignored;
We look at the current function to determine if stdargs or varargs We fill in an initial va_list. A pointer to this constructor
is used and fill in an initial va_list. A pointer to this constructor is returned. */
is returned. */
struct rtx_def * struct rtx_def *
clipper_builtin_saveregs (arglist) clipper_builtin_saveregs (arglist)
tree arglist; tree arglist;
{ {
extern int current_function_varargs; extern int current_function_varargs;
rtx block, addr, argsize; rtx block, addr, argsize, scratch, r0_addr,r1_addr,f0_addr,f1_addr;
/* Allocate the va_list constructor */
block = assign_stack_local (BLKmode, 8 * UNITS_PER_WORD, 2 * BITS_PER_WORD); /* Allocate the va_list constructor + save area for r0,r1,f0,f1 */
block = assign_stack_local (BLKmode,
(6 + 6) * UNITS_PER_WORD, 2 * BITS_PER_WORD);
RTX_UNCHANGING_P (block) = 1; RTX_UNCHANGING_P (block) = 1;
RTX_UNCHANGING_P (XEXP (block, 0)) = 1; RTX_UNCHANGING_P (XEXP (block, 0)) = 1;
addr = copy_to_reg (XEXP (block, 0)); addr = copy_to_reg (XEXP (block, 0));
/* Store float regs */ f0_addr = gen_rtx (PLUS, Pmode, addr, gen_rtx (CONST_INT, Pmode, 24));
f1_addr = gen_rtx (PLUS, Pmode, addr, gen_rtx (CONST_INT, Pmode, 32));
r0_addr = gen_rtx (PLUS, Pmode, addr, gen_rtx (CONST_INT, Pmode, 40));
r1_addr = gen_rtx (PLUS, Pmode, addr, gen_rtx (CONST_INT, Pmode, 44));
emit_move_insn (gen_rtx (MEM, DFmode, addr),
gen_rtx (REG, DFmode, 16));
emit_move_insn (gen_rtx (MEM, DFmode, /* Store float regs */
gen_rtx (PLUS, Pmode, addr,
gen_rtx (CONST_INT, Pmode, 8))), emit_move_insn (gen_rtx (MEM, DFmode, f0_addr), gen_rtx (REG, DFmode, 16));
gen_rtx (REG, DFmode, 17)); emit_move_insn (gen_rtx (MEM, DFmode, f1_addr), gen_rtx (REG, DFmode, 17));
/* Store int regs */ /* Store int regs */
emit_move_insn (gen_rtx (MEM, SImode, emit_move_insn (gen_rtx (MEM, SImode, r0_addr), gen_rtx (REG, SImode, 0));
gen_rtx (PLUS, Pmode, addr, emit_move_insn (gen_rtx (MEM, SImode, r1_addr), gen_rtx (REG, SImode, 1));
gen_rtx (CONST_INT, Pmode, 16))),
gen_rtx (REG, SImode, 0));
emit_move_insn (gen_rtx (MEM, SImode, /* Store the arg pointer in the __va_stk member. */
gen_rtx (PLUS, Pmode, addr,
gen_rtx (CONST_INT, Pmode, 20))),
gen_rtx (REG, SImode, 1));
emit_move_insn (gen_rtx (MEM, SImode, addr),
copy_to_reg (virtual_incoming_args_rtx));
/* Store the arg pointer in the __va_stk member. */ /* now move addresses of the saved regs into the pointer array */
scratch = gen_reg_rtx (Pmode);
emit_move_insn (scratch, r0_addr);
emit_move_insn (gen_rtx (MEM, SImode, emit_move_insn (gen_rtx (MEM, SImode,
gen_rtx (PLUS, Pmode, addr, gen_rtx (PLUS, Pmode, addr,
gen_rtx (CONST_INT, Pmode, 24))), gen_rtx (CONST_INT, Pmode, 4))),
copy_to_reg (virtual_incoming_args_rtx)); scratch);
emit_move_insn (scratch, f0_addr);
emit_move_insn (gen_rtx (MEM, SImode,
gen_rtx (PLUS, Pmode, addr,
gen_rtx (CONST_INT, Pmode, 8))),
scratch);
emit_move_insn (scratch, r1_addr);
emit_move_insn (gen_rtx (MEM, SImode,
gen_rtx (PLUS, Pmode, addr,
gen_rtx (CONST_INT, Pmode, 12))),
scratch);
emit_move_insn (scratch, f1_addr);
emit_move_insn (gen_rtx (MEM, SImode,
gen_rtx (PLUS, Pmode, addr,
gen_rtx (CONST_INT, Pmode, 16))),
scratch);
/* Return the address of the va_list constructor, but don't put it in a /* Return the address of the va_list constructor, but don't put it in a
register. This fails when not optimizing and produces worse code when register. This fails when not optimizing and produces worse code when
optimizing. */ optimizing. */
return XEXP (block, 0); return XEXP (block, 0);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment