[Patch, rtl] PR middle-end/78016, keep REG_NOTE order during insn copy

Jiong Wang jiong.wang@foss.arm.com
Thu Oct 20 15:28:00 GMT 2016


As discussed on PR middle-end/78016, here is the patch.

This patch makes EXPR_LIST/INST_LIST/INT_LIST insertion bi-directional, the new
node can be inserted to either the start or the end of the given list.

The existed alloc_EXPR_LIST, alloc_INSN_LIST becomes wrapper of new
bi-directional function, there is no functional change on them, callers of them
are *not affected*.

This patch then factor out those REG_NOTES copy code in emit-rtl.c and
sel-sched-ir.c into a function append_insn_reg_notes in rtlanal.c, it use those
new bi-directional interfaces to make sure the order of REG_NOTES are not
changed during insn copy.  Redundant code in emit-rtl.c and sel-sched-ir.c are
deleted also.

x86_64/aarch64 bootstrap OK. c/c++ regression OK.

OK for trunk?

gcc/
2016-10-20  Jiong Wang  <jiong.wang@arm.com>

         PR middle-end/78016
         * lists.c (alloc_INSN_LIST_bidirection): New function.  The function
         body is cloned from alloc_INSN_LIST with minor changes to make it
         support bi-directional insertion.
         (alloc_EXPR_LIST_bidirection): Likewise.
         (alloc_INT_LIST_bidirection): New function.  Alloc INT_LIST node, and
         support bi-directional insertion into given list.
         (alloc_INSN_LIST): Call alloc_INSN_LIST_bidirection.
         (alloc_EXPR_LIST): Call alloc_EXPR_LIST_bidirection.
         * rtl.h (append_insn_reg_notes): New declaration.
         (alloc_INSN_LIST_bidirection): New declaration.
         (alloc_EXPR_LIST_bidirection): New declaration.
         (alloc_INT_LIST_bidirection): New declaration.
         * rtlanal.c (alloc_reg_note_bidirection): New static function.  Function
         body is cloned from alloc_reg_note with minor changes to make it support
         bi-directional insertion.
         (alloc_reg_note): Call alloc_reg_note_bidirection.
         (append_insn_reg_notes): New function.
         * emit-rtl.c (emit_copy_of_insn_after): Use append_insn_reg_notes.
         * sel-sched-ir.c (create_copy_of_insn_rtx): Likewise.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: y.patch
Type: text/x-patch
Size: 9707 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20161020/a0e6c4e2/attachment.bin>


More information about the Gcc-patches mailing list