GCC Middle and Back End API Reference
ira-build.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "target.h"
#include "rtl.h"
#include "predict.h"
#include "df.h"
#include "insn-config.h"
#include "regs.h"
#include "memmodel.h"
#include "ira.h"
#include "ira-int.h"
#include "sparseset.h"
#include "cfgloop.h"
Include dependency graph for ira-build.cc:

Macros

#define BB_TO_VISIT   BB_VISITED
 

Functions

static ira_copy_t find_allocno_copy (ira_allocno_t, ira_allocno_t, rtx_insn *, ira_loop_tree_node_t)
 
static void init_loop_tree_node (struct ira_loop_tree_node *node, int loop_num)
 
static void create_loop_tree_nodes (void)
 
static bool more_one_region_p (void)
 
static void finish_loop_tree_node (ira_loop_tree_node_t loop)
 
static void finish_loop_tree_nodes (void)
 
static void add_loop_to_tree (class loop *loop)
 
static int setup_loop_tree_level (ira_loop_tree_node_t loop_node, int level)
 
static void form_loop_tree (void)
 
static void rebuild_regno_allocno_maps (void)
 
static void initiate_allocnos (void)
 
static ira_object_t ira_create_object (ira_allocno_t a, int subword)
 
ira_allocno_t ira_create_allocno (int regno, bool cap_p, ira_loop_tree_node_t loop_tree_node)
 
void ira_set_allocno_class (ira_allocno_t a, enum reg_class aclass)
 
void ira_create_allocno_objects (ira_allocno_t a)
 
static void create_allocno_objects (void)
 
static void merge_hard_reg_conflicts (ira_allocno_t from, ira_allocno_t to, bool total_only)
 
void ior_hard_reg_conflicts (ira_allocno_t a, const_hard_reg_set set)
 
bool ira_conflict_vector_profitable_p (ira_object_t obj, int num)
 
void ira_allocate_conflict_vec (ira_object_t obj, int num)
 
static void allocate_conflict_bit_vec (ira_object_t obj)
 
void ira_allocate_object_conflicts (ira_object_t obj, int num)
 
static void add_to_conflicts (ira_object_t obj1, ira_object_t obj2)
 
static void ira_add_conflict (ira_object_t obj1, ira_object_t obj2)
 
static void clear_conflicts (ira_object_t obj)
 
static void compress_conflict_vec (ira_object_t obj)
 
static void compress_conflict_vecs (void)
 
void ira_print_expanded_allocno (ira_allocno_t a)
 
static ira_allocno_t create_cap_allocno (ira_allocno_t a)
 
live_range_t ira_create_live_range (ira_object_t obj, int start, int finish, live_range_t next)
 
void ira_add_live_range_to_object (ira_object_t object, int start, int finish)
 
static live_range_t copy_live_range (live_range_t r)
 
live_range_t ira_copy_live_range_list (live_range_t r)
 
live_range_t ira_merge_live_ranges (live_range_t r1, live_range_t r2)
 
bool ira_live_ranges_intersect_p (live_range_t r1, live_range_t r2)
 
void ira_finish_live_range (live_range_t r)
 
void ira_finish_live_range_list (live_range_t r)
 
void ira_free_allocno_updated_costs (ira_allocno_t a)
 
static void ira_free_allocno_costs (ira_allocno_t a)
 
static void finish_allocno (ira_allocno_t a)
 
static void finish_allocnos (void)
 
static void initiate_prefs (void)
 
static ira_pref_t find_allocno_pref (ira_allocno_t a, int hard_regno)
 
ira_pref_t ira_create_pref (ira_allocno_t a, int hard_regno, int freq)
 
static void add_allocno_pref_to_list (ira_pref_t pref)
 
void ira_add_allocno_pref (ira_allocno_t a, int hard_regno, int freq)
 
static void print_pref (FILE *f, ira_pref_t pref)
 
void ira_debug_pref (ira_pref_t pref)
 
static void print_prefs (FILE *f)
 
void ira_debug_prefs (void)
 
static void print_allocno_prefs (FILE *f, ira_allocno_t a)
 
void ira_debug_allocno_prefs (ira_allocno_t a)
 
static void finish_pref (ira_pref_t pref)
 
void ira_remove_pref (ira_pref_t pref)
 
void ira_remove_allocno_prefs (ira_allocno_t a)
 
static void finish_prefs (void)
 
static void initiate_copies (void)
 
ira_copy_t ira_create_copy (ira_allocno_t first, ira_allocno_t second, int freq, bool constraint_p, rtx_insn *insn, ira_loop_tree_node_t loop_tree_node)
 
static void add_allocno_copy_to_list (ira_copy_t cp)
 
static void swap_allocno_copy_ends_if_necessary (ira_copy_t cp)
 
ira_copy_t ira_add_allocno_copy (ira_allocno_t first, ira_allocno_t second, int freq, bool constraint_p, rtx_insn *insn, ira_loop_tree_node_t loop_tree_node)
 
static void print_copy (FILE *f, ira_copy_t cp)
 
DEBUG_FUNCTION void debug (ira_allocno_copy &ref)
 
DEBUG_FUNCTION void debug (ira_allocno_copy *ptr)
 
void ira_debug_copy (ira_copy_t cp)
 
static void print_copies (FILE *f)
 
void ira_debug_copies (void)
 
static void print_allocno_copies (FILE *f, ira_allocno_t a)
 
DEBUG_FUNCTION void debug (ira_allocno &ref)
 
DEBUG_FUNCTION void debug (ira_allocno *ptr)
 
void ira_debug_allocno_copies (ira_allocno_t a)
 
static void finish_copy (ira_copy_t cp)
 
static void finish_copies (void)
 
static void initiate_cost_vectors (void)
 
int * ira_allocate_cost_vector (reg_class_t aclass)
 
void ira_free_cost_vector (int *vec, reg_class_t aclass)
 
static void finish_cost_vectors (void)
 
static vec< ira_loop_tree_node_tira_loop_tree_body_rev_postorder (ira_loop_tree_node_t loop_node, const vec< ira_loop_tree_node_t > &loop_preorder)
 
void ira_traverse_loop_tree (bool bb_p, ira_loop_tree_node_t loop_node, void(*preorder_func)(ira_loop_tree_node_t), void(*postorder_func)(ira_loop_tree_node_t))
 
static void create_insn_allocnos (rtx x, rtx outer, bool output_p)
 
static void create_bb_allocnos (ira_loop_tree_node_t bb_node)
 
static void create_loop_allocnos (edge e)
 
static void create_loop_tree_node_allocnos (ira_loop_tree_node_t loop_node)
 
static void propagate_modified_regnos (ira_loop_tree_node_t loop_tree_node)
 
static void ira_propagate_hard_reg_costs (ira_allocno_t parent_a, ira_allocno_t a, int spill_cost)
 
static void propagate_allocno_info (void)
 
static void create_allocnos (void)
 
static void change_object_in_range_list (live_range_t r, ira_object_t obj)
 
static void move_allocno_live_ranges (ira_allocno_t from, ira_allocno_t to)
 
static void copy_allocno_live_ranges (ira_allocno_t from, ira_allocno_t to)
 
static bool low_pressure_loop_node_p (ira_loop_tree_node_t node)
 
static int loop_compare_func (const void *v1p, const void *v2p)
 
static void mark_loops_for_removal (void)
 
static void mark_all_loops_for_removal (void)
 
