LLVM 23.0.0git
GCNVOPDUtils.cpp File Reference

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "gcn-vopd-utils"

Functions

static std::optional< VOPDMatchInfotryMatchVOPDPairVariant (const SIInstrInfo &TII, unsigned EncodingFamily, MachineInstr &FirstMI, MachineInstr &SecondMI, bool IsVOPD3)
 Core pair-eligibility check for a single VOPD encoding variant (VOPD or VOPD3).
static bool shouldScheduleVOPDAdjacent (const TargetInstrInfo &TII, const TargetSubtargetInfo &TSI, const MachineInstr *FirstMI, const MachineInstr &SecondMI)
 Check if the instr pair, FirstMI and SecondMI, should be scheduled together.
static void collectLoads (SmallPtrSet< SUnit *, 8 > &Loads, BitVector &Visited, SUnit &Head, bool Forward, bool StopAtLoads)
 Collect all load (dependents if Forward else dependencies) that connect to the Head SU.
static bool loadsMayOverlap (SUnit &I, const SmallPtrSet< SUnit *, 8 > &ILoadSuccs, SUnit &J, BitVector &LoadPredsComputed, SmallVector< SmallPtrSet< SUnit *, 8 > > &LoadPredsCache, BitVector &Scratch)
 Checks whether fusing SU I with SU J would force the loads preceding J to complete before loads depending on I.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "gcn-vopd-utils"

Definition at line 35 of file GCNVOPDUtils.cpp.

Function Documentation

◆ collectLoads()

void collectLoads ( SmallPtrSet< SUnit *, 8 > & Loads,
BitVector & Visited,
SUnit & Head,
bool Forward,
bool StopAtLoads )
static

Collect all load (dependents if Forward else dependencies) that connect to the Head SU.

Visited should allocate enough bits for the number of SUnits, but its value can otherwise be uninitialized.

Definition at line 271 of file GCNVOPDUtils.cpp.

References llvm::SDep::Data, llvm::SUnit::getInstr(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::SUnit::isBoundaryNode(), llvm::SUnit::isInstr(), llvm::MachineInstr::mayLoad(), llvm::SUnit::NodeNum, llvm::SUnit::Preds, llvm::BitVector::reset(), llvm::BitVector::set(), llvm::SUnit::Succs, and llvm::BitVector::test().

Referenced by loadsMayOverlap().

◆ loadsMayOverlap()

bool loadsMayOverlap ( SUnit & I,
const SmallPtrSet< SUnit *, 8 > & ILoadSuccs,
SUnit & J,
BitVector & LoadPredsComputed,
SmallVector< SmallPtrSet< SUnit *, 8 > > & LoadPredsCache,
BitVector & Scratch )
static

Checks whether fusing SU I with SU J would force the loads preceding J to complete before loads depending on I.

ILoadSuccs should hold all first load successors of I (via collectLoads with StopAtLoads=true). For set bits in LoadPredsComputed, the corresponding set in LoadPredsCache should hold all transitive load dependencies (via collectLoads with StopAtLoads=false). The Scratch bitvector should allocate enough bits for the number of SUnits.

Definition at line 309 of file GCNVOPDUtils.cpp.

References collectLoads(), llvm::SmallPtrSetImpl< PtrType >::contains(), llvm::dbgs(), llvm::SmallPtrSetImplBase::empty(), I, LLVM_DEBUG, llvm::SUnit::NodeNum, llvm::BitVector::set(), and llvm::BitVector::test().

◆ shouldScheduleVOPDAdjacent()

bool shouldScheduleVOPDAdjacent ( const TargetInstrInfo & TII,
const TargetSubtargetInfo & TSI,
const MachineInstr * FirstMI,
const MachineInstr & SecondMI )
static

Check if the instr pair, FirstMI and SecondMI, should be scheduled together.

Given SecondMI, when FirstMI is unspecified, then check if SecondMI may be part of a fused pair at all.

Definition at line 232 of file GCNVOPDUtils.cpp.

References assert(), llvm::AMDGPU::getCanBeVOPD(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getParent(), llvm::SIInstrInfo::getSubtarget(), llvm::AMDGPU::getVOPDEncodingFamily(), TII, llvm::tryMatchVOPDPair(), llvm::AMDGPU::CanBeVOPD::X, and llvm::AMDGPU::CanBeVOPD::Y.

Referenced by llvm::createVOPDPairingMutation().

◆ tryMatchVOPDPairVariant()

std::optional< VOPDMatchInfo > tryMatchVOPDPairVariant ( const SIInstrInfo & TII,
unsigned EncodingFamily,
MachineInstr & FirstMI,
MachineInstr & SecondMI,
bool IsVOPD3 )
static

Core pair-eligibility check for a single VOPD encoding variant (VOPD or VOPD3).

Returns the X/Y assignment on success, or std::nullopt otherwise.

Definition at line 175 of file GCNVOPDUtils.cpp.

References llvm::checkVOPDRegConstraints(), llvm::AMDGPU::getCanBeVOPD(), llvm::MachineInstr::getOpcode(), Opc, TII, llvm::AMDGPU::CanBeVOPD::X, and llvm::AMDGPU::CanBeVOPD::Y.

Referenced by llvm::tryMatchVOPDPair().