LLVM 20.0.0git
|
SI Implementation of TargetInstrInfo. More...
#include "SIInstrInfo.h"
#include "AMDGPU.h"
#include "AMDGPUInstrInfo.h"
#include "GCNHazardRecognizer.h"
#include "GCNSubtarget.h"
#include "SIMachineFunctionInfo.h"
#include "Utils/AMDGPUBaseInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/CodeGen/GlobalISel/GenericMachineInstrs.h"
#include "llvm/CodeGen/LiveIntervals.h"
#include "llvm/CodeGen/LiveVariables.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineScheduler.h"
#include "llvm/CodeGen/RegisterScavenging.h"
#include "llvm/CodeGen/ScheduleDAG.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/IntrinsicsAMDGPU.h"
#include "llvm/MC/MCContext.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Target/TargetMachine.h"
#include "AMDGPUGenInstrInfo.inc"
#include "AMDGPUGenSearchableTables.inc"
Go to the source code of this file.
Namespaces | |
namespace | llvm |
This is an optimization pass for GlobalISel generic memory operations. | |
namespace | llvm::AMDGPU |
Macros | |
#define | DEBUG_TYPE "si-instr-info" |
#define | GET_INSTRINFO_CTOR_DTOR |
#define | GET_D16ImageDimIntrinsics_IMPL |
#define | GET_ImageDimIntrinsicTable_IMPL |
#define | GET_RsrcIntrinsics_IMPL |
#define | GENERATE_RENAMED_GFX9_CASES(OPCODE) |
Variables | |
static cl::opt< unsigned > | BranchOffsetBits ("amdgpu-s-branch-bits", cl::ReallyHidden, cl::init(16), cl::desc("Restrict range of branch instructions (DEBUG)")) |
static cl::opt< bool > | Fix16BitCopies ("amdgpu-fix-16-bit-physreg-copies", cl::desc("Fix copies between 32 and 16 bit registers by extending to 32 bit"), cl::init(true), cl::ReallyHidden) |
static constexpr unsigned | ModifierOpNames [] |
SI Implementation of TargetInstrInfo.
Definition in file SIInstrInfo.cpp.
#define DEBUG_TYPE "si-instr-info" |
Definition at line 38 of file SIInstrInfo.cpp.
#define GENERATE_RENAMED_GFX9_CASES | ( | OPCODE | ) |
#define GET_D16ImageDimIntrinsics_IMPL |
Definition at line 44 of file SIInstrInfo.cpp.
#define GET_ImageDimIntrinsicTable_IMPL |
Definition at line 45 of file SIInstrInfo.cpp.
#define GET_INSTRINFO_CTOR_DTOR |
Definition at line 40 of file SIInstrInfo.cpp.
#define GET_RsrcIntrinsics_IMPL |
Definition at line 46 of file SIInstrInfo.cpp.
|
static |
Definition at line 5621 of file SIInstrInfo.cpp.
References llvm::SIInstrFlags::DS, llvm::SIRegisterInfo::getProperlyAlignedRC(), llvm::SIRegisterInfo::getRegClass(), llvm::MCInstrDesc::mayLoad(), llvm::MCInstrDesc::mayStore(), llvm::SIInstrFlags::MIMG, MRI, llvm::SIInstrFlags::Spill, and llvm::MCInstrDesc::TSFlags.
Referenced by llvm::SIInstrInfo::getOpRegClass(), and llvm::SIInstrInfo::getRegClass().
|
static |
Definition at line 107 of file SIInstrInfo.cpp.
References llvm::all_of(), llvm::SIInstrInfo::isSALU(), llvm::SIInstrInfo::isSDWA(), llvm::SIInstrInfo::isSMRD(), llvm::SIInstrInfo::isVOP1(), llvm::SIInstrInfo::isVOP2(), llvm::SIInstrInfo::isVOP3(), and MI.
Referenced by llvm::SIInstrInfo::isReallyTriviallyReMaterializable().
|
static |
Definition at line 4076 of file SIInstrInfo.cpp.
References MI.
Referenced by llvm::SIInstrInfo::isSchedulingBoundary().
|
static |
Definition at line 4350 of file SIInstrInfo.cpp.
References llvm::MachineOperand::getImm(), llvm::MachineOperand::getReg(), llvm::MachineOperand::getType(), llvm_unreachable, llvm::MachineOperand::MO_Immediate, and llvm::MachineOperand::MO_Register.
Referenced by llvm::SIInstrInfo::verifyInstruction().
|
static |
Definition at line 4487 of file SIInstrInfo.cpp.
References llvm::MachineOperand::isKill(), llvm::MachineOperand::isUndef(), and MI.
Referenced by llvm::SIInstrInfo::buildShrunkInst().
|
static |
Definition at line 6347 of file SIInstrInfo.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addMBB(), llvm::MachineInstrBuilder::addReg(), assert(), llvm::MachineBasicBlock::begin(), llvm::BuildMI(), DL, llvm::MachineBasicBlock::end(), llvm::MachineBasicBlock::getParent(), llvm::MachineFunction::getSubtarget(), llvm::getUndefRegState(), I, Idx, llvm::RegState::Kill, Merge, MRI, llvm::SmallVectorTemplateBase< T, bool >::push_back(), RegSize, TII, and TRI.
Referenced by loadMBUFScalarOperandsFromVGPR().
|
static |
Definition at line 749 of file SIInstrInfo.cpp.
References llvm::MachineInstr::addOperand(), llvm::MachineInstrBuilder::addReg(), assert(), llvm::BuildMI(), llvm::MachineOperand::CreateReg(), DL, llvm::SIRegisterInfo::getChannelFromSubReg(), llvm::SIRegisterInfo::getRegSplitParts(), llvm::SIRegisterInfo::getSubRegFromChannel(), I, Idx, llvm::RegState::Implicit, MBB, MI, llvm::ArrayRef< T >::size(), std::swap(), and TII.
Referenced by llvm::SIInstrInfo::copyPhysReg().
|
static |
Definition at line 6598 of file SIInstrInfo.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::MachineBasicBlock::getParent(), llvm::MachineFunction::getRegInfo(), llvm::Hi_32(), llvm::Lo_32(), MBB, MI, MRI, and TII.
Referenced by llvm::SIInstrInfo::legalizeOperands().
|
static |
Definition at line 4571 of file SIInstrInfo.cpp.
References MI.
Referenced by llvm::SIInstrInfo::legalizeOperandsVOP2(), and llvm::SIInstrInfo::verifyInstruction().
|
static |
Definition at line 9390 of file SIInstrInfo.cpp.
References getRegOrUndef(), llvm::getRegSequenceSubReg(), MI, llvm::TargetInstrInfo::RegSubRegPair::Reg, and llvm::TargetInstrInfo::RegSubRegPair::SubReg.
Referenced by llvm::getVRegSubRegDef().
Definition at line 1850 of file SIInstrInfo.cpp.
References llvm_unreachable, and Size.
Referenced by getVectorRegSpillRestoreOpcode().
Definition at line 1624 of file SIInstrInfo.cpp.
References llvm_unreachable, and Size.
Referenced by getVectorRegSpillSaveOpcode().
Definition at line 1885 of file SIInstrInfo.cpp.
References llvm_unreachable, and Size.
Referenced by getVectorRegSpillRestoreOpcode().
Definition at line 1659 of file SIInstrInfo.cpp.
References llvm_unreachable, and Size.
Referenced by getVectorRegSpillSaveOpcode().
|
static |
Definition at line 3787 of file SIInstrInfo.cpp.
References DefMI, getFoldableImm(), llvm::MachineOperand::getParent(), llvm::MachineBasicBlock::getParent(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::MachineOperand::isReg(), and MRI.
|
static |
Definition at line 3773 of file SIInstrInfo.cpp.
References DefMI, llvm::SIInstrInfo::isFoldableCopy(), and MRI.
Referenced by llvm::SIInstrInfo::convertToThreeAddress(), getFoldableImm(), and llvm::SIInstrInfo::optimizeCompareInstr().
Definition at line 1492 of file SIInstrInfo.cpp.
References llvm_unreachable.
Referenced by llvm::SIInstrInfo::getIndirectRegWriteMovRelPseudo().
Definition at line 1521 of file SIInstrInfo.cpp.
References llvm_unreachable.
Referenced by llvm::SIInstrInfo::getIndirectRegWriteMovRelPseudo().
Definition at line 1463 of file SIInstrInfo.cpp.
References llvm_unreachable.
Referenced by llvm::SIInstrInfo::getIndirectRegWriteMovRelPseudo().
Definition at line 73 of file SIInstrInfo.cpp.
References N.
Referenced by llvm::SIInstrInfo::areLoadsFromSameBasePtr().
|
static |
Definition at line 9371 of file SIInstrInfo.cpp.
References assert(), llvm::getRegSubRegPair(), llvm::MachineOperand::isReg(), and llvm::MachineOperand::isUndef().
Referenced by followSubRegDef(), and llvm::getRegSequenceSubReg().
Definition at line 1780 of file SIInstrInfo.cpp.
References llvm_unreachable, and Size.
Referenced by llvm::SIInstrInfo::loadRegFromStackSlot().
Definition at line 1554 of file SIInstrInfo.cpp.
References llvm_unreachable, and Size.
Referenced by llvm::SIInstrInfo::storeRegToStackSlot().
|
static |
Definition at line 1933 of file SIInstrInfo.cpp.
References llvm::SIMachineFunctionInfo::checkFlag(), getAGPRSpillRestoreOpcode(), getAVSpillRestoreOpcode(), getVGPRSpillRestoreOpcode(), getWWMRegSpillRestoreOpcode(), Size, TRI, and llvm::AMDGPU::VirtRegFlag::WWM_REG.
Referenced by llvm::SIInstrInfo::loadRegFromStackSlot().
|
static |
Definition at line 1706 of file SIInstrInfo.cpp.
References llvm::SIMachineFunctionInfo::checkFlag(), getAGPRSpillSaveOpcode(), getAVSpillSaveOpcode(), getVGPRSpillSaveOpcode(), getWWMRegSpillSaveOpcode(), Size, TRI, and llvm::AMDGPU::VirtRegFlag::WWM_REG.
Referenced by llvm::SIInstrInfo::storeRegToStackSlot().
Definition at line 1815 of file SIInstrInfo.cpp.
References llvm_unreachable, and Size.
Referenced by getVectorRegSpillRestoreOpcode().
Definition at line 1589 of file SIInstrInfo.cpp.
References llvm_unreachable, and Size.
Referenced by getVectorRegSpillSaveOpcode().
Definition at line 1920 of file SIInstrInfo.cpp.
References llvm_unreachable, and Size.
Referenced by getVectorRegSpillRestoreOpcode().
Definition at line 1694 of file SIInstrInfo.cpp.
References llvm_unreachable, and Size.
Referenced by getVectorRegSpillSaveOpcode().
|
static |
Handle copying from SGPR to AGPR, or from AGPR to AGPR on GFX908.
It is not possible to have a direct copy in these cases on GFX908, so an intermediate VGPR copy is required.
Definition at line 630 of file SIInstrInfo.cpp.
References llvm::MachineInstrBuilder::add(), llvm::MachineInstrBuilder::addReg(), assert(), llvm::RegScavenger::backward(), llvm::MachineBasicBlock::begin(), llvm::BuildMI(), contains(), llvm::RegState::Define, DL, llvm::RegScavenger::enterBasicBlockEnd(), llvm::SIRegisterInfo::getHWRegIndex(), llvm::MachineFunction::getInfo(), llvm::getKillRegState(), llvm::MachineBasicBlock::getParent(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::SIRegisterInfo::getRegPressureLimit(), I, llvm::RegState::Implicit, llvm::MachineOperand::isImm(), llvm::MachineOperand::isReg(), llvm::MachineRegisterInfo::isReserved(), llvm::RegState::Kill, MBB, MI, llvm::RegScavenger::scavengeRegisterBackwards(), llvm::MachineOperand::setIsKill(), llvm::RegScavenger::setRegUsed(), and TII.
Referenced by llvm::SIInstrInfo::copyPhysReg().
|
static |
Definition at line 4615 of file SIInstrInfo.cpp.
References llvm::MachineOperand::isFI(), and llvm::MachineOperand::isReg().
Referenced by llvm::SIInstrInfo::verifyInstruction().
|
static |
Definition at line 9282 of file SIInstrInfo.cpp.
References GENERATE_RENAMED_GFX9_CASES.
Referenced by llvm::SIInstrInfo::pseudoToMCOpcode().
Definition at line 344 of file SIInstrInfo.cpp.
Referenced by llvm::SIInstrInfo::getMemOperandsWithOffsetWidth().
|
static |
Definition at line 4619 of file SIInstrInfo.cpp.
References llvm::MachineOperand::getReg(), SubReg, and TRI.
Referenced by llvm::SIInstrInfo::verifyInstruction().
|
static |
Definition at line 6491 of file SIInstrInfo.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::DominatorTreeBase< NodeT, IsPostDom >::addNewBlock(), llvm::MachineInstrBuilder::addReg(), llvm::MachineBasicBlock::addSuccessor(), llvm::MachineBasicBlock::begin(), llvm::BuildMI(), llvm::DominatorTreeBase< NodeT, IsPostDom >::changeImmediateDominator(), llvm::MachineBasicBlock::computeRegisterLiveness(), llvm::MachineFunction::CreateMachineBasicBlock(), DL, emitLoadScalarOpsFromVGPRLoop(), llvm::MachineBasicBlock::end(), End, llvm::First, llvm::MachineBasicBlock::getParent(), llvm::MachineFunction::getRegInfo(), llvm::MachineFunction::getSubtarget(), I, llvm::MachineFunction::insert(), llvm::RegState::Kill, llvm::MachineBasicBlock::LQR_Dead, MBB, MBBI, MI, MRI, llvm::DominatorTreeBase< NodeT, IsPostDom >::properlyDominates(), llvm::MachineBasicBlock::splice(), llvm::MachineBasicBlock::successors(), TII, llvm::MachineBasicBlock::transferSuccessorsAndUpdatePHIs(), and TRI.
Referenced by llvm::SIInstrInfo::legalizeOperands().
|
static |
Definition at line 3665 of file SIInstrInfo.cpp.
References I, and llvm::ArrayRef< T >::size().
|
static |
Definition at line 518 of file SIInstrInfo.cpp.
References llvm::ArrayRef< T >::front(), llvm::getUnderlyingObject(), llvm::MachineInstr::hasOneMemOperand(), and llvm::MachineInstr::memoperands_begin().
Referenced by llvm::SIInstrInfo::shouldClusterMemOps(), and llvm::RISCVInstrInfo::shouldClusterMemOps().
Returns true if both nodes have the same value for the given operand Op
, or if both nodes do not have this operand.
Definition at line 82 of file SIInstrInfo.cpp.
References llvm::SDNode::getMachineOpcode(), llvm::AMDGPU::getNamedOperandIdx(), and llvm::SDNode::getOperand().
Referenced by llvm::SIInstrInfo::areLoadsFromSameBasePtr().
|
static |
Definition at line 3676 of file SIInstrInfo.cpp.
References llvm::LocationSize::getValue(), and llvm::LocationSize::hasValue().
|
static |
Definition at line 3133 of file SIInstrInfo.cpp.
References llvm::MachineOperand::isKill(), llvm::MachineOperand::isUndef(), llvm::MachineOperand::setIsKill(), and llvm::MachineOperand::setIsUndef().
Referenced by llvm::SIInstrInfo::insertBranch(), and llvm::SIInstrInfo::insertSelect().
|
static |
Definition at line 613 of file SIInstrInfo.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::CallingConv::C, DL, llvm::DS_Error, llvm::Function::getContext(), llvm::MachineFunction::getFunction(), llvm::getKillRegState(), llvm::MachineBasicBlock::getParent(), MBB, MI, and TII.
Referenced by llvm::SIInstrInfo::copyPhysReg().
|
static |
Definition at line 149 of file SIInstrInfo.cpp.
References llvm::Register::isVirtual(), MI, and MRI.
Referenced by llvm::SIInstrInfo::isIgnorableUse().
|
static |
Definition at line 4593 of file SIInstrInfo.cpp.
References llvm::SIInstrInfo::isSALU(), llvm::SIInstrInfo::isSMRD(), llvm::SIInstrInfo::isVALU(), and MI.
Referenced by llvm::SIInstrInfo::verifyInstruction().
|
static |
Definition at line 9235 of file SIInstrInfo.cpp.
References llvm::AMDGPUSubtarget::GFX10, llvm::SIEncodingFamily::GFX10, llvm::AMDGPUSubtarget::GFX11, llvm::SIEncodingFamily::GFX11, llvm::AMDGPUSubtarget::GFX12, llvm::SIEncodingFamily::GFX12, llvm::AMDGPUSubtarget::GFX9, llvm_unreachable, llvm::AMDGPUSubtarget::SEA_ISLANDS, llvm::SIEncodingFamily::SI, llvm::AMDGPUSubtarget::SOUTHERN_ISLANDS, llvm::SIEncodingFamily::VI, and llvm::AMDGPUSubtarget::VOLCANIC_ISLANDS.
Referenced by llvm::SIInstrInfo::pseudoToMCOpcode().
|
static |
Definition at line 2723 of file SIInstrInfo.cpp.
References llvm::MachineOperand::ChangeToFrameIndex(), llvm::MachineOperand::ChangeToGA(), llvm::MachineOperand::ChangeToImmediate(), llvm::MachineOperand::ChangeToRegister(), llvm::MachineOperand::getGlobal(), llvm::MachineOperand::getImm(), llvm::MachineOperand::getIndex(), llvm::MachineOperand::getOffset(), llvm::MachineOperand::getReg(), llvm::MachineOperand::getSubReg(), llvm::MachineOperand::getTargetFlags(), llvm::MachineOperand::isDead(), IsDead, llvm::MachineOperand::isDebug(), llvm::MachineOperand::isFI(), llvm::MachineOperand::isGlobal(), llvm::MachineOperand::isImm(), llvm::MachineOperand::isKill(), llvm::MachineOperand::isUndef(), MI, llvm::MachineOperand::setSubReg(), llvm::MachineOperand::setTargetFlags(), and SubReg.
Referenced by llvm::SIInstrInfo::commuteInstructionImpl().
|
static |
Definition at line 3796 of file SIInstrInfo.cpp.
References I, MI, and llvm::LiveVariables::replaceKillInstruction().
Referenced by llvm::SIInstrInfo::convertToThreeAddress().
|
static |
Referenced by llvm::SIInstrInfo::isBranchOffsetInRange().
|
static |
Referenced by llvm::SIInstrInfo::copyPhysReg().
|
staticconstexpr |
Definition at line 3377 of file SIInstrInfo.cpp.
Referenced by llvm::SIInstrInfo::hasAnyModifiersSet(), and llvm::SIInstrInfo::removeModOperands().