static void remove_uneccesary_loop_nodes_from_loop_tree (ira_loop_tree_node_t node)
 
static bool loop_is_inside_p (ira_loop_tree_node_t node, ira_loop_tree_node_t parent)
 
static int regno_allocno_order_compare_func (const void *v1p, const void *v2p)
 
static void ira_rebuild_regno_allocno_list (int regno)
 
static void propagate_some_info_from_allocno (ira_allocno_t a, ira_allocno_t from_a)
 
static void remove_unnecessary_allocnos (void)
 
static void remove_low_level_allocnos (void)
 
static void remove_unnecessary_regions (bool all_p)
 
static void update_bad_spill_attribute (void)
 
static void setup_min_max_allocno_live_range_point (void)
 
static int object_range_compare_func (const void *v1p, const void *v2p)
 
static void sort_conflict_id_map (void)
 
static void setup_min_max_conflict_allocno_ids (void)
 
static void create_caps (void)
 
ira_allocno_t ira_parent_allocno (ira_allocno_t a)
 
ira_allocno_t ira_parent_or_cap_allocno (ira_allocno_t a)
 
static bool copy_info_to_removed_store_destinations (int regno)
 
void ira_flattening (int max_regno_before_emit, int ira_max_point_before_emit)
 
static void update_conflict_hard_reg_costs (void)
 
bool ira_build (void)
 
void ira_destroy (void)
 

Variables

ira_loop_tree_node_t ira_loop_tree_root
 
int ira_loop_tree_height
 
ira_loop_tree_node_t ira_bb_nodes
 
ira_loop_tree_node_t ira_loop_nodes
 
unsigned int ira_loop_nodes_count
 
ira_allocno_tira_regno_allocno_map
 
ira_allocno_tira_allocnos
 
int ira_allocnos_num
 
int ira_objects_num
 
ira_object_tira_object_id_map
 
ira_pref_tira_prefs
 
int ira_prefs_num
 
ira_copy_tira_copies
 
int ira_copies_num
 
static int last_basic_block_before_change
 
static object_allocator< live_rangelive_range_pool ("live ranges")
 
static object_allocator< ira_allocnoallocno_pool ("allocnos")
 
static object_allocator< ira_objectobject_pool ("objects")
 
static vec< ira_allocno_tallocno_vec
 
static vec< ira_object_tira_object_id_map_vec
 
static int * conflict_check
 
static int curr_conflict_check_tick
 
static object_allocator< ira_allocno_prefpref_pool ("prefs")
 
static vec< ira_pref_tpref_vec
 
static object_allocator< ira_allocno_copycopy_pool ("copies")
 
static vec< ira_copy_tcopy_vec
 
static pool_allocatorcost_vector_pool [N_REG_CLASSES]
 
ira_loop_tree_node_t ira_curr_loop_tree_node
 
ira_allocno_tira_curr_regno_allocno_map
 
static basic_block curr_bb
 
static vec< ira_loop_tree_node_tremoved_loop_vec
 
static vec< ira_loop_tree_node_tchildren_vec
 
static ira_allocno_tregno_allocnos
 
static ira_allocno_tregno_top_level_allocno_map
 

Macro Definition Documentation

◆ BB_TO_VISIT

#define BB_TO_VISIT   BB_VISITED

Function Documentation

◆ add_allocno_copy_to_list()

◆ add_allocno_pref_to_list()

static void add_allocno_pref_to_list ( ira_pref_t pref)
static
Attach a pref PREF to the corresponding allocno.   

References a, ALLOCNO_PREFS, and pref.

Referenced by ira_add_allocno_pref().

◆ add_loop_to_tree()

static void add_loop_to_tree ( class loop * loop)
static
The following recursive function adds LOOP to the loop tree
hierarchy.  LOOP is added only once.  If LOOP is NULL we adding
loop designating the whole function when CFG loops are not
built.   

References add_loop_to_tree(), ira_loop_tree_node::bb, ira_loop_tree_node::children, ira_loop_nodes, ira_loop_tree_node::loop, ira_loop_tree_node::loop_num, loop_outer(), ira_loop_tree_node::next, NULL, loop::num, ira_loop_tree_node::parent, ira_loop_tree_node::regno_allocno_map, ira_loop_tree_node::subloop_next, and ira_loop_tree_node::subloops.

Referenced by add_loop_to_tree(), and form_loop_tree().

◆ add_to_conflicts()

◆ allocate_conflict_bit_vec()

static void allocate_conflict_bit_vec ( ira_object_t obj)
static

◆ change_object_in_range_list()

static void change_object_in_range_list ( live_range_t r,
ira_object_t obj )
static
The page contains function to remove some regions from a separate
register allocation.  We remove regions whose separate allocation
will hardly improve the result.  As a result we speed up regional
register allocation.   
The function changes the object in range list given by R to OBJ.   

References NULL, and r.

Referenced by copy_allocno_live_ranges(), and move_allocno_live_ranges().

◆ clear_conflicts()

static void clear_conflicts ( ira_object_t obj)
static

◆ compress_conflict_vec()

static void compress_conflict_vec ( ira_object_t obj)
static

◆ compress_conflict_vecs()

static void compress_conflict_vecs ( void )
static
Remove duplications in conflict vectors of all allocnos.   

References compress_conflict_vec(), conflict_check, curr_conflict_check_tick, FOR_EACH_OBJECT, ira_allocate(), ira_free(), ira_objects_num, and OBJECT_CONFLICT_VEC_P.

Referenced by ira_flattening().

◆ copy_allocno_live_ranges()

◆ copy_info_to_removed_store_destinations()

static bool copy_info_to_removed_store_destinations ( int regno)
static
Process all allocnos originated from pseudo REGNO and copy live
ranges, hard reg conflicts, and allocno stack reg attributes from
low level allocnos to final allocnos which are destinations of
removed stores at a loop exit.  Return true if we copied live
ranges.   

References a, ALLOCNO_CALL_FREQ, ALLOCNO_CALLS_CROSSED_NUM, ALLOCNO_CAP_MEMBER, ALLOCNO_CHEAP_CALLS_CROSSED_NUM, ALLOCNO_CROSSED_CALLS_ABIS, ALLOCNO_CROSSED_CALLS_CLOBBERED_REGS, ALLOCNO_EMIT_DATA, allocno_emit_reg(), ALLOCNO_EXCESS_PRESSURE_POINTS_NUM, ALLOCNO_LOOP_TREE_NODE, ALLOCNO_NEXT_REGNO_ALLOCNO, copy_allocno_live_ranges(), ira_assert, ira_regno_allocno_map, merge_hard_reg_conflicts(), NULL, ira_loop_tree_node::parent, REGNO, ira_loop_tree_node::regno_allocno_map, and regno_top_level_allocno_map.

Referenced by ira_flattening().

◆ copy_live_range()

static live_range_t copy_live_range ( live_range_t r)
static
Copy allocno live range R and return the result.   

References live_range_pool, and r.

Referenced by ira_copy_live_range_list().

◆ create_allocno_objects()

static void create_allocno_objects ( void )
static
For each allocno, set ALLOCNO_NUM_OBJECTS and create the
ALLOCNO_OBJECT structures.  This must be called after the allocno
classes are known.   

References a, FOR_EACH_ALLOCNO, and ira_create_allocno_objects().

Referenced by ira_build().

◆ create_allocnos()

static void create_allocnos ( void )
static
Create allocnos corresponding to pseudo-registers in the current
function.  Traverse the loop tree for this.   

