Commit 469ac993 by Jason Merrill

x

From-SVN: r13305
parent 97adc6ed
......@@ -1832,6 +1832,7 @@ ix86_expand_prologue ()
int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table
|| current_function_uses_const_pool);
long tsize = get_frame_size ();
rtx insn;
if (!TARGET_SCHEDULE_PROLOGUE)
return;
......@@ -1841,17 +1842,23 @@ ix86_expand_prologue ()
xops[2] = GEN_INT (tsize);
if (frame_pointer_needed)
{
emit_insn (gen_rtx (SET, 0,
gen_rtx (MEM, SImode,
gen_rtx (PRE_DEC, SImode, stack_pointer_rtx)),
frame_pointer_rtx));
emit_move_insn (xops[1], xops[0]);
insn = emit_insn
(gen_rtx (SET, 0,
gen_rtx (MEM, SImode,
gen_rtx (PRE_DEC, SImode, stack_pointer_rtx)),
frame_pointer_rtx));
RTX_FRAME_RELATED_P (insn) = 1;
insn = emit_move_insn (xops[1], xops[0]);
RTX_FRAME_RELATED_P (insn) = 1;
}
if (tsize == 0)
;
else if (! TARGET_STACK_PROBE || tsize < CHECK_STACK_LIMIT)
emit_insn (gen_subsi3 (xops[0], xops[0], xops[2]));
{
insn = emit_insn (gen_subsi3 (xops[0], xops[0], xops[2]));
RTX_FRAME_RELATED_P (insn) = 1;
}
else
{
xops[3] = gen_rtx (REG, SImode, 0);
......@@ -1877,10 +1884,13 @@ ix86_expand_prologue ()
|| (regno == PIC_OFFSET_TABLE_REGNUM && pic_reg_used))
{
xops[0] = gen_rtx (REG, SImode, regno);
emit_insn (gen_rtx (SET, 0,
gen_rtx (MEM, SImode,
gen_rtx (PRE_DEC, SImode, stack_pointer_rtx)),
xops[0]));
insn = emit_insn
(gen_rtx (SET, 0,
gen_rtx (MEM, SImode,
gen_rtx (PRE_DEC, SImode, stack_pointer_rtx)),
xops[0]));
RTX_FRAME_RELATED_P (insn) = 1;
}
if (pic_reg_used && TARGET_DEEP_BRANCH_PREDICTION)
......
......@@ -2331,6 +2331,13 @@ number as al, and ax.
(n) == 7 ? 5 : \
(n) + 4)
/* Before the prologue, RA is at 0(%esp). */
#define INCOMING_RETURN_ADDR_RTX \
gen_rtx (MEM, VOIDmode, gen_rtx (REG, VOIDmode, STACK_POINTER_REGNUM))
/* PC is dbx register 8; let's use that column for RA. */
#define DWARF_FRAME_RETURN_COLUMN 8
/* This is how to output the definition of a user-level label named NAME,
such as the label on a static function or variable NAME. */
......
......@@ -5068,22 +5068,7 @@ save_restore_insns (store_p, large_reg, large_offset, file)
if (store_p)
{
rtx insn = emit_move_insn (mem_rtx, reg_rtx);
if (write_symbols == DWARF2_DEBUG)
{
int offset = (gp_offset
- current_frame_info.total_size);
if (regno == GP_REG_FIRST + 31)
REG_NOTES (insn)
= gen_rtx (EXPR_LIST, REG_RETURN_SAVE,
GEN_INT (offset), REG_NOTES (insn));
else
REG_NOTES (insn)
= gen_rtx (EXPR_LIST, REG_SAVE,
gen_rtx (EXPR_LIST, VOIDmode, reg_rtx,
GEN_INT (offset)),
REG_NOTES (insn));
}
RTX_FRAME_RELATED_P (insn) = 1;
}
else if (!TARGET_ABICALLS || mips_abi != ABI_32
|| regno != (PIC_OFFSET_TABLE_REGNUM - GP_REG_FIRST))
......@@ -5199,17 +5184,7 @@ save_restore_insns (store_p, large_reg, large_offset, file)
if (store_p)
{
rtx insn = emit_move_insn (mem_rtx, reg_rtx);
if (write_symbols == DWARF2_DEBUG)
{
int offset = (gp_offset
- current_frame_info.total_size);
REG_NOTES (insn)
= gen_rtx (EXPR_LIST, REG_SAVE,
gen_rtx (EXPR_LIST, VOIDmode, reg_rtx,
GEN_INT (offset)),
REG_NOTES (insn));
}
RTX_FRAME_RELATED_P (insn) = 1;
}
else
emit_move_insn (reg_rtx, mem_rtx);
......@@ -5452,12 +5427,7 @@ mips_expand_prologue ()
insn = emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx,
tsize_rtx));
if (write_symbols == DWARF2_DEBUG)
REG_NOTES (insn)
= gen_rtx (EXPR_LIST, REG_FRAME,
gen_rtx (PLUS, VOIDmode, stack_pointer_rtx,
GEN_INT (tsize)),
REG_NOTES (insn));
RTX_FRAME_RELATED_P (insn) = 1;
}
save_restore_insns (TRUE, tmp_rtx, tsize, (FILE *)0);
......@@ -5471,12 +5441,7 @@ mips_expand_prologue ()
else
insn= emit_insn (gen_movsi (frame_pointer_rtx, stack_pointer_rtx));
if (write_symbols == DWARF2_DEBUG)
REG_NOTES (insn)
= gen_rtx (EXPR_LIST, REG_FRAME,
gen_rtx (PLUS, VOIDmode, frame_pointer_rtx,
GEN_INT (tsize)),
REG_NOTES (insn));
RTX_FRAME_RELATED_P (insn) = 1;
}
if (TARGET_ABICALLS && mips_abi != ABI_32)
......
......@@ -927,11 +927,16 @@ while (0)
This mapping does not allow for tracking DBX register 0, since column 0
is used for the frame address, but since register 0 is fixed this is
not really a problem. */
#define DWARF_FRAME_REGNUM(REG) (DBX_REGISTER_NUMBER (REG))
#define DWARF_FRAME_REGNUM(REG) \
(REG == GP_REG_FIRST + 31 ? DWARF_FRAME_RETURN_COLUMN \
: DBX_REGISTER_NUMBER (REG))
/* The DWARF 2 CFA column which tracks the return address. */
#define DWARF_FRAME_RETURN_COLUMN (FP_REG_LAST + 1)
/* Before the prologue, RA lives in r31. */
#define INCOMING_RETURN_ADDR_RTX gen_rtx (REG, VOIDmode, GP_REG_FIRST + 31)
/* Overrides for the COFF debug format. */
#define PUT_SDB_SCL(a) \
do { \
......
......@@ -1208,6 +1208,10 @@ final (first, file, optimize, prescan)
last_ignored_compare = 0;
new_block = 1;
#if defined (DWARF2_DEBUGGING_INFO) && defined (HAVE_prologue)
dwarf2out_frame_debug (NULL_RTX);
#endif
check_exception_handler_labels ();
/* Make a map indicating which line numbers appear in this function.
......@@ -1370,12 +1374,6 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
if (write_symbols == DWARF_DEBUG)
dwarfout_begin_function ();
#endif
#ifdef DWARF2_DEBUGGING_INFO
/* This outputs a marker where the function body starts, so it
must be after the prologue. */
if (write_symbols == DWARF2_DEBUG)
dwarf2out_begin_function ();
#endif
break;
}
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED)
......@@ -2104,6 +2102,13 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
output_asm_insn (template, recog_operand);
#if defined (DWARF2_DEBUGGING_INFO) && defined (HAVE_prologue)
/* If this insn is part of the prologue, emit DWARF v2
call frame info. */
if (write_symbols == DWARF2_DEBUG && RTX_FRAME_RELATED_P (insn))
dwarf2out_frame_debug (insn);
#endif
#if 0
/* It's not at all clear why we did this and doing so interferes
with tests we'd like to do to use REG_WAS_0 notes, so let's try
......
......@@ -140,6 +140,10 @@ typedef struct rtx_def
In a REG, nonzero means this reg refers to the return value
of the current function. */
unsigned integrated : 1;
/* Nonzero if this rtx is related to the call frame, either changing how
we compute the frame address or saving and restoring registers in
the prologue and epilogue. */
unsigned frame_related : 1;
/* The first element of the operands of this rtx.
The number of operands and their types are controlled
by the `code' field, according to rtl.def. */
......@@ -165,6 +169,7 @@ typedef struct rtx_def
#define RTX_INTEGRATED_P(RTX) ((RTX)->integrated)
#define RTX_UNCHANGING_P(RTX) ((RTX)->unchanging)
#define RTX_FRAME_RELATED_P(RTX) ((RTX)->frame_related)
/* RTL vector. These appear inside RTX's when there is a need
for a variable number of things. The principle use is inside
......
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