gengenrtl.c (special_rtx): PC, CC0 and RETURN are special.

* gengenrtl.c (special_rtx): PC, CC0 and RETURN are special.
	* genemit.c (gen_exp): Handle RETURN.
	* emit-rtl.c (verify_rtx_sharing): Likewise.
	(init_emit_regs): Create pc_rtx, ret_rtx and cc0_rtx specially.
	* rtl.c (copy_rtx): RETURN is shared.
	* rtl.h (enum global_rtl_index): Add GR_RETURN.
	(ret_rtx): New.
	* jump.c (redirect_exp_1): Don't use gen_rtx_RETURN.
	* config/s390/s390.c (s390_emit_epilogue): Likewise.
	* config/rx/rx.c (gen_rx_rtsd_vector): Likewise.
	* config/cris/cris.c (cris_expand_return): Likewise.
	* config/m68k/m68k.c (m68k_expand_epilogue): Likewise.
	* config/rs6000/rs6000.c (rs6000_make_savres_rtx,
	rs6000_emit_epilogue, rs6000_output_mi_thunk): Likewise.
	* config/picochip/picochip.c (picochip_expand_epilogue): Likewise.
	* config/h8300/h8300.c (h8300_push_pop, h8300_expand_epilogue):
	Likewise.
	* config/v850/v850.c (expand_epilogue): Likewise.
	* config/bfin/bfin.c (bfin_expand_call): Likewise.
	* config/arm/arm.md (epilogue): Likewise.
	* config/mn10300/mn10300.c (mn10300_expand_epilogue): Likewise.
	* config/sparc/sparc.c (sparc_struct_value_rtx): Rename ret_rtx
	variable to ret_reg.

From-SVN: r173300
This commit is contained in:
Bernd Schmidt 2011-05-03 11:52:38 +00:00 committed by Bernd Schmidt
parent 9efdb4adb6
commit 3810076ba7
19 changed files with 61 additions and 26 deletions

View File

@ -1,3 +1,29 @@
2011-05-03 Bernd Schmidt <bernds@codesourcery.com>
* gengenrtl.c (special_rtx): PC, CC0 and RETURN are special.
* genemit.c (gen_exp): Handle RETURN.
* emit-rtl.c (verify_rtx_sharing): Likewise.
(init_emit_regs): Create pc_rtx, ret_rtx and cc0_rtx specially.
* rtl.c (copy_rtx): RETURN is shared.
* rtl.h (enum global_rtl_index): Add GR_RETURN.
(ret_rtx): New.
* jump.c (redirect_exp_1): Don't use gen_rtx_RETURN.
* config/s390/s390.c (s390_emit_epilogue): Likewise.
* config/rx/rx.c (gen_rx_rtsd_vector): Likewise.
* config/cris/cris.c (cris_expand_return): Likewise.
* config/m68k/m68k.c (m68k_expand_epilogue): Likewise.
* config/rs6000/rs6000.c (rs6000_make_savres_rtx,
rs6000_emit_epilogue, rs6000_output_mi_thunk): Likewise.
* config/picochip/picochip.c (picochip_expand_epilogue): Likewise.
* config/h8300/h8300.c (h8300_push_pop, h8300_expand_epilogue):
Likewise.
* config/v850/v850.c (expand_epilogue): Likewise.
* config/bfin/bfin.c (bfin_expand_call): Likewise.
* config/arm/arm.md (epilogue): Likewise.
* config/mn10300/mn10300.c (mn10300_expand_epilogue): Likewise.
* config/sparc/sparc.c (sparc_struct_value_rtx): Rename ret_rtx
variable to ret_reg.
2011-05-03 Richard Guenther <rguenther@suse.de> 2011-05-03 Richard Guenther <rguenther@suse.de>
PR lto/48846 PR lto/48846

View File

@ -10006,9 +10006,7 @@
DONE; DONE;
} }
emit_jump_insn (gen_rtx_UNSPEC_VOLATILE (VOIDmode, emit_jump_insn (gen_rtx_UNSPEC_VOLATILE (VOIDmode,
gen_rtvec (1, gen_rtvec (1, ret_rtx), VUNSPEC_EPILOGUE));
gen_rtx_RETURN (VOIDmode)),
VUNSPEC_EPILOGUE));
DONE; DONE;
" "
) )

View File

