LLVM  8.0.0svn
Namespaces | Macros | Enumerations | Functions | Variables
SIInstrInfo.cpp File Reference

SI Implementation of TargetInstrInfo. More...

#include "SIInstrInfo.h"
#include "AMDGPU.h"
#include "AMDGPUIntrinsicInfo.h"
#include "AMDGPUSubtarget.h"
#include "GCNHazardRecognizer.h"
#include "SIDefines.h"
#include "SIMachineFunctionInfo.h"
#include "SIRegisterInfo.h"
#include "MCTargetDesc/AMDGPUMCTargetDesc.h"
#include "Utils/AMDGPUBaseInfo.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/MemoryLocation.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineInstrBundle.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/RegisterScavenging.h"
#include "llvm/CodeGen/ScheduleDAG.h"
#include "llvm/CodeGen/SelectionDAGNodes.h"
#include "llvm/CodeGen/TargetOpcodes.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MachineValueType.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Target/TargetMachine.h"
#include <cassert>
#include <cstdint>
#include <iterator>
#include <utility>
#include "AMDGPUGenInstrInfo.inc"
#include "AMDGPUGenSearchableTables.inc"

Go to the source code of this file.

Namespaces

 llvm
 This class represents lattice values for constants.
 
 llvm::AMDGPU
 

Macros

#define GET_INSTRINFO_CTOR_DTOR
 
#define GET_D16ImageDimIntrinsics_IMPL
 
#define GET_ImageDimIntrinsicTable_IMPL
 
#define GET_RsrcIntrinsics_IMPL
 

Enumerations

enum  SIEncodingFamily {
  SI = 0, VI = 1, SDWA = 2, SDWA9 = 3,
  GFX80 = 4, GFX9 = 5
}
 

Functions

static unsigned getNumOperandsNoGlue (SDNode *Node)
 
static SDValue findChainOperand (SDNode *Load)
 
static bool nodesHaveSameOperandValue (SDNode *N0, SDNode *N1, unsigned OpName)
 Returns true if both nodes have the same value for the given operand Op, or if both nodes do not have this operand. More...
 
static bool isStride64 (unsigned Opc)
 
static bool memOpsHaveSameBasePtr (const MachineInstr &MI1, const MachineOperand &BaseOp1, const MachineInstr &MI2, const MachineOperand &BaseOp2)
 
static void reportIllegalCopy (const SIInstrInfo *TII, MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, bool KillSrc)
 
static unsigned getSGPRSpillSaveOpcode (unsigned Size)
 
static unsigned getVGPRSpillSaveOpcode (unsigned Size)
 
static unsigned getSGPRSpillRestoreOpcode (unsigned Size)
 
static unsigned getVGPRSpillRestoreOpcode (unsigned Size)
 
static MachineInstrswapRegAndNonRegOperand (MachineInstr &MI, MachineOperand &RegOp, MachineOperand &NonRegOp)
 
static void preserveCondRegFlags (MachineOperand &CondReg, const MachineOperand &OrigCond)
 
static void removeModOperands (MachineInstr &MI)
 
static bool offsetsDoNotOverlap (int WidthA, int OffsetA, int WidthB, int OffsetB)
 
static int64_t getFoldableImm (const MachineOperand *MO)
 
static bool changesVGPRIndexingMode (const MachineInstr &MI)
 
static bool compareMachineOp (const MachineOperand &Op0, const MachineOperand &Op1)
 
static void copyFlagsToImplicitVCC (MachineInstr &MI, const MachineOperand &Orig)
 
static unsigned findImplicitSGPRRead (const MachineInstr &MI)
 
static bool shouldReadExec (const MachineInstr &MI)
 
static bool isSubRegOf (const SIRegisterInfo &TRI, const MachineOperand &SuperVec, const MachineOperand &SubReg)
 
static void emitLoadSRsrcFromVGPRLoop (const SIInstrInfo &TII, MachineRegisterInfo &MRI, MachineBasicBlock &OrigBB, MachineBasicBlock &LoopBB, const DebugLoc &DL, MachineOperand &Rsrc)
 
