/* Instruction scheduling pass. This file contains definitions used
internally in the scheduler.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000 Free Software Foundation, Inc.
+ 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GNU CC.
to ensure that they won't cross a call after scheduling is done. */
rtx sched_before_next_call;
+ /* The maximum register number for the following arrays. Before reload
+ this is max_reg_num; after reload it is FIRST_PSEUDO_REGISTER. */
+ int max_reg;
+
/* Element N is the next insn that sets (hard or pseudo) register
N within the current basic block; or zero, if there is no
such insn. Needed for new registers which may be introduced
by splitting insns. */
- rtx *reg_last_uses;
- rtx *reg_last_sets;
- rtx *reg_last_clobbers;
+ struct deps_reg
+ {
+ rtx uses;
+ rtx sets;
+ rtx clobbers;
+ } *reg_last;
+
+ /* Element N is set for each register that has any non-zero element
+ in reg_last[N].{uses,sets,clobbers}. */
+ regset_head reg_last_in_use;
};
/* This structure holds some state of the current scheduling pass, and
static buffer for this. The ALIGNED parameter should cause the string
to be formatted so that multiple output lines will line up nicely. */
const char *(*print_insn) PARAMS ((rtx, int));
+ /* Return nonzero if an insn should be included in priority
+ calculations. */
+ int (*contributes_to_priority) PARAMS ((rtx, rtx));
+ /* Called when computing dependencies for a JUMP_INSN. This function
+ should store the set of registers that must be considered as set by
+ the jump in the regset. */
+ void (*compute_jump_reg_dependencies) PARAMS ((rtx, regset));
/* The boundaries of the set of insns to be scheduled. */
rtx prev_head, next_tail;
extern struct haifa_insn_data *h_i_d;
-/* Accessor macros for h_i_d. There are more in haifa-sched.c. */
+/* Accessor macros for h_i_d. There are more in haifa-sched.c and
+ sched-rgn.c. */
#define INSN_DEPEND(INSN) (h_i_d[INSN_UID (INSN)].depend)
#define INSN_LUID(INSN) (h_i_d[INSN_UID (INSN)].luid)
#define CANT_MOVE(insn) (h_i_d[INSN_UID (insn)].cant_move)
#define INSN_DEP_COUNT(INSN) (h_i_d[INSN_UID (INSN)].dep_count)
+#define INSN_PRIORITY(INSN) (h_i_d[INSN_UID (INSN)].priority)
+#define INSN_COST(INSN) (h_i_d[INSN_UID (INSN)].cost)
+#define INSN_UNIT(INSN) (h_i_d[INSN_UID (INSN)].units)
+#define INSN_REG_WEIGHT(INSN) (h_i_d[INSN_UID (INSN)].reg_weight)
+
+#define INSN_BLOCKAGE(INSN) (h_i_d[INSN_UID (INSN)].blockage)
+#define UNIT_BITS 5
+#define BLOCKAGE_MASK ((1 << BLOCKAGE_BITS) - 1)
+#define ENCODE_BLOCKAGE(U, R) \
+ (((U) << BLOCKAGE_BITS \
+ | MIN_BLOCKAGE_COST (R)) << BLOCKAGE_BITS \
+ | MAX_BLOCKAGE_COST (R))
+#define UNIT_BLOCKED(B) ((B) >> (2 * BLOCKAGE_BITS))
+#define BLOCKAGE_RANGE(B) \
+ (((((B) >> BLOCKAGE_BITS) & BLOCKAGE_MASK) << (HOST_BITS_PER_INT / 2)) \
+ | ((B) & BLOCKAGE_MASK))
+
+/* Encodings of the `<name>_unit_blockage_range' function. */
+#define MIN_BLOCKAGE_COST(R) ((R) >> (HOST_BITS_PER_INT / 2))
+#define MAX_BLOCKAGE_COST(R) ((R) & ((1 << (HOST_BITS_PER_INT / 2)) - 1))
extern FILE *sched_dump;
+extern int sched_verbose;
#ifndef __GNUC__
#define __inline
extern void free_dependency_caches PARAMS ((void));
/* Functions in haifa-sched.c. */
+extern void get_block_head_tail PARAMS ((int, rtx *, rtx *));
+extern int no_real_insns_p PARAMS ((rtx, rtx));
+
+extern void rm_line_notes PARAMS ((rtx, rtx));
+extern void save_line_notes PARAMS ((int, rtx, rtx));
+extern void restore_line_notes PARAMS ((rtx, rtx));
+extern void rm_redundant_line_notes PARAMS ((void));
+extern void rm_other_notes PARAMS ((rtx, rtx));
+
+extern int insn_issue_delay PARAMS ((rtx));
+extern int set_priorities PARAMS ((rtx, rtx));
+
+extern void schedule_block PARAMS ((int, int));
+extern void sched_init PARAMS ((FILE *));
+extern void sched_finish PARAMS ((void));
+
+extern void ready_add PARAMS ((struct ready_list *, rtx));
+
+/* The following are exported for the benefit of debugging functions. It
+ would be nicer to keep them private to haifa-sched.c. */
extern int insn_unit PARAMS ((rtx));
+extern int insn_cost PARAMS ((rtx, rtx, rtx));
extern rtx get_unit_last_insn PARAMS ((int));
extern int actual_hazard_this_instance PARAMS ((int, int, rtx, int, int));