Commit 18674659 by DJ Delorie Committed by DJ Delorie

h8300.c (F): New.

* config/h8300/h8300.c (F): New.
(Fpa): New.
(h8300_emit_stack_adjustment): Call them.
(push): Likewise.
(h8300_push_pop): Likewise.
(h8300_expand_prologue): Likewise.
* config/h8300/h8300.h (DWARF2_DEBUGGING_INFO): Define.
(MUST_USE_SJLJ_EXCEPTIONS): Define.
(INCOMING_RETURN_ADDR_RTX): Define.
(INCOMING_FRAME_SP_OFFSET): Define.
(DWARF_CIE_DATA_ALIGNMENT): Define.

From-SVN: r152795
parent 5cab7013
2009-10-14 DJ Delorie <dj@redhat.com>
* config/h8300/h8300.c (F): New.
(Fpa): New.
(h8300_emit_stack_adjustment): Call them.
(push): Likewise.
(h8300_push_pop): Likewise.
(h8300_expand_prologue): Likewise.
* config/h8300/h8300.h (DWARF2_DEBUGGING_INFO): Define.
(MUST_USE_SJLJ_EXCEPTIONS): Define.
(INCOMING_RETURN_ADDR_RTX): Define.
(INCOMING_FRAME_SP_OFFSET): Define.
(DWARF_CIE_DATA_ALIGNMENT): Define.
2009-10-14 Jakub Jelinek <jakub@redhat.com> 2009-10-14 Jakub Jelinek <jakub@redhat.com>
* stor-layout.c (place_field): Don't emit -Wpadded warnings for * stor-layout.c (place_field): Don't emit -Wpadded warnings for
...@@ -507,6 +507,32 @@ byte_reg (rtx x, int b) ...@@ -507,6 +507,32 @@ byte_reg (rtx x, int b)
&& call_used_regs[regno] \ && call_used_regs[regno] \
&& !current_function_is_leaf))) && !current_function_is_leaf)))
/* We use this to wrap all emitted insns in the prologue. */
static rtx
F (rtx x)
{
RTX_FRAME_RELATED_P (x) = 1;
return x;
}
/* Mark all the subexpressions of the PARALLEL rtx PAR as
frame-related. Return PAR.
dwarf2out.c:dwarf2out_frame_debug_expr ignores sub-expressions of a
PARALLEL rtx other than the first if they do not have the
FRAME_RELATED flag set on them. */
static rtx
Fpa (rtx par)
{
int len = XVECLEN (par, 0);
int i;
for (i = 0; i < len; i++)
F (XVECEXP (par, 0, i));
return par;
}
/* Output assembly language to FILE for the operation OP with operand size /* Output assembly language to FILE for the operation OP with operand size
SIZE to adjust the stack pointer. */ SIZE to adjust the stack pointer. */
...@@ -526,22 +552,27 @@ h8300_emit_stack_adjustment (int sign, HOST_WIDE_INT size) ...@@ -526,22 +552,27 @@ h8300_emit_stack_adjustment (int sign, HOST_WIDE_INT size)
&& !(cfun->static_chain_decl != NULL && sign < 0)) && !(cfun->static_chain_decl != NULL && sign < 0))
{ {
rtx r3 = gen_rtx_REG (Pmode, 3); rtx r3 = gen_rtx_REG (Pmode, 3);
emit_insn (gen_movhi (r3, GEN_INT (sign * size))); F (emit_insn (gen_movhi (r3, GEN_INT (sign * size))));
emit_insn (gen_addhi3 (stack_pointer_rtx, F (emit_insn (gen_addhi3 (stack_pointer_rtx,
stack_pointer_rtx, r3)); stack_pointer_rtx, r3)));
} }
else else
{ {
/* The stack adjustment made here is further optimized by the /* The stack adjustment made here is further optimized by the
splitter. In case of H8/300, the splitter always splits the splitter. In case of H8/300, the splitter always splits the
addition emitted here to make the adjustment addition emitted here to make the adjustment interrupt-safe.
interrupt-safe. */ FIXME: We don't always tag those, because we don't know what
the splitter will do. */
if (Pmode == HImode) if (Pmode == HImode)
emit_insn (gen_addhi3 (stack_pointer_rtx, {
stack_pointer_rtx, GEN_INT (sign * size))); rtx x = emit_insn (gen_addhi3 (stack_pointer_rtx,
stack_pointer_rtx, GEN_INT (sign * size)));
if (size < 4)
F (x);
}
else else
emit_insn (gen_addsi3 (stack_pointer_rtx, F (emit_insn (gen_addsi3 (stack_pointer_rtx,
stack_pointer_rtx, GEN_INT (sign * size))); stack_pointer_rtx, GEN_INT (sign * size))));
} }
} }
...@@ -591,7 +622,7 @@ push (int rn) ...@@ -591,7 +622,7 @@ push (int rn)
x = gen_push_h8300hs_advanced (reg); x = gen_push_h8300hs_advanced (reg);
else else
x = gen_push_h8300hs_normal (reg); x = gen_push_h8300hs_normal (reg);
x = emit_insn (x); x = F (emit_insn (x));
REG_NOTES (x) = gen_rtx_EXPR_LIST (REG_INC, stack_pointer_rtx, 0); REG_NOTES (x) = gen_rtx_EXPR_LIST (REG_INC, stack_pointer_rtx, 0);
} }
...@@ -634,7 +665,7 @@ h8300_push_pop (int regno, int nregs, int pop_p, int return_p) ...@@ -634,7 +665,7 @@ h8300_push_pop (int regno, int nregs, int pop_p, int return_p)
{ {
int i, j; int i, j;
rtvec vec; rtvec vec;
rtx sp, offset; rtx sp, offset, x;
/* See whether we can use a simple push or pop. */ /* See whether we can use a simple push or pop. */
if (!return_p && nregs == 1) if (!return_p && nregs == 1)
...@@ -685,7 +716,10 @@ h8300_push_pop (int regno, int nregs, int pop_p, int return_p) ...@@ -685,7 +716,10 @@ h8300_push_pop (int regno, int nregs, int pop_p, int return_p)
RTVEC_ELT (vec, i + j) = gen_rtx_SET (VOIDmode, sp, RTVEC_ELT (vec, i + j) = gen_rtx_SET (VOIDmode, sp,
gen_rtx_PLUS (Pmode, sp, offset)); gen_rtx_PLUS (Pmode, sp, offset));
emit_insn (gen_rtx_PARALLEL (VOIDmode, vec)); x = gen_rtx_PARALLEL (VOIDmode, vec);
if (!pop_p)
x = Fpa (x);
emit_insn (x);
} }
/* Return true if X has the value sp + OFFSET. */ /* Return true if X has the value sp + OFFSET. */
...@@ -820,7 +854,7 @@ h8300_expand_prologue (void) ...@@ -820,7 +854,7 @@ h8300_expand_prologue (void)
{ {
/* Push fp. */ /* Push fp. */
push (HARD_FRAME_POINTER_REGNUM); push (HARD_FRAME_POINTER_REGNUM);
emit_move_insn (hard_frame_pointer_rtx, stack_pointer_rtx); F (emit_move_insn (hard_frame_pointer_rtx, stack_pointer_rtx));
} }
/* Push the rest of the registers in ascending order. */ /* Push the rest of the registers in ascending order. */
......
...@@ -147,6 +147,17 @@ extern const char * const *h8_reg_names; ...@@ -147,6 +147,17 @@ extern const char * const *h8_reg_names;
/* Show we can debug even without a frame pointer. */ /* Show we can debug even without a frame pointer. */
/* #define CAN_DEBUG_WITHOUT_FP */ /* #define CAN_DEBUG_WITHOUT_FP */
/* We want dwarf2 info available to gdb... */
#define DWARF2_DEBUGGING_INFO 1
/* ... but we don't actually support full dwarf2 EH. */
#define MUST_USE_SJLJ_EXCEPTIONS 1
/* The return address is pushed on the stack. */
#define INCOMING_RETURN_ADDR_RTX gen_rtx_MEM (Pmode, gen_rtx_REG (Pmode, STACK_POINTER_REGNUM))
#define INCOMING_FRAME_SP_OFFSET (POINTER_SIZE / 8)
#define DWARF_CIE_DATA_ALIGNMENT 2
/* Define this if addresses of constant functions /* Define this if addresses of constant functions
shouldn't be put through pseudo regs where they can be cse'd. shouldn't be put through pseudo regs where they can be cse'd.
Desirable on machines where ordinary constants are expensive Desirable on machines where ordinary constants are expensive
......
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