1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513 |
- #ifndef GCC_IRA_INT_H
- #define GCC_IRA_INT_H
- #include "cfgloop.h"
- #include "ira.h"
- #include "alloc-pool.h"
- #ifdef ENABLE_CHECKING
- #define ENABLE_IRA_CHECKING
- #endif
- #ifdef ENABLE_IRA_CHECKING
- #define ira_assert(c) gcc_assert (c)
- #else
- #define ira_assert(c) ((void)(0 && (c)))
- #endif
- #define REG_FREQ_FROM_EDGE_FREQ(freq) \
- (optimize_function_for_size_p (cfun) \
- ? REG_FREQ_MAX : (freq * REG_FREQ_MAX / BB_FREQ_MAX) \
- ? (freq * REG_FREQ_MAX / BB_FREQ_MAX) : 1)
- extern int internal_flag_ira_verbose;
- extern FILE *ira_dump_file;
- typedef struct live_range *live_range_t;
- typedef struct ira_allocno *ira_allocno_t;
- typedef struct ira_allocno_pref *ira_pref_t;
- typedef struct ira_allocno_copy *ira_copy_t;
- typedef struct ira_object *ira_object_t;
- typedef struct ira_loop_tree_node *ira_loop_tree_node_t;
- typedef unsigned short move_table[N_REG_CLASSES];
- struct ira_loop_tree_node
- {
-
- basic_block bb;
-
- struct loop *loop;
-
- ira_loop_tree_node_t subloop_next, next;
-
- ira_loop_tree_node_t subloops, children;
-
- ira_loop_tree_node_t parent;
-
- int level;
-
-
- int loop_num;
-
- bool to_remove_p;
-
- ira_allocno_t *regno_allocno_map;
-
- bool entered_from_non_parent_p;
-
- int reg_pressure[N_REG_CLASSES];
-
- bitmap all_allocnos;
-
- bitmap border_allocnos;
-
- bitmap modified_regnos;
-
- bitmap local_copies;
- };
- extern ira_loop_tree_node_t ira_loop_tree_root;
- extern int ira_loop_tree_height;
- extern ira_loop_tree_node_t ira_bb_nodes;
- #if defined ENABLE_IRA_CHECKING && (GCC_VERSION >= 2007)
- #define IRA_BB_NODE_BY_INDEX(index) __extension__ \
- (({ ira_loop_tree_node_t _node = (&ira_bb_nodes[index]); \
- if (_node->children != NULL || _node->loop != NULL || _node->bb == NULL)\
- { \
- fprintf (stderr, \
- "\n%s: %d: error in %s: it is not a block node\n", \
- __FILE__, __LINE__, __FUNCTION__); \
- gcc_unreachable (); \
- } \
- _node; }))
- #else
- #define IRA_BB_NODE_BY_INDEX(index) (&ira_bb_nodes[index])
- #endif
- #define IRA_BB_NODE(bb) IRA_BB_NODE_BY_INDEX ((bb)->index)
- extern ira_loop_tree_node_t ira_loop_nodes;
- #if defined ENABLE_IRA_CHECKING && (GCC_VERSION >= 2007)
- #define IRA_LOOP_NODE_BY_INDEX(index) __extension__ \
- (({ ira_loop_tree_node_t const _node = (&ira_loop_nodes[index]); \
- if (_node->children == NULL || _node->bb != NULL \
- || (_node->loop == NULL && current_loops != NULL)) \
- { \
- fprintf (stderr, \
- "\n%s: %d: error in %s: it is not a loop node\n", \
- __FILE__, __LINE__, __FUNCTION__); \
- gcc_unreachable (); \
- } \
- _node; }))
- #else
- #define IRA_LOOP_NODE_BY_INDEX(index) (&ira_loop_nodes[index])
- #endif
- #define IRA_LOOP_NODE(loop) IRA_LOOP_NODE_BY_INDEX ((loop)->num)
- struct live_range
- {
-
- ira_object_t object;
-
- int start, finish;
-
- live_range_t next;
-
- live_range_t start_next, finish_next;
- };
- extern int ira_max_point;
- extern live_range_t *ira_start_point_ranges, *ira_finish_point_ranges;
- struct ira_object
- {
-
- ira_allocno_t allocno;
-
- void *conflicts_array;
-
- live_range_t live_ranges;
-
- int subword;
-
- unsigned int conflicts_array_size;
-
- int id;
-
- int min, max;
-
- HARD_REG_SET conflict_hard_regs, total_conflict_hard_regs;
-
- int num_accumulated_conflicts;
-
- unsigned int conflict_vec_p : 1;
- };
- struct ira_allocno
- {
-
- int num;
-
- int regno;
-
- ENUM_BITFIELD (machine_mode) mode : 8;
-
- ENUM_BITFIELD (machine_mode) wmode : 8;
-
- ENUM_BITFIELD (reg_class) aclass : 16;
-
- unsigned int dont_reassign_p : 1;
- #ifdef STACK_REGS
-
- unsigned int no_stack_reg_p : 1, total_no_stack_reg_p : 1;
- #endif
-
- unsigned int bad_spill_p : 1;
-
- unsigned int assigned_p : 1;
-
- unsigned int conflict_vec_p : 1;
-
- signed int hard_regno : 16;
-
- ira_allocno_t next_regno_allocno;
-
- ira_loop_tree_node_t loop_tree_node;
-
- int nrefs;
-
- int freq;
-
- int class_cost, updated_class_cost;
-
- int memory_cost, updated_memory_cost;
-
- int excess_pressure_points_num;
-
- ira_pref_t allocno_prefs;
-
- ira_copy_t allocno_copies;
-
- ira_allocno_t cap;
-
- ira_allocno_t cap_member;
-
- int num_objects;
-
- ira_object_t objects[2];
-
- int call_freq;
-
- int calls_crossed_num;
-
- int cheap_calls_crossed_num;
-
- HARD_REG_SET crossed_calls_clobbered_regs;
-
- int *hard_reg_costs, *updated_hard_reg_costs;
-
- int *conflict_hard_reg_costs, *updated_conflict_hard_reg_costs;
-
- void *add_data;
- };
- #define ALLOCNO_NUM(A) ((A)->num)
- #define ALLOCNO_REGNO(A) ((A)->regno)
- #define ALLOCNO_REG(A) ((A)->reg)
- #define ALLOCNO_NEXT_REGNO_ALLOCNO(A) ((A)->next_regno_allocno)
- #define ALLOCNO_LOOP_TREE_NODE(A) ((A)->loop_tree_node)
- #define ALLOCNO_CAP(A) ((A)->cap)
- #define ALLOCNO_CAP_MEMBER(A) ((A)->cap_member)
- #define ALLOCNO_NREFS(A) ((A)->nrefs)
- #define ALLOCNO_FREQ(A) ((A)->freq)
- #define ALLOCNO_HARD_REGNO(A) ((A)->hard_regno)
- #define ALLOCNO_CALL_FREQ(A) ((A)->call_freq)
- #define ALLOCNO_CALLS_CROSSED_NUM(A) ((A)->calls_crossed_num)
- #define ALLOCNO_CHEAP_CALLS_CROSSED_NUM(A) ((A)->cheap_calls_crossed_num)
- #define ALLOCNO_CROSSED_CALLS_CLOBBERED_REGS(A) \
- ((A)->crossed_calls_clobbered_regs)
- #define ALLOCNO_MEM_OPTIMIZED_DEST(A) ((A)->mem_optimized_dest)
- #define ALLOCNO_MEM_OPTIMIZED_DEST_P(A) ((A)->mem_optimized_dest_p)
- #define ALLOCNO_SOMEWHERE_RENAMED_P(A) ((A)->somewhere_renamed_p)
- #define ALLOCNO_CHILD_RENAMED_P(A) ((A)->child_renamed_p)
- #define ALLOCNO_DONT_REASSIGN_P(A) ((A)->dont_reassign_p)
- #ifdef STACK_REGS
- #define ALLOCNO_NO_STACK_REG_P(A) ((A)->no_stack_reg_p)
- #define ALLOCNO_TOTAL_NO_STACK_REG_P(A) ((A)->total_no_stack_reg_p)
- #endif
- #define ALLOCNO_BAD_SPILL_P(A) ((A)->bad_spill_p)
- #define ALLOCNO_ASSIGNED_P(A) ((A)->assigned_p)
- #define ALLOCNO_MODE(A) ((A)->mode)
- #define ALLOCNO_WMODE(A) ((A)->wmode)
- #define ALLOCNO_PREFS(A) ((A)->allocno_prefs)
- #define ALLOCNO_COPIES(A) ((A)->allocno_copies)
- #define ALLOCNO_HARD_REG_COSTS(A) ((A)->hard_reg_costs)
- #define ALLOCNO_UPDATED_HARD_REG_COSTS(A) ((A)->updated_hard_reg_costs)
- #define ALLOCNO_CONFLICT_HARD_REG_COSTS(A) \
- ((A)->conflict_hard_reg_costs)
- #define ALLOCNO_UPDATED_CONFLICT_HARD_REG_COSTS(A) \
- ((A)->updated_conflict_hard_reg_costs)
- #define ALLOCNO_CLASS(A) ((A)->aclass)
- #define ALLOCNO_CLASS_COST(A) ((A)->class_cost)
- #define ALLOCNO_UPDATED_CLASS_COST(A) ((A)->updated_class_cost)
- #define ALLOCNO_MEMORY_COST(A) ((A)->memory_cost)
- #define ALLOCNO_UPDATED_MEMORY_COST(A) ((A)->updated_memory_cost)
- #define ALLOCNO_EXCESS_PRESSURE_POINTS_NUM(A) \
- ((A)->excess_pressure_points_num)
- #define ALLOCNO_OBJECT(A,N) ((A)->objects[N])
- #define ALLOCNO_NUM_OBJECTS(A) ((A)->num_objects)
- #define ALLOCNO_ADD_DATA(A) ((A)->add_data)
- typedef struct ira_emit_data *ira_emit_data_t;
- struct ira_emit_data
- {
-
- unsigned int mem_optimized_dest_p : 1;
-
- unsigned int somewhere_renamed_p : 1;
-
- unsigned int child_renamed_p : 1;
-
- rtx reg;
-
- ira_allocno_t mem_optimized_dest;
- };
- #define ALLOCNO_EMIT_DATA(a) ((ira_emit_data_t) ALLOCNO_ADD_DATA (a))
- extern ira_emit_data_t ira_allocno_emit_data;
- static inline rtx
- allocno_emit_reg (ira_allocno_t a)
- {
- return ALLOCNO_EMIT_DATA (a)->reg;
- }
- #define OBJECT_ALLOCNO(O) ((O)->allocno)
- #define OBJECT_SUBWORD(O) ((O)->subword)
- #define OBJECT_CONFLICT_ARRAY(O) ((O)->conflicts_array)
- #define OBJECT_CONFLICT_VEC(O) ((ira_object_t *)(O)->conflicts_array)
- #define OBJECT_CONFLICT_BITVEC(O) ((IRA_INT_TYPE *)(O)->conflicts_array)
- #define OBJECT_CONFLICT_ARRAY_SIZE(O) ((O)->conflicts_array_size)
- #define OBJECT_CONFLICT_VEC_P(O) ((O)->conflict_vec_p)
- #define OBJECT_NUM_CONFLICTS(O) ((O)->num_accumulated_conflicts)
- #define OBJECT_CONFLICT_HARD_REGS(O) ((O)->conflict_hard_regs)
- #define OBJECT_TOTAL_CONFLICT_HARD_REGS(O) ((O)->total_conflict_hard_regs)
- #define OBJECT_MIN(O) ((O)->min)
- #define OBJECT_MAX(O) ((O)->max)
- #define OBJECT_CONFLICT_ID(O) ((O)->id)
- #define OBJECT_LIVE_RANGES(O) ((O)->live_ranges)
- extern ira_allocno_t *ira_regno_allocno_map;
- extern ira_allocno_t *ira_allocnos;
- extern int ira_allocnos_num;
- extern ira_object_t *ira_object_id_map;
- extern int ira_objects_num;
- struct ira_allocno_pref
- {
-
- int num;
-
- int hard_regno;
-
- int freq;
-
- ira_allocno_t allocno;
-
- ira_pref_t next_pref;
- };
- extern ira_pref_t *ira_prefs;
- extern int ira_prefs_num;
- struct ira_allocno_copy
- {
-
- int num;
-
- ira_allocno_t first, second;
-
- int freq;
- bool constraint_p;
-
- rtx_insn *insn;
-
- ira_copy_t prev_first_allocno_copy, next_first_allocno_copy;
-
- ira_copy_t prev_second_allocno_copy, next_second_allocno_copy;
-
- ira_loop_tree_node_t loop_tree_node;
- };
- extern ira_copy_t *ira_copies;
- extern int ira_copies_num;
- struct ira_spilled_reg_stack_slot
- {
-
- bitmap_head spilled_regs;
-
- rtx mem;
-
- unsigned int width;
- };
- extern int ira_spilled_reg_stack_slots_num;
- extern struct ira_spilled_reg_stack_slot *ira_spilled_reg_stack_slots;
- extern int64_t ira_overall_cost;
- extern int64_t ira_reg_cost, ira_mem_cost;
- extern int64_t ira_load_cost, ira_store_cost, ira_shuffle_cost;
- extern int ira_move_loops_num, ira_additional_jumps_num;
- #define IRA_INT_BITS HOST_BITS_PER_WIDE_INT
- #define IRA_INT_TYPE HOST_WIDE_INT
- #if defined ENABLE_IRA_CHECKING && (GCC_VERSION >= 2007)
- #define SET_MINMAX_SET_BIT(R, I, MIN, MAX) __extension__ \
- (({ int _min = (MIN), _max = (MAX), _i = (I); \
- if (_i < _min || _i > _max) \
- { \
- fprintf (stderr, \
- "\n%s: %d: error in %s: %d not in range [%d,%d]\n", \
- __FILE__, __LINE__, __FUNCTION__, _i, _min, _max); \
- gcc_unreachable (); \
- } \
- ((R)[(unsigned) (_i - _min) / IRA_INT_BITS] \
- |= ((IRA_INT_TYPE) 1 << ((unsigned) (_i - _min) % IRA_INT_BITS))); }))
- #define CLEAR_MINMAX_SET_BIT(R, I, MIN, MAX) __extension__ \
- (({ int _min = (MIN), _max = (MAX), _i = (I); \
- if (_i < _min || _i > _max) \
- { \
- fprintf (stderr, \
- "\n%s: %d: error in %s: %d not in range [%d,%d]\n", \
- __FILE__, __LINE__, __FUNCTION__, _i, _min, _max); \
- gcc_unreachable (); \
- } \
- ((R)[(unsigned) (_i - _min) / IRA_INT_BITS] \
- &= ~((IRA_INT_TYPE) 1 << ((unsigned) (_i - _min) % IRA_INT_BITS))); }))
- #define TEST_MINMAX_SET_BIT(R, I, MIN, MAX) __extension__ \
- (({ int _min = (MIN), _max = (MAX), _i = (I); \
- if (_i < _min || _i > _max) \
- { \
- fprintf (stderr, \
- "\n%s: %d: error in %s: %d not in range [%d,%d]\n", \
- __FILE__, __LINE__, __FUNCTION__, _i, _min, _max); \
- gcc_unreachable (); \
- } \
- ((R)[(unsigned) (_i - _min) / IRA_INT_BITS] \
- & ((IRA_INT_TYPE) 1 << ((unsigned) (_i - _min) % IRA_INT_BITS))); }))
- #else
- #define SET_MINMAX_SET_BIT(R, I, MIN, MAX) \
- ((R)[(unsigned) ((I) - (MIN)) / IRA_INT_BITS] \
- |= ((IRA_INT_TYPE) 1 << ((unsigned) ((I) - (MIN)) % IRA_INT_BITS)))
- #define CLEAR_MINMAX_SET_BIT(R, I, MIN, MAX) \
- ((R)[(unsigned) ((I) - (MIN)) / IRA_INT_BITS] \
- &= ~((IRA_INT_TYPE) 1 << ((unsigned) ((I) - (MIN)) % IRA_INT_BITS)))
- #define TEST_MINMAX_SET_BIT(R, I, MIN, MAX) \
- ((R)[(unsigned) ((I) - (MIN)) / IRA_INT_BITS] \
- & ((IRA_INT_TYPE) 1 << ((unsigned) ((I) - (MIN)) % IRA_INT_BITS)))
- #endif
- struct minmax_set_iterator {
-
- IRA_INT_TYPE *vec;
-
- unsigned int word_num;
-
- unsigned int nel;
-
- unsigned int bit_num;
-
- int start_val;
-
- unsigned IRA_INT_TYPE word;
- };
- static inline void
- minmax_set_iter_init (minmax_set_iterator *i, IRA_INT_TYPE *vec, int min,
- int max)
- {
- i->vec = vec;
- i->word_num = 0;
- i->nel = max < min ? 0 : max - min + 1;
- i->start_val = min;
- i->bit_num = 0;
- i->word = i->nel == 0 ? 0 : vec[0];
- }
- static inline bool
- minmax_set_iter_cond (minmax_set_iterator *i, int *n)
- {
-
- for (; i->word == 0; i->word = i->vec[i->word_num])
- {
- i->word_num++;
- i->bit_num = i->word_num * IRA_INT_BITS;
-
- if (i->bit_num >= i->nel)
- return false;
- }
-
- for (; (i->word & 1) == 0; i->word >>= 1)
- i->bit_num++;
- *n = (int) i->bit_num + i->start_val;
- return true;
- }
- static inline void
- minmax_set_iter_next (minmax_set_iterator *i)
- {
- i->word >>= 1;
- i->bit_num++;
- }
- #define FOR_EACH_BIT_IN_MINMAX_SET(VEC, MIN, MAX, N, ITER) \
- for (minmax_set_iter_init (&(ITER), (VEC), (MIN), (MAX)); \
- minmax_set_iter_cond (&(ITER), &(N)); \
- minmax_set_iter_next (&(ITER)))
- struct target_ira_int {
- ~target_ira_int ();
- void free_ira_costs ();
- void free_register_move_costs ();
-
- int x_max_struct_costs_size;
-
- struct costs *x_init_cost;
-
- struct costs *x_temp_costs;
-
- struct costs *x_op_costs[MAX_RECOG_OPERANDS];
- struct costs *x_this_op_costs[MAX_RECOG_OPERANDS];
-
- HARD_REG_SET x_no_unit_alloc_regs;
-
- HARD_REG_SET (x_ira_reg_mode_hard_regset
- [FIRST_PSEUDO_REGISTER][NUM_MACHINE_MODES]);
-
- move_table *x_ira_register_move_cost[MAX_MACHINE_MODE];
-
- move_table *x_ira_may_move_in_cost[MAX_MACHINE_MODE];
-
- move_table *x_ira_may_move_out_cost[MAX_MACHINE_MODE];
-
- int x_last_mode_for_init_move_cost;
-
- short int x_ira_max_memory_move_cost[MAX_MACHINE_MODE][N_REG_CLASSES][2];
-
- bool x_ira_reg_allocno_class_p[N_REG_CLASSES];
-
- bool x_ira_reg_pressure_class_p[N_REG_CLASSES];
-
- short x_ira_non_ordered_class_hard_regs[N_REG_CLASSES][FIRST_PSEUDO_REGISTER];
-
- short x_ira_class_hard_reg_index[N_REG_CLASSES][FIRST_PSEUDO_REGISTER];
-
- HARD_REG_SET x_ira_useful_class_mode_regs[N_REG_CLASSES][NUM_MACHINE_MODES];
-
- int x_ira_important_classes_num;
-
- enum reg_class x_ira_important_classes[N_REG_CLASSES];
-
- int x_ira_important_class_nums[N_REG_CLASSES];
-
- bool x_ira_uniform_class_p[N_REG_CLASSES];
-
- enum reg_class x_ira_reg_class_intersect[N_REG_CLASSES][N_REG_CLASSES];
-
- enum reg_class x_ira_reg_class_super_classes[N_REG_CLASSES][N_REG_CLASSES];
-
- enum reg_class x_ira_reg_class_subunion[N_REG_CLASSES][N_REG_CLASSES];
- enum reg_class x_ira_reg_class_superunion[N_REG_CLASSES][N_REG_CLASSES];
-
- enum reg_class x_alloc_reg_class_subclasses[N_REG_CLASSES][N_REG_CLASSES];
-
- HARD_REG_SET x_ira_prohibited_mode_move_regs[NUM_MACHINE_MODES];
-
- bool x_ira_prohibited_mode_move_regs_initialized_p;
- };
- extern struct target_ira_int default_target_ira_int;
- #if SWITCHABLE_TARGET
- extern struct target_ira_int *this_target_ira_int;
- #else
- #define this_target_ira_int (&default_target_ira_int)
- #endif
- #define ira_reg_mode_hard_regset \
- (this_target_ira_int->x_ira_reg_mode_hard_regset)
- #define ira_register_move_cost \
- (this_target_ira_int->x_ira_register_move_cost)
- #define ira_max_memory_move_cost \
- (this_target_ira_int->x_ira_max_memory_move_cost)
- #define ira_may_move_in_cost \
- (this_target_ira_int->x_ira_may_move_in_cost)
- #define ira_may_move_out_cost \
- (this_target_ira_int->x_ira_may_move_out_cost)
- #define ira_reg_allocno_class_p \
- (this_target_ira_int->x_ira_reg_allocno_class_p)
- #define ira_reg_pressure_class_p \
- (this_target_ira_int->x_ira_reg_pressure_class_p)
- #define ira_non_ordered_class_hard_regs \
- (this_target_ira_int->x_ira_non_ordered_class_hard_regs)
- #define ira_class_hard_reg_index \
- (this_target_ira_int->x_ira_class_hard_reg_index)
- #define ira_useful_class_mode_regs \
- (this_target_ira_int->x_ira_useful_class_mode_regs)
- #define ira_important_classes_num \
- (this_target_ira_int->x_ira_important_classes_num)
- #define ira_important_classes \
- (this_target_ira_int->x_ira_important_classes)
- #define ira_important_class_nums \
- (this_target_ira_int->x_ira_important_class_nums)
- #define ira_uniform_class_p \
- (this_target_ira_int->x_ira_uniform_class_p)
- #define ira_reg_class_intersect \
- (this_target_ira_int->x_ira_reg_class_intersect)
- #define ira_reg_class_super_classes \
- (this_target_ira_int->x_ira_reg_class_super_classes)
- #define ira_reg_class_subunion \
- (this_target_ira_int->x_ira_reg_class_subunion)
- #define ira_reg_class_superunion \
- (this_target_ira_int->x_ira_reg_class_superunion)
- #define ira_prohibited_mode_move_regs \
- (this_target_ira_int->x_ira_prohibited_mode_move_regs)
- extern void *ira_allocate (size_t);
- extern void ira_free (void *addr);
- extern bitmap ira_allocate_bitmap (void);
- extern void ira_free_bitmap (bitmap);
- extern void ira_print_disposition (FILE *);
- extern void ira_debug_disposition (void);
- extern void ira_debug_allocno_classes (void);
- extern void ira_init_register_move_cost (machine_mode);
- extern void ira_setup_alts (rtx_insn *insn, HARD_REG_SET &alts);
- extern int ira_get_dup_out_num (int op_num, HARD_REG_SET &alts);
- extern ira_loop_tree_node_t ira_curr_loop_tree_node;
- extern ira_allocno_t *ira_curr_regno_allocno_map;
- extern void ira_debug_pref (ira_pref_t);
- extern void ira_debug_prefs (void);
- extern void ira_debug_allocno_prefs (ira_allocno_t);
- extern void ira_debug_copy (ira_copy_t);
- extern void debug (ira_allocno_copy &ref);
- extern void debug (ira_allocno_copy *ptr);
- extern void ira_debug_copies (void);
- extern void ira_debug_allocno_copies (ira_allocno_t);
- extern void debug (ira_allocno &ref);
- extern void debug (ira_allocno *ptr);
- extern void ira_traverse_loop_tree (bool, ira_loop_tree_node_t,
- void (*) (ira_loop_tree_node_t),
- void (*) (ira_loop_tree_node_t));
- extern ira_allocno_t ira_parent_allocno (ira_allocno_t);
- extern ira_allocno_t ira_parent_or_cap_allocno (ira_allocno_t);
- extern ira_allocno_t ira_create_allocno (int, bool, ira_loop_tree_node_t);
- extern void ira_create_allocno_objects (ira_allocno_t);
- extern void ira_set_allocno_class (ira_allocno_t, enum reg_class);
- extern bool ira_conflict_vector_profitable_p (ira_object_t, int);
- extern void ira_allocate_conflict_vec (ira_object_t, int);
- extern void ira_allocate_object_conflicts (ira_object_t, int);
- extern void ior_hard_reg_conflicts (ira_allocno_t, HARD_REG_SET *);
- extern void ira_print_expanded_allocno (ira_allocno_t);
- extern void ira_add_live_range_to_object (ira_object_t, int, int);
- extern live_range_t ira_create_live_range (ira_object_t, int, int,
- live_range_t);
- extern live_range_t ira_copy_live_range_list (live_range_t);
- extern live_range_t ira_merge_live_ranges (live_range_t, live_range_t);
- extern bool ira_live_ranges_intersect_p (live_range_t, live_range_t);
- extern void ira_finish_live_range (live_range_t);
- extern void ira_finish_live_range_list (live_range_t);
- extern void ira_free_allocno_updated_costs (ira_allocno_t);
- extern ira_pref_t ira_create_pref (ira_allocno_t, int, int);
- extern void ira_add_allocno_pref (ira_allocno_t, int, int);
- extern void ira_remove_pref (ira_pref_t);
- extern void ira_remove_allocno_prefs (ira_allocno_t);
- extern ira_copy_t ira_create_copy (ira_allocno_t, ira_allocno_t,
- int, bool, rtx_insn *,
- ira_loop_tree_node_t);
- extern ira_copy_t ira_add_allocno_copy (ira_allocno_t, ira_allocno_t, int,
- bool, rtx_insn *,
- ira_loop_tree_node_t);
- extern int *ira_allocate_cost_vector (reg_class_t);
- extern void ira_free_cost_vector (int *, reg_class_t);
- extern void ira_flattening (int, int);
- extern bool ira_build (void);
- extern void ira_destroy (void);
- extern void ira_init_costs_once (void);
- extern void ira_init_costs (void);
- extern void ira_costs (void);
- extern void ira_tune_allocno_costs (void);
- extern void ira_rebuild_start_finish_chains (void);
- extern void ira_print_live_range_list (FILE *, live_range_t);
- extern void debug (live_range &ref);
- extern void debug (live_range *ptr);
- extern void ira_debug_live_range_list (live_range_t);
- extern void ira_debug_allocno_live_ranges (ira_allocno_t);
- extern void ira_debug_live_ranges (void);
- extern void ira_create_allocno_live_ranges (void);
- extern void ira_compress_allocno_live_ranges (void);
- extern void ira_finish_allocno_live_ranges (void);
- extern void ira_implicitly_set_insn_hard_regs (HARD_REG_SET *,
- alternative_mask);
- extern void ira_debug_conflicts (bool);
- extern void ira_build_conflicts (void);
- extern void ira_debug_hard_regs_forest (void);
- extern int ira_loop_edge_freq (ira_loop_tree_node_t, int, bool);
- extern void ira_reassign_conflict_allocnos (int);
- extern void ira_initiate_assign (void);
- extern void ira_finish_assign (void);
- extern void ira_color (void);
- extern void ira_initiate_emit_data (void);
- extern void ira_finish_emit_data (void);
- extern void ira_emit (bool);
- static inline bool
- ira_equiv_no_lvalue_p (int regno)
- {
- if (regno >= ira_reg_equiv_len)
- return false;
- return (ira_reg_equiv[regno].constant != NULL_RTX
- || ira_reg_equiv[regno].invariant != NULL_RTX
- || (ira_reg_equiv[regno].memory != NULL_RTX
- && MEM_READONLY_P (ira_reg_equiv[regno].memory)));
- }
- static inline void
- ira_init_register_move_cost_if_necessary (machine_mode mode)
- {
- if (ira_register_move_cost[mode] == NULL)
- ira_init_register_move_cost (mode);
- }
- struct ira_allocno_iterator {
-
- int n;
- };
- static inline void
- ira_allocno_iter_init (ira_allocno_iterator *i)
- {
- i->n = 0;
- }
- static inline bool
- ira_allocno_iter_cond (ira_allocno_iterator *i, ira_allocno_t *a)
- {
- int n;
- for (n = i->n; n < ira_allocnos_num; n++)
- if (ira_allocnos[n] != NULL)
- {
- *a = ira_allocnos[n];
- i->n = n + 1;
- return true;
- }
- return false;
- }
- #define FOR_EACH_ALLOCNO(A, ITER) \
- for (ira_allocno_iter_init (&(ITER)); \
- ira_allocno_iter_cond (&(ITER), &(A));)
- struct ira_object_iterator {
-
- int n;
- };
- static inline void
- ira_object_iter_init (ira_object_iterator *i)
- {
- i->n = 0;
- }
- static inline bool
- ira_object_iter_cond (ira_object_iterator *i, ira_object_t *obj)
- {
- int n;
- for (n = i->n; n < ira_objects_num; n++)
- if (ira_object_id_map[n] != NULL)
- {
- *obj = ira_object_id_map[n];
- i->n = n + 1;
- return true;
- }
- return false;
- }
- #define FOR_EACH_OBJECT(OBJ, ITER) \
- for (ira_object_iter_init (&(ITER)); \
- ira_object_iter_cond (&(ITER), &(OBJ));)
- struct ira_allocno_object_iterator {
-
- int n;
- };
- static inline void
- ira_allocno_object_iter_init (ira_allocno_object_iterator *i)
- {
- i->n = 0;
- }
- static inline bool
- ira_allocno_object_iter_cond (ira_allocno_object_iterator *i, ira_allocno_t a,
- ira_object_t *o)
- {
- int n = i->n++;
- if (n < ALLOCNO_NUM_OBJECTS (a))
- {
- *o = ALLOCNO_OBJECT (a, n);
- return true;
- }
- return false;
- }
- #define FOR_EACH_ALLOCNO_OBJECT(A, O, ITER) \
- for (ira_allocno_object_iter_init (&(ITER)); \
- ira_allocno_object_iter_cond (&(ITER), (A), &(O));)
- struct ira_pref_iterator {
-
- int n;
- };
- static inline void
- ira_pref_iter_init (ira_pref_iterator *i)
- {
- i->n = 0;
- }
- static inline bool
- ira_pref_iter_cond (ira_pref_iterator *i, ira_pref_t *pref)
- {
- int n;
- for (n = i->n; n < ira_prefs_num; n++)
- if (ira_prefs[n] != NULL)
- {
- *pref = ira_prefs[n];
- i->n = n + 1;
- return true;
- }
- return false;
- }
- #define FOR_EACH_PREF(P, ITER) \
- for (ira_pref_iter_init (&(ITER)); \
- ira_pref_iter_cond (&(ITER), &(P));)
- struct ira_copy_iterator {
-
- int n;
- };
- static inline void
- ira_copy_iter_init (ira_copy_iterator *i)
- {
- i->n = 0;
- }
- static inline bool
- ira_copy_iter_cond (ira_copy_iterator *i, ira_copy_t *cp)
- {
- int n;
- for (n = i->n; n < ira_copies_num; n++)
- if (ira_copies[n] != NULL)
- {
- *cp = ira_copies[n];
- i->n = n + 1;
- return true;
- }
- return false;
- }
- #define FOR_EACH_COPY(C, ITER) \
- for (ira_copy_iter_init (&(ITER)); \
- ira_copy_iter_cond (&(ITER), &(C));)
- struct ira_object_conflict_iterator {
-
- bool conflict_vec_p;
-
- void *vec;
-
- unsigned int word_num;
-
- unsigned int size;
-
- unsigned int bit_num;
-
- int base_conflict_id;
-
- unsigned IRA_INT_TYPE word;
- };
- static inline void
- ira_object_conflict_iter_init (ira_object_conflict_iterator *i,
- ira_object_t obj)
- {
- i->conflict_vec_p = OBJECT_CONFLICT_VEC_P (obj);
- i->vec = OBJECT_CONFLICT_ARRAY (obj);
- i->word_num = 0;
- if (i->conflict_vec_p)
- i->size = i->bit_num = i->base_conflict_id = i->word = 0;
- else
- {
- if (OBJECT_MIN (obj) > OBJECT_MAX (obj))
- i->size = 0;
- else
- i->size = ((OBJECT_MAX (obj) - OBJECT_MIN (obj)
- + IRA_INT_BITS)
- / IRA_INT_BITS) * sizeof (IRA_INT_TYPE);
- i->bit_num = 0;
- i->base_conflict_id = OBJECT_MIN (obj);
- i->word = (i->size == 0 ? 0 : ((IRA_INT_TYPE *) i->vec)[0]);
- }
- }
- static inline bool
- ira_object_conflict_iter_cond (ira_object_conflict_iterator *i,
- ira_object_t *pobj)
- {
- ira_object_t obj;
- if (i->conflict_vec_p)
- {
- obj = ((ira_object_t *) i->vec)[i->word_num++];
- if (obj == NULL)
- return false;
- }
- else
- {
- unsigned IRA_INT_TYPE word = i->word;
- unsigned int bit_num = i->bit_num;
-
- for (; word == 0; word = ((IRA_INT_TYPE *) i->vec)[i->word_num])
- {
- i->word_num++;
-
- if (i->word_num * sizeof (IRA_INT_TYPE) >= i->size)
- return false;
- bit_num = i->word_num * IRA_INT_BITS;
- }
-
- for (; (word & 1) == 0; word >>= 1)
- bit_num++;
- obj = ira_object_id_map[bit_num + i->base_conflict_id];
- i->bit_num = bit_num + 1;
- i->word = word >> 1;
- }
- *pobj = obj;
- return true;
- }
- #define FOR_EACH_OBJECT_CONFLICT(OBJ, CONF, ITER) \
- for (ira_object_conflict_iter_init (&(ITER), (OBJ)); \
- ira_object_conflict_iter_cond (&(ITER), &(CONF));)
- static inline bool
- ira_hard_reg_set_intersection_p (int hard_regno, machine_mode mode,
- HARD_REG_SET hard_regset)
- {
- int i;
- gcc_assert (hard_regno >= 0);
- for (i = hard_regno_nregs[hard_regno][mode] - 1; i >= 0; i--)
- if (TEST_HARD_REG_BIT (hard_regset, hard_regno + i))
- return true;
- return false;
- }
- static inline int
- hard_reg_set_size (HARD_REG_SET set)
- {
- int i, size;
- for (size = i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (TEST_HARD_REG_BIT (set, i))
- size++;
- return size;
- }
- static inline bool
- ira_hard_reg_in_set_p (int hard_regno, machine_mode mode,
- HARD_REG_SET hard_regset)
- {
- int i;
- ira_assert (hard_regno >= 0);
- for (i = hard_regno_nregs[hard_regno][mode] - 1; i >= 0; i--)
- if (!TEST_HARD_REG_BIT (hard_regset, hard_regno + i))
- return false;
- return true;
- }
- static inline void
- ira_allocate_and_set_costs (int **vec, reg_class_t aclass, int val)
- {
- int i, *reg_costs;
- int len;
- if (*vec != NULL)
- return;
- *vec = reg_costs = ira_allocate_cost_vector (aclass);
- len = ira_class_hard_regs_num[(int) aclass];
- for (i = 0; i < len; i++)
- reg_costs[i] = val;
- }
- static inline void
- ira_allocate_and_copy_costs (int **vec, enum reg_class aclass, int *src)
- {
- int len;
- if (*vec != NULL || src == NULL)
- return;
- *vec = ira_allocate_cost_vector (aclass);
- len = ira_class_hard_regs_num[aclass];
- memcpy (*vec, src, sizeof (int) * len);
- }
- static inline void
- ira_allocate_and_accumulate_costs (int **vec, enum reg_class aclass, int *src)
- {
- int i, len;
- if (src == NULL)
- return;
- len = ira_class_hard_regs_num[aclass];
- if (*vec == NULL)
- {
- *vec = ira_allocate_cost_vector (aclass);
- memset (*vec, 0, sizeof (int) * len);
- }
- for (i = 0; i < len; i++)
- (*vec)[i] += src[i];
- }
- static inline void
- ira_allocate_and_set_or_copy_costs (int **vec, enum reg_class aclass,
- int val, int *src)
- {
- int i, *reg_costs;
- int len;
- if (*vec != NULL)
- return;
- *vec = reg_costs = ira_allocate_cost_vector (aclass);
- len = ira_class_hard_regs_num[aclass];
- if (src != NULL)
- memcpy (reg_costs, src, sizeof (int) * len);
- else
- {
- for (i = 0; i < len; i++)
- reg_costs[i] = val;
- }
- }
- extern rtx ira_create_new_reg (rtx);
- extern int first_moveable_pseudo, last_moveable_pseudo;
- #endif
|