* [Patch, microblaze]: Enable DWARF exception handling support
@ 2013-03-18 12:49 David Holsgrove
2013-03-19 17:05 ` Michael Eager
0 siblings, 1 reply; 3+ messages in thread
From: David Holsgrove @ 2013-03-18 12:49 UTC (permalink / raw)
To: gcc-patches
Cc: Michael Eager, Edgar Iglesias, John Williams, Vinod Kathail,
Vidhumouli Hunsigida, Nagaraju Mekala, Tom Shui
[-- Attachment #1: Type: text/plain, Size: 930 bytes --]
Add DWARF exception handling support for MicroBlaze.
Changelog
2013-03-18 Edgar E. Iglesias <edgar.iglesias@xilinx.com>
David Holsgrove <david.holsgrove@xilinx.com>
* common/config/microblaze/microblaze-common.c: Remove
TARGET_EXCEPT_UNWIND_INFO definition.
* config/microblaze/microblaze-protos.h: Add microblaze_eh_return prototype.
* gcc/config/microblaze/microblaze.c: (microblaze_must_save_register,
microblaze_expand_epilogue, microblaze_return_addr): Handle
calls_eh_return
(microblaze_eh_return): New function.
* gcc/config/microblaze/microblaze.h: Define RETURN_ADDR_OFFSET,
EH_RETURN_DATA_REGNO, MB_EH_STACKADJ_REGNUM, EH_RETURN_STACKADJ_RTX,
ASM_PREFERRED_EH_DATA_FORMAT
* gcc/config/microblaze/microblaze.md: Define eh_return pattern.
Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
[-- Attachment #2: 0001-Patch-microblaze-Enable-DWARF-exception-handling-sup.patch --]
[-- Type: application/octet-stream, Size: 6337 bytes --]
From d2d57856b99f46a482d586e7467350396f9c3719 Mon Sep 17 00:00:00 2001
From: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Date: Mon, 18 Jun 2012 20:18:13 +0200
Subject: [PATCH] [Patch, microblaze]: Enable DWARF exception handling support.
Changelog
2013-03-18 Edgar E. Iglesias <edgar.iglesias@xilinx.com>
David Holsgrove <david.holsgrove@xilinx.com>
* common/config/microblaze/microblaze-common.c: Remove
TARGET_EXCEPT_UNWIND_INFO definition.
* config/microblaze/microblaze-protos.h: Add
microblaze_eh_return prototype.
* gcc/config/microblaze/microblaze.c: (microblaze_must_save_register,
microblaze_expand_epilogue, microblaze_return_addr): Handle
calls_eh_return
(microblaze_eh_return): New function.
* gcc/config/microblaze/microblaze.h: Define RETURN_ADDR_OFFSET,
EH_RETURN_DATA_REGNO, MB_EH_STACKADJ_REGNUM, EH_RETURN_STACKADJ_RTX,
ASM_PREFERRED_EH_DATA_FORMAT
* gcc/config/microblaze/microblaze.md: Define eh_return pattern.
Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
---
gcc/common/config/microblaze/microblaze-common.c | 3 --
gcc/config/microblaze/microblaze-protos.h | 1 +
gcc/config/microblaze/microblaze.c | 29 +++++++++++++++++++---
gcc/config/microblaze/microblaze.h | 15 +++++++++++
gcc/config/microblaze/microblaze.md | 10 +++++++
5 files changed, 51 insertions(+), 7 deletions(-)
diff --git a/gcc/common/config/microblaze/microblaze-common.c b/gcc/common/config/microblaze/microblaze-common.c
index 07a71fb..6c25a76 100644
--- a/gcc/common/config/microblaze/microblaze-common.c
+++ b/gcc/common/config/microblaze/microblaze-common.c
@@ -37,7 +37,4 @@ static const struct default_options microblaze_option_optimization_table[] =
#undef TARGET_OPTION_OPTIMIZATION_TABLE
#define TARGET_OPTION_OPTIMIZATION_TABLE microblaze_option_optimization_table
-#undef TARGET_EXCEPT_UNWIND_INFO
-#define TARGET_EXCEPT_UNWIND_INFO sjlj_except_unwind_info
-
struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;
diff --git a/gcc/config/microblaze/microblaze-protos.h b/gcc/config/microblaze/microblaze-protos.h
index 34be76f..201390b 100644
--- a/gcc/config/microblaze/microblaze-protos.h
+++ b/gcc/config/microblaze/microblaze-protos.h
@@ -54,6 +54,7 @@ extern bool microblaze_tls_referenced_p (rtx);
extern int symbol_mentioned_p (rtx);
extern int label_mentioned_p (rtx);
extern bool microblaze_cannot_force_const_mem (enum machine_mode, rtx);
+extern void microblaze_eh_return (rtx op0);
#endif /* RTX_CODE */
/* Declare functions in microblaze-c.c. */
diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
index c121c2b..5f4bc60 100644
--- a/gcc/config/microblaze/microblaze.c
+++ b/gcc/config/microblaze/microblaze.c
@@ -1896,6 +1896,11 @@ microblaze_must_save_register (int regno)
if (frame_pointer_needed && (regno == HARD_FRAME_POINTER_REGNUM))
return 1;
+ if (crtl->calls_eh_return
+ && regno == MB_ABI_SUB_RETURN_ADDR_REGNUM) {
+ return 1;
+ }
+
if (!crtl->is_leaf)
{
if (regno == MB_ABI_SUB_RETURN_ADDR_REGNUM)
@@ -1923,6 +1928,13 @@ microblaze_must_save_register (int regno)
return 1;
}
+ if (crtl->calls_eh_return
+ && (regno == EH_RETURN_DATA_REGNO (0)
+ || regno == EH_RETURN_DATA_REGNO (1)))
+ {
+ return 1;
+ }
+
return 0;
}
@@ -2939,6 +2951,12 @@ microblaze_expand_epilogue (void)
emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, fsiz_rtx));
}
+ if (crtl->calls_eh_return)
+ emit_insn (gen_addsi3 (stack_pointer_rtx,
+ stack_pointer_rtx,
+ gen_rtx_raw_REG (SImode,
+ MB_EH_STACKADJ_REGNUM)));
+
emit_jump_insn (gen_return_internal (gen_rtx_REG (Pmode, GP_REG_FIRST +
MB_ABI_SUB_RETURN_ADDR_REGNUM)));
}
@@ -3166,10 +3184,13 @@ microblaze_return_addr (int count, rtx frame ATTRIBUTE_UNUSED)
if (count != 0)
return NULL_RTX;
- return gen_rtx_PLUS (Pmode,
- get_hard_reg_initial_val (Pmode,
- MB_ABI_SUB_RETURN_ADDR_REGNUM),
- GEN_INT (8));
+ return get_hard_reg_initial_val (Pmode,
+ MB_ABI_SUB_RETURN_ADDR_REGNUM);
+}
+
+void microblaze_eh_return (rtx op0)
+{
+ emit_insn (gen_movsi(gen_rtx_MEM(Pmode, stack_pointer_rtx), op0));
}
/* Queue an .ident string in the queue of top-level asm statements.
diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
index bc4d9a1..074b78e 100644
--- a/gcc/config/microblaze/microblaze.h
+++ b/gcc/config/microblaze/microblaze.h
@@ -184,6 +184,21 @@ extern enum pipeline_type microblaze_pipe;
#define INCOMING_RETURN_ADDR_RTX \
gen_rtx_REG (VOIDmode, GP_REG_FIRST + MB_ABI_SUB_RETURN_ADDR_REGNUM)
+/* Specifies the offset from INCOMING_RETURN_ADDR_RTX and the actual return PC. */
+#define RETURN_ADDR_OFFSET (8)
+
+/* Describe how we implement __builtin_eh_return. */
+#define EH_RETURN_DATA_REGNO(N) (((N) < 2) ? MB_ABI_FIRST_ARG_REGNUM + (N) : INVALID_REGNUM)
+
+#define MB_EH_STACKADJ_REGNUM MB_ABI_INT_RETURN_VAL2_REGNUM
+#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, MB_EH_STACKADJ_REGNUM)
+
+/* Select a format to encode pointers in exception handling data. CODE
+ is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
+ true if the symbol may be affected by dynamic relocations. */
+#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
+ ((flag_pic || GLOBAL) ? DW_EH_PE_aligned : DW_EH_PE_absptr)
+
/* Use DWARF 2 debugging information by default. */
#define DWARF2_DEBUGGING_INFO
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
index 3618cad..4e7fe3b 100644
--- a/gcc/config/microblaze/microblaze.md
+++ b/gcc/config/microblaze/microblaze.md
@@ -2221,3 +2221,13 @@
[(set_attr "type" "arith")
(set_attr "mode" "SI")
(set_attr "length" "4")])
+
+; This is used in compiling the unwind routines.
+(define_expand "eh_return"
+ [(use (match_operand 0 "general_operand" ""))]
+ ""
+ "
+{
+ microblaze_eh_return(operands[0]);
+ DONE;
+}")
--
1.7.0.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch, microblaze]: Enable DWARF exception handling support
2013-03-18 12:49 [Patch, microblaze]: Enable DWARF exception handling support David Holsgrove
@ 2013-03-19 17:05 ` Michael Eager
2013-03-19 21:30 ` David Holsgrove
0 siblings, 1 reply; 3+ messages in thread
From: Michael Eager @ 2013-03-19 17:05 UTC (permalink / raw)
To: David Holsgrove
Cc: gcc-patches, Edgar Iglesias, John Williams, Vinod Kathail,
Vidhumouli Hunsigida, Nagaraju Mekala, Tom Shui
On 03/18/2013 05:47 AM, David Holsgrove wrote:
> Add DWARF exception handling support for MicroBlaze.
>
> Changelog
>
> 2013-03-18 Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> David Holsgrove <david.holsgrove@xilinx.com>
>
> * common/config/microblaze/microblaze-common.c: Remove
> TARGET_EXCEPT_UNWIND_INFO definition.
> * config/microblaze/microblaze-protos.h: Add microblaze_eh_return prototype.
> * gcc/config/microblaze/microblaze.c: (microblaze_must_save_register,
> microblaze_expand_epilogue, microblaze_return_addr): Handle
> calls_eh_return
> (microblaze_eh_return): New function.
> * gcc/config/microblaze/microblaze.h: Define RETURN_ADDR_OFFSET,
> EH_RETURN_DATA_REGNO, MB_EH_STACKADJ_REGNUM, EH_RETURN_STACKADJ_RTX,
> ASM_PREFERRED_EH_DATA_FORMAT
> * gcc/config/microblaze/microblaze.md: Define eh_return pattern.
Hi David --
I see about 50 more failures (an increase from 137 to 189) in the g++
regression tests after applying this patch. I haven't looked at the
failures in detail.
--
Michael Eager eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [Patch, microblaze]: Enable DWARF exception handling support
2013-03-19 17:05 ` Michael Eager
@ 2013-03-19 21:30 ` David Holsgrove
0 siblings, 0 replies; 3+ messages in thread
From: David Holsgrove @ 2013-03-19 21:30 UTC (permalink / raw)
To: Michael Eager
Cc: gcc-patches, Edgar Iglesias, John Williams, Vinod Kathail,
Vidhumouli Hunsigida, Nagaraju Mekala, Tom Shui
> -----Original Message-----
> From: Michael Eager [mailto:eager@eagerm.com]
> Sent: Wednesday, 20 March 2013 3:05 am
> To: David Holsgrove
> Cc: gcc-patches@gcc.gnu.org; Edgar Iglesias; John Williams; Vinod Kathail;
> Vidhumouli Hunsigida; Nagaraju Mekala; Tom Shui
> Subject: Re: [Patch, microblaze]: Enable DWARF exception handling support
>
> On 03/18/2013 05:47 AM, David Holsgrove wrote:
> > Add DWARF exception handling support for MicroBlaze.
> >
> > Changelog
> >
> > 2013-03-18 Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> > David Holsgrove <david.holsgrove@xilinx.com>
> >
> > * common/config/microblaze/microblaze-common.c: Remove
> > TARGET_EXCEPT_UNWIND_INFO definition.
> > * config/microblaze/microblaze-protos.h: Add microblaze_eh_return
> prototype.
> > * gcc/config/microblaze/microblaze.c: (microblaze_must_save_register,
> > microblaze_expand_epilogue, microblaze_return_addr): Handle
> > calls_eh_return
> > (microblaze_eh_return): New function.
> > * gcc/config/microblaze/microblaze.h: Define RETURN_ADDR_OFFSET,
> > EH_RETURN_DATA_REGNO, MB_EH_STACKADJ_REGNUM,
> EH_RETURN_STACKADJ_RTX,
> > ASM_PREFERRED_EH_DATA_FORMAT
> > * gcc/config/microblaze/microblaze.md: Define eh_return pattern.
>
> Hi David --
>
> I see about 50 more failures (an increase from 137 to 189) in the g++
> regression tests after applying this patch. I haven't looked at the
> failures in detail.
>
Hi Michael,
Thanks I'll have another look at the regression tests today. We should be
enabling new tests now by supporting DWARF, but I don’t think my
last run with a microblaze-xilinx-linux-gnu was giving me as many
failures as you see;
=== g++ Summary ===
# of expected passes 26617
# of unexpected failures 17
# of unexpected successes 2
# of expected failures 167
# of unresolved testcases 3
# of unsupported tests 433
thanks,
David
>
> --
> Michael Eager eager@eagercon.com
> 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-19 21:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-18 12:49 [Patch, microblaze]: Enable DWARF exception handling support David Holsgrove
2013-03-19 17:05 ` Michael Eager
2013-03-19 21:30 ` David Holsgrove
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).