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.  

References lra_dump_file, max_reg_num(), max_regno, lra_insn_reg::next, and timevar_push().

bool lra_coalesce ( void  )
   The major function for aggressive pseudo coalescing of moves only
   if the both pseudos were spilled and not special reload pseudos.  
     Collect moves.  
     Coalesced copies, most frequently executed first.  
             We updated involved_insns_bitmap when doing the merge.  
                   Coalesced move.  
static bool mem_move_p ( )
static
   Return true if the move involving REGNO1 and REGNO2 is a potential
   memory-memory move.  

References bitmap_clear().

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, and lra_insn_reg::regno.

static int move_freq_compare_func ( )
static
   The function is used to sort moves according to their execution
   frequencies.  
     If frequencies are equal, sort by moves, so that the results of
     qsort leave nothing to chance.  
static bool substitute ( )
static
   Change pseudos in *LOC on their coalescing group
   representatives.  
static void update_live_info ( )
static
   Set up USED_PSEUDOS_BITMAP, and update LR_BITMAP (a BB live info
   bitmap).  

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 merge_pseudos().

int lra_coalesce_iter
   The current iteration (1, 2, ...) of the coalescing pass.  
int * next_coalesced_pseudo
static
bitmap_head used_pseudos_bitmap
static
   Pseudos used instead of the coalesced pseudos.