28 #ifdef ENABLE_CHECKING
29 #define ENABLE_IRA_CHECKING
32 #ifdef ENABLE_IRA_CHECKING
33 #define ira_assert(c) gcc_assert (c)
37 #define ira_assert(c) ((void)(0 && (c)))
45 #define REG_FREQ_FROM_EDGE_FREQ(freq) \
46 (optimize_size || (flag_branch_probabilities && !ENTRY_BLOCK_PTR->count) \
47 ? REG_FREQ_MAX : (freq * REG_FREQ_MAX / BB_FREQ_MAX) \
48 ? (freq * REG_FREQ_MAX / BB_FREQ_MAX) : 1)
92 ira_loop_tree_node_t
parent;
152 #if defined ENABLE_IRA_CHECKING && (GCC_VERSION >= 2007)
153 #define IRA_BB_NODE_BY_INDEX(index) __extension__ \
154 (({ ira_loop_tree_node_t _node = (&ira_bb_nodes[index]); \
155 if (_node->children != NULL || _node->loop != NULL || _node->bb == NULL)\
158 "\n%s: %d: error in %s: it is not a block node\n", \
159 __FILE__, __LINE__, __FUNCTION__); \
160 gcc_unreachable (); \
164 #define IRA_BB_NODE_BY_INDEX(index) (&ira_bb_nodes[index])
167 #define IRA_BB_NODE(bb) IRA_BB_NODE_BY_INDEX ((bb)->index)
174 #if defined ENABLE_IRA_CHECKING && (GCC_VERSION >= 2007)
175 #define IRA_LOOP_NODE_BY_INDEX(index) __extension__ \
176 (({ ira_loop_tree_node_t const _node = (&ira_loop_nodes[index]); \
177 if (_node->children == NULL || _node->bb != NULL \
178 || (_node->loop == NULL && current_loops != NULL)) \
181 "\n%s: %d: error in %s: it is not a loop node\n", \
182 __FILE__, __LINE__, __FUNCTION__); \
183 gcc_unreachable (); \
187 #define IRA_LOOP_NODE_BY_INDEX(index) (&ira_loop_nodes[index])
190 #define IRA_LOOP_NODE(loop) IRA_LOOP_NODE_BY_INDEX ((loop)->num)
282 ENUM_BITFIELD (machine_mode) mode : 8;
285 ENUM_BITFIELD (reg_class) aclass : 16;
295 unsigned int no_stack_reg_p : 1, total_no_stack_reg_p : 1;
407 #define ALLOCNO_NUM(A) ((A)->num)
408 #define ALLOCNO_REGNO(A) ((A)->regno)
409 #define ALLOCNO_REG(A) ((A)->reg)
410 #define ALLOCNO_NEXT_REGNO_ALLOCNO(A) ((A)->next_regno_allocno)
411 #define ALLOCNO_LOOP_TREE_NODE(A) ((A)->loop_tree_node)
412 #define ALLOCNO_CAP(A) ((A)->cap)
413 #define ALLOCNO_CAP_MEMBER(A) ((A)->cap_member)
414 #define ALLOCNO_NREFS(A) ((A)->nrefs)
415 #define ALLOCNO_FREQ(A) ((A)->freq)
416 #define ALLOCNO_HARD_REGNO(A) ((A)->hard_regno)
417 #define ALLOCNO_CALL_FREQ(A) ((A)->call_freq)
418 #define ALLOCNO_CALLS_CROSSED_NUM(A) ((A)->calls_crossed_num)
419 #define ALLOCNO_CHEAP_CALLS_CROSSED_NUM(A) ((A)->cheap_calls_crossed_num)
420 #define ALLOCNO_MEM_OPTIMIZED_DEST(A) ((A)->mem_optimized_dest)
421 #define ALLOCNO_MEM_OPTIMIZED_DEST_P(A) ((A)->mem_optimized_dest_p)
422 #define ALLOCNO_SOMEWHERE_RENAMED_P(A) ((A)->somewhere_renamed_p)
423 #define ALLOCNO_CHILD_RENAMED_P(A) ((A)->child_renamed_p)
424 #define ALLOCNO_DONT_REASSIGN_P(A) ((A)->dont_reassign_p)
426 #define ALLOCNO_NO_STACK_REG_P(A) ((A)->no_stack_reg_p)
427 #define ALLOCNO_TOTAL_NO_STACK_REG_P(A) ((A)->total_no_stack_reg_p)
429 #define ALLOCNO_BAD_SPILL_P(A) ((A)->bad_spill_p)
430 #define ALLOCNO_ASSIGNED_P(A) ((A)->assigned_p)
431 #define ALLOCNO_MODE(A) ((A)->mode)
432 #define ALLOCNO_PREFS(A) ((A)->allocno_prefs)
433 #define ALLOCNO_COPIES(A) ((A)->allocno_copies)
434 #define ALLOCNO_HARD_REG_COSTS(A) ((A)->hard_reg_costs)
435 #define ALLOCNO_UPDATED_HARD_REG_COSTS(A) ((A)->updated_hard_reg_costs)
436 #define ALLOCNO_CONFLICT_HARD_REG_COSTS(A) \
437 ((A)->conflict_hard_reg_costs)
438 #define ALLOCNO_UPDATED_CONFLICT_HARD_REG_COSTS(A) \
439 ((A)->updated_conflict_hard_reg_costs)
440 #define ALLOCNO_CLASS(A) ((A)->aclass)
441 #define ALLOCNO_CLASS_COST(A) ((A)->class_cost)
442 #define ALLOCNO_UPDATED_CLASS_COST(A) ((A)->updated_class_cost)
443 #define ALLOCNO_MEMORY_COST(A) ((A)->memory_cost)
444 #define ALLOCNO_UPDATED_MEMORY_COST(A) ((A)->updated_memory_cost)
445 #define ALLOCNO_EXCESS_PRESSURE_POINTS_NUM(A) \
446 ((A)->excess_pressure_points_num)
447 #define ALLOCNO_OBJECT(A,N) ((A)->objects[N])
448 #define ALLOCNO_NUM_OBJECTS(A) ((A)->num_objects)
449 #define ALLOCNO_ADD_DATA(A) ((A)->add_data)
478 #define ALLOCNO_EMIT_DATA(a) ((ira_emit_data_t) ALLOCNO_ADD_DATA (a))
490 #define OBJECT_ALLOCNO(O) ((O)->allocno)
491 #define OBJECT_SUBWORD(O) ((O)->subword)
492 #define OBJECT_CONFLICT_ARRAY(O) ((O)->conflicts_array)
493 #define OBJECT_CONFLICT_VEC(O) ((ira_object_t *)(O)->conflicts_array)
494 #define OBJECT_CONFLICT_BITVEC(O) ((IRA_INT_TYPE *)(O)->conflicts_array)
495 #define OBJECT_CONFLICT_ARRAY_SIZE(O) ((O)->conflicts_array_size)
496 #define OBJECT_CONFLICT_VEC_P(O) ((O)->conflict_vec_p)
497 #define OBJECT_NUM_CONFLICTS(O) ((O)->num_accumulated_conflicts)
498 #define OBJECT_CONFLICT_HARD_REGS(O) ((O)->conflict_hard_regs)
499 #define OBJECT_TOTAL_CONFLICT_HARD_REGS(O) ((O)->total_conflict_hard_regs)
500 #define OBJECT_MIN(O) ((O)->min)
501 #define OBJECT_MAX(O) ((O)->max)
502 #define OBJECT_CONFLICT_ID(O) ((O)->id)
503 #define OBJECT_LIVE_RANGES(O) ((O)->live_ranges)
628 #define IRA_INT_BITS HOST_BITS_PER_WIDE_INT
629 #define IRA_INT_TYPE HOST_WIDE_INT
634 #if defined ENABLE_IRA_CHECKING && (GCC_VERSION >= 2007)
636 #define SET_MINMAX_SET_BIT(R, I, MIN, MAX) __extension__ \
637 (({ int _min = (MIN), _max = (MAX), _i = (I); \
638 if (_i < _min || _i > _max) \
641 "\n%s: %d: error in %s: %d not in range [%d,%d]\n", \
642 __FILE__, __LINE__, __FUNCTION__, _i, _min, _max); \
643 gcc_unreachable (); \
645 ((R)[(unsigned) (_i - _min) / IRA_INT_BITS] \
646 |= ((IRA_INT_TYPE) 1 << ((unsigned) (_i - _min) % IRA_INT_BITS))); }))
649 #define CLEAR_MINMAX_SET_BIT(R, I, MIN, MAX) __extension__ \
650 (({ int _min = (MIN), _max = (MAX), _i = (I); \
651 if (_i < _min || _i > _max) \
654 "\n%s: %d: error in %s: %d not in range [%d,%d]\n", \
655 __FILE__, __LINE__, __FUNCTION__, _i, _min, _max); \
656 gcc_unreachable (); \
658 ((R)[(unsigned) (_i - _min) / IRA_INT_BITS] \
659 &= ~((IRA_INT_TYPE) 1 << ((unsigned) (_i - _min) % IRA_INT_BITS))); }))
661 #define TEST_MINMAX_SET_BIT(R, I, MIN, MAX) __extension__ \
662 (({ int _min = (MIN), _max = (MAX), _i = (I); \
663 if (_i < _min || _i > _max) \
666 "\n%s: %d: error in %s: %d not in range [%d,%d]\n", \
667 __FILE__, __LINE__, __FUNCTION__, _i, _min, _max); \
668 gcc_unreachable (); \
670 ((R)[(unsigned) (_i - _min) / IRA_INT_BITS] \
671 & ((IRA_INT_TYPE) 1 << ((unsigned) (_i - _min) % IRA_INT_BITS))); }))
675 #define SET_MINMAX_SET_BIT(R, I, MIN, MAX) \
676 ((R)[(unsigned) ((I) - (MIN)) / IRA_INT_BITS] \
677 |= ((IRA_INT_TYPE) 1 << ((unsigned) ((I) - (MIN)) % IRA_INT_BITS)))
679 #define CLEAR_MINMAX_SET_BIT(R, I, MIN, MAX) \
680 ((R)[(unsigned) ((I) - (MIN)) / IRA_INT_BITS] \
681 &= ~((IRA_INT_TYPE) 1 << ((unsigned) ((I) - (MIN)) % IRA_INT_BITS)))
683 #define TEST_MINMAX_SET_BIT(R, I, MIN, MAX) \
684 ((R)[(unsigned) ((I) - (MIN)) / IRA_INT_BITS] \
685 & ((IRA_INT_TYPE) 1 << ((unsigned) ((I) - (MIN)) % IRA_INT_BITS)))
696 unsigned int word_num;
702 unsigned int bit_num;
719 i->
nel = max < min ? 0 : max - min + 1;
722 i->
word = i->
nel == 0 ? 0 : vec[0];
743 for (; (i->
word & 1) == 0; i->
word >>= 1)
763 #define FOR_EACH_BIT_IN_MINMAX_SET(VEC, MIN, MAX, N, ITER) \
764 for (minmax_set_iter_init (&(ITER), (VEC), (MIN), (MAX)); \
765 minmax_set_iter_cond (&(ITER), &(N)); \
766 minmax_set_iter_next (&(ITER)))
791 [FIRST_PSEUDO_REGISTER][NUM_MACHINE_MODES]);
902 #if SWITCHABLE_TARGET
905 #define this_target_ira_int (&default_target_ira_int)
908 #define ira_reg_mode_hard_regset \
909 (this_target_ira_int->x_ira_reg_mode_hard_regset)
910 #define ira_register_move_cost \
911 (this_target_ira_int->x_ira_register_move_cost)
912 #define ira_max_memory_move_cost \
913 (this_target_ira_int->x_ira_max_memory_move_cost)
914 #define ira_may_move_in_cost \
915 (this_target_ira_int->x_ira_may_move_in_cost)
916 #define ira_may_move_out_cost \
917 (this_target_ira_int->x_ira_may_move_out_cost)
918 #define ira_reg_allocno_class_p \
919 (this_target_ira_int->x_ira_reg_allocno_class_p)
920 #define ira_reg_pressure_class_p \
921 (this_target_ira_int->x_ira_reg_pressure_class_p)
922 #define ira_non_ordered_class_hard_regs \
923 (this_target_ira_int->x_ira_non_ordered_class_hard_regs)
924 #define ira_class_hard_reg_index \
925 (this_target_ira_int->x_ira_class_hard_reg_index)
926 #define ira_prohibited_class_mode_regs \
927 (this_target_ira_int->x_ira_prohibited_class_mode_regs)
928 #define ira_useful_class_mode_regs \
929 (this_target_ira_int->x_ira_useful_class_mode_regs)
930 #define ira_important_classes_num \
931 (this_target_ira_int->x_ira_important_classes_num)
932 #define ira_important_classes \
933 (this_target_ira_int->x_ira_important_classes)
934 #define ira_important_class_nums \
935 (this_target_ira_int->x_ira_important_class_nums)
936 #define ira_uniform_class_p \
937 (this_target_ira_int->x_ira_uniform_class_p)
938 #define ira_reg_class_intersect \
939 (this_target_ira_int->x_ira_reg_class_intersect)
940 #define ira_reg_class_super_classes \
941 (this_target_ira_int->x_ira_reg_class_super_classes)
942 #define ira_reg_class_subunion \
943 (this_target_ira_int->x_ira_reg_class_subunion)
944 #define ira_reg_class_superunion \
945 (this_target_ira_int->x_ira_reg_class_superunion)
946 #define ira_prohibited_mode_move_regs \
947 (this_target_ira_int->x_ira_prohibited_mode_move_regs)
982 void (*) (ira_loop_tree_node_t),
983 void (*) (ira_loop_tree_node_t));
1008 int,
bool,
rtx, ira_loop_tree_node_t);
1010 bool,
rtx, ira_loop_tree_node_t);
1102 for (n = i->
n; n < ira_allocnos_num; n++)
1103 if (ira_allocnos[n] !=
NULL)
1105 *a = ira_allocnos[n];
1115 #define FOR_EACH_ALLOCNO(A, ITER) \
1116 for (ira_allocno_iter_init (&(ITER)); \
1117 ira_allocno_iter_cond (&(ITER), &(A));)
1139 for (n = i->
n; n < ira_objects_num; n++)
1140 if (ira_object_id_map[n] !=
NULL)
1142 *obj = ira_object_id_map[n];
1152 #define FOR_EACH_OBJECT(OBJ, ITER) \
1153 for (ira_object_iter_init (&(ITER)); \
1154 ira_object_iter_cond (&(ITER), &(OBJ));)
1188 #define FOR_EACH_ALLOCNO_OBJECT(A, O, ITER) \
1189 for (ira_allocno_object_iter_init (&(ITER)); \
1190 ira_allocno_object_iter_cond (&(ITER), (A), &(O));)
1213 for (n = i->
n; n < ira_prefs_num; n++)
1214 if (ira_prefs[n] !=
NULL)
1216 *pref = ira_prefs[n];
1226 #define FOR_EACH_PREF(P, ITER) \
1227 for (ira_pref_iter_init (&(ITER)); \
1228 ira_pref_iter_cond (&(ITER), &(P));)
1251 for (n = i->
n; n < ira_copies_num; n++)
1252 if (ira_copies[n] !=
NULL)
1254 *cp = ira_copies[n];
1264 #define FOR_EACH_COPY(C, ITER) \
1265 for (ira_copy_iter_init (&(ITER)); \
1266 ira_copy_iter_cond (&(ITER), &(C));)
1272 bool conflict_vec_p;
1279 unsigned int word_num;
1287 unsigned int bit_num;
1291 int base_conflict_id;
1340 unsigned int bit_num = i->
bit_num;
1355 for (; (word & 1) == 0; word >>= 1)
1360 i->
word = word >> 1;
1370 #define FOR_EACH_OBJECT_CONFLICT(OBJ, CONF, ITER) \
1371 for (ira_object_conflict_iter_init (&(ITER), (OBJ)); \
1372 ira_object_conflict_iter_cond (&(ITER), &(CONF));)
1398 for (size = i = 0; i < FIRST_PSEUDO_REGISTER; i++)
1438 for (i = 0; i < len; i++)
1453 memcpy (*vec, src,
sizeof (
int) * len);
1469 memset (*vec, 0,
sizeof (
int) * len);
1471 for (i = 0; i < len; i++)
1472 (*vec)[i] += src[i];
1490 memcpy (reg_costs, src,
sizeof (
int) * len);
1493 for (i = 0; i < len; i++)