References create_loop_tree_node_allocnos(), ira_loop_tree_root, ira_traverse_loop_tree(), NULL, and propagate_modified_regnos().

Referenced by ira_build().

◆ create_bb_allocnos()

static void create_bb_allocnos ( ira_loop_tree_node_t bb_node)
static
Create allocnos corresponding to pseudo-registers living in the
basic block represented by the corresponding loop tree node
BB_NODE.   

References ira_loop_tree_node::bb, create_insn_allocnos(), curr_bb, df_get_live_in(), EXECUTE_IF_SET_IN_REG_SET, FOR_BB_INSNS_REVERSE, i, ira_assert, ira_create_allocno(), ira_curr_loop_tree_node, ira_curr_regno_allocno_map, NONDEBUG_INSN_P, NULL, and PATTERN().

Referenced by create_loop_tree_node_allocnos().

◆ create_cap_allocno()

◆ create_caps()

◆ create_insn_allocnos()

static void create_insn_allocnos ( rtx x,
rtx outer,
bool output_p )
static
This recursive function creates allocnos corresponding to
pseudo-registers containing in X.  True OUTPUT_P means that X is
an lvalue.  OUTER corresponds to the parent expression of X.   

References a, ALLOCNO_FREQ, ALLOCNO_NREFS, ALLOCNO_WMODE, bitmap_set_bit, create_insn_allocnos(), curr_bb, GET_CODE, GET_MODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, ira_create_allocno(), ira_curr_loop_tree_node, ira_curr_regno_allocno_map, ira_loop_tree_node::modified_regnos, NULL, partial_subreg_p(), REG_FREQ_FROM_BB, REGNO, SET, SET_DEST, SET_SRC, XEXP, XVECEXP, and XVECLEN.

Referenced by create_bb_allocnos(), and create_insn_allocnos().

◆ create_loop_allocnos()

static void create_loop_allocnos ( edge e)
static
Create allocnos corresponding to pseudo-registers living on edge E
(a loop entry or exit).  Also mark the allocnos as living on the
loop border.  

References ALLOCNO_NUM, bitmap_bit_p, bitmap_set_bit, ira_loop_tree_node::border_allocnos, df_get_live_in(), df_get_live_out(), EXECUTE_IF_SET_IN_REG_SET, i, ira_create_allocno(), ira_curr_loop_tree_node, ira_curr_regno_allocno_map, NULL, ira_loop_tree_node::parent, and ira_loop_tree_node::regno_allocno_map.

Referenced by create_loop_tree_node_allocnos().

◆ create_loop_tree_node_allocnos()

static void create_loop_tree_node_allocnos ( ira_loop_tree_node_t loop_node)
static
Create allocnos corresponding to pseudo-registers living in loop
represented by the corresponding loop tree node LOOP_NODE.  This
function is called by ira_traverse_loop_tree.   

References ira_loop_tree_node::bb, create_bb_allocnos(), create_loop_allocnos(), current_loops, FOR_EACH_EDGE, FOR_EACH_VEC_ELT, get_loop_exit_edges(), loop::header, i, ira_assert, ira_loop_tree_root, loop::latch, ira_loop_tree_node::loop, NULL, and basic_block_def::preds.

Referenced by create_allocnos().

◆ create_loop_tree_nodes()

static void create_loop_tree_nodes ( void )
static

◆ debug() [1/4]

DEBUG_FUNCTION void debug ( ira_allocno & ref)

◆ debug() [2/4]

DEBUG_FUNCTION void debug ( ira_allocno * ptr)

References debug.

◆ debug() [3/4]

DEBUG_FUNCTION void debug ( ira_allocno_copy & ref)

References print_copy().

◆ debug() [4/4]

DEBUG_FUNCTION void debug ( ira_allocno_copy * ptr)

References debug.

◆ find_allocno_copy()

static ira_copy_t find_allocno_copy ( ira_allocno_t a1,
ira_allocno_t a2,
rtx_insn * insn,
ira_loop_tree_node_t loop_tree_node )
static
Building internal representation for IRA.
   Copyright (C) 2006-2024 Free Software Foundation, Inc.
   Contributed by Vladimir Makarov <vmakarov@redhat.com>.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   
Return copy connecting A1 and A2 and originated from INSN of
LOOP_TREE_NODE if any.   

References ALLOCNO_COPIES, ira_allocno_copy::first, gcc_unreachable, ira_allocno_copy::insn, ira_allocno_copy::loop_tree_node, ira_allocno_copy::next_first_allocno_copy, ira_allocno_copy::next_second_allocno_copy, NULL, and ira_allocno_copy::second.

Referenced by ira_add_allocno_copy().

◆ find_allocno_pref()

static ira_pref_t find_allocno_pref ( ira_allocno_t a,
int hard_regno )
static
Return pref for A and HARD_REGNO if any.   

References a, ALLOCNO_PREFS, NULL, and pref.

Referenced by ira_add_allocno_pref().

◆ finish_allocno()

static void finish_allocno ( ira_allocno_t a)
static
Free the memory allocated for allocno A.   

References a, allocno_pool, and ira_free_allocno_costs().

Referenced by finish_allocnos(), ira_flattening(), remove_low_level_allocnos(), and remove_unnecessary_allocnos().

◆ finish_allocnos()

static void finish_allocnos ( void )
static

◆ finish_copies()

static void finish_copies ( void )
static
Free memory allocated for all copies.   

References copy_pool, copy_vec, finish_copy(), and FOR_EACH_COPY.

Referenced by ira_destroy().

◆ finish_copy()

static void finish_copy ( ira_copy_t cp)
static
The function frees memory allocated for copy CP.   

References copy_pool.

Referenced by finish_copies(), and ira_flattening().

◆ finish_cost_vectors()

static void finish_cost_vectors ( void )
static
Finish work with hard register cost vectors.  Release allocation
pool for each allocno class.   

References cost_vector_pool, i, ira_allocno_classes, and ira_allocno_classes_num.

Referenced by ira_destroy().

◆ finish_loop_tree_node()

static void finish_loop_tree_node ( ira_loop_tree_node_t loop)
static
Free the loop tree node of a loop.   

References ira_assert, ira_free(), ira_free_bitmap(), and NULL.

Referenced by finish_loop_tree_nodes(), and remove_unnecessary_regions().

◆ finish_loop_tree_nodes()

◆ finish_pref()

static void finish_pref ( ira_pref_t pref)
static
The function frees memory allocated for PREF.   

References ira_prefs, NULL, pref, and pref_pool.

Referenced by finish_prefs(), ira_remove_allocno_prefs(), and ira_remove_pref().

◆ finish_prefs()

static void finish_prefs ( void )
static
Free memory allocated for all prefs.   

References finish_pref(), FOR_EACH_PREF, pref, pref_pool, and pref_vec.

Referenced by ira_destroy().

◆ form_loop_tree()

◆ init_loop_tree_node()

◆ initiate_allocnos()

static void initiate_allocnos ( void )
static

◆ initiate_copies()

static void initiate_copies ( void )
static
The function initializes data concerning allocno copies.   

References copy_vec, get_max_uid(), ira_copies, ira_copies_num, and NULL.

Referenced by ira_build().

◆ initiate_cost_vectors()

static void initiate_cost_vectors ( void )
static
The function initiates work with hard register cost vectors.  It
creates allocation pool for each allocno class.   