@ -2334,7 +2334,7 @@ bfin_expand_call (rtx retval, rtx fnaddr, rtx callarg1, rtx cookie, int sibcall)
XVECEXP (pat, 0, n++) = gen_rtx_USE (VOIDmode, picreg); XVECEXP (pat, 0, n++) = gen_rtx_USE (VOIDmode, picreg);
XVECEXP (pat, 0, n++) = gen_rtx_USE (VOIDmode, cookie); XVECEXP (pat, 0, n++) = gen_rtx_USE (VOIDmode, cookie);
if (sibcall) if (sibcall)
XVECEXP (pat, 0, n++) = gen_rtx_RETURN (VOIDmode); XVECEXP (pat, 0, n++) = ret_rtx;
else else
XVECEXP (pat, 0, n++) = gen_rtx_CLOBBER (VOIDmode, retsreg); XVECEXP (pat, 0, n++) = gen_rtx_CLOBBER (VOIDmode, retsreg);
call = emit_call_insn (pat); call = emit_call_insn (pat);

View File

@ -1790,7 +1790,7 @@ cris_expand_return (bool on_stack)
we do that until they're fixed. Currently, all return insns in a we do that until they're fixed. Currently, all return insns in a
function must be the same (not really a limiting factor) so we need function must be the same (not really a limiting factor) so we need
to check that it doesn't change half-way through. */ to check that it doesn't change half-way through. */
emit_jump_insn (gen_rtx_RETURN (VOIDmode)); emit_jump_insn (ret_rtx);
CRIS_ASSERT (cfun->machine->return_type != CRIS_RETINSN_RET || !on_stack); CRIS_ASSERT (cfun->machine->return_type != CRIS_RETINSN_RET || !on_stack);
CRIS_ASSERT (cfun->machine->return_type != CRIS_RETINSN_JUMP || on_stack); CRIS_ASSERT (cfun->machine->return_type != CRIS_RETINSN_JUMP || on_stack);

View File

@ -643,7 +643,7 @@ h8300_push_pop (int regno, int nregs, bool pop_p, bool return_p)
/* Add the return instruction. */ /* Add the return instruction. */
if (return_p) if (return_p)
{ {
RTVEC_ELT (vec, i) = gen_rtx_RETURN (VOIDmode); RTVEC_ELT (vec, i) = ret_rtx;
i++; i++;
} }
@ -927,7 +927,7 @@ h8300_expand_epilogue (void)
} }
if (!returned_p) if (!returned_p)
emit_jump_insn (gen_rtx_RETURN (VOIDmode)); emit_jump_insn (ret_rtx);
} }
/* Return nonzero if the current function is an interrupt /* Return nonzero if the current function is an interrupt

View File

@ -1308,7 +1308,7 @@ m68k_expand_epilogue (bool sibcall_p)
EH_RETURN_STACKADJ_RTX)); EH_RETURN_STACKADJ_RTX));
if (!sibcall_p) if (!sibcall_p)
emit_jump_insn (gen_rtx_RETURN (VOIDmode)); emit_jump_insn (ret_rtx);
} }
/* Return true if X is a valid comparison operator for the dbcc /* Return true if X is a valid comparison operator for the dbcc

View File

@ -1255,7 +1255,7 @@ mn10300_expand_epilogue (void)
/* Adjust the stack and restore callee-saved registers, if any. */ /* Adjust the stack and restore callee-saved registers, if any. */
if (mn10300_can_use_rets_insn ()) if (mn10300_can_use_rets_insn ())
emit_jump_insn (gen_rtx_RETURN (VOIDmode)); emit_jump_insn (ret_rtx);
else else
emit_jump_insn (gen_return_ret (GEN_INT (size + REG_SAVE_BYTES))); emit_jump_insn (gen_return_ret (GEN_INT (size + REG_SAVE_BYTES)));
} }

View File

@ -2273,7 +2273,7 @@ picochip_expand_epilogue (int is_sibling_call ATTRIBUTE_UNUSED)
rtvec p; rtvec p;
p = rtvec_alloc (2); p = rtvec_alloc (2);
RTVEC_ELT (p, 0) = gen_rtx_RETURN (VOIDmode); RTVEC_ELT (p, 0) = ret_rtx;
RTVEC_ELT (p, 1) = gen_rtx_USE (VOIDmode, RTVEC_ELT (p, 1) = gen_rtx_USE (VOIDmode,
gen_rtx_REG (Pmode, LINK_REGNUM)); gen_rtx_REG (Pmode, LINK_REGNUM));
emit_jump_insn (gen_rtx_PARALLEL (VOIDmode, p)); emit_jump_insn (gen_rtx_PARALLEL (VOIDmode, p));

