X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=gcc%2Fira-emit.c;h=255af307b3c83ba3d7173598928ccb836e65643c;hb=ac71c66c0f8f737601d34ee7eb813cdfacf83455;hp=544f200cf7564dc07e95f3840786e354269424ac;hpb=d040a5b0982d5756311f25d3382723da8a90475d;p=thirdparty%2Fgcc.git diff --git a/gcc/ira-emit.c b/gcc/ira-emit.c index 544f200cf756..255af307b3c8 100644 --- a/gcc/ira-emit.c +++ b/gcc/ira-emit.c @@ -1,5 +1,5 @@ /* Integrated Register Allocator. Changing code and generating moves. - Copyright (C) 2006-2015 Free Software Foundation, Inc. + Copyright (C) 2006-2019 Free Software Foundation, Inc. Contributed by Vladimir Makarov . This file is part of GCC. @@ -69,34 +69,20 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" #include "backend.h" -#include "predict.h" -#include "tree.h" #include "rtl.h" +#include "tree.h" +#include "predict.h" #include "df.h" +#include "insn-config.h" #include "regs.h" -#include "tm_p.h" -#include "target.h" -#include "flags.h" -#include "obstack.h" +#include "memmodel.h" +#include "ira.h" +#include "ira-int.h" #include "cfgrtl.h" #include "cfgbuild.h" -#include "alias.h" -#include "insn-config.h" -#include "expmed.h" -#include "dojump.h" -#include "explow.h" -#include "calls.h" -#include "emit-rtl.h" -#include "varasm.h" -#include "stmt.h" #include "expr.h" -#include "recog.h" -#include "params.h" #include "reload.h" #include "cfgloop.h" -#include "ira.h" -#include "alloc-pool.h" -#include "ira-int.h" /* Data used to emit live range split insns and to flattening IR. */ @@ -797,7 +783,7 @@ modify_move_list (move_t list) to = move->to; if ((hard_regno = ALLOCNO_HARD_REGNO (to)) < 0) continue; - nregs = hard_regno_nregs[hard_regno][ALLOCNO_MODE (to)]; + nregs = hard_regno_nregs (hard_regno, ALLOCNO_MODE (to)); for (i = 0; i < nregs; i++) { hard_regno_last_set[hard_regno + i] = move; @@ -810,7 +796,7 @@ modify_move_list (move_t list) to = move->to; if ((hard_regno = ALLOCNO_HARD_REGNO (from)) >= 0) { - nregs = hard_regno_nregs[hard_regno][ALLOCNO_MODE (from)]; + nregs = hard_regno_nregs (hard_regno, ALLOCNO_MODE (from)); for (n = i = 0; i < nregs; i++) if (hard_regno_last_set_check[hard_regno + i] == curr_tick && (ALLOCNO_REGNO (hard_regno_last_set[hard_regno + i]->to) @@ -848,7 +834,7 @@ modify_move_list (move_t list) to = move->to; if ((hard_regno = ALLOCNO_HARD_REGNO (from)) >= 0) { - nregs = hard_regno_nregs[hard_regno][ALLOCNO_MODE (from)]; + nregs = hard_regno_nregs (hard_regno, ALLOCNO_MODE (from)); for (i = 0; i < nregs; i++) if (hard_regno_last_set_check[hard_regno + i] == curr_tick && ALLOCNO_HARD_REGNO @@ -900,7 +886,7 @@ modify_move_list (move_t list) } if ((hard_regno = ALLOCNO_HARD_REGNO (to)) < 0) continue; - nregs = hard_regno_nregs[hard_regno][ALLOCNO_MODE (to)]; + nregs = hard_regno_nregs (hard_regno, ALLOCNO_MODE (to)); for (i = 0; i < nregs; i++) { hard_regno_last_set[hard_regno + i] = move; @@ -1011,23 +997,30 @@ emit_moves (void) basic_block bb; edge_iterator ei; edge e; - rtx_insn *insns, *tmp; + rtx_insn *insns, *tmp, *next; FOR_EACH_BB_FN (bb, cfun) { if (at_bb_start[bb->index] != NULL) { at_bb_start[bb->index] = modify_move_list (at_bb_start[bb->index]); - insns = emit_move_list (at_bb_start[bb->index], - REG_FREQ_FROM_BB (bb)); + insns + = emit_move_list (at_bb_start[bb->index], REG_FREQ_FROM_BB (bb)); tmp = BB_HEAD (bb); if (LABEL_P (tmp)) tmp = NEXT_INSN (tmp); if (NOTE_INSN_BASIC_BLOCK_P (tmp)) tmp = NEXT_INSN (tmp); + /* Make sure to put the location of TMP or a subsequent instruction + to avoid inheriting the location of the previous instruction. */ + next = tmp; + while (next && !NONDEBUG_INSN_P (next)) + next = NEXT_INSN (next); + if (next) + set_insn_locations (insns, INSN_LOCATION (next)); if (tmp == BB_HEAD (bb)) emit_insn_before (insns, tmp); - else if (tmp != NULL_RTX) + else if (tmp) emit_insn_after (insns, PREV_INSN (tmp)); else emit_insn_after (insns, get_last_insn ());