GCC Middle and Back End API Reference
lra-coalesce.c File Reference

Functions

static int move_freq_compare_func ()
static void merge_pseudos ()
static bool substitute ()
static bool mem_move_p ()
static void update_live_info ()
static bool coalescable_pseudo_p ()
bool lra_coalesce ()

Variables

static int * first_coalesced_pseudo
static int * next_coalesced_pseudo
static bitmap_head coalesced_pseudos_bitmap
int lra_coalesce_iter
static bitmap_head used_pseudos_bitmap

Function Documentation

static bool coalescable_pseudo_p ( )
static
Return true if pseudo REGNO can be potentially coalesced.   

Referenced by lra_coalesce().

static bool mem_move_p ( )
static
Return true if the move involving REGNO1 and REGNO2 is a potential
   memory-memory move.   

References reg_renumber.

Referenced by lra_coalesce().

static void merge_pseudos ( )
static
Merge two sets of coalesced pseudos given correspondingly by
   pseudos REGNO1 and REGNO2 (more accurately merging REGNO2 group
   into REGNO1 group).  Set up COALESCED_PSEUDOS_BITMAP.   

References bitmap_set_bit(), first, first_coalesced_pseudo, last, lra_reg::live_ranges, lra_copy_live_range_list(), lra_merge_live_ranges(), lra_reg_info, lra_insn_reg::next, next_coalesced_pseudo, and lra_insn_reg::regno.

Referenced by lra_coalesce().

static int move_freq_compare_func ( )
static
The function is used to sort moves according to their execution
   frequencies.   

Referenced by lra_coalesce().

static bool substitute ( )
static
Change pseudos in *LOC on their coalescing group
   representatives.   

References first_coalesced_pseudo, lra_insn_reg::regno, and regno_reg_rtx.

Referenced by gen_reload_chain_without_interm_reg_p(), lra_coalesce(), and substitute().

static void update_live_info ( )
static
Set up USED_PSEUDOS_BITMAP, and update LR_BITMAP (a BB live info
   bitmap).   

References bitmap_and_compl_into(), bitmap_clear(), bitmap_empty_p(), bitmap_ior_into(), bitmap_set_bit(), and first_coalesced_pseudo.

Referenced by lra_coalesce().


Variable Documentation

bitmap_head coalesced_pseudos_bitmap
static
Pseudos which go away after coalescing.   
int* first_coalesced_pseudo
static
@verbatim Coalesce spilled pseudos.

Copyright (C) 2010-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 a pass making some simple RTL code
   transformations by coalescing pseudos to remove some move insns.

   Spilling pseudos in LRA can create memory-memory moves.  We should
   remove potential memory-memory moves before the next constraint
   pass because the constraint pass will generate additional insns for
   such moves and all these insns will be hard to remove afterwards.

   Here we coalesce only spilled pseudos.  Coalescing non-spilled
   pseudos (with different hard regs) might result in spilling
   additional pseudos because of possible conflicts with other
   non-spilled pseudos and, as a consequence, in more constraint
   passes and even LRA infinite cycling.  Trivial the same hard
   register moves will be removed by subsequent compiler passes.

   We don't coalesce special reload pseudos.  It complicates LRA code
   a lot without visible generated code improvement.

   The pseudo live-ranges are used to find conflicting pseudos during
   coalescing.

   Most frequently executed moves is tried to be coalesced first.   
Arrays whose elements represent the first and the next pseudo
   (regno) in the coalesced pseudos group to which given pseudo (its
   regno is the index) belongs.  The next of the last pseudo in the
   group refers to the first pseudo in the group, in other words the
   group is represented by a cyclic list.   

Referenced by lra_coalesce(), merge_pseudos(), substitute(), and update_live_info().

int lra_coalesce_iter
The current iteration (1, 2, ...) of the coalescing pass.   

Referenced by lra(), and lra_coalesce().

int * next_coalesced_pseudo
static

Referenced by lra_coalesce(), and merge_pseudos().

bitmap_head used_pseudos_bitmap
static
Pseudos used instead of the coalesced pseudos.