View File

@ -20358,7 +20358,7 @@ rs6000_make_savres_rtx (rs6000_stack_t *info,
p = rtvec_alloc ((lr ? 4 : 3) + n_regs); p = rtvec_alloc ((lr ? 4 : 3) + n_regs);
if (!savep && lr) if (!savep && lr)
RTVEC_ELT (p, offset++) = gen_rtx_RETURN (VOIDmode); RTVEC_ELT (p, offset++) = ret_rtx;
RTVEC_ELT (p, offset++) RTVEC_ELT (p, offset++)
= gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (Pmode, 65)); = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (Pmode, 65));
@ -21350,7 +21350,7 @@ rs6000_emit_epilogue (int sibcall)
alloc_rname = ggc_strdup (rname); alloc_rname = ggc_strdup (rname);
j = 0; j = 0;
RTVEC_ELT (p, j++) = gen_rtx_RETURN (VOIDmode); RTVEC_ELT (p, j++) = ret_rtx;
RTVEC_ELT (p, j++) = gen_rtx_USE (VOIDmode, RTVEC_ELT (p, j++) = gen_rtx_USE (VOIDmode,
gen_rtx_REG (Pmode, gen_rtx_REG (Pmode,
LR_REGNO)); LR_REGNO));
@ -21966,7 +21966,7 @@ rs6000_emit_epilogue (int sibcall)
else else
p = rtvec_alloc (2); p = rtvec_alloc (2);
RTVEC_ELT (p, 0) = gen_rtx_RETURN (VOIDmode); RTVEC_ELT (p, 0) = ret_rtx;
RTVEC_ELT (p, 1) = ((restoring_FPRs_inline || !lr) RTVEC_ELT (p, 1) = ((restoring_FPRs_inline || !lr)
? gen_rtx_USE (VOIDmode, gen_rtx_REG (Pmode, 65)) ? gen_rtx_USE (VOIDmode, gen_rtx_REG (Pmode, 65))
: gen_rtx_CLOBBER (VOIDmode, : gen_rtx_CLOBBER (VOIDmode,
@ -22405,7 +22405,7 @@ rs6000_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
gen_rtx_USE (VOIDmode, gen_rtx_USE (VOIDmode,
gen_rtx_REG (SImode, gen_rtx_REG (SImode,
LR_REGNO)), LR_REGNO)),
gen_rtx_RETURN (VOIDmode)))); ret_rtx)));
SIBLING_CALL_P (insn) = 1; SIBLING_CALL_P (insn) = 1;
emit_barrier (); emit_barrier ();

View File

@ -1567,7 +1567,7 @@ gen_rx_rtsd_vector (unsigned int adjust, unsigned int low, unsigned int high)
: plus_constant (stack_pointer_rtx, : plus_constant (stack_pointer_rtx,
i * UNITS_PER_WORD))); i * UNITS_PER_WORD)));
XVECEXP (vector, 0, count - 1) = gen_rtx_RETURN (VOIDmode); XVECEXP (vector, 0, count - 1) = ret_rtx;
return vector; return vector;
} }

View File

@ -8485,7 +8485,7 @@ s390_emit_epilogue (bool sibcall)
p = rtvec_alloc (2); p = rtvec_alloc (2);
RTVEC_ELT (p, 0) = gen_rtx_RETURN (VOIDmode); RTVEC_ELT (p, 0) = ret_rtx;
RTVEC_ELT (p, 1) = gen_rtx_USE (VOIDmode, return_reg); RTVEC_ELT (p, 1) = gen_rtx_USE (VOIDmode, return_reg);
emit_jump_insn (gen_rtx_PARALLEL (VOIDmode, p)); emit_jump_insn (gen_rtx_PARALLEL (VOIDmode, p));
} }

View File