static void loadSRsrcFromVGPR (const SIInstrInfo &TII, MachineInstr &MI, MachineOperand &Rsrc, MachineDominatorTree *MDT)
 
static std::tuple< unsigned, unsignedextractRsrcPtr (const SIInstrInfo &TII, MachineInstr &MI, MachineOperand &Rsrc)
 
static SIEncodingFamily subtargetEncodingFamily (const GCNSubtarget &ST)
 
static TargetInstrInfo::RegSubRegPair getRegOrUndef (const MachineOperand &RegOpnd)
 
static bool followSubRegDef (MachineInstr &MI, TargetInstrInfo::RegSubRegPair &RSR)
 

Variables

static cl::opt< unsignedBranchOffsetBits ("amdgpu-s-branch-bits", cl::ReallyHidden, cl::init(16), cl::desc("Restrict range of branch instructions (DEBUG)"))
 

Detailed Description

SI Implementation of TargetInstrInfo.

Definition in file SIInstrInfo.cpp.

Macro Definition Documentation

◆ GET_D16ImageDimIntrinsics_IMPL

#define GET_D16ImageDimIntrinsics_IMPL

Definition at line 73 of file SIInstrInfo.cpp.

◆ GET_ImageDimIntrinsicTable_IMPL

#define GET_ImageDimIntrinsicTable_IMPL

Definition at line 74 of file SIInstrInfo.cpp.

◆ GET_INSTRINFO_CTOR_DTOR

#define GET_INSTRINFO_CTOR_DTOR

Definition at line 68 of file SIInstrInfo.cpp.

◆ GET_RsrcIntrinsics_IMPL

#define GET_RsrcIntrinsics_IMPL

Definition at line 75 of file SIInstrInfo.cpp.

Enumeration Type Documentation

◆ SIEncodingFamily

Enumerator
SI 
VI 
SDWA 
SDWA9 
GFX80 
GFX9 

Definition at line 5461 of file SIInstrInfo.cpp.

Function Documentation

◆ changesVGPRIndexingMode()

static bool changesVGPRIndexingMode ( const MachineInstr MI)
static

◆ compareMachineOp()

static bool compareMachineOp ( const MachineOperand Op0,
const MachineOperand Op1 
)
static

◆ copyFlagsToImplicitVCC()

static void copyFlagsToImplicitVCC ( MachineInstr MI,
const MachineOperand Orig 
)
static

◆ emitLoadSRsrcFromVGPRLoop()

static void emitLoadSRsrcFromVGPRLoop ( const SIInstrInfo TII,
MachineRegisterInfo MRI,
MachineBasicBlock OrigBB,
MachineBasicBlock LoopBB,
const DebugLoc DL,
MachineOperand Rsrc 
)
static

◆ extractRsrcPtr()

static std::tuple<unsigned, unsigned> extractRsrcPtr ( const SIInstrInfo TII,
MachineInstr MI,
MachineOperand Rsrc 
)
static

◆ findChainOperand()

static SDValue findChainOperand ( SDNode Load)
static

◆ findImplicitSGPRRead()

static unsigned findImplicitSGPRRead ( const MachineInstr MI)
static

◆ followSubRegDef()

static bool followSubRegDef ( MachineInstr MI,
TargetInstrInfo::RegSubRegPair RSR 
)
static

◆ getFoldableImm()

static int64_t getFoldableImm ( const MachineOperand MO)
static

◆ getNumOperandsNoGlue()

static unsigned getNumOperandsNoGlue ( SDNode Node)
static

Definition at line 96 of file SIInstrInfo.cpp.

Referenced by llvm::SIInstrInfo::areLoadsFromSameBasePtr(), and findChainOperand().

◆ getRegOrUndef()

static TargetInstrInfo::RegSubRegPair getRegOrUndef ( const MachineOperand RegOpnd)
static

