summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2012-12-25 17:10:54 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2012-12-25 17:10:54 +0000
commit33dbdb956388cefb977199b74e3bf16813b7f9db (patch)
treea11a9a1528880a6ce6f231d437bc5144c0b66336
parent0c75789fd616233f09416a8ed478cc75e3dfc0e9 (diff)
Define INCOMING_RETURN_ADDR_RTX and DWARF_FRAME_RETURN_COLUMN to allow for
DWARF debugging information to be produced, but define DWARF2_UNWIND_INFO to zero to prevent it from being output yet. This exposes dire weaknesses in the way the dwarf unwinder recognizes stack frame setup instructions, so borrow code from rs6000 to rewrite and annotate them as dwarf-edible instructions. No functional change intended - although this enables one more optimization code path in gcc.
-rw-r--r--gnu/usr.bin/gcc/gcc/config/m88k/m88k.c98
-rw-r--r--gnu/usr.bin/gcc/gcc/config/m88k/m88k.h4
-rw-r--r--gnu/usr.bin/gcc/gcc/config/m88k/openbsd.h5
3 files changed, 68 insertions, 39 deletions
diff --git a/gnu/usr.bin/gcc/gcc/config/m88k/m88k.c b/gnu/usr.bin/gcc/gcc/config/m88k/m88k.c
index 70e5cd3d0f5..fe0fe4fefb7 100644
--- a/gnu/usr.bin/gcc/gcc/config/m88k/m88k.c
+++ b/gnu/usr.bin/gcc/gcc/config/m88k/m88k.c
@@ -61,6 +61,7 @@ rtx m88k_compare_op1; /* cmpsi operand 1 */
enum processor_type m88k_cpu; /* target cpu */
+static void m88k_frame_related PARAMS ((rtx, rtx, int));
static void m88k_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
static void m88k_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
static void m88k_output_function_end_prologue PARAMS ((FILE *));
@@ -1808,7 +1809,7 @@ output_label (label_number)
static rtx emit_add PARAMS ((rtx, rtx, int));
static void preserve_registers PARAMS ((int, int));
-static void emit_ldst PARAMS ((int, int, enum machine_mode, int, int));
+static void emit_ldst PARAMS ((int, int, enum machine_mode, int));
static void output_tdesc PARAMS ((FILE *, int));
static int nregs;
@@ -1981,6 +1982,54 @@ m88k_output_function_end_prologue (stream)
}
}
+/* Add to 'insn' a note which is PATTERN (INSN) but with REG replaced
+ with (plus:P (reg 31) VAL). It would be nice if dwarf2out_frame_debug_expr
+ could deduce these equivalences by itself so it wasn't necessary to hold
+ its hand so much. */
+
+static void
+m88k_frame_related (insn, reg, val)
+ rtx insn;
+ rtx reg;
+ HOST_WIDE_INT val;
+{
+ rtx real, temp;
+
+ real = copy_rtx (PATTERN (insn));
+
+ real = replace_rtx (real, reg,
+ gen_rtx_PLUS (Pmode, gen_rtx_REG (Pmode,
+ STACK_POINTER_REGNUM),
+ GEN_INT (val)));
+
+ /* We expect that 'real' is a SET. */
+
+ if (GET_CODE (real) == SET)
+ {
+ rtx set = real;
+
+ temp = simplify_rtx (SET_SRC (set));
+ if (temp)
+ SET_SRC (set) = temp;
+ temp = simplify_rtx (SET_DEST (set));
+ if (temp)
+ SET_DEST (set) = temp;
+ if (GET_CODE (SET_DEST (set)) == MEM)
+ {
+ temp = simplify_rtx (XEXP (SET_DEST (set), 0));
+ if (temp)
+ XEXP (SET_DEST (set), 0) = temp;
+ }
+ }
+ else
+ abort ();
+
+ RTX_FRAME_RELATED_P (insn) = 1;
+ REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
+ real,
+ REG_NOTES (insn));
+}
+
void
m88k_expand_prologue ()
{
@@ -2092,18 +2141,13 @@ m88k_output_function_epilogue (stream, size)
void
m88k_expand_epilogue ()
{
- rtx insn;
-
#if (MONITOR_GCC & 0x4) /* What are interesting prologue/epilogue values? */
fprintf (stream, "; size = %d, m88k_fp_offset = %d, m88k_stack_size = %d\n",
size, m88k_fp_offset, m88k_stack_size);
#endif
if (frame_pointer_needed)
- {
- insn = emit_add (stack_pointer_rtx, frame_pointer_rtx, -m88k_fp_offset);
- RTX_FRAME_RELATED_P (insn) = 1;
- }
+ emit_add (stack_pointer_rtx, frame_pointer_rtx, -m88k_fp_offset);
if (nregs || nxregs)
preserve_registers (m88k_fp_offset + 4, 0);
@@ -2163,7 +2207,7 @@ preserve_registers (base, store_p)
offset -= 4;
/* Do not reload r1 in the epilogue unless really necessary */
if (store_p || regs_ever_live[1])
- emit_ldst (store_p, 1, SImode, offset, 1);
+ emit_ldst (store_p, 1, SImode, offset);
offset -= 4;
base = offset;
}
@@ -2230,23 +2274,20 @@ preserve_registers (base, store_p)
if (mo_ptr->nregs)
emit_ldst (store_p, mo_ptr->regno,
(mo_ptr->nregs > 1 ? DImode : SImode),
- mo_ptr->offset, 1);
+ mo_ptr->offset);
}
}
static void
-emit_ldst (store_p, regno, mode, offset, frame_related)
+emit_ldst (store_p, regno, mode, offset)
int store_p;
int regno;
enum machine_mode mode;
int offset;
- int frame_related;
{
rtx reg = gen_rtx_REG (mode, regno);
rtx mem;
-
- if (frame_related)
- start_sequence ();
+ rtx insn;
if (SMALL_INTVAL (offset))
{
@@ -2265,33 +2306,12 @@ emit_ldst (store_p, regno, mode, offset, frame_related)
}
if (store_p)
- emit_move_insn (mem, reg);
- else
- emit_move_insn (reg, mem);
-
- if (frame_related)
{
- rtx seq = get_insns();
- rtx insn;
-
- end_sequence ();
-
- if (INSN_P (seq))
- {
- insn = seq;
- while (insn != NULL_RTX)
- {
- RTX_FRAME_RELATED_P (insn) = 1;
- insn = NEXT_INSN (insn);
- }
- seq = emit_insn (seq);
- }
- else
- {
- seq = emit_insn (seq);
- RTX_FRAME_RELATED_P (seq) = 1;
- }
+ insn = emit_move_insn (mem, reg);
+ m88k_frame_related (insn, stack_pointer_rtx, offset);
}
+ else
+ emit_move_insn (reg, mem);
}
/* Convert the address expression REG to a CFA offset. */
diff --git a/gnu/usr.bin/gcc/gcc/config/m88k/m88k.h b/gnu/usr.bin/gcc/gcc/config/m88k/m88k.h
index 7bc6a550d06..4440e2c97a1 100644
--- a/gnu/usr.bin/gcc/gcc/config/m88k/m88k.h
+++ b/gnu/usr.bin/gcc/gcc/config/m88k/m88k.h
@@ -989,6 +989,10 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS,
/* Define registers used by the epilogue and return instruction. */
#define EPILOGUE_USES(REGNO) (reload_completed && (REGNO) == 1)
+/* Before the prologue, RA is in r1. */
+#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, 1)
+#define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (1)
+
/* Definitions for register eliminations.
We have two registers that can be eliminated on the m88k. First, the
diff --git a/gnu/usr.bin/gcc/gcc/config/m88k/openbsd.h b/gnu/usr.bin/gcc/gcc/config/m88k/openbsd.h
index be83b05174b..f6511b5f148 100644
--- a/gnu/usr.bin/gcc/gcc/config/m88k/openbsd.h
+++ b/gnu/usr.bin/gcc/gcc/config/m88k/openbsd.h
@@ -116,3 +116,8 @@ __dcache_sync (addr, len) \
m88k_override_options (); \
flag_propolice_protection = flag_stack_protection = 0; \
} while (0)
+
+/* All configurations that don't use elf must be explicit about not using
+ dwarf unwind information. egcs doesn't try too hard to check internal
+ configuration files... */
+#define DWARF2_UNWIND_INFO 0