m32r.h (RETURN_ADDR_RTX): Define.

* config/m32r/m32r.h (RETURN_ADDR_RTX): Define.
  (INCOMING_RETURN_ADDR_RTX): Define.
* config/m32r/m32r-protos.h (m32r_return_addr): Added.
* config/m32r/m32r.c (m32r_exppand_prologue): Changed for
  __builtin_return_address(0).
  (m32r_return_addr): Added for __builtin_return_address(0).
  (m32r_reload_lr): Ditto.

From-SVN: r83171
This commit is contained in:
Kazuhiro Inaoka 2004-06-15 10:01:34 +00:00 committed by Nick Clifton
parent cf11c05cfd
commit 7b14411a87
4 changed files with 53 additions and 2 deletions

View File

@ -1,3 +1,13 @@
2004-06-15 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
* config/m32r/m32r.h (RETURN_ADDR_RTX): Define.
(INCOMING_RETURN_ADDR_RTX): Define.
* config/m32r/m32r-protos.h (m32r_return_addr): Added.
* config/m32r/m32r.c (m32r_exppand_prologue): Changed for
__builtin_return_address(0).
(m32r_return_addr): Added for __builtin_return_address(0).
(m32r_reload_lr): Ditto.
2004-06-15 Paolo Bonzini <bonzini@gnu.org>
* doc/install.texi (Prerequisites): Update libbanshee,
@ -5910,7 +5920,7 @@
* config/arm/t-xscale-elf: Disable iwmmxt multilibs until they can
be safely built.
2004-04-16 Kazuhiro Inaoka <inaoka dot kazuhiro at renesas dot com>
2004-04-16 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
* config/m32r/m32r.h (BIG_ENDIAN_BIT): Deleted to fix endian
bug.

View File

@ -58,6 +58,7 @@ extern int m32r_not_same_reg (rtx, rtx);
extern int m32r_hard_regno_rename_ok (unsigned int, unsigned int);
extern int m32r_legitimate_pic_operand_p (rtx);
extern rtx m32r_legitimize_pic_address (rtx, rtx);
extern rtx m32r_return_addr (int);
#ifdef HAVE_MACHINE_MODES
extern int call_address_operand (rtx, Mmode);

View File

@ -1905,6 +1905,29 @@ m32r_compute_frame_size (int size) /* # of var. bytes allocated. */
/* The table we use to reference PIC data. */
static rtx global_offset_table;
static void
m32r_reload_lr (rtx sp, int size)
{
rtx lr = gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM);
if (size == 0)
emit_insn (gen_movsi (lr, gen_rtx_MEM (Pmode, sp)));
else if (size <= 32768)
emit_insn (gen_movsi (lr, gen_rtx_MEM (Pmode,
gen_rtx_PLUS (Pmode, sp,
GEN_INT (size)))));
else
{
rtx tmp = gen_rtx_REG (Pmode, PROLOGUE_TMP_REGNUM);
emit_insn (gen_movsi (tmp, GEN_INT (size)));
emit_insn (gen_addsi3 (tmp, tmp, sp));
emit_insn (gen_movsi (lr, gen_rtx_MEM (Pmode, tmp)));
}
emit_insn (gen_rtx_USE (VOIDmode, lr));
}
void
m32r_load_pic_register (void)
{
@ -1993,7 +2016,11 @@ m32r_expand_prologue (void)
gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM)));
if (pic_reg_used)
{
m32r_load_pic_register ();
m32r_reload_lr (stack_pointer_rtx,
(current_function_profile ? 0 : frame_size));
}
if (current_function_profile && !pic_reg_used)
emit_insn (gen_blockage ());
@ -3052,3 +3079,12 @@ m32r_hard_regno_rename_ok (unsigned int old_reg ATTRIBUTE_UNUSED,
return 1;
}
rtx
m32r_return_addr (int count)
{
if (count != 0)
return const0_rtx;
return get_hard_reg_initial_val (Pmode, RETURN_ADDR_REGNUM);
}

View File

@ -1265,6 +1265,10 @@ L2: .word STATIC
/* Generate calls to memcpy, memcmp and memset. */
#define TARGET_MEM_FUNCTIONS
#define RETURN_ADDR_RTX(COUNT, FRAME) m32r_return_addr (COUNT)
#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM)
/* Addressing modes, and classification of registers for them. */
/* Maximum number of registers that can appear in a valid memory address. */