LLVM API Documentation

Public Member Functions | Static Public Member Functions
llvm::SIInstrInfo Class Reference

#include <SIInstrInfo.h>

Inheritance diagram for llvm::SIInstrInfo:
Inheritance graph
[legend]
Collaboration diagram for llvm::SIInstrInfo:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SIInstrInfo (const AMDGPUSubtarget &st)
const SIRegisterInfogetRegisterInfo () const override
bool areLoadsFromSameBasePtr (SDNode *Load1, SDNode *Load2, int64_t &Offset1, int64_t &Offset2) const override
bool getLdStBaseRegImmOfs (MachineInstr *LdSt, unsigned &BaseReg, unsigned &Offset, const TargetRegisterInfo *TRI) const final
bool shouldClusterLoads (MachineInstr *FirstLdSt, MachineInstr *SecondLdSt, unsigned NumLoads) const final
void copyPhysReg (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, DebugLoc DL, unsigned DestReg, unsigned SrcReg, bool KillSrc) const override
void storeRegToStackSlot (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const override
void loadRegFromStackSlot (MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const override
bool expandPostRAPseudo (MachineBasicBlock::iterator MI) const override
unsigned commuteOpcode (unsigned Opcode) const
MachineInstrcommuteInstruction (MachineInstr *MI, bool NewMI=false) const override
bool isTriviallyReMaterializable (const MachineInstr *MI, AliasAnalysis *AA=nullptr) const
MachineInstrbuildMovInstr (MachineBasicBlock *MBB, MachineBasicBlock::iterator I, unsigned DstReg, unsigned SrcReg) const override
 Build a MOV instruction.
bool isMov (unsigned Opcode) const override
bool isSafeToMoveRegClassDefs (const TargetRegisterClass *RC) const override
bool isDS (uint16_t Opcode) const
bool isMIMG (uint16_t Opcode) const
bool isSMRD (uint16_t Opcode) const
bool isMUBUF (uint16_t Opcode) const
bool isMTBUF (uint16_t Opcode) const
bool isFLAT (uint16_t Opcode) const
bool isVOP1 (uint16_t Opcode) const
bool isVOP2 (uint16_t Opcode) const
bool isVOP3 (uint16_t Opcode) const
bool isVOPC (uint16_t Opcode) const
bool isInlineConstant (const APInt &Imm) const
bool isInlineConstant (const MachineOperand &MO) const
bool isLiteralConstant (const MachineOperand &MO) const
bool isImmOperandLegal (const MachineInstr *MI, unsigned OpNo, const MachineOperand &MO) const
bool hasVALU32BitEncoding (unsigned Opcode) const
 Return true if this 64-bit VALU instruction has a 32-bit encoding. This function will return false if you pass it a 32-bit instruction.
bool hasModifiers (unsigned Opcode) const
 Return true if this instruction has any modifiers. e.g. src[012]_mod, omod, clamp.
bool verifyInstruction (const MachineInstr *MI, StringRef &ErrInfo) const override
bool isSALUInstr (const MachineInstr &MI) const
bool isSALUOpSupportedOnVALU (const MachineInstr &MI) const
const TargetRegisterClassgetOpRegClass (const MachineInstr &MI, unsigned OpNo) const
 Return the correct register class for OpNo. For target-specific instructions, this will return the register class that has been defined in tablegen. For generic instructions, like REG_SEQUENCE it will return the register class of its machine operand. to infer the correct register class base on the other operands.
bool canReadVGPR (const MachineInstr &MI, unsigned OpNo) const
void legalizeOpWithMove (MachineInstr *MI, unsigned OpIdx) const
 Legalize the OpIndex operand of this instruction by inserting a MOV. For example: ADD_I32_e32 VGPR0, 15 to MOV VGPR1, 15 ADD_I32_e32 VGPR0, VGPR1.
bool isOperandLegal (const MachineInstr *MI, unsigned OpIdx, const MachineOperand *MO=nullptr) const
 Check if MO is a legal operand if it was the OpIdx Operand for MI.
void legalizeOperands (MachineInstr *MI) const
 Legalize all operands in this instruction. This function may create new instruction and insert them before MI.
void splitSMRD (MachineInstr *MI, const TargetRegisterClass *HalfRC, unsigned HalfImmOp, unsigned HalfSGPROp, MachineInstr *&Lo, MachineInstr *&Hi) const
 Split an SMRD instruction into two smaller loads of half the.
void moveSMRDToVALU (MachineInstr *MI, MachineRegisterInfo &MRI) const
void moveToVALU (MachineInstr &MI) const
 Replace this instruction's opcode with the equivalent VALU opcode. This function will also move the users of MI to the VALU if necessary.
unsigned calculateIndirectAddress (unsigned RegIndex, unsigned Channel) const override
 Calculate the "Indirect Address" for the given RegIndex and Channel.
const TargetRegisterClassgetIndirectAddrRegClass () const override
MachineInstrBuilder buildIndirectWrite (MachineBasicBlock *MBB, MachineBasicBlock::iterator I, unsigned ValueReg, unsigned Address, unsigned OffsetReg) const override
 Build instruction(s) for an indirect register write.
MachineInstrBuilder buildIndirectRead (MachineBasicBlock *MBB, MachineBasicBlock::iterator I, unsigned ValueReg, unsigned Address, unsigned OffsetReg) const override
 Build instruction(s) for an indirect register read.
void reserveIndirectRegisters (BitVector &Reserved, const MachineFunction &MF) const
void LoadM0 (MachineInstr *MoveRel, MachineBasicBlock::iterator I, unsigned SavReg, unsigned IndexReg) const
void insertNOPs (MachineBasicBlock::iterator MI, int Count) const
MachineOperandgetNamedOperand (MachineInstr &MI, unsigned OperandName) const
 Returns the operand named Op. If MI does not have an operand named Op, this function returns nullptr.

Static Public Member Functions

static bool canFoldOffset (unsigned OffsetSize, unsigned AS) LLVM_READNONE
 Return true if the given offset Size in bytes can be folded into the immediate offsets of a memory instruction for the given address space.
static unsigned getVALUOp (const MachineInstr &MI)

Detailed Description

Definition at line 24 of file SIInstrInfo.h.


Constructor & Destructor Documentation

Definition at line 28 of file SIInstrInfo.cpp.


Member Function Documentation

bool SIInstrInfo::areLoadsFromSameBasePtr ( SDNode Load1,
SDNode Load2,
int64_t &  Offset1,
int64_t &  Offset2 
) const [override]
MachineInstrBuilder SIInstrInfo::buildIndirectRead ( MachineBasicBlock MBB,
MachineBasicBlock::iterator  I,
unsigned  ValueReg,
unsigned  Address,
unsigned  OffsetReg 
) const [override, virtual]

Build instruction(s) for an indirect register read.

Returns:
The instruction that performs the indirect register read

Implements llvm::AMDGPUInstrInfo.

Definition at line 1972 of file SIInstrInfo.cpp.

References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addOperand(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), llvm::MachineBasicBlock::findDebugLoc(), llvm::AMDGPUInstrInfo::getIndirectIndexBegin(), and llvm::MachineBasicBlock::getParent().

MachineInstrBuilder SIInstrInfo::buildIndirectWrite ( MachineBasicBlock MBB,
MachineBasicBlock::iterator  I,
unsigned  ValueReg,
unsigned  Address,
unsigned  OffsetReg 
) const [override, virtual]
MachineInstr * SIInstrInfo::buildMovInstr ( MachineBasicBlock MBB,
MachineBasicBlock::iterator  I,
unsigned  DstReg,
unsigned  SrcReg 
) const [override, virtual]

Build a MOV instruction.

Implements llvm::AMDGPUInstrInfo.

Definition at line 600 of file SIInstrInfo.cpp.

References llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), and llvm::MachineBasicBlock::findDebugLoc().

unsigned SIInstrInfo::calculateIndirectAddress ( unsigned  RegIndex,
unsigned  Channel 
) const [override, virtual]

Calculate the "Indirect Address" for the given RegIndex and Channel.

We model indirect addressing using a virtual address space that can be accesed with loads and stores. The "Indirect Address" is the memory address in this virtual address space that maps to the given RegIndex and Channel.

Implements llvm::AMDGPUInstrInfo.

Definition at line 1770 of file SIInstrInfo.cpp.

bool SIInstrInfo::canFoldOffset ( unsigned  OffsetSize,
unsigned  AS 
) [static]

Return true if the given offset Size in bytes can be folded into the immediate offsets of a memory instruction for the given address space.

Definition at line 761 of file SIInstrInfo.cpp.

References AMDGPUAS::CONSTANT_ADDRESS, AMDGPUAS::GLOBAL_ADDRESS, llvm::isUInt< 16 >(), llvm::isUInt< 8 >(), AMDGPUAS::LOCAL_ADDRESS, AMDGPUAS::PRIVATE_ADDRESS, and AMDGPUAS::REGION_ADDRESS.

Returns:
true if it is legal for the operand at index OpNo to read a VGPR.

Definition at line 1014 of file SIInstrInfo.cpp.

References llvm::TargetOpcode::COPY, llvm::MachineInstr::getOpcode(), getOpRegClass(), llvm::SIRegisterInfo::hasVGPRs(), llvm::TargetOpcode::INSERT_SUBREG, llvm::TargetOpcode::PHI, and llvm::TargetOpcode::REG_SEQUENCE.

Referenced by moveToVALU().

MachineInstr * SIInstrInfo::commuteInstruction ( MachineInstr MI,
bool  NewMI = false 
) const [override]

Definition at line 422 of file SIInstrInfo.cpp.

References llvm::AMDGPU::getCommuteOrig(), and llvm::AMDGPU::getCommuteRev().

Referenced by commuteInstruction().

void SIInstrInfo::copyPhysReg ( MachineBasicBlock MBB,
MachineBasicBlock::iterator  MI,
DebugLoc  DL,
unsigned  DestReg,
unsigned  SrcReg,
bool  KillSrc 
) const [override]
Returns:
The register class to be used for loading and storing values from an "Indirect Address" .

Implements llvm::AMDGPUInstrInfo.

Definition at line 1776 of file SIInstrInfo.cpp.

bool SIInstrInfo::getLdStBaseRegImmOfs ( MachineInstr LdSt,
unsigned BaseReg,
unsigned Offset,
const TargetRegisterInfo TRI 
) const

Returns the operand named Op. If MI does not have an operand named Op, this function returns nullptr.

Definition at line 2018 of file SIInstrInfo.cpp.

References llvm::AMDGPU::getNamedOperandIdx(), llvm::MachineInstr::getOpcode(), and llvm::MachineInstr::getOperand().

Referenced by canShrink(), commuteInstruction(), foldImmediates(), getLdStBaseRegImmOfs(), legalizeOperands(), and splitSMRD().

Return the correct register class for OpNo. For target-specific instructions, this will return the register class that has been defined in tablegen. For generic instructions, like REG_SEQUENCE it will return the register class of its machine operand. to infer the correct register class base on the other operands.

Definition at line 1002 of file SIInstrInfo.cpp.

References llvm::MCInstrDesc::getNumOperands(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineInstr::getParent(), llvm::MachineBasicBlock::getParent(), llvm::MachineOperand::getReg(), llvm::MachineRegisterInfo::getRegClass(), llvm::MachineFunction::getRegInfo(), llvm::MachineInstr::isVariadic(), llvm::MCInstrDesc::OpInfo, and llvm::MCOperandInfo::RegClass.

Referenced by canReadVGPR(), getLdStBaseRegImmOfs(), legalizeOperands(), and moveToVALU().

const SIRegisterInfo& llvm::SIInstrInfo::getRegisterInfo ( ) const [inline, override, virtual]

Implements llvm::AMDGPUInstrInfo.

Definition at line 61 of file SIInstrInfo.h.

Referenced by foldImmediates().

Return true if this instruction has any modifiers. e.g. src[012]_mod, omod, clamp.

Definition at line 787 of file SIInstrInfo.cpp.

References llvm::AMDGPU::getNamedOperandIdx().

Return true if this 64-bit VALU instruction has a 32-bit encoding. This function will return false if you pass it a 32-bit instruction.

Definition at line 783 of file SIInstrInfo.cpp.

References llvm::AMDGPU::getVOPe32().

bool SIInstrInfo::isDS ( uint16_t  Opcode) const
bool SIInstrInfo::isFLAT ( uint16_t  Opcode) const

Definition at line 664 of file SIInstrInfo.cpp.

References SIInstrFlags::FLAT.

bool SIInstrInfo::isMIMG ( uint16_t  Opcode) const
bool SIInstrInfo::isMov ( unsigned  Opcode) const [override, virtual]

Implements llvm::AMDGPUInstrInfo.

Definition at line 608 of file SIInstrInfo.cpp.

bool SIInstrInfo::isMTBUF ( uint16_t  Opcode) const
bool SIInstrInfo::isMUBUF ( uint16_t  Opcode) const
bool SIInstrInfo::isOperandLegal ( const MachineInstr MI,
unsigned  OpIdx,
const MachineOperand MO = nullptr 
) const

Reimplemented from llvm::AMDGPUInstrInfo.

Definition at line 620 of file SIInstrInfo.cpp.

Definition at line 684 of file SIInstrInfo.cpp.

References llvm::MachineInstr::getOpcode(), and SIInstrFlags::SALU.

Definition at line 998 of file SIInstrInfo.cpp.

References getVALUOp().

bool SIInstrInfo::isSMRD ( uint16_t  Opcode) const
bool SIInstrInfo::isVOP1 ( uint16_t  Opcode) const

Definition at line 668 of file SIInstrInfo.cpp.

References SIInstrFlags::VOP1.

Referenced by foldImmediates(), and verifyInstruction().

bool SIInstrInfo::isVOP2 ( uint16_t  Opcode) const
bool SIInstrInfo::isVOP3 ( uint16_t  Opcode) const

Definition at line 676 of file SIInstrInfo.cpp.

References SIInstrFlags::VOP3.

Referenced by commuteInstruction(), legalizeOperands(), and verifyInstruction().

bool SIInstrInfo::isVOPC ( uint16_t  Opcode) const

Definition at line 680 of file SIInstrInfo.cpp.

References SIInstrFlags::VOPC.

Referenced by foldImmediates(), and verifyInstruction().

Legalize all operands in this instruction. This function may create new instruction and insert them before MI.

Definition at line 1156 of file SIInstrInfo.cpp.

References llvm::MachineInstrBuilder::addImm(), llvm::MachineInstrBuilder::addOperand(), llvm::MachineInstrBuilder::addReg(), llvm::BuildMI(), commuteInstruction(), llvm::TargetOpcode::COPY, llvm::MachineRegisterInfo::createVirtualRegister(), llvm::AMDGPU::getAddr64Inst(), llvm::MachineInstr::getDebugLoc(), llvm::SIRegisterInfo::getEquivalentVGPRClass(), llvm::MachineBasicBlock::getFirstTerminator(), llvm::MachineOperand::getImm(), llvm::MachineOperand::getMBB(), getNamedOperand(), llvm::AMDGPU::getNamedOperandIdx(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), getOpRegClass(), llvm::MachineInstr::getParent(), llvm::MachineBasicBlock::getParent(), llvm::MachineOperand::getReg(), llvm::MachineRegisterInfo::getRegClass(), llvm::MachineFunction::getRegInfo(), llvm::SIRegisterInfo::hasVGPRs(), llvm::RegState::Implicit, llvm::RegState::ImplicitDefine, llvm::TargetOpcode::INSERT_SUBREG, llvm::MachineInstr::isCommutable(), llvm::MachineOperand::isImm(), isLiteralConstant(), isOperandLegal(), llvm::MachineOperand::isReg(), llvm::SIRegisterInfo::isSGPRClass(), llvm::TargetRegisterInfo::isVirtualRegister(), isVOP2(), isVOP3(), legalizeOpWithMove(), llvm::AArch64CC::MI, llvm::TargetOpcode::PHI, llvm::TargetOpcode::REG_SEQUENCE, llvm::MachineInstr::removeFromParent(), llvm::AMDGPU::RSRC_DATA_FORMAT, and llvm::MachineOperand::setReg().

Referenced by moveToVALU().

void SIInstrInfo::legalizeOpWithMove ( MachineInstr MI,
unsigned  OpIdx 
) const
void llvm::SIInstrInfo::LoadM0 ( MachineInstr MoveRel,
MachineBasicBlock::iterator  I,
unsigned  SavReg,
unsigned  IndexReg 
) const
void SIInstrInfo::loadRegFromStackSlot ( MachineBasicBlock MBB,
MachineBasicBlock::iterator  MI,
unsigned  DestReg,
int  FrameIndex,
const TargetRegisterClass RC,
const TargetRegisterInfo TRI 
) const [override]
void SIInstrInfo::moveToVALU ( MachineInstr MI) const
bool SIInstrInfo::shouldClusterLoads ( MachineInstr FirstLdSt,
MachineInstr SecondLdSt,
unsigned  NumLoads 
) const

Definition at line 264 of file SIInstrInfo.cpp.

References llvm::MachineInstr::getOpcode(), isDS(), isMTBUF(), isMUBUF(), and isSMRD().

void SIInstrInfo::splitSMRD ( MachineInstr MI,
const TargetRegisterClass HalfRC,
unsigned  HalfImmOp,
unsigned  HalfSGPROp,
MachineInstr *&  Lo,
MachineInstr *&  Hi 
) const
void SIInstrInfo::storeRegToStackSlot ( MachineBasicBlock MBB,
MachineBasicBlock::iterator  MI,
unsigned  SrcReg,
bool  isKill,
int  FrameIndex,
const TargetRegisterClass RC,
const TargetRegisterInfo TRI 
) const [override]
bool SIInstrInfo::verifyInstruction ( const MachineInstr MI,
StringRef ErrInfo 
) const [override]

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