GCC Middle and Back End API Reference
ira-conflicts.c File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "regs.h"
#include "rtl.h"
#include "tm_p.h"
#include "target.h"
#include "flags.h"
#include "hard-reg-set.h"
#include "basic-block.h"
#include "insn-config.h"
#include "recog.h"
#include "diagnostic-core.h"
#include "params.h"
#include "df.h"
#include "sparseset.h"
#include "ira-int.h"
#include "addresses.h"
Include dependency graph for ira-conflicts.c:

Macros

#define OBJECTS_CONFLICT_P(C1, C2)
#define REG_SUBREG_P(x)   (REG_P (x) || (GET_CODE (x) == SUBREG && REG_P (SUBREG_REG (x))))

Functions

static void record_object_conflict ()
static bool build_conflict_bit_table ()
static bool allocnos_conflict_for_copy_p ()
static rtx go_through_subreg ()
static bool process_regs_for_copy (rtx reg1, rtx reg2, bool constraint_p, rtx insn, int freq)
static void process_reg_shuffles ()
static void add_insn_allocno_copies ()
static void add_copies ()
static void propagate_copies ()
static void build_object_conflicts ()
static void build_conflicts ()
static void print_hard_reg_set ()
static void print_allocno_conflicts ()
static void print_conflicts ()
void ira_debug_conflicts ()
void ira_build_conflicts ()

Variables

static IRA_INT_TYPE ** conflicts
static ira_object_tcollected_conflict_objects

Macro Definition Documentation

#define OBJECTS_CONFLICT_P (   C1,
  C2 
)
Value:

Macro to test a conflict of C1 and C2 in `conflicts'.

#define REG_SUBREG_P (   x)    (REG_P (x) || (GET_CODE (x) == SUBREG && REG_P (SUBREG_REG (x))))

Check that X is REG or SUBREG of REG.

Referenced by process_reg_shuffles().


Function Documentation

static void add_insn_allocno_copies ( )
static

Process INSN and create allocno copies if necessary. For example, it might be because INSN is a pseudo-register move or INSN is two operand insn.

Fast check of possibility of constraint or shuffle copies. If there are no dead registers, there will be no such copies.

       If an operand dies, prefer its hard register for the output
       operands by decreasing the hard register cost or creating
       the corresponding allocno copies.  The cost will not
       correspond to a real move insn cost, so make the frequency
       smaller.   
static bool allocnos_conflict_for_copy_p ( )
static

Return true iff allocnos A1 and A2 cannot be allocated to the same register due to conflicts.

Due to the fact that we canonicalize conflicts (see record_object_conflict), we only need to test for conflicts of the lowest order words.

Referenced by add_copies().

static bool build_conflict_bit_table ( )
static

Build allocno conflict table by processing allocno live ranges. Return true if the table was built. The table is not built if it is too big.

Don't set up conflict for the allocno with itself.

References HOST_WIDEST_INT, internal_flag_ira_verbose, ira_dump_file, IRA_INT_BITS, IRA_INT_TYPE, IRA_MAX_CONFLICT_TABLE_SIZE, NULL, OBJECT_MAX, and OBJECT_MIN.

Referenced by print_conflicts().

static void build_conflicts ( )
static

Build conflict vectors or bit conflict vectors (whatever is more profitable) of all allocnos from the conflict table.

Referenced by print_conflicts().

static void build_object_conflicts ( )
static

Build conflict vectors or bit conflict vectors (whatever is more profitable) for object OBJ from the conflict table.

static rtx go_through_subreg ( )
static

Return X if X is a REG, otherwise it should be SUBREG of REG and the function returns the reg in this case. *OFFSET will be set to 0 in the first case or the regno offset in the first case.

void ira_build_conflicts ( void  )

Entry function which builds allocno conflicts and allocno copies and accumulate some allocno info on upper level regions.

         We need finished conflict table for the subsequent call.   
         Now we can free memory for the conflict table (see function
         build_object_conflicts for details).   
             For debugging purposes don't put user defined variables in
             callee-clobbered registers.  However, do allow parameters
             in callee-clobbered registers to improve debugging.  This
             is a bit of a fragile hack.   
             Allocnos bigger than the saved part of call saved
             regs must conflict with them.   
void ira_debug_conflicts ( )

Print information about allocno or only regno (if REG_P) conflicts to stderr.

static void print_allocno_conflicts ( )
static
static void print_conflicts ( )
static

Print information about allocno or only regno (if REG_P) conflicts to FILE.

References add_copies(), build_conflict_bit_table(), build_conflicts(), ira_conflicts_p, ira_loop_tree_root, IRA_REGION_ALL, ira_traverse_loop_tree(), and NULL.

static void print_hard_reg_set ( )
static
static void process_reg_shuffles ( )
static

Process all of the output registers of the current insn which are not bound (BOUND_P) and the input register REG (its operand number OP_NUM) which dies in the insn as if there were a move insn between them with frequency FREQ.

References BLOCK_FOR_INSN, find_reg_note(), HARD_REG_SET, NULL_RTX, process_regs_for_copy(), REG_FREQ_FROM_BB, REG_P, REG_SUBREG_P, SET_DEST, SET_SRC, side_effects_p(), single_set, and SUBREG_REG.

static bool process_regs_for_copy ( rtx  reg1,
rtx  reg2,
bool  constraint_p,
rtx  insn,
int  freq 
)
static

Process registers REG1 and REG2 in move INSN with execution frequency FREQ. The function also processes the registers in a potential move insn (INSN == NULL in this case) with frequency FREQ. The function can modify hard register costs of the corresponding allocnos or create a copy involving the corresponding allocnos. The function does nothing if the both registers are hard registers. When nothing is changed, the function returns FALSE.

 Set up hard regno preferenced by allocno.  If allocno gets the
 hard regno the copy (or potential move) insn will be removed.   
   Can not be tied.   
   It is already taken into account in ira-costs.c.   
   Can not be tied.  It is not in the allocno class.   

Referenced by process_reg_shuffles().

static void propagate_copies ( )
static

Propagate copies the corresponding allocnos on upper loop tree level.

References conflicts, FOR_EACH_BIT_IN_MINMAX_SET, ira_assert, IRA_INT_TYPE, ira_object_id_map, ira_reg_classes_intersect_p, OBJECT_ALLOCNO, OBJECT_CONFLICT_ID, OBJECT_MAX, and OBJECT_MIN.

static void record_object_conflict ( )
static

Record a conflict between objects OBJ1 and OBJ2. If necessary, canonicalize the conflict by recording it for lower-order subobjects of the corresponding allocnos.

Canonicalize the conflict. If two identically-numbered words conflict, always record this as a conflict between words 0. That is the only information we need, and it is easier to test for if it is collected in each allocno's lowest-order object.


Variable Documentation

ira_object_t* collected_conflict_objects
static

Array used to collect all conflict allocnos for given allocno.

IRA_INT_TYPE** conflicts
static

IRA conflict builder. Copyright (C) 2006-2013 Free Software Foundation, Inc. Contributed by Vladimir Makarov vmaka.nosp@m.rov@.nosp@m.redha.nosp@m.t.co.nosp@m.m.

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/. This file contains code responsible for allocno conflict creation, allocno copy creation and allocno info accumulation on upper level regions. ira_allocnos_num array of arrays of bits, recording whether two allocno's conflict (can't go in the same hardware register).

Some arrays will be used as conflict bit vector of the corresponding allocnos see function build_object_conflicts.

Referenced by propagate_copies().