LLVM 23.0.0git
llvm::Rematerializer::DependencyReuseInfo Struct Reference

When rematerializating a register (called the "root" register in this context) to a given position, we must decide what to do with all its rematerializable dependencies (for unrematerializable dependencies, we have no choice but to re-use the same register). More...

#include "llvm/CodeGen/Rematerializer.h"

Public Member Functions

DependencyReuseInforeuse (RegisterIdx DepIdx)
DependencyReuseInfouseRemat (RegisterIdx DepIdx, RegisterIdx DepRematIdx)
DependencyReuseInfoclear ()

Public Attributes

SmallDenseMap< RegisterIdx, RegisterIdx, 4 > DependencyMap
 Keys and values are rematerializable register indices.

Detailed Description

When rematerializating a register (called the "root" register in this context) to a given position, we must decide what to do with all its rematerializable dependencies (for unrematerializable dependencies, we have no choice but to re-use the same register).

For each rematerializable dependency we can either

  1. rematerialize it along with the register,
  2. re-use it as-is, or
  3. re-use a pre-existing rematerialization of it. In case 1, the same decision needs to be made for all of the dependency's dependencies. In cases 2 and 3, the dependency's dependencies need not be examined.

This struct allows to encode decisions of types (2) and (3) when rematerialization of all of the root's dependency DAG is undesirable. During rematerialization, registers in the root's dependency DAG which have a path to the root made up exclusively of non-re-used registers will be rematerialized along with the root.

Definition at line 264 of file Rematerializer.h.

Member Function Documentation

◆ clear()

DependencyReuseInfo & llvm::Rematerializer::DependencyReuseInfo::clear ( )
inline

Definition at line 292 of file Rematerializer.h.

References DependencyMap.

◆ reuse()

DependencyReuseInfo & llvm::Rematerializer::DependencyReuseInfo::reuse ( RegisterIdx DepIdx)
inline

Definition at line 284 of file Rematerializer.h.

References DependencyMap.

◆ useRemat()

DependencyReuseInfo & llvm::Rematerializer::DependencyReuseInfo::useRemat ( RegisterIdx DepIdx,
RegisterIdx DepRematIdx )
inline

Definition at line 288 of file Rematerializer.h.

References DependencyMap.

Member Data Documentation

◆ DependencyMap

SmallDenseMap<RegisterIdx, RegisterIdx, 4> llvm::Rematerializer::DependencyReuseInfo::DependencyMap

Keys and values are rematerializable register indices.

Before rematerialization, this only contains entries for non-root registers of the root's dependency DAG which should not be rematerialized i.e., for which an existing register should be used instead. These map each such non-root register to either the same register (case 2, DependencyReuseInfo::reuse) or to a rematerialization of the key register (case 3, DependencyReuseInfo::useRemat).

After rematerialization, this contains additional entries for non-root registers of the root's dependency DAG that needed to be rematerialized along the root. These map each such non-root register to their corresponding new rematerialization that is used in the rematerialized root's dependency DAG. It follows that the difference in map size before and after rematerialization indicates the number of non-root registers that were rematerialized along the root.

Definition at line 282 of file Rematerializer.h.

Referenced by clear(), llvm::Rematerializer::rematerializeToPos(), reuse(), and useRemat().


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