LLVM  6.0.0svn
Macros | Enumerations | Functions | Variables
SIInsertWaitcnts.cpp File Reference

Insert wait instructions for memory reads and writes. More...

#include "AMDGPU.h"
#include "AMDGPUSubtarget.h"
#include "SIDefines.h"
#include "SIInstrInfo.h"
#include "SIMachineFunctionInfo.h"
#include "SIRegisterInfo.h"
#include "Utils/AMDGPUBaseInfo.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstring>
#include <memory>
#include <utility>
#include <vector>
Include dependency graph for SIInsertWaitcnts.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "si-insert-waitcnts"
 
#define CNT_MASK(t)   (1u << (t))
 
#define ForAllWaitEventType(w)
 

Enumerations

enum  InstCounterType
 
enum  WaitEventType
 
enum  RegisterMapping
 

Functions

 INITIALIZE_PASS_BEGIN (SIInsertWaitcnts, DEBUG_TYPE, "SI Insert Waitcnts", false, false) INITIALIZE_PASS_END(SIInsertWaitcnts
 
static bool readsVCCZ (const MachineInstr &MI)
 

Variables

 DEBUG_TYPE
 
SI Insert Waitcnts
 
SI Insert false
 

Detailed Description

Insert wait instructions for memory reads and writes.

Memory reads and writes are issued asynchronously, so we need to insert S_WAITCNT instructions when we want to access any of their results or overwrite any register that's used asynchronously.

Definition in file SIInsertWaitcnts.cpp.

Macro Definition Documentation

◆ CNT_MASK

#define CNT_MASK (   t)    (1u << (t))

Definition at line 63 of file SIInsertWaitcnts.cpp.

Referenced by readsVCCZ().

◆ DEBUG_TYPE

#define DEBUG_TYPE   "si-insert-waitcnts"

Definition at line 53 of file SIInsertWaitcnts.cpp.

◆ ForAllWaitEventType

#define ForAllWaitEventType (   w)
Value:
for (enum WaitEventType w = (enum WaitEventType)0; \
(w) < (enum WaitEventType)NUM_WAIT_EVENTS; \
(w) = (enum WaitEventType)((w) + 1))
WaitEventType

Definition at line 112 of file SIInsertWaitcnts.cpp.

Referenced by readsVCCZ().

Enumeration Type Documentation

◆ InstCounterType

Definition at line 65 of file SIInsertWaitcnts.cpp.

◆ RegisterMapping

Definition at line 104 of file SIInsertWaitcnts.cpp.

◆ WaitEventType

Definition at line 84 of file SIInsertWaitcnts.cpp.

Function Documentation

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( SIInsertWaitcnts  ,
DEBUG_TYPE  ,
"SI Insert Waitcnts ,
false  ,
false   
)

◆ readsVCCZ()

static bool readsVCCZ ( const MachineInstr MI)
static

Definition at line 788 of file SIInsertWaitcnts.cpp.

References llvm::MachineInstr::addOperand(), AS, assert(), llvm::MachineBasicBlock::begin(), llvm::ReversePostOrderTraversal< GraphT, GT >::begin(), llvm::MachineFunction::begin(), llvm::LoopBase< BlockT, LoopT >::blocks(), llvm::BuildMI(), CNT_MASK, llvm::MachineOperand::CreateImm(), llvm::MachineFunction::CreateMachineInstr(), llvm::dbgs(), DEBUG, llvm::AMDGPU::decodeExpcnt(), llvm::AMDGPU::decodeLgkmcnt(), llvm::AMDGPU::decodeVmcnt(), llvm::MachineInstr::definesRegister(), E, llvm::MachineBasicBlock::empty(), llvm::AMDGPU::encodeWaitcnt(), llvm::MachineBasicBlock::end(), llvm::ReversePostOrderTraversal< GraphT, GT >::end(), llvm::MachineFunction::end(), llvm::SIInstrFlags::EXP, llvm::SIInstrFlags::EXP_CNT, ForAllWaitEventType, llvm::MachineFunction::front(), llvm::AMDGPU::getAtomicNoRetOp(), llvm::MachineInstr::getDebugLoc(), llvm::AMDGPU::getExpcntBitMask(), llvm::MachineBasicBlock::getFirstNonPHI(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::MachineOperand::getImm(), llvm::MachineFunction::getInfo(), llvm::AMDGPU::IsaInfo::getIsaVersion(), llvm::AMDGPU::getLgkmcntBitMask(), llvm::SIInstrInfo::getNamedOperand(), llvm::MachineBasicBlock::getNumber(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineInstr::getParent(), llvm::MachineBasicBlock::getParent(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::SISubtarget::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), llvm::AMDGPU::getVmcntBitMask(), llvm::SIInstrInfo::hasModifiersSet(), I, llvm::AMDGPU::SendMsg::ID_GS_DONE, llvm::AMDGPU::SendMsg::ID_MASK_, llvm::MachineBasicBlock::insert(), llvm::MachineInstr::isBranch(), llvm::MachineInstr::isDebugValue(), llvm::SIInstrInfo::isDS(), llvm::SIInstrInfo::isFLAT(), llvm::SIInstrInfo::isSMRD(), llvm::MachineOperand::isUndef(), llvm::SIRegisterInfo::isVGPR(), llvm::SIInstrInfo::isVMEM(), llvm::AMDGPUISD::KILL, llvm::SIInstrFlags::LGKM_CNT, llvm::max(), llvm::MachineInstr::mayLoad(), llvm::MachineInstr::mayStore(), llvm::MachineInstr::memoperands(), llvm::MachineInstr::memoperands_empty(), Modified, llvm::MachineInstr::modifiesRegister(), MRI, pred, llvm::MachineBasicBlock::predecessors(), llvm::MachineInstr::print(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::MachineBasicBlock::push_back(), llvm::MachineInstr::removeFromParent(), llvm::NVPTXISD::RETURN, llvm::AMDGPUSubtarget::SEA_ISLANDS, llvm::ARM_MB::ST, llvm::MachineBasicBlock::succ_empty(), T, llvm::SIInstrInfo::usesLGKM_CNT(), llvm::SIInstrInfo::usesVM_CNT(), llvm::SIInstrFlags::VM_CNT, llvm::AMDGPUSubtarget::VOLCANIC_ISLANDS, llvm::RISCVFenceField::W, X, and Y.

Variable Documentation

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 777 of file SIInsertWaitcnts.cpp.

◆ false

SI Insert false

Definition at line 777 of file SIInsertWaitcnts.cpp.

◆ Waitcnts

SI Insert Waitcnts

Definition at line 777 of file SIInsertWaitcnts.cpp.