◆ getSGPRSpillRestoreOpcode()

static unsigned getSGPRSpillRestoreOpcode ( unsigned  Size)
static

Definition at line 936 of file SIInstrInfo.cpp.

References llvm_unreachable.

Referenced by llvm::SIInstrInfo::loadRegFromStackSlot().

◆ getSGPRSpillSaveOpcode()

static unsigned getSGPRSpillSaveOpcode ( unsigned  Size)
static

Definition at line 834 of file SIInstrInfo.cpp.

References llvm_unreachable.

Referenced by llvm::SIInstrInfo::storeRegToStackSlot().

◆ getVGPRSpillRestoreOpcode()

static unsigned getVGPRSpillRestoreOpcode ( unsigned  Size)
static

Definition at line 953 of file SIInstrInfo.cpp.

References llvm_unreachable.

Referenced by llvm::SIInstrInfo::loadRegFromStackSlot().

◆ getVGPRSpillSaveOpcode()

static unsigned getVGPRSpillSaveOpcode ( unsigned  Size)
static

Definition at line 851 of file SIInstrInfo.cpp.

References llvm_unreachable.

Referenced by llvm::SIInstrInfo::storeRegToStackSlot().

◆ isStride64()

static bool isStride64 ( unsigned  Opc)
static

Definition at line 256 of file SIInstrInfo.cpp.

Referenced by llvm::SIInstrInfo::getMemOperandWithOffset().

◆ isSubRegOf()

static bool isSubRegOf ( const SIRegisterInfo TRI,
const MachineOperand SuperVec,
const MachineOperand SubReg 
)
static

◆ loadSRsrcFromVGPR()

static void loadSRsrcFromVGPR ( const SIInstrInfo TII,
MachineInstr MI,
MachineOperand Rsrc,
MachineDominatorTree MDT 
)
static

◆ memOpsHaveSameBasePtr()

static bool memOpsHaveSameBasePtr ( const MachineInstr MI1,
const MachineOperand BaseOp1,
const MachineInstr MI2,
const MachineOperand BaseOp2 
)
static

◆ nodesHaveSameOperandValue()

static bool nodesHaveSameOperandValue ( SDNode N0,
SDNode N1,
unsigned  OpName 
)
static

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 111 of file SIInstrInfo.cpp.

References llvm::SDNode::getMachineOpcode(), llvm::AMDGPU::getNamedOperandIdx(), and llvm::SDNode::getOperand().

Referenced by llvm::SIInstrInfo::areLoadsFromSameBasePtr().

◆ offsetsDoNotOverlap()

static bool offsetsDoNotOverlap ( int  WidthA,
int  OffsetA,
int  WidthB,
int  OffsetB 
)
static

◆ preserveCondRegFlags()

static void preserveCondRegFlags ( MachineOperand CondReg,
const MachineOperand OrigCond 
)
static

◆ removeModOperands()

static void removeModOperands ( MachineInstr MI)
static

◆ reportIllegalCopy()

static void reportIllegalCopy ( const SIInstrInfo TII,
MachineBasicBlock MBB,
MachineBasicBlock::iterator  MI,
const DebugLoc DL,
unsigned  DestReg,
unsigned  SrcReg,
bool  KillSrc 
)
static

◆ shouldReadExec()

static bool shouldReadExec ( const MachineInstr MI)
static

◆ subtargetEncodingFamily()

static SIEncodingFamily subtargetEncodingFamily ( const GCNSubtarget ST)
static

◆ swapRegAndNonRegOperand()

static MachineInstr* swapRegAndNonRegOperand ( MachineInstr MI,
MachineOperand RegOp,
MachineOperand NonRegOp 
)
static

Variable Documentation

◆ BranchOffsetBits

cl::opt<unsigned> BranchOffsetBits("amdgpu-s-branch-bits", cl::ReallyHidden, cl::init(16), cl::desc("Restrict range of branch instructions (DEBUG)"))
static