References cost_vector_pool, i, ira_allocno_classes, ira_allocno_classes_num, and ira_class_hard_regs_num.

Referenced by ira_build().

◆ initiate_prefs()

static void initiate_prefs ( void )
static
The function initializes data concerning allocno prefs.   

References get_max_uid(), ira_prefs, ira_prefs_num, NULL, and pref_vec.

Referenced by ira_build().

◆ ior_hard_reg_conflicts()

void ior_hard_reg_conflicts ( ira_allocno_t a,
const_hard_reg_set set )
Update hard register conflict information for all objects associated with
A to include the regs in SET.   

References a, FOR_EACH_ALLOCNO_OBJECT, i, OBJECT_CONFLICT_HARD_REGS, and OBJECT_TOTAL_CONFLICT_HARD_REGS.

Referenced by add_range_and_copies_from_move_list(), and ira_build().

◆ ira_add_allocno_copy()

ira_copy_t ira_add_allocno_copy ( ira_allocno_t first,
ira_allocno_t second,
int freq,
bool constraint_p,
rtx_insn * insn,
ira_loop_tree_node_t loop_tree_node )
Create (or update frequency if the copy already exists) and return
the copy of allocnos FIRST and SECOND with frequency FREQ
corresponding to move insn INSN (if any) and originated from
LOOP_TREE_NODE.   

References add_allocno_copy_to_list(), find_allocno_copy(), ira_allocno_copy::freq, ira_assert, ira_create_copy(), NULL, and swap_allocno_copy_ends_if_necessary().

Referenced by add_range_and_copies_from_move_list(), process_regs_for_copy(), and propagate_copies().

◆ ira_add_allocno_pref()

void ira_add_allocno_pref ( ira_allocno_t a,
int hard_regno,
int freq )
Create (or update frequency if the pref already exists) the pref of
allocnos A preferring HARD_REGNO with frequency FREQ.   

References a, add_allocno_pref_to_list(), find_allocno_pref(), ira_assert, ira_create_pref(), NULL, and pref.

Referenced by find_costs_and_classes(), process_bb_node_for_hard_reg_moves(), and process_regs_for_copy().

◆ ira_add_conflict()

static void ira_add_conflict ( ira_object_t obj1,
ira_object_t obj2 )
static
Add OBJ1 to the conflicts of OBJ2 and vice versa.   

References add_to_conflicts().

Referenced by ira_flattening().

◆ ira_add_live_range_to_object()

void ira_add_live_range_to_object ( ira_object_t object,
int start,
int finish )
Create a new live range for OBJECT and queue it at the head of its
live range list.   

References ira_create_live_range(), and OBJECT_LIVE_RANGES.

Referenced by add_range_and_copies_from_move_list(), and make_object_live().

◆ ira_allocate_conflict_vec()

void ira_allocate_conflict_vec ( ira_object_t obj,
int num )
Allocates and initialize the conflict vector of OBJ for NUM
conflicting objects.   

References ira_allocate(), ira_assert, NULL, loop::num, OBJECT_CONFLICT_ARRAY, OBJECT_CONFLICT_ARRAY_SIZE, OBJECT_CONFLICT_VEC_P, and OBJECT_NUM_CONFLICTS.

Referenced by build_object_conflicts(), and ira_allocate_object_conflicts().

◆ ira_allocate_cost_vector()

int * ira_allocate_cost_vector ( reg_class_t aclass)

◆ ira_allocate_object_conflicts()

void ira_allocate_object_conflicts ( ira_object_t obj,
int num )
Allocate and initialize the conflict vector or conflict bit vector
of OBJ for NUM conflicting allocnos whatever is more profitable.   

References allocate_conflict_bit_vec(), ira_allocate_conflict_vec(), ira_conflict_vector_profitable_p(), and loop::num.

Referenced by add_range_and_copies_from_move_list().

◆ ira_build()

◆ ira_conflict_vector_profitable_p()

bool ira_conflict_vector_profitable_p ( ira_object_t obj,
int num )
Return TRUE if a conflict vector with NUM elements is more
profitable than a conflict bit vector for OBJ.   

References loop::num, OBJECT_MAX, OBJECT_MIN, and STATIC_ASSERT.

Referenced by build_object_conflicts(), and ira_allocate_object_conflicts().

◆ ira_copy_live_range_list()

live_range_t ira_copy_live_range_list ( live_range_t r)
Copy allocno live range list given by its head R and return the
result.   

References copy_live_range(), last, filedep::next, NULL, and r.

Referenced by copy_allocno_live_ranges(), and setup_slot_coalesced_allocno_live_ranges().

◆ ira_create_allocno()

◆ ira_create_allocno_objects()

void ira_create_allocno_objects ( ira_allocno_t a)
Determine the number of objects we should associate with allocno A
and allocate them.   

References a, ALLOCNO_CLASS, ALLOCNO_MODE, ALLOCNO_NUM_OBJECTS, ALLOCNO_OBJECT, GET_MODE_SIZE(), i, ira_create_object(), and ira_reg_class_max_nregs.

Referenced by create_allocno_objects(), create_cap_allocno(), and modify_move_list().

◆ ira_create_copy()

ira_copy_t ira_create_copy ( ira_allocno_t first,
ira_allocno_t second,
int freq,
bool constraint_p,
rtx_insn * insn,
ira_loop_tree_node_t loop_tree_node )
Create and return copy with given attributes LOOP_TREE_NODE, FIRST,
SECOND, FREQ, CONSTRAINT_P, and INSN.   

References ira_allocno_copy::constraint_p, copy_pool, copy_vec, ira_allocno_copy::first, ira_allocno_copy::freq, ira_allocno_copy::insn, ira_copies, ira_copies_num, ira_allocno_copy::loop_tree_node, ira_allocno_copy::num, and ira_allocno_copy::second.

Referenced by ira_add_allocno_copy().

◆ ira_create_live_range()

live_range_t ira_create_live_range ( ira_object_t obj,
int start,
int finish,
live_range_t next )
Create and return a live range for OBJECT with given attributes.   

References live_range::finish, live_range_pool, live_range::next, loop::next, live_range::object, and live_range::start.

Referenced by ira_add_live_range_to_object().

◆ ira_create_object()

◆ ira_create_pref()

ira_pref_t ira_create_pref ( ira_allocno_t a,
int hard_regno,
int freq )
Create and return pref with given attributes A, HARD_REGNO, and FREQ.   

References a, ira_prefs, ira_prefs_num, ira_allocno_pref::num, pref, pref_pool, and pref_vec.

Referenced by ira_add_allocno_pref().

◆ ira_debug_allocno_copies()

void ira_debug_allocno_copies ( ira_allocno_t a)
Print info about copies involving allocno A into stderr.   

References a, and print_allocno_copies().

◆ ira_debug_allocno_prefs()

void ira_debug_allocno_prefs ( ira_allocno_t a)
Print info about prefs involving allocno A into stderr.   

References a, and print_allocno_prefs().

◆ ira_debug_copies()

void ira_debug_copies ( void )
Print info about all copies into stderr.   

References print_copies().

◆ ira_debug_copy()

void ira_debug_copy ( ira_copy_t cp)
Print info about copy CP into stderr.   

References print_copy().

◆ ira_debug_pref()

void ira_debug_pref ( ira_pref_t pref)
Print info about PREF into stderr.   

References pref, and print_pref().

◆ ira_debug_prefs()

void ira_debug_prefs ( void )
Print info about all prefs into stderr.   

References print_prefs().