@ -6063,7 +6063,7 @@ sparc_struct_value_rtx (tree fndecl, int incoming)
/* We must check and adjust the return address, as it is /* We must check and adjust the return address, as it is
optional as to whether the return object is really optional as to whether the return object is really
provided. */ provided. */
rtx ret_rtx = gen_rtx_REG (Pmode, 31); rtx ret_reg = gen_rtx_REG (Pmode, 31);
rtx scratch = gen_reg_rtx (SImode); rtx scratch = gen_reg_rtx (SImode);
rtx endlab = gen_label_rtx (); rtx endlab = gen_label_rtx ();
@ -6080,12 +6080,12 @@ sparc_struct_value_rtx (tree fndecl, int incoming)
it's an unimp instruction (the most significant 10 bits it's an unimp instruction (the most significant 10 bits
will be zero). */ will be zero). */
emit_move_insn (scratch, gen_rtx_MEM (SImode, emit_move_insn (scratch, gen_rtx_MEM (SImode,
plus_constant (ret_rtx, 8))); plus_constant (ret_reg, 8)));
/* Assume the size is valid and pre-adjust */ /* Assume the size is valid and pre-adjust */
emit_insn (gen_add3_insn (ret_rtx, ret_rtx, GEN_INT (4))); emit_insn (gen_add3_insn (ret_reg, ret_reg, GEN_INT (4)));
emit_cmp_and_jump_insns (scratch, size_rtx, EQ, const0_rtx, SImode, emit_cmp_and_jump_insns (scratch, size_rtx, EQ, const0_rtx, SImode,
0, endlab); 0, endlab);
emit_insn (gen_sub3_insn (ret_rtx, ret_rtx, GEN_INT (4))); emit_insn (gen_sub3_insn (ret_reg, ret_reg, GEN_INT (4)));
/* Write the address of the memory pointed to by temp_val into /* Write the address of the memory pointed to by temp_val into
the memory pointed to by mem */ the memory pointed to by mem */
emit_move_insn (mem, XEXP (temp_val, 0)); emit_move_insn (mem, XEXP (temp_val, 0));

View File

