/* Instruction scheduling pass.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010
Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com) Enhanced by,
and currently maintained by, Jim Wilson (wilson@cygnus.com)
#include "system.h"
#include "coretypes.h"
#include "tm.h"
-#include "toplev.h"
+#include "diagnostic-core.h"
#include "rtl.h"
#include "tm_p.h"
#include "hard-reg-set.h"
#include "insn-config.h"
#include "insn-attr.h"
#include "except.h"
-#include "toplev.h"
#include "recog.h"
#include "cfglayout.h"
#include "params.h"
static void schedule_region (int);
static rtx concat_INSN_LIST (rtx, rtx);
static void concat_insn_mem_list (rtx, rtx, rtx *, rtx *);
-static void propagate_deps (int, struct deps *);
+static void propagate_deps (int, struct deps_desc *);
static void free_pending_lists (void);
/* Functions for construction of the control flow graph. */
/* Print the regions, for debugging purposes. Callable from debugger. */
-void
+DEBUG_FUNCTION void
debug_regions (void)
{
int rgn, bb;
/* Print the region's basic blocks. */
-void
+DEBUG_FUNCTION void
debug_region (int rgn)
{
int bb;
for (bb = ebb_start; ; bb = bb->next_bb)
{
edge e;
- edge_iterator ei;
rgn_bb_table[i] = bb->index;
RGN_NR_BLOCKS (nr_regions)++;
|| LABEL_P (BB_HEAD (bb->next_bb)))
break;
- FOR_EACH_EDGE (e, ei, bb->succs)
- if ((e->flags & EDGE_FALLTHRU) != 0)
- break;
+ e = find_fallthru_edge (bb->succs);
if (! e)
break;
if (e->probability <= probability_cutoff)
/* Print candidates info, for debugging purposes. Callable from debugger. */
-void
+DEBUG_FUNCTION void
debug_candidate (int i)
{
if (!candidate_table[i].is_valid)
/* Print candidates info, for debugging purposes. Callable from debugger. */
-void
+DEBUG_FUNCTION void
debug_candidates (int trg)
{
int i;
src_head = head;
for (insn = src_head; insn != src_next_tail; insn = NEXT_INSN (insn))
- if (INSN_P (insn) && !BOUNDARY_DEBUG_INSN_P (insn))
+ if (INSN_P (insn))
try_ready (insn);
}
}
return rgn_sched_info.sched_max_insns_priority;
}
-/* Determine if PAT sets a CLASS_LIKELY_SPILLED_P register. */
+/* Determine if PAT sets a TARGET_CLASS_LIKELY_SPILLED_P register. */
static bool
sets_likely_spilled (rtx pat)
if (GET_CODE (pat) == SET
&& REG_P (x)
- && REGNO (x) < FIRST_PSEUDO_REGISTER
- && CLASS_LIKELY_SPILLED_P (REGNO_REG_CLASS (REGNO (x))))
+ && HARD_REGISTER_P (x)
+ && targetm.class_likely_spilled_p (REGNO_REG_CLASS (REGNO (x))))
*ret = true;
}
COND_EXEC insns cannot be moved past a branch (see e.g. PR17808).
- Insns setting CLASS_LIKELY_SPILLED_P registers (usually return values)
- are not moved before reload because we can wind up with register
+ Insns setting TARGET_CLASS_LIKELY_SPILLED_P registers (usually return
+ values) are not moved before reload because we can wind up with register
allocation failures. */
while (tail != head && DEBUG_INSN_P (tail))
the variables of its predecessors. When the analysis for a bb completes,
we save the contents to the corresponding bb_deps[bb] variable. */
-static struct deps *bb_deps;
+static struct deps_desc *bb_deps;
/* Duplicate the INSN_LIST elements of COPY and prepend them to OLD. */
{
rtx new_rtx = old;
for (; copy ; copy = XEXP (copy, 1))
- new_rtx = alloc_INSN_LIST (XEXP (copy, 0), new_rtx);
+ {
+ new_rtx = alloc_INSN_LIST (XEXP (copy, 0), new_rtx);
+ PUT_REG_NOTE_KIND (new_rtx, REG_NOTE_KIND (copy));
+ }
return new_rtx;
}
/* Join PRED_DEPS to the SUCC_DEPS. */
void
-deps_join (struct deps *succ_deps, struct deps *pred_deps)
+deps_join (struct deps_desc *succ_deps, struct deps_desc *pred_deps)
{
unsigned reg;
reg_set_iterator rsi;
/* After computing the dependencies for block BB, propagate the dependencies
found in TMP_DEPS to the successors of the block. */
static void
-propagate_deps (int bb, struct deps *pred_deps)
+propagate_deps (int bb, struct deps_desc *pred_deps)
{
basic_block block = BASIC_BLOCK (BB_TO_BLOCK (bb));
edge_iterator ei;
compute_block_dependences (int bb)
{
rtx head, tail;
- struct deps tmp_deps;
+ struct deps_desc tmp_deps;
tmp_deps = bb_deps[bb];
Callable from debugger. */
/* Print dependences for debugging starting from FROM_BB.
Callable from debugger. */
-void
+DEBUG_FUNCTION void
debug_rgn_dependencies (int from_bb)
{
int bb;
init_deps_global ();
/* Initializations for region data dependence analysis. */
- bb_deps = XNEWVEC (struct deps, current_nr_blocks);
+ bb_deps = XNEWVEC (struct deps_desc, current_nr_blocks);
for (bb = 0; bb < current_nr_blocks; bb++)
init_deps (bb_deps + bb, false);
{
#ifdef INSN_SCHEDULING
return optimize > 0 && flag_schedule_insns_after_reload
- && dbg_cnt (sched2_func);
+ && !targetm.delay_sched2 && dbg_cnt (sched2_func);
#else
return 0;
#endif
{
/* Do control and data sched analysis again,
and write some more of the results to dump file. */
- if (flag_sched2_use_superblocks || flag_sched2_use_traces)
+ if (flag_sched2_use_superblocks)
schedule_ebbs ();
else
schedule_insns ();