◆ ira_destroy()

void ira_destroy ( void )
Release the data created by function ira_build.   

References finish_allocnos(), finish_copies(), finish_cost_vectors(), finish_loop_tree_nodes(), finish_prefs(), and ira_finish_allocno_live_ranges().

Referenced by do_reload().

◆ ira_finish_live_range()

void ira_finish_live_range ( live_range_t r)

◆ ira_finish_live_range_list()

void ira_finish_live_range_list ( live_range_t r)
Free list of allocno live ranges starting with R.   

References ira_finish_live_range(), live_range::next, NULL, and r.

Referenced by coalesce_spill_slots(), and ira_free_allocno_costs().

◆ ira_flattening()

void ira_flattening ( int max_regno_before_emit,
int ira_max_point_before_emit )
Flatten the IR.  In other words, this function transforms IR as if
it were built with one region (without loops).  We could make it
much simpler by rebuilding IR with one region, but unfortunately it
takes a lot of time.  MAX_REGNO_BEFORE_EMIT and
IRA_MAX_POINT_BEFORE_EMIT are correspondingly MAX_REG_NUM () and
IRA_MAX_POINT before emitting insns on the loop borders.   

References a, add_allocno_copy_to_list(), ALLOCNO_ASSIGNED_P, ALLOCNO_CALL_FREQ, ALLOCNO_CALLS_CROSSED_NUM, ALLOCNO_CAP, ALLOCNO_CAP_MEMBER, ALLOCNO_CHEAP_CALLS_CROSSED_NUM, ALLOCNO_CLASS, ALLOCNO_CLASS_COST, ALLOCNO_CONFLICT_HARD_REG_COSTS, ALLOCNO_COPIES, ALLOCNO_EMIT_DATA, allocno_emit_reg(), ALLOCNO_EXCESS_PRESSURE_POINTS_NUM, ALLOCNO_FREQ, ALLOCNO_HARD_REG_COSTS, ALLOCNO_LOOP_TREE_NODE, ALLOCNO_MEMORY_COST, ALLOCNO_NEXT_REGNO_ALLOCNO, ALLOCNO_NREFS, ALLOCNO_NUM, ALLOCNO_REGNO, ALLOCNO_UPDATED_CLASS_COST, ALLOCNO_UPDATED_CONFLICT_HARD_REG_COSTS, ALLOCNO_UPDATED_HARD_REG_COSTS, ALLOCNO_UPDATED_MEMORY_COST, clear_conflicts(), compress_conflict_vecs(), copy_info_to_removed_store_destinations(), EXECUTE_IF_SET_IN_SPARSESET, finish_allocno(), finish_copy(), live_range::finish_next, ira_allocno_copy::first, FOR_EACH_ALLOCNO, FOR_EACH_ALLOCNO_OBJECT, FOR_EACH_COPY, i, internal_flag_ira_verbose, ira_add_conflict(), ira_allocate(), ira_assert, ira_class_hard_regs_num, ira_compress_allocno_live_ranges(), ira_copies, ira_dump_file, ira_finish_point_ranges, ira_free(), ira_free_allocno_updated_costs(), ira_loop_tree_root, ira_max_point, ira_object_id_map, ira_objects_num, ira_parent_allocno(), ira_rebuild_start_finish_chains(), ira_reg_classes_intersect_p, ira_regno_allocno_map, ira_remove_allocno_prefs(), ira_start_point_ranges, ira_allocno_copy::loop_tree_node, max_reg_num(), ira_emit_data::mem_optimized_dest_p, merge_hard_reg_conflicts(), move_allocno_live_ranges(), NULL, ira_allocno_copy::num, OBJECT_ALLOCNO, OBJECT_CONFLICT_HARD_REGS, OBJECT_CONFLICT_ID, OBJECT_LIVE_RANGES, OBJECT_TOTAL_CONFLICT_HARD_REGS, objects_live, r, rebuild_regno_allocno_maps(), ira_emit_data::reg, REGNO, ira_loop_tree_node::regno_allocno_map, regno_top_level_allocno_map, ira_allocno_copy::second, sparseset_alloc(), sparseset_clear_bit(), sparseset_free, sparseset_set_bit(), live_range::start_next, and swap_allocno_copy_ends_if_necessary().

Referenced by ira().

◆ ira_free_allocno_costs()

◆ ira_free_allocno_updated_costs()

◆ ira_free_cost_vector()

void ira_free_cost_vector ( int * vec,
reg_class_t aclass )
Free a cost vector VEC for ACLASS.   

References cost_vector_pool, ira_assert, and NULL.

Referenced by ira_free_allocno_costs(), and ira_free_allocno_updated_costs().

◆ ira_live_ranges_intersect_p()

bool ira_live_ranges_intersect_p ( live_range_t r1,
live_range_t r2 )
Return TRUE if live ranges R1 and R2 intersect.   

References live_range::finish, live_range::next, NULL, and live_range::start.

Referenced by allocnos_conflict_by_live_ranges_p(), and slot_coalesced_allocno_live_ranges_intersect_p().

◆ ira_loop_tree_body_rev_postorder()

static vec< ira_loop_tree_node_t > ira_loop_tree_body_rev_postorder ( ira_loop_tree_node_t loop_node,
const vec< ira_loop_tree_node_t > & loop_preorder )
static
Compute a post-ordering of the reverse control flow of the loop body
designated by the children nodes of LOOP_NODE, whose body nodes in
pre-order are input as LOOP_PREORDER.  Return a VEC with a post-order
of the reverse loop body.

For the post-order of the reverse CFG, we visit the basic blocks in
LOOP_PREORDER array in the reverse order of where they appear.
This is important: We do not just want to compute a post-order of
the reverse CFG, we want to make a best-guess for a visiting order that
minimizes the number of chain elements per allocno live range.  If the
blocks would be visited in a different order, we would still compute a
correct post-ordering but it would be less likely that two nodes
connected by an edge in the CFG are neighbors in the topsort.   

References ira_loop_tree_node::bb, BB_TO_VISIT, cfun, ENTRY_BLOCK_PTR_FOR_FN, basic_block_def::flags, FOR_EACH_EDGE, FOR_EACH_VEC_ELT, FOR_EACH_VEC_ELT_REVERSE, gcc_assert, gcc_checking_assert, i, basic_block_def::index, IRA_BB_NODE_BY_INDEX, basic_block_def::preds, and vNULL.

Referenced by ira_traverse_loop_tree().

◆ ira_merge_live_ranges()

live_range_t ira_merge_live_ranges ( live_range_t r1,
live_range_t r2 )
Merge ranges R1 and R2 and returns the result.  The function
maintains the order of ranges and tries to minimize number of the
result ranges.   

References live_range::finish, ira_assert, ira_finish_live_range(), last, filedep::next, live_range::next, NULL, and live_range::start.

Referenced by copy_allocno_live_ranges(), move_allocno_live_ranges(), and setup_slot_coalesced_allocno_live_ranges().

◆ ira_parent_allocno()

ira_allocno_t ira_parent_allocno ( ira_allocno_t a)
Find the allocno that corresponds to A at a level one higher up in the
loop tree.  Returns NULL if A is a cap, or if it has no parent.   

References a, ALLOCNO_CAP, ALLOCNO_LOOP_TREE_NODE, ALLOCNO_REGNO, NULL, ira_loop_tree_node::parent, and ira_loop_tree_node::regno_allocno_map.

