|
LLVM 24.0.0git
|
#include "GCNVOPDUtils.h"#include "AMDGPUSubtarget.h"#include "GCNSubtarget.h"#include "SIInstrInfo.h"#include "Utils/AMDGPUBaseInfo.h"#include "llvm/ADT/SmallVector.h"#include "llvm/CodeGen/MachineBasicBlock.h"#include "llvm/CodeGen/MachineFunction.h"#include "llvm/CodeGen/MachineInstr.h"#include "llvm/CodeGen/MachineOperand.h"#include "llvm/CodeGen/MachineRegisterInfo.h"#include "llvm/CodeGen/MacroFusion.h"#include "llvm/CodeGen/ScheduleDAG.h"#include "llvm/CodeGen/ScheduleDAGMutation.h"#include "llvm/CodeGen/TargetInstrInfo.h"#include "llvm/MC/MCInst.h"Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "gcn-vopd-utils" |
Functions | |
| static const TargetRegisterClass * | getVOPDSrcRegClass (const SIInstrInfo &TII, int VOPDOpc, unsigned CompIdx, unsigned SrcIdx) |
| static bool | isValidVOPDSrc (const SIInstrInfo &TII, int VOPDOpc, unsigned CompIdx, unsigned SrcIdx, Register PhysSrcReg) |
| static const MachineOperand & | getNamedOp (const MachineInstr &MI, AMDGPU::OpName Name) |
| static bool | canMapVOP3PToVOPD (const MachineInstr &MI) |
| static bool | canMaterializeVOPDLiterals (const MachineFunction &MF) |
| static bool | checkVOPDRegConstraints (const SIInstrInfo &TII, const MachineInstr &MIX, const MachineInstr &MIY, bool IsVOPD3, bool AllowSameVGPR, SmallVectorImpl< VOPDLiteralFixup > &LiteralFixups) |
| static std::optional< VOPDMatchInfo > | tryMatchVOPDPairVariant (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, const SDep *) |
| 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. | |
| #define DEBUG_TYPE "gcn-vopd-utils" |
Definition at line 34 of file GCNVOPDUtils.cpp.
|
static |
Definition at line 84 of file GCNVOPDUtils.cpp.
References llvm::getImm(), getNamedOp(), llvm::MachineOperand::getReg(), isReg(), MI, llvm::SISrcMods::OP_SEL_1, and Opc.
Referenced by checkVOPDRegConstraints().
|
static |
Definition at line 108 of file GCNVOPDUtils.cpp.
References llvm::MachineFunction::getFunction(), llvm::MachineFunction::getProperties(), and llvm::Function::hasOptSize().
Referenced by checkVOPDRegConstraints().
|
static |
Definition at line 116 of file GCNVOPDUtils.cpp.
References assert(), llvm::SmallVectorImpl< T >::assign(), canMapVOP3PToVOPD(), canMaterializeVOPDLiterals(), llvm::dbgs(), llvm::MachineInstr::getDesc(), llvm::MachineOperand::getImm(), llvm::MachineInstr::getMF(), llvm::MachineInstr::getOpcode(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::MachineFunction::getSubtarget(), llvm::AMDGPU::getVOPDEncodingFamily(), llvm::AMDGPU::getVOPDFull(), llvm::AMDGPU::getVOPDInstInfo(), llvm::AMDGPU::getVOPDOpcode(), getVOPDSrcRegClass(), llvm::AMDGPU::hasNamedOperand(), Imm, llvm::SmallSet< T, N, C >::insert(), llvm::MachineOperand::isImm(), llvm::MachineOperand::isReg(), isValidVOPDSrc(), llvm::Literal, LLVM_DEBUG, MI, llvm::SISrcMods::NEG, Register, llvm::SmallSet< T, N, C >::size(), llvm::SmallVectorTemplateCommon< T, typename >::size(), TII, and TRI.
Referenced by tryMatchVOPDPairVariant().
|
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 398 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().
|
static |
|
static |
Definition at line 39 of file GCNVOPDUtils.cpp.
References assert(), llvm_unreachable, and TII.
Referenced by checkVOPDRegConstraints(), and isValidVOPDSrc().
|
static |
Definition at line 69 of file GCNVOPDUtils.cpp.
References llvm::MCRegisterClass::contains(), getVOPDSrcRegClass(), and TII.
Referenced by checkVOPDRegConstraints().
|
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 436 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().
|
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 358 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().
|
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 293 of file GCNVOPDUtils.cpp.
References checkVOPDRegConstraints(), llvm::AMDGPU::getCanBeVOPD(), llvm::MachineInstr::getOpcode(), Opc, TII, llvm::AMDGPU::CanBeVOPD::X, and llvm::AMDGPU::CanBeVOPD::Y.
Referenced by llvm::tryMatchVOPDPair().