LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
llvm::LiveRegUnits Class Reference

#include <LiveRegUnits.h>

Public Member Functions

 LiveRegUnits ()
 Constructs a new empty LiveRegUnits set. More...
 
void init (const TargetRegisterInfo *TRI)
 
void clear ()
 
bool empty () const
 
void addReg (unsigned Reg, const MCRegisterInfo &MCRI)
 Adds a register to the set. More...
 
void removeReg (unsigned Reg, const MCRegisterInfo &MCRI)
 Removes a register from the set. More...
 
void removeRegsInMask (const MachineOperand &Op, const MCRegisterInfo &MCRI)
 Removes registers clobbered by the regmask operand Op. More...
 
bool contains (unsigned Reg, const MCRegisterInfo &MCRI) const
 Returns true if register Reg (or one of its super register) is contained in the set. More...
 
void stepBackward (const MachineInstr &MI, const MCRegisterInfo &MCRI)
 Simulates liveness when stepping backwards over an instruction(bundle): Remove Defs, add uses. More...
 
void stepForward (const MachineInstr &MI, const MCRegisterInfo &MCRI)
 Simulates liveness when stepping forward over an instruction(bundle): Remove killed-uses, add defs. More...
 
void addLiveIns (const MachineBasicBlock *MBB, const MCRegisterInfo &MCRI)
 Adds all registers in the live-in list of block BB. More...
 

Detailed Description

A set of live register units with functions to track liveness when walking backward/forward through a basic block.

Definition at line 31 of file LiveRegUnits.h.

Constructor & Destructor Documentation

llvm::LiveRegUnits::LiveRegUnits ( )
inline

Constructs a new empty LiveRegUnits set.

Definition at line 38 of file LiveRegUnits.h.

Member Function Documentation

void LiveRegUnits::addLiveIns ( const MachineBasicBlock MBB,
const MCRegisterInfo MCRI 
)

Adds all registers in the live-in list of block BB.

Definition at line 105 of file LiveRegUnits.cpp.

References addReg(), llvm::A64CC::LE, llvm::MachineBasicBlock::livein_begin(), and llvm::MachineBasicBlock::livein_end().

void llvm::LiveRegUnits::addReg ( unsigned  Reg,
const MCRegisterInfo MCRI 
)
inline
void llvm::LiveRegUnits::clear ( )
inline
bool llvm::LiveRegUnits::contains ( unsigned  Reg,
const MCRegisterInfo MCRI 
) const
inline

Returns true if register Reg (or one of its super register) is contained in the set.

Definition at line 66 of file LiveRegUnits.h.

References llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::count(), and llvm::MCRegisterInfo::DiffListIterator::isValid().

Referenced by RemoveKills(), and UpdatePredRedefs().

bool llvm::LiveRegUnits::empty ( ) const
inline
void llvm::LiveRegUnits::init ( const TargetRegisterInfo TRI)
inline
void llvm::LiveRegUnits::removeReg ( unsigned  Reg,
const MCRegisterInfo MCRI 
)
inline
void LiveRegUnits::removeRegsInMask ( const MachineOperand Op,
const MCRegisterInfo MCRI 
)

Removes registers clobbered by the regmask operand Op.

We assume the high bits of a physical super register are not preserved unless the instruction has an implicit-use operand reading the super-register or a register unit for the upper bits is available.

Definition at line 36 of file LiveRegUnits.cpp.

References llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::begin(), llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::end(), llvm::SparseSet< ValueT, KeyFunctorT, SparseT >::erase(), and operClobbersUnit().

Referenced by stepBackward(), and stepForward().

void LiveRegUnits::stepBackward ( const MachineInstr MI,
const MCRegisterInfo MCRI 
)

Simulates liveness when stepping backwards over an instruction(bundle): Remove Defs, add uses.

Definition at line 47 of file LiveRegUnits.cpp.

References addReg(), llvm::MachineOperandIteratorBase::isValid(), removeReg(), and removeRegsInMask().

void LiveRegUnits::stepForward ( const MachineInstr MI,
const MCRegisterInfo MCRI 
)

Simulates liveness when stepping forward over an instruction(bundle): Remove killed-uses, add defs.

Uses with kill flag get removed from the set, defs added. If possible use StepBackward() instead of this function because some kill flags may be missing.

Definition at line 76 of file LiveRegUnits.cpp.

References addReg(), llvm::MachineOperandIteratorBase::isValid(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), removeReg(), removeRegsInMask(), and llvm::SmallVectorTemplateCommon< T, typename >::size().


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