21 #ifndef GCC_SCHED_INT_H
22 #define GCC_SCHED_INT_H
24 #include "insn-attr.h"
26 #ifdef INSN_SCHEDULING
114 #define INSN_LUID(INSN) (sched_luids[INSN_UID (INSN)])
115 #define LUID_BY_UID(UID) (sched_luids[UID])
117 #define SET_INSN_LUID(INSN, LUID) \
118 (sched_luids[INSN_UID (INSN)] = (LUID))
135 extern void *
xrecalloc (
void *,
size_t,
size_t,
size_t);
196 typedef unsigned int ds_t;
197 #define BITS_PER_DEP_STATUS HOST_BITS_PER_INT
200 typedef unsigned int dw_t;
248 #define UNKNOWN_DEP_COST (-1<<19)
253 #define DEP_PRO(D) ((D)->pro)
254 #define DEP_CON(D) ((D)->con)
255 #define DEP_TYPE(D) ((D)->type)
256 #define DEP_STATUS(D) ((D)->status)
257 #define DEP_COST(D) ((D)->cost)
258 #define DEP_NONREG(D) ((D)->nonreg)
259 #define DEP_MULTIPLE(D) ((D)->multiple)
260 #define DEP_REPLACE(D) ((D)->replace)
292 #define DEP_LINK_NODE(N) ((N)->node)
293 #define DEP_LINK_NEXT(N) ((N)->next)
294 #define DEP_LINK_PREV_NEXTP(N) ((N)->prev_nextp)
300 #define DEP_LINK_DEP(N) (DEP_NODE_DEP (DEP_LINK_NODE (N)))
301 #define DEP_LINK_PRO(N) (DEP_PRO (DEP_LINK_DEP (N)))
302 #define DEP_LINK_CON(N) (DEP_CON (DEP_LINK_DEP (N)))
303 #define DEP_LINK_TYPE(N) (DEP_TYPE (DEP_LINK_DEP (N)))
304 #define DEP_LINK_STATUS(N) (DEP_STATUS (DEP_LINK_DEP (N)))
317 #define DEPS_LIST_FIRST(L) ((L)->first)
318 #define DEPS_LIST_N_LINKS(L) ((L)->n_links)
427 #define DEP_NODE_BACK(N) (&(N)->back)
428 #define DEP_NODE_DEP(N) (&(N)->dep)
429 #define DEP_NODE_FORW(N) (&(N)->forw)
474 rtx pending_read_insns;
477 rtx pending_read_mems;
480 rtx pending_write_insns;
486 rtx pending_jump_insns;
494 int pending_read_list_length;
497 int pending_write_list_length;
502 int pending_flush_length;
513 rtx last_pending_memory_flush;
518 rtx last_function_call;
524 rtx last_function_call_may_noreturn;
530 rtx sched_before_next_call;
533 rtx sched_before_next_jump;
561 BOOL_BITFIELD readonly : 1;
595 const char *(*print_insn) (
const_rtx, int);
602 bool (*insn_finishes_block_p) (
rtx);
605 rtx prev_head, next_tail;
612 unsigned int queue_must_finish_empty:1;
615 int sched_max_insns_priority;
621 void (*add_remove_insn) (
rtx, int);
641 void *(*save_state) (void);
644 void (*restore_state) (
void *);
664 dw_t data_weakness_cutoff;
668 int control_weakness_cutoff;
699 unsigned int has_internal_dep;
741 unsigned int reverse_cond : 1;
744 unsigned int cant_move : 1;
750 #define INCREASE_BITS 8
757 unsigned int clobber_increase : INCREASE_BITS;
760 unsigned int set_increase : INCREASE_BITS;
763 unsigned int unused_set_increase : INCREASE_BITS;
765 int change : INCREASE_BITS;
830 signed char priority_status;
834 unsigned int fed_by_spec_load : 1;
835 unsigned int is_load_insn : 1;
838 unsigned int feeds_backtrack_insn : 1;
843 unsigned int shadow_p : 1;
847 unsigned int must_recompute_spec : 1;
877 int *max_reg_pressure;
886 int reg_pressure_excess_cost_change;
896 #define HID(INSN) (&h_i_d[INSN_UID (INSN)])
900 #define INSN_PRIORITY(INSN) (HID (INSN)->priority)
901 #define INSN_REG_PRESSURE(INSN) (HID (INSN)->reg_pressure)
902 #define INSN_MAX_REG_PRESSURE(INSN) (HID (INSN)->max_reg_pressure)
903 #define INSN_REG_USE_LIST(INSN) (HID (INSN)->reg_use_list)
904 #define INSN_REG_SET_LIST(INSN) (HID (INSN)->reg_set_list)
905 #define INSN_REG_PRESSURE_EXCESS_COST_CHANGE(INSN) \
906 (HID (INSN)->reg_pressure_excess_cost_change)
907 #define INSN_PRIORITY_STATUS(INSN) (HID (INSN)->priority_status)
908 #define INSN_MODEL_INDEX(INSN) (HID (INSN)->model_index)
916 #define HDID(INSN) (&h_d_i_d[INSN_LUID (INSN)])
917 #define INSN_DEP_COUNT(INSN) (HDID (INSN)->dep_count)
918 #define HAS_INTERNAL_DEP(INSN) (HDID (INSN)->has_internal_dep)
919 #define INSN_FORW_DEPS(INSN) (HDID (INSN)->forw_deps)
920 #define INSN_RESOLVED_BACK_DEPS(INSN) (HDID (INSN)->resolved_back_deps)
921 #define INSN_RESOLVED_FORW_DEPS(INSN) (HDID (INSN)->resolved_forw_deps)
922 #define INSN_HARD_BACK_DEPS(INSN) (HDID (INSN)->hard_back_deps)
923 #define INSN_SPEC_BACK_DEPS(INSN) (HDID (INSN)->spec_back_deps)
924 #define INSN_CACHED_COND(INSN) (HDID (INSN)->cond)
925 #define INSN_REVERSE_COND(INSN) (HDID (INSN)->reverse_cond)
926 #define INSN_COND_DEPS(INSN) (HDID (INSN)->cond_deps)
927 #define CANT_MOVE(INSN) (HDID (INSN)->cant_move)
928 #define CANT_MOVE_BY_LUID(LUID) (h_d_i_d[LUID].cant_move)
931 #define INSN_PRIORITY(INSN) (HID (INSN)->priority)
932 #define INSN_PRIORITY_STATUS(INSN) (HID (INSN)->priority_status)
933 #define INSN_PRIORITY_KNOWN(INSN) (INSN_PRIORITY_STATUS (INSN) > 0)
934 #define TODO_SPEC(INSN) (HID (INSN)->todo_spec)
935 #define DONE_SPEC(INSN) (HID (INSN)->done_spec)
936 #define CHECK_SPEC(INSN) (HID (INSN)->check_spec)
937 #define RECOVERY_BLOCK(INSN) (HID (INSN)->recovery_block)
938 #define ORIG_PAT(INSN) (HID (INSN)->orig_pat)
939 #define PREDICATED_PAT(INSN) (HID (INSN)->predicated_pat)
942 #define IS_SPECULATION_CHECK_P(INSN) \
943 (sel_sched_p () ? sel_insn_is_speculation_check (INSN) : RECOVERY_BLOCK (INSN) != NULL)
947 #define IS_SPECULATION_SIMPLE_CHECK_P(INSN) \
948 (RECOVERY_BLOCK (INSN) == EXIT_BLOCK_PTR)
954 #define IS_SPECULATION_BRANCHY_CHECK_P(INSN) \
955 (RECOVERY_BLOCK (INSN) != NULL && RECOVERY_BLOCK (INSN) != EXIT_BLOCK_PTR)
1003 #define BITS_PER_DEP_WEAK ((BITS_PER_DEP_STATUS - 8) / 4)
1006 #define DEP_WEAK_MASK ((1 << BITS_PER_DEP_WEAK) - 1)
1013 #define MAX_DEP_WEAK (DEP_WEAK_MASK - 1)
1018 #define MIN_DEP_WEAK 1
1024 #define NO_DEP_WEAK (MAX_DEP_WEAK + MIN_DEP_WEAK)
1028 #define UNCERTAIN_DEP_WEAK (MAX_DEP_WEAK - MAX_DEP_WEAK / 4)
1045 #define BEGIN_DATA (((ds_t) DEP_WEAK_MASK) << BEGIN_DATA_BITS_OFFSET)
1051 #define BE_IN_DATA (((ds_t) DEP_WEAK_MASK) << BE_IN_DATA_BITS_OFFSET)
1055 #define BEGIN_CONTROL (((ds_t) DEP_WEAK_MASK) << BEGIN_CONTROL_BITS_OFFSET)
1061 #define BE_IN_CONTROL (((ds_t) DEP_WEAK_MASK) << BE_IN_CONTROL_BITS_OFFSET)
1064 #define BEGIN_SPEC (BEGIN_DATA | BEGIN_CONTROL)
1065 #define DATA_SPEC (BEGIN_DATA | BE_IN_DATA)
1066 #define CONTROL_SPEC (BEGIN_CONTROL | BE_IN_CONTROL)
1067 #define SPECULATIVE (DATA_SPEC | CONTROL_SPEC)
1068 #define BE_IN_SPEC (BE_IN_DATA | BE_IN_CONTROL)
1071 #define FIRST_SPEC_TYPE BEGIN_DATA
1072 #define LAST_SPEC_TYPE BE_IN_CONTROL
1073 #define SPEC_TYPE_SHIFT BITS_PER_DEP_WEAK
1078 #define DEP_TRUE (((ds_t) 1) << (BE_IN_CONTROL_BITS_OFFSET + BITS_PER_DEP_WEAK))
1079 #define DEP_OUTPUT (DEP_TRUE << 1)
1080 #define DEP_ANTI (DEP_OUTPUT << 1)
1081 #define DEP_CONTROL (DEP_ANTI << 1)
1083 #define DEP_TYPES (DEP_TRUE | DEP_OUTPUT | DEP_ANTI | DEP_CONTROL)
1088 #define HARD_DEP (DEP_CONTROL << 1)
1099 #define DEP_POSTPONED (HARD_DEP << 1)
1102 #define DEP_CANCELLED (DEP_POSTPONED << 1)
1131 SCHED_RGN = DONT_BREAK_DEPENDENCIES << 1,
1145 #define NOTE_NOT_BB_P(NOTE) (NOTE_P (NOTE) && (NOTE_KIND (NOTE) \
1146 != NOTE_INSN_BASIC_BLOCK))
1221 #define WORST_CLASS(class1, class2) \
1222 ((class1 > class2) ? class1 : class2)
1228 #ifndef HAIFA_INLINE
1229 #define HAIFA_INLINE __inline
1240 void (*start_insn) (
rtx);
1243 void (*finish_insn) (void);
1246 void (*start_lhs) (
rtx);
1249 void (*finish_lhs) (void);
1252 void (*start_rhs) (
rtx);
1255 void (*finish_rhs) (void);
1277 unsigned int use_cselib : 1;
1281 unsigned int use_deps_list : 1;
1285 unsigned int generate_spec_deps : 1;
1391 unsigned int has_real_ebb : 1;
1404 #define BLOCK_NUM(INSN) (BLOCK_FOR_INSN (INSN)->index + 0)
1406 #define RGN_NR_BLOCKS(rgn) (rgn_table[rgn].rgn_nr_blocks)
1407 #define RGN_BLOCKS(rgn) (rgn_table[rgn].rgn_blocks)
1408 #define RGN_DONT_CALC_DEPS(rgn) (rgn_table[rgn].dont_calc_deps)
1409 #define RGN_HAS_REAL_EBB(rgn) (rgn_table[rgn].has_real_ebb)
1410 #define BLOCK_TO_BB(block) (block_to_bb[block])
1411 #define CONTAINING_RGN(block) (containing_rgn[block])
1415 #define BB_TO_BLOCK(ebb) (rgn_bb_table[ebb_head[ebb]])
1416 #define EBB_FIRST_BB(ebb) BASIC_BLOCK (BB_TO_BLOCK (ebb))
1417 #define EBB_LAST_BB(ebb) BASIC_BLOCK (rgn_bb_table[ebb_head[ebb + 1] - 1])
1418 #define INSN_BB(INSN) (BLOCK_TO_BB (BLOCK_NUM (INSN)))
1470 #define SD_LIST_NONE (0)
1473 #define SD_LIST_HARD_BACK (1)
1476 #define SD_LIST_SPEC_BACK (2)
1479 #define SD_LIST_FORW (4)
1482 #define SD_LIST_RES_BACK (8)
1485 #define SD_LIST_RES_FORW (16)
1487 #define SD_LIST_BACK (SD_LIST_HARD_BACK | SD_LIST_SPEC_BACK)
1536 i.
linkp = &null_link;
1552 *dep_ptr = DEP_LINK_DEP (link);
1559 if (types != SD_LIST_NONE)
1567 it_ptr->
linkp = &DEPS_LIST_FIRST (list);
1582 it_ptr->
linkp = &DEP_LINK_NEXT (*it_ptr->
linkp);
1586 #define FOR_EACH_DEP(INSN, LIST_TYPES, ITER, DEP) \
1587 for ((ITER) = sd_iterator_start ((INSN), (LIST_TYPES)); \
1588 sd_iterator_cond (&(ITER), &(DEP)); \
1589 sd_iterator_next (&(ITER)))
1591 #define IS_DISPATCH_ON 1
1593 #define DISPATCH_VIOLATION 3
1594 #define FITS_DISPATCH_WINDOW 4
1595 #define DISPATCH_INIT 5
1596 #define ADD_TO_DISPATCH_WINDOW 6