This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[bfin] Fix eh_return patten
- From: "Jie Zhang" <jzhang918 at gmail dot com>
- To: "GCC Patches" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 15 Jun 2006 13:10:31 +0800
- Subject: [bfin] Fix eh_return patten
Currently bfin port GCC will fail on this simple test case:
$ cat t.c
void foo ()
{
long offset;
void *handler;
__builtin_eh_return (offset, handler);
}
$ bfin-uclinux-gcc -S t.c
t.c: In function 'foo':
t.c:6: internal compiler error: in purge_dead_edges, at cfgrtl.c:2477
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
This patch tries to fix it by setting pc explicitly in
eh_return_internal pattern and emit it as a jump instruction in
eh_return pattern, thus not confuse GCC when doing rtl control flow
analysis.
Is it OK?
Jie
* config/bfin/bfin.md (eh_return): Call emit_jump_insn instead of
emit_insn to emit eh_return_internal instruction.
(eh_return_internal): Explicitly set pc.
Index: config/bfin/bfin.md
===================================================================
RCS file: /cvsroot/gcc3/gcc-4.1/gcc/config/bfin/bfin.md,v
retrieving revision 1.16
diff -u -r1.16 bfin.md
--- config/bfin/bfin.md 3 May 2006 12:38:32 -0000 1.16
+++ config/bfin/bfin.md 14 Jun 2006 17:36:00 -0000
@@ -2343,13 +2343,14 @@
""
{
emit_move_insn (EH_RETURN_HANDLER_RTX, operands[0]);
- emit_insn (gen_eh_return_internal ());
+ emit_jump_insn (gen_eh_return_internal ());
emit_barrier ();
DONE;
})
(define_insn_and_split "eh_return_internal"
- [(unspec_volatile [(reg:SI REG_P2)] UNSPEC_VOLATILE_EH_RETURN)]
+ [(set (pc)
+ (unspec_volatile [(reg:SI REG_P2)] UNSPEC_VOLATILE_EH_RETURN))]
""
"#"
"reload_completed"