GCC Middle and Back End API Reference
[struct].stats Struct Reference

Data Fields

int moves_inserted
int copies_inserted
int insns_deleted

Detailed Description

Post reload partially redundant load elimination
   Copyright (C) 2004-2026 Free Software Foundation, Inc.

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/>.   
The following code implements gcse after reload, the purpose of this
  pass is to cleanup redundant loads generated by reload and other
  optimizations that come after gcse. It searches for simple inter-block
  redundancies and tries to eliminate them by adding moves and loads
  in cold places.

  Perform partially redundant load elimination, try to eliminate redundant
  loads created by the reload pass.  We try to look for full or partial
  redundant loads fed by one or more loads/stores in predecessor BBs,
  and try adding loads to make them fully redundant.  We also check if
  it's worth adding loads to be able to delete the redundant load.

  Algorithm:
  1. Build available expressions hash table:
      For each load/store instruction, if the loaded/stored memory didn't
      change until the end of the basic block add this memory expression to
      the hash table.
  2. Perform Redundancy elimination:
     For each load instruction do the following:
        perform partial redundancy elimination, check if it's worth adding
        loads to make the load fully redundant.  If so add loads and
        register copies and delete the load.
  3. Delete instructions made redundant in step 2.

  Future enhancement:
    If the loaded register is used/defined between load and some store,
    look for some other free register between load and all its stores,
    and replace the load with a copy from this register to the loaded
    register.
Keep statistics of this pass.   

Field Documentation

◆ copies_inserted

int [struct].stats copies_inserted

◆ insns_deleted

int [struct].stats insns_deleted

◆ moves_inserted

int [struct].stats moves_inserted

The documentation for this struct was generated from the following files: