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

A rematerializable register defined by a single machine instruction. More...

#include "llvm/CodeGen/Rematerializer.h"

Classes

struct  Dependency
 A read register operand of DefMI that is rematerializable (according to the rematerializer). More...

Public Types

using RegionUsers = SmallDenseSet<MachineInstr *, 4>

Public Member Functions

Register getDefReg () const
 Returns the rematerializable register from its defining instruction.
bool hasUsersInDefRegion () const
bool hasUsersOutsideDefRegion () const
std::pair< MachineInstr *, MachineInstr * > getRegionUseBounds (unsigned UseRegion, const LiveIntervals &LIS) const
 Returns the first and last user of the register in region UseRegion.
bool isAlive () const

Public Attributes

MachineInstrDefMI
 Single MI defining the rematerializable register.
unsigned DefRegion
 Defining region of DefMI.
LaneBitmask Mask
 The rematerializable register's lane bitmask.
SmallDenseMap< unsigned, RegionUsers, 2 > Uses
 Uses of the register, mapped by region.
SmallVector< Dependency, 2 > Dependencies
 This register's rematerializable dependencies, one per unique rematerializable register operand.

Detailed Description

A rematerializable register defined by a single machine instruction.

A rematerializable register has a set of dependencies, which correspond to the unique read register operands of its defining instruction. They are identified by their machine operand index, and can themselves be rematerializable. Operand indices corresponding to unrematerializable dependencies are managed by and queried from the rematerializer.

A rematerializable register also has an arbitrary number of users in an arbitrary number of regions, potentially including its own defining region. When rematerializations lead to operand changes in users, a register may find itself without any user left, at which point the rematerializer marks it for deletion. Its defining instruction either becomes nullptr (without rollback support) or its opcode is set to TargetOpcode::DBG_VALUE (with rollback support) until Rematerializer::commitRematerializations is called.

Definition at line 128 of file Rematerializer.h.

Member Typedef Documentation

◆ RegionUsers

Member Function Documentation

◆ getDefReg()

Register llvm::Rematerializer::Reg::getDefReg ( ) const
inline

Returns the rematerializable register from its defining instruction.

Definition at line 156 of file Rematerializer.h.

References assert(), and DefMI.

Referenced by llvm::Rematerializer::printID(), llvm::Rematerializer::printRematReg(), and llvm::Rematerializer::updateLiveIntervals().

◆ getRegionUseBounds()

std::pair< MachineInstr *, MachineInstr * > Rematerializer::Reg::getRegionUseBounds ( unsigned UseRegion,
const LiveIntervals & LIS ) const

Returns the first and last user of the register in region UseRegion.

If the register has no user in the region, returns a pair of nullptr's.

Definition at line 638 of file Rematerializer.cpp.

References assert(), and Uses.

Referenced by llvm::Rematerializer::rematerializeToRegion().

◆ hasUsersInDefRegion()

bool llvm::Rematerializer::Reg::hasUsersInDefRegion ( ) const
inline

Definition at line 162 of file Rematerializer.h.

References DefRegion, and Uses.

◆ hasUsersOutsideDefRegion()

bool llvm::Rematerializer::Reg::hasUsersOutsideDefRegion ( ) const
inline

Definition at line 166 of file Rematerializer.h.

References DefRegion, and Uses.

◆ isAlive()

bool llvm::Rematerializer::Reg::isAlive ( ) const
inline

Definition at line 177 of file Rematerializer.h.

References DefMI.

Referenced by llvm::Rematerializer::reviveRegIfDead().

Member Data Documentation

◆ DefMI

◆ DefRegion

◆ Dependencies

SmallVector<Dependency, 2> llvm::Rematerializer::Reg::Dependencies

This register's rematerializable dependencies, one per unique rematerializable register operand.

Definition at line 153 of file Rematerializer.h.

Referenced by llvm::Rematerializer::reviveRegIfDead().

◆ Mask

LaneBitmask llvm::Rematerializer::Reg::Mask

The rematerializable register's lane bitmask.

Definition at line 134 of file Rematerializer.h.

◆ Uses

SmallDenseMap<unsigned, RegionUsers, 2> llvm::Rematerializer::Reg::Uses

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