Referenced by ira_flattening(), ira_parent_or_cap_allocno(), and ira_soft_conflict().

◆ ira_parent_or_cap_allocno()

ira_allocno_t ira_parent_or_cap_allocno ( ira_allocno_t a)
Find the allocno that corresponds to A at a level one higher up in the
loop tree.  If ALLOCNO_CAP is set for A, return that.   

References a, ALLOCNO_CAP, ira_parent_allocno(), and NULL.

Referenced by build_object_conflicts(), process_regs_for_copy(), propagate_copies(), and spill_soft_conflicts().

◆ ira_print_expanded_allocno()

◆ ira_propagate_hard_reg_costs()

static void ira_propagate_hard_reg_costs ( ira_allocno_t parent_a,
ira_allocno_t a,
int spill_cost )
static
Propagate ALLOCNO_HARD_REG_COSTS from A to PARENT_A.  Use SPILL_COST
as the cost of spilling a register throughout A (which we have to do
for PARENT_A allocations that conflict with A).   

References a, ALLOCNO_CLASS, ALLOCNO_CLASS_COST, ALLOCNO_HARD_REG_COSTS, ALLOCNO_MIGHT_CONFLICT_WITH_PARENT_P, conflicts, hard_reg_set_empty_p(), i, ira_allocate_and_set_costs(), ira_caller_save_loop_spill_p(), ira_class_hard_regs, ira_class_hard_regs_num, ira_need_caller_save_regs(), ira_total_conflict_hard_regs(), MIN, spill_cost, and TEST_HARD_REG_BIT.

Referenced by propagate_allocno_info().

◆ ira_rebuild_regno_allocno_list()

static void ira_rebuild_regno_allocno_list ( int regno)
static

◆ ira_remove_allocno_prefs()

void ira_remove_allocno_prefs ( ira_allocno_t a)

◆ ira_remove_pref()

void ira_remove_pref ( ira_pref_t pref)
Remove PREF from the list of allocno prefs and free memory for
it.   

References ALLOCNO_PREFS, finish_pref(), internal_flag_ira_verbose, ira_assert, ira_dump_file, ira_allocno_pref::next_pref, NULL, and pref.

Referenced by color_allocnos().

◆ ira_set_allocno_class()

void ira_set_allocno_class ( ira_allocno_t a,
enum reg_class aclass )
Set up register class for A and update its conflict hard
registers.   

References a, ALLOCNO_CLASS, FOR_EACH_ALLOCNO_OBJECT, OBJECT_CONFLICT_HARD_REGS, and OBJECT_TOTAL_CONFLICT_HARD_REGS.

Referenced by create_cap_allocno(), modify_move_list(), and setup_allocno_class_and_costs().

◆ ira_traverse_loop_tree()

void ira_traverse_loop_tree ( bool bb_p,
ira_loop_tree_node_t loop_node,
void(* preorder_func )(ira_loop_tree_node_t),
void(* postorder_func )(ira_loop_tree_node_t) )
This recursive function traverses loop tree with root LOOP_NODE
calling non-null functions PREORDER_FUNC and POSTORDER_FUNC
correspondingly in preorder and postorder.  The function sets up
IRA_CURR_LOOP_TREE_NODE and IRA_CURR_REGNO_ALLOCNO_MAP.  If BB_P,
basic block nodes of LOOP_NODE is also processed (before its
subloop nodes).

If BB_P is set and POSTORDER_FUNC is given, the basic blocks in
the loop are passed in the *reverse* post-order of the *reverse*
CFG.  This is only used by ira_create_allocno_live_ranges, which
wants to visit basic blocks in this order to minimize the number
of elements per live range chain.
Note that the loop tree nodes are still visited in the normal,
forward post-order of  the loop tree.   

References ira_loop_tree_node::bb, ira_loop_tree_node::children, FOR_EACH_VEC_ELT, FOR_EACH_VEC_ELT_REVERSE, i, ira_assert, ira_curr_loop_tree_node, ira_curr_regno_allocno_map, ira_loop_tree_body_rev_postorder(), ira_traverse_loop_tree(), ira_loop_tree_node::next, NULL, ira_loop_tree_node::regno_allocno_map, ira_loop_tree_node::subloop_next, and ira_loop_tree_node::subloops.

Referenced by create_allocnos(), do_coloring(), find_costs_and_classes(), ira_build_conflicts(), ira_create_allocno_live_ranges(), ira_emit(), ira_traverse_loop_tree(), and setup_allocno_class_and_costs().

◆ loop_compare_func()

static int loop_compare_func ( const void * v1p,
const void * v2p )
static
Sort loops for marking them for removal.  We put already marked
loops first, then less frequent loops next, and then outer loops
next.   

References cfun, basic_block_def::count, loop::header, ira_assert, ira_loop_tree_node::loop, loop_depth(), ira_loop_tree_node::loop_num, NULL, ira_loop_tree_node::parent, profile_count::to_frequency(), and ira_loop_tree_node::to_remove_p.

Referenced by mark_loops_for_removal().

◆ loop_is_inside_p()

static bool loop_is_inside_p ( ira_loop_tree_node_t node,
ira_loop_tree_node_t parent )
static
Return TRUE if NODE is inside PARENT.   

References NULL, and ira_loop_tree_node::parent.

Referenced by regno_allocno_order_compare_func().

◆ low_pressure_loop_node_p()

static bool low_pressure_loop_node_p ( ira_loop_tree_node_t node)
static
Return TRUE if NODE represents a loop with low register
pressure.   

References ira_loop_tree_node::bb, i, ira_class_hard_regs_num, ira_pressure_classes, ira_pressure_classes_num, NULL, and ira_loop_tree_node::reg_pressure.

Referenced by mark_loops_for_removal().

◆ mark_all_loops_for_removal()

◆ mark_loops_for_removal()

static void mark_loops_for_removal ( void )
static
Mark loops which should be removed from regional allocation.  We
remove a loop with low register pressure inside another loop with
register pressure.  In this case a separate allocation of the loop
hardly helps (for irregular register file architecture it could
help by choosing a better hard register in the loop but we prefer
faster allocation even in this case).  We also remove cheap loops
if there are more than param_ira_max_loops_num of them.  Loop with EH
exit or enter edges are removed too because the allocation might
require put pseudo moves on the EH edges (we could still do this
for pseudos with caller saved hard registers in some cases but it
is impossible to say here or during top-down allocation pass what
hard register the pseudos get finally).   

References cfun, basic_block_def::count, current_loops, get_loops(), loop::header, i, basic_block_def::index, internal_flag_ira_verbose, ira_allocate(), ira_assert, ira_dump_file, ira_free(), ira_loop_nodes, ira_loop_tree_node::loop, loop_compare_func(), loop_depth(), low_pressure_loop_node_p(), NULL, number_of_loops(), qsort, profile_count::to_frequency(), ira_loop_tree_node::to_remove_p, and vec_safe_iterate().

Referenced by remove_unnecessary_regions().

◆ merge_hard_reg_conflicts()

static void merge_hard_reg_conflicts ( ira_allocno_t from,
ira_allocno_t to,
bool total_only )
static
Merge hard register conflict information for all objects associated with
allocno TO into the corresponding objects associated with FROM.
If TOTAL_ONLY is true, we only merge OBJECT_TOTAL_CONFLICT_HARD_REGS.   

References ALLOCNO_NUM_OBJECTS, ALLOCNO_OBJECT, gcc_assert, i, OBJECT_CONFLICT_HARD_REGS, and OBJECT_TOTAL_CONFLICT_HARD_REGS.

