LLVM 24.0.0git
llvm::RegisterOperands Class Reference

List of registers defined and used by a machine instruction. More...

#include "llvm/CodeGen/RegisterPressure.h"

Public Member Functions

LLVM_ABI void collect (const MachineInstr &MI, const TargetRegisterInfo &TRI, const MachineRegisterInfo &MRI, bool TrackLaneMasks, bool IgnoreDead)
 Analyze the given instruction MI and fill in the Uses, Defs and DeadDefs list based on the MachineOperand flags.
LLVM_ABI void detectDeadDefs (const MachineInstr &MI, LiveIntervals &LIS, const MachineRegisterInfo &MRI)
 Use liveness information to find dead defs at MI's dead slot not marked with a dead flag and move them to the DeadDefs vector.
LLVM_ABI void adjustLaneLiveness (LiveIntervals &LIS, const MachineRegisterInfo &MRI, SlotIndex Pos)
 Use liveness information to find out which uses/defs are partially undefined/dead at Pos and adjust the VRegMaskOrUnits accordingly.
LLVM_ABI void adjustLaneLiveness (LiveIntervals &LIS, const MachineRegisterInfo &MRI, MachineInstr &MI)
 Use liveness information to find out which uses/defs are partially undefined/dead at the MI's position and adjust the VRegMaskOrUnits accordingly.

Static Public Member Functions

static LLVM_ABI void restoreLivenessFlags (MachineInstr &MI, const TargetRegisterInfo &TRI, const MachineRegisterInfo &MRI, LiveIntervals &LIS, bool TrackLaneMasks=true, ArrayRef< Register > OnlyRegs={})
 Clear potentially-stale read-undef flags on the defs of MI, then recompute them from LIS.

Public Attributes

SmallVector< VRegMaskOrUnit, 8 > Uses
 List of virtual registers and register units read by the instruction.
SmallVector< VRegMaskOrUnit, 8 > Defs
 List of virtual registers and register units defined by the instruction which are not dead.
SmallVector< VRegMaskOrUnit, 8 > DeadDefs
 List of virtual registers and register units defined by the instruction but dead.

Detailed Description

List of registers defined and used by a machine instruction.

Definition at line 167 of file RegisterPressure.h.

Member Function Documentation

◆ adjustLaneLiveness() [1/2]

void RegisterOperands::adjustLaneLiveness ( LiveIntervals & LIS,
const MachineRegisterInfo & MRI,
MachineInstr & MI )

Use liveness information to find out which uses/defs are partially undefined/dead at the MI's position and adjust the VRegMaskOrUnits accordingly.

Missing read-undef and dead flags are added to MI.

Definition at line 603 of file RegisterPressure.cpp.

References llvm::VirtRegOrUnit::asVirtualReg(), llvm::SmallVectorTemplateCommon< T, typename >::back(), DeadDefs, Defs, llvm::SlotIndex::getDeadSlot(), llvm::LiveIntervals::getInstructionIndex(), llvm::LiveIntervals::getInterval(), getLiveLanesAt(), llvm::MachineRegisterInfo::getTargetRegisterInfo(), I, llvm::VirtRegOrUnit::isVirtualReg(), MI, llvm::LaneBitmask::none(), P, llvm::LiveRange::segments, and TRI.

◆ adjustLaneLiveness() [2/2]

◆ collect()

◆ detectDeadDefs()

void RegisterOperands::detectDeadDefs ( const MachineInstr & MI,
LiveIntervals & LIS,
const MachineRegisterInfo & MRI )

Use liveness information to find dead defs at MI's dead slot not marked with a dead flag and move them to the DeadDefs vector.

This only considers the merged live interval for defs, not the per-lane sub-ranges.

Definition at line 578 of file RegisterPressure.cpp.

References Defs, llvm::SlotIndex::getDeadSlot(), llvm::LiveIntervals::getInstructionIndex(), getLiveLanesAt(), I, and MI.

Referenced by llvm::ScheduleDAGDependencyBuilder::buildDeps(), llvm::RegPressureTracker::bumpUpwardPressure(), llvm::RegPressureTracker::recede(), restoreLivenessFlags(), and llvm::ScheduleDAGMILive::scheduleMI().

◆ restoreLivenessFlags()

void RegisterOperands::restoreLivenessFlags ( MachineInstr & MI,
const TargetRegisterInfo & TRI,
const MachineRegisterInfo & MRI,
LiveIntervals & LIS,
bool TrackLaneMasks = true,
ArrayRef< Register > OnlyRegs = {} )
static

Clear potentially-stale read-undef flags on the defs of MI, then recompute them from LIS.

The clear must come first because adjustLaneLiveness only adds flags. When OnlyRegs is non-empty, only subregister defs of those virtual registers are cleared (and the recompute is skipped when MI has none); otherwise all defs are cleared. This is used after moving an already-scheduled instruction, which can invalidate the flags set for its previous position.

Definition at line 641 of file RegisterPressure.cpp.

References adjustLaneLiveness(), assert(), collect(), detectDeadDefs(), llvm::ArrayRef< T >::empty(), llvm::MachineOperand::getReg(), llvm::MachineOperand::getSubReg(), llvm::is_contained(), llvm::Register::isVirtual(), MI, llvm::MachineOperand::setIsUndef(), and TRI.

Referenced by llvm::GCNSchedStage::modifyRegionSchedule(), llvm::GCNIterativeScheduler::restoreRegionLivenessFlags(), and llvm::GCNIterativeScheduler::scheduleRegion().

Member Data Documentation

◆ DeadDefs

SmallVector<VRegMaskOrUnit, 8> llvm::RegisterOperands::DeadDefs

List of virtual registers and register units defined by the instruction but dead.

Dead definitions should not necessarily be marked with a dead flag. In this context a dead definition is just a definition which doesn't define any register lane that remains live after the defining instruction.

Definition at line 179 of file RegisterPressure.h.

Referenced by adjustLaneLiveness(), llvm::RegPressureTracker::advance(), llvm::RegPressureTracker::bumpDownwardPressure(), llvm::RegPressureTracker::bumpUpwardPressure(), and llvm::RegPressureTracker::recede().

◆ Defs

◆ Uses


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