@ -1890,7 +1890,7 @@ expand_epilogue (void)
int offset; int offset;
restore_all = gen_rtx_PARALLEL (VOIDmode, restore_all = gen_rtx_PARALLEL (VOIDmode,
rtvec_alloc (num_restore + 2)); rtvec_alloc (num_restore + 2));
XVECEXP (restore_all, 0, 0) = gen_rtx_RETURN (VOIDmode); XVECEXP (restore_all, 0, 0) = ret_rtx;
XVECEXP (restore_all, 0, 1) XVECEXP (restore_all, 0, 1)
= gen_rtx_SET (VOIDmode, stack_pointer_rtx, = gen_rtx_SET (VOIDmode, stack_pointer_rtx,
gen_rtx_PLUS (Pmode, gen_rtx_PLUS (Pmode,

View File

@ -2450,6 +2450,7 @@ verify_rtx_sharing (rtx orig, rtx insn)
case CODE_LABEL: case CODE_LABEL:
case PC: case PC:
case CC0: case CC0:
case RETURN:
case SCRATCH: case SCRATCH:
return; return;
/* SCRATCH must be shared because they represent distinct values. */ /* SCRATCH must be shared because they represent distinct values. */
@ -5416,8 +5417,9 @@ init_emit_regs (void)
init_reg_modes_target (); init_reg_modes_target ();
/* Assign register numbers to the globally defined register rtx. */ /* Assign register numbers to the globally defined register rtx. */
pc_rtx = gen_rtx_PC (VOIDmode); pc_rtx = gen_rtx_fmt_ (PC, VOIDmode);
cc0_rtx = gen_rtx_CC0 (VOIDmode); ret_rtx = gen_rtx_fmt_ (RETURN, VOIDmode);
cc0_rtx = gen_rtx_fmt_ (CC0, VOIDmode);
stack_pointer_rtx = gen_raw_REG (Pmode, STACK_POINTER_REGNUM); stack_pointer_rtx = gen_raw_REG (Pmode, STACK_POINTER_REGNUM);
frame_pointer_rtx = gen_raw_REG (Pmode, FRAME_POINTER_REGNUM); frame_pointer_rtx = gen_raw_REG (Pmode, FRAME_POINTER_REGNUM);
hard_frame_pointer_rtx = gen_raw_REG (Pmode, HARD_FRAME_POINTER_REGNUM); hard_frame_pointer_rtx = gen_raw_REG (Pmode, HARD_FRAME_POINTER_REGNUM);

View File

@ -166,6 +166,9 @@ gen_exp (rtx x, enum rtx_code subroutine_type, char *used)
case PC: case PC:
printf ("pc_rtx"); printf ("pc_rtx");
return; return;
case RETURN:
printf ("ret_rtx");
return;
case CLOBBER: case CLOBBER:
if (REG_P (XEXP (x, 0))) if (REG_P (XEXP (x, 0)))
{ {

View File

@ -128,6 +128,9 @@ special_rtx (int idx)
|| strcmp (defs[idx].enumname, "REG") == 0 || strcmp (defs[idx].enumname, "REG") == 0
|| strcmp (defs[idx].enumname, "SUBREG") == 0 || strcmp (defs[idx].enumname, "SUBREG") == 0
|| strcmp (defs[idx].enumname, "MEM") == 0 || strcmp (defs[idx].enumname, "MEM") == 0
|| strcmp (defs[idx].enumname, "PC") == 0
|| strcmp (defs[idx].enumname, "CC0") == 0
|| strcmp (defs[idx].enumname, "RETURN") == 0
|| strcmp (defs[idx].enumname, "CONST_VECTOR") == 0); || strcmp (defs[idx].enumname, "CONST_VECTOR") == 0);
} }

View File

@ -1367,7 +1367,7 @@ redirect_exp_1 (rtx *loc, rtx olabel, rtx nlabel, rtx insn)
if (nlabel) if (nlabel)
n = gen_rtx_LABEL_REF (Pmode, nlabel); n = gen_rtx_LABEL_REF (Pmode, nlabel);
else else
n = gen_rtx_RETURN (VOIDmode); n = ret_rtx;
validate_change (insn, loc, n, 1); validate_change (insn, loc, n, 1);
return; return;
@ -1378,7 +1378,7 @@ redirect_exp_1 (rtx *loc, rtx olabel, rtx nlabel, rtx insn)
if (nlabel) if (nlabel)
x = gen_rtx_LABEL_REF (Pmode, nlabel); x = gen_rtx_LABEL_REF (Pmode, nlabel);
else else
x = gen_rtx_RETURN (VOIDmode); x = ret_rtx;
if (loc == &PATTERN (insn)) if (loc == &PATTERN (insn))
x = gen_rtx_SET (VOIDmode, pc_rtx, x); x = gen_rtx_SET (VOIDmode, pc_rtx, x);
validate_change (insn, loc, x, 1); validate_change (insn, loc, x, 1);
@ -1389,7 +1389,7 @@ redirect_exp_1 (rtx *loc, rtx olabel, rtx nlabel, rtx insn)
&& GET_CODE (SET_SRC (x)) == LABEL_REF && GET_CODE (SET_SRC (x)) == LABEL_REF
&& XEXP (SET_SRC (x), 0) == olabel) && XEXP (SET_SRC (x), 0) == olabel)
{ {
validate_change (insn, loc, gen_rtx_RETURN (VOIDmode), 1); validate_change (insn, loc, ret_rtx, 1);
return; return;
} }

View File

@ -255,6 +255,7 @@ copy_rtx (rtx orig)
case CODE_LABEL: case CODE_LABEL:
case PC: case PC:
case CC0: case CC0:
case RETURN:
case SCRATCH: case SCRATCH:
/* SCRATCH must be shared because they represent distinct values. */ /* SCRATCH must be shared because they represent distinct values. */
return orig; return orig;

View File

@ -2045,6 +2045,7 @@ enum global_rtl_index
{ {
GR_PC, GR_PC,
GR_CC0, GR_CC0,
GR_RETURN,
GR_STACK_POINTER, GR_STACK_POINTER,
GR_FRAME_POINTER, GR_FRAME_POINTER,
/* For register elimination to work properly these hard_frame_pointer_rtx, /* For register elimination to work properly these hard_frame_pointer_rtx,
@ -2134,6 +2135,7 @@ extern struct target_rtl *this_target_rtl;
/* Standard pieces of rtx, to be substituted directly into things. */ /* Standard pieces of rtx, to be substituted directly into things. */
#define pc_rtx (global_rtl[GR_PC]) #define pc_rtx (global_rtl[GR_PC])
#define ret_rtx (global_rtl[GR_RETURN])
#define cc0_rtx (global_rtl[GR_CC0]) #define cc0_rtx (global_rtl[GR_CC0])
/* All references to certain hard regs, except those created /* All references to certain hard regs, except those created