Referenced by copy_info_to_removed_store_destinations(), create_cap_allocno(), ira_flattening(), propagate_allocno_info(), and propagate_some_info_from_allocno().

◆ more_one_region_p()

static bool more_one_region_p ( void )
static
The function returns TRUE if there are more one allocation
region.   

References cfun, current_loops, FOR_EACH_VEC_SAFE_ELT, get_loops(), i, ira_loop_nodes, ira_loop_tree_root, ira_loop_tree_node::loop, NULL, and ira_loop_tree_node::regno_allocno_map.

Referenced by ira_build().

◆ move_allocno_live_ranges()

◆ object_range_compare_func()

static int object_range_compare_func ( const void * v1p,
const void * v2p )
static
Sort allocnos according to their live ranges.  Allocnos with
smaller allocno class are put first unless we use priority
coloring.  Allocnos with the same class are ordered according
their start (min).  Allocnos with the same start are ordered
according their finish (max).   

References ALLOCNO_NUM, OBJECT_ALLOCNO, OBJECT_MAX, and OBJECT_MIN.

Referenced by sort_conflict_id_map().

◆ print_allocno_copies()

◆ print_allocno_prefs()

static void print_allocno_prefs ( FILE * f,
ira_allocno_t a )
static
Print info about prefs involving allocno A into file F.   

References a, ALLOCNO_NUM, ALLOCNO_PREFS, ALLOCNO_REGNO, NULL, and pref.

Referenced by ira_debug_allocno_prefs().

◆ print_copies()

static void print_copies ( FILE * f)
static
Print info about all copies into file F.   

References FOR_EACH_COPY, and print_copy().

Referenced by ira_build(), and ira_debug_copies().

◆ print_copy()

static void print_copy ( FILE * f,
ira_copy_t cp )
static

◆ print_pref()

static void print_pref ( FILE * f,
ira_pref_t pref )
static
Print info about PREF into file F.   

References ALLOCNO_NUM, ALLOCNO_REGNO, and pref.

Referenced by ira_debug_pref(), and print_prefs().

◆ print_prefs()

static void print_prefs ( FILE * f)
static
Print info about all prefs into file F.   

References FOR_EACH_PREF, pref, and print_pref().

Referenced by ira_build(), and ira_debug_prefs().

◆ propagate_allocno_info()

◆ propagate_modified_regnos()

static void propagate_modified_regnos ( ira_loop_tree_node_t loop_tree_node)
static
Propagate information about allocnos modified inside the loop given
by its LOOP_TREE_NODE to its parent.   

References ira_loop_tree_node::bb, bitmap_ior_into(), ira_assert, ira_loop_tree_root, ira_loop_tree_node::modified_regnos, NULL, and ira_loop_tree_node::parent.

Referenced by create_allocnos().

◆ propagate_some_info_from_allocno()

◆ rebuild_regno_allocno_maps()

static void rebuild_regno_allocno_maps ( void )
static

◆ regno_allocno_order_compare_func()

static int regno_allocno_order_compare_func ( const void * v1p,
const void * v2p )
static
Sort allocnos according to their order in regno allocno list.   

References ALLOCNO_LOOP_TREE_NODE, ALLOCNO_NUM, and loop_is_inside_p().

Referenced by ira_rebuild_regno_allocno_list().

◆ remove_low_level_allocnos()

◆ remove_uneccesary_loop_nodes_from_loop_tree()

◆ remove_unnecessary_allocnos()

◆ remove_unnecessary_regions()

static void remove_unnecessary_regions ( bool all_p)
static
Remove loops from consideration.  We remove all loops except for
root if ALL_P or loops for which a separate allocation will not
improve the result.  We have to do this after allocno creation and
their costs and allocno class evaluation because only after that
the register pressure can be known and is calculated.   

References cfun, children_vec, current_loops, finish_loop_tree_node(), ira_loop_tree_root, last_basic_block_for_fn, mark_all_loops_for_removal(), mark_loops_for_removal(), NULL, number_of_loops(), remove_low_level_allocnos(), remove_uneccesary_loop_nodes_from_loop_tree(), remove_unnecessary_allocnos(), and removed_loop_vec.

Referenced by ira_build().

◆ setup_loop_tree_level()

static int setup_loop_tree_level ( ira_loop_tree_node_t loop_node,
int level )
static
The following recursive function sets up levels of nodes of the
tree given its root LOOP_NODE.  The enumeration starts with LEVEL.
The function returns maximal value of level in the tree + 1.   

References ira_loop_tree_node::bb, ira_assert, ira_loop_tree_node::level, NULL, setup_loop_tree_level(), ira_loop_tree_node::subloop_next, and ira_loop_tree_node::subloops.

Referenced by form_loop_tree(), and setup_loop_tree_level().

◆ setup_min_max_allocno_live_range_point()

◆ setup_min_max_conflict_allocno_ids()

static void setup_min_max_conflict_allocno_ids ( void )
static
Set up minimal and maximal conflict ids of allocnos with which
given allocno can conflict.   

References a, ALLOCNO_CLASS, ALLOCNO_NUM_OBJECTS, ALLOCNO_OBJECT, FOR_EACH_ALLOCNO, i, INT_MAX, INT_MIN, ira_allocate(), ira_free(), ira_max_point, ira_object_id_map, ira_objects_num, NULL, OBJECT_ALLOCNO, OBJECT_CONFLICT_ID, OBJECT_MAX, and OBJECT_MIN.

Referenced by ira_build().

◆ sort_conflict_id_map()

static void sort_conflict_id_map ( void )
static
Sort ira_object_id_map and set up conflict id of allocnos.   

References a, FOR_EACH_ALLOCNO, FOR_EACH_ALLOCNO_OBJECT, gcc_assert, i, ira_object_id_map, ira_objects_num, NULL, loop::num, OBJECT_CONFLICT_ID, object_range_compare_func(), and qsort.

Referenced by ira_build().

◆ swap_allocno_copy_ends_if_necessary()

static void swap_allocno_copy_ends_if_necessary ( ira_copy_t cp)
static

◆ update_bad_spill_attribute()

static void update_bad_spill_attribute ( void )
static
At this point true value of allocno attribute bad_spill_p means
that there is an insn where allocno occurs and where the allocno
cannot be used as memory.  The function updates the attribute, now
it can be true only for allocnos which cannot be used as memory in
an insn and in whose live ranges there is other allocno deaths.
Spilling allocnos with true value will not improve the code because
it will not make other allocnos colorable and additional reloads
for the corresponding pseudo will be generated in reload pass for
each insn it occurs.

This is a trick mentioned in one classic article of Chaitin etc
which is frequently omitted in other implementations of RA based on
graph coloring.   

References a, ALLOCNO_BAD_SPILL_P, ALLOCNO_CLASS, bitmap_bit_p, bitmap_clear(), bitmap_initialize(), bitmap_set_bit, FOR_EACH_ALLOCNO, FOR_EACH_ALLOCNO_OBJECT, i, ira_allocno_classes, ira_allocno_classes_num, NULL, OBJECT_LIVE_RANGES, r, and reg_obstack.

Referenced by ira_build().

◆ update_conflict_hard_reg_costs()

static void update_conflict_hard_reg_costs ( void )
static
Identify allocnos which prefer a register class with a single hard register.
Adjust ALLOCNO_CONFLICT_HARD_REG_COSTS so that conflicting allocnos are
less likely to use the preferred singleton register.   

