This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: delete LIBCALL note after split
- From: Sa Liu <SALIU at de dot ibm dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 3 Aug 2007 16:58:47 +0200
- Subject: Re: delete LIBCALL note after split
Ian Lance Taylor <iant@google.com> wrote on 30.07.2007 18:59:28:
> If the compiler splits an insn with a REG_LIBCALL note, it needs to
> remove the corresponding REG_RETVAL note, or it needs to relink the
> insns. This looks like a compiler bug, in that try_split doesn't
> handle REG_LIBCALL notes at all. It's quite unusual to be able to
> split a libcall insn, so it's not surprising that this has not been
> noticed previously.
>
> Ian
Thanks for replying, Ian!
I have added a piece of code in try_split to handle the links. Not sure
whether this is O.K. for the other platforms.
Index: gcc/emit-rtl.c
===================================================================
--- gcc.orig/emit-rtl.c
+++ gcc/emit-rtl.c
@@ -3121,7 +3121,7 @@ try_split (rtx pat, rtx trial, int last)
rtx before = PREV_INSN (trial);
rtx after = NEXT_INSN (trial);
int has_barrier = 0;
- rtx tem;
+ rtx tem, note_libcall, note_retval;
rtx note, seq;
int probability;
rtx insn_last, insn;
@@ -3257,6 +3257,17 @@ try_split (rtx pat, rtx trial, int last)
break;
#endif
+ case REG_LIBCALL:
+ /* Relink the insns with REG_LIBCALL note and with REG_RETVAL note
+ after split. */
+ note_libcall
+ = find_reg_note (trial, REG_LIBCALL, NULL);
+ REG_NOTES (insn_last) = note_libcall;
+ note_retval
+ = find_reg_note (XEXP (note_libcall, 0), REG_RETVAL,
NULL);
+ XEXP (note_retval, 0) = insn_last;
+ break;
+
default:
break;
}
Thanks,
Sa