LLVM  16.0.0git
Namespaces | Macros | Functions
SPIRVPreLegalizer.cpp File Reference
#include "SPIRV.h"
#include "SPIRVSubtarget.h"
#include "SPIRVUtils.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/IntrinsicsSPIRV.h"
#include "llvm/Target/TargetIntrinsicInfo.h"
Include dependency graph for SPIRVPreLegalizer.cpp:

Go to the source code of this file.

Namespaces

 llvm
 This is an optimization pass for GlobalISel generic memory operations.
 

Macros

#define DEBUG_TYPE   "spirv-prelegalizer"
 

Functions

static void addConstantsToTrack (MachineFunction &MF, SPIRVGlobalRegistry *GR)
 
static void foldConstantsIntoIntrinsics (MachineFunction &MF)
 
static void insertBitcasts (MachineFunction &MF, SPIRVGlobalRegistry *GR, MachineIRBuilder MIB)
 
static SPIRVTypepropagateSPIRVType (MachineInstr *MI, SPIRVGlobalRegistry *GR, MachineRegisterInfo &MRI, MachineIRBuilder &MIB)
 
Register llvm::insertAssignInstr (Register Reg, Type *Ty, SPIRVType *SpirvTy, SPIRVGlobalRegistry *GR, MachineIRBuilder &MIB, MachineRegisterInfo &MRI)
 Helper external function for inserting ASSIGN_TYPE instuction between Reg and its definition, set the new register as a destination of the definition, assign SPIRVType to both registers. More...
 
static void generateAssignInstrs (MachineFunction &MF, SPIRVGlobalRegistry *GR, MachineIRBuilder MIB)
 
static std::pair< Register, unsigned > createNewIdReg (Register ValReg, unsigned Opcode, MachineRegisterInfo &MRI, const SPIRVGlobalRegistry &GR)
 
static void processInstr (MachineInstr &MI, MachineIRBuilder &MIB, MachineRegisterInfo &MRI, SPIRVGlobalRegistry *GR)
 
bool isTypeFoldingSupported (unsigned Opcode)
 
static void processInstrsWithTypeFolding (MachineFunction &MF, SPIRVGlobalRegistry *GR, MachineIRBuilder MIB)
 
static void processSwitches (MachineFunction &MF, SPIRVGlobalRegistry *GR, MachineIRBuilder MIB)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "spirv-prelegalizer"

Definition at line 26 of file SPIRVPreLegalizer.cpp.

Function Documentation

◆ addConstantsToTrack()

static void addConstantsToTrack ( MachineFunction MF,
SPIRVGlobalRegistry GR 
)
static

◆ createNewIdReg()

static std::pair<Register, unsigned> createNewIdReg ( Register  ValReg,
unsigned  Opcode,
MachineRegisterInfo MRI,
const SPIRVGlobalRegistry GR 
)
static

◆ foldConstantsIntoIntrinsics()

static void foldConstantsIntoIntrinsics ( MachineFunction MF)
static

◆ generateAssignInstrs()

static void generateAssignInstrs ( MachineFunction MF,
SPIRVGlobalRegistry GR,
MachineIRBuilder  MIB 
)
static

◆ insertBitcasts()

static void insertBitcasts ( MachineFunction MF,
SPIRVGlobalRegistry GR,
MachineIRBuilder  MIB 
)
static

◆ isTypeFoldingSupported()

bool isTypeFoldingSupported ( unsigned  Opcode)

◆ processInstr()

static void processInstr ( MachineInstr MI,
MachineIRBuilder MIB,
MachineRegisterInfo MRI,
SPIRVGlobalRegistry GR 
)
static

◆ processInstrsWithTypeFolding()

static void processInstrsWithTypeFolding ( MachineFunction MF,
SPIRVGlobalRegistry GR,
MachineIRBuilder  MIB 
)
static

◆ processSwitches()

static void processSwitches ( MachineFunction MF,
SPIRVGlobalRegistry GR,
MachineIRBuilder  MIB 
)
static

Definition at line 390 of file SPIRVPreLegalizer.cpp.

References assert(), llvm::SPIRVGlobalRegistry::assignSPIRVTypeToVReg(), CC, llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, DenseMapInfo< ValueT >, detail::DenseSetPair< ValueT > >, DenseMapInfo< ValueT > >::contains(), llvm::MachineOperand::CreateCImm(), llvm::MachineOperand::CreateMBB(), llvm::MachineBasicBlock::front(), llvm::IntegerType::get(), llvm::MachineOperand::getCImm(), llvm::getDefInstrMaybeConstant(), llvm::getIConstVal(), llvm::MachineOperand::getMBB(), llvm::MachineIRBuilder::getMF(), llvm::ilist_node_with_parent< NodeTy, ParentTy, Options >::getNextNode(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::SPIRVGlobalRegistry::getOrCreateSPIRVType(), llvm::MachineOperand::getParent(), llvm::MachineOperand::getPredicate(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::SPIRVGlobalRegistry::getSPIRVTypeForVReg(), llvm::MachineRegisterInfo::hasOneDef(), llvm::MachineRegisterInfo::hasOneUse(), i, llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_ULE, llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, DenseMapInfo< ValueT >, detail::DenseSetPair< ValueT > >, DenseMapInfo< ValueT > >::insert(), llvm::insertAssignInstr(), llvm::MachineOperand::isMBB(), llvm::MachineOperand::isReg(), llvm::isSpvIntrinsic(), MBB, MI, MRI, llvm::MachineIRBuilder::setInsertPt(), llvm::MachineRegisterInfo::setRegClass(), llvm::MachineBasicBlock::succ_begin(), and llvm::MachineRegisterInfo::use_begin().

Referenced by llvm::SPIRVModuleAnalysis::runOnModule().

◆ propagateSPIRVType()

static SPIRVType* propagateSPIRVType ( MachineInstr MI,
SPIRVGlobalRegistry GR,
MachineRegisterInfo MRI,
MachineIRBuilder MIB 
)
static