References a, ALLOCNO_CLASS, ALLOCNO_CLASS_COST, ALLOCNO_CONFLICT_HARD_REG_COSTS, ALLOCNO_HARD_REG_COSTS, ALLOCNO_MODE, ALLOCNO_REGNO, FOR_EACH_ALLOCNO, i, INT_MAX, ira_allocate_and_set_costs(), ira_class_hard_reg_index, ira_class_hard_regs_num, ira_class_singleton, NULL, pref, and reg_preferred_class().

Referenced by ira_build().

Variable Documentation

◆ allocno_pool

object_allocator< ira_allocno > allocno_pool("allocnos") ( "allocnos" )
static

◆ allocno_vec

vec<ira_allocno_t> allocno_vec
static
Vec containing references to all created allocnos.  It is a
container of array allocnos.   

Referenced by finish_allocnos(), initiate_allocnos(), and ira_create_allocno().

◆ children_vec

vec<ira_loop_tree_node_t> children_vec
static
Vec containing references to all children of loop tree nodes.   

Referenced by remove_uneccesary_loop_nodes_from_loop_tree(), and remove_unnecessary_regions().

◆ conflict_check

int* conflict_check
static
The array used to find duplications in conflict vectors of
allocnos.   

Referenced by compress_conflict_vec(), and compress_conflict_vecs().

◆ copy_pool

object_allocator< ira_allocno_copy > copy_pool("copies") ( "copies" )
static
Pools for copies.   

Referenced by finish_copies(), finish_copy(), and ira_create_copy().

◆ copy_vec

vec<ira_copy_t> copy_vec
static
Vec containing references to all created copies.  It is a
container of array ira_copies.   

Referenced by finish_copies(), initiate_copies(), and ira_create_copy().

◆ cost_vector_pool

pool_allocator* cost_vector_pool[N_REG_CLASSES]
static
Pools for cost vectors.  It is defined only for allocno classes.   

Referenced by finish_cost_vectors(), initiate_cost_vectors(), ira_allocate_cost_vector(), and ira_free_cost_vector().

◆ curr_bb

basic_block curr_bb
static
The basic block currently being processed.   

Referenced by create_bb_allocnos(), and create_insn_allocnos().

◆ curr_conflict_check_tick

int curr_conflict_check_tick
static
The value used to mark allocation presence in conflict vector of
the current allocno.   

Referenced by compress_conflict_vec(), and compress_conflict_vecs().

◆ ira_allocnos

ira_allocno_t* ira_allocnos
Array of references to all allocnos.  The order number of the
allocno corresponds to the index in the array.  Removed allocnos
have NULL element value.   

Referenced by change_loop(), coalesce_allocnos(), color_allocnos(), color_pass(), form_allocno_hard_regs_nodes_forest(), improve_allocation(), init_allocno_threads(), initiate_allocnos(), ira_allocno_iter_cond(), ira_create_allocno(), ira_free_allocno_costs(), print_loop_title(), setup_profitable_hard_regs(), and spill_soft_conflicts().

◆ ira_allocnos_num

◆ ira_bb_nodes

ira_loop_tree_node_t ira_bb_nodes
All nodes representing basic blocks are referred through the
following array.  We cannot use basic block member `aux' for this
because it is used for insertion of insns on edges.   

Referenced by calculate_equiv_gains(), create_loop_tree_nodes(), finish_loop_tree_nodes(), and form_loop_tree().

◆ ira_copies

ira_copy_t* ira_copies
Array of references to all copies.  The order number of the copy
corresponds to the index in the array.  Removed copies have NULL
element value.   

Referenced by initiate_copies(), ira_copy_iter_cond(), ira_create_copy(), and ira_flattening().

◆ ira_copies_num

int ira_copies_num

◆ ira_curr_loop_tree_node

ira_loop_tree_node_t ira_curr_loop_tree_node
The current loop tree node and its regno allocno map.   

Referenced by change_loop(), create_bb_allocnos(), create_insn_allocnos(), create_loop_allocnos(), ira_traverse_loop_tree(), and process_regs_for_copy().

◆ ira_curr_regno_allocno_map

◆ ira_loop_nodes

◆ ira_loop_nodes_count

unsigned int ira_loop_nodes_count
And size of the ira_loop_nodes array.   

Referenced by create_loop_tree_nodes(), and finish_loop_tree_nodes().

◆ ira_loop_tree_height

int ira_loop_tree_height
Height of the loop tree.   

Referenced by form_loop_tree().

◆ ira_loop_tree_root

◆ ira_object_id_map

◆ ira_object_id_map_vec

vec<ira_object_t> ira_object_id_map_vec
static
Vec containing references to all created ira_objects.  It is a
container of ira_object_id_map.   

Referenced by finish_allocnos(), initiate_allocnos(), and ira_create_object().

◆ ira_objects_num

◆ ira_prefs

ira_pref_t* ira_prefs
Array of references to all allocno preferences.  The order number
of the preference corresponds to the index in the array.   

Referenced by finish_pref(), initiate_prefs(), ira_create_pref(), and ira_pref_iter_cond().

◆ ira_prefs_num

int ira_prefs_num
Size of the previous array.   

Referenced by initiate_prefs(), ira_create_pref(), and ira_pref_iter_cond().

◆ ira_regno_allocno_map

◆ last_basic_block_before_change

int last_basic_block_before_change
static
LAST_BASIC_BLOCK before generating additional insns because of live
range splitting.  Emitting insns on a critical edge creates a new
basic block.   

Referenced by create_loop_tree_nodes(), and finish_loop_tree_nodes().

◆ live_range_pool

object_allocator< live_range > live_range_pool("live ranges") ( "live ranges" )
static
Pools for allocnos, allocno live ranges and objects.   

Referenced by copy_live_range(), finish_allocnos(), ira_create_live_range(), and ira_finish_live_range().

◆ object_pool

object_allocator< ira_object > object_pool("objects") ( "objects" )
static

◆ pref_pool

object_allocator< ira_allocno_pref > pref_pool("prefs") ( "prefs" )
static
Pools for allocno preferences.   

Referenced by finish_pref(), finish_prefs(), and ira_create_pref().

◆ pref_vec

vec<ira_pref_t> pref_vec
static
Vec containing references to all created preferences.  It is a
container of array ira_prefs.   

Referenced by finish_prefs(), initiate_prefs(), and ira_create_pref().

◆ regno_allocnos

ira_allocno_t* regno_allocnos
static
This array is used to sort allocnos to restore allocno order in
the regno allocno list.   

Referenced by ira_rebuild_regno_allocno_list(), and remove_unnecessary_allocnos().

◆ regno_top_level_allocno_map

ira_allocno_t* regno_top_level_allocno_map
static
The page contains code transforming more one region internal
representation (IR) to one region IR which is necessary for reload.
This transformation is called IR flattening.  We might just rebuild
the IR for one region but we don't do it because it takes a lot of
time.   
Map: regno -> allocnos which will finally represent the regno for
IR with one region.   

Referenced by copy_info_to_removed_store_destinations(), and ira_flattening().

◆ removed_loop_vec

vec<ira_loop_tree_node_t> removed_loop_vec
static
Definition of vector of loop tree nodes.   
Vec containing references to all removed loop tree nodes.   

Referenced by remove_uneccesary_loop_nodes_from_loop_tree(), and remove_unnecessary_regions().