LLVM 20.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"

Go to the source code of this file.

Namespaces

namespace  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, const SPIRVSubtarget &STI, DenseMap< MachineInstr *, Type * > &TargetExtConstTypes, SmallSet< Register, 4 > &TrackedConstRegs)
 
static void foldConstantsIntoIntrinsics (MachineFunction &MF, const SmallSet< Register, 4 > &TrackedConstRegs)
 
static MachineInstrfindAssignTypeInstr (Register Reg, MachineRegisterInfo *MRI)
 
static void buildOpBitcast (SPIRVGlobalRegistry *GR, MachineIRBuilder &MIB, Register ResVReg, Register OpReg)
 
static void selectOpBitcasts (MachineFunction &MF, SPIRVGlobalRegistry *GR, MachineIRBuilder MIB)
 
static void insertBitcasts (MachineFunction &MF, SPIRVGlobalRegistry *GR, MachineIRBuilder MIB)
 
static SPIRVTypepropagateSPIRVType (MachineInstr *MI, SPIRVGlobalRegistry *GR, MachineRegisterInfo &MRI, MachineIRBuilder &MIB)
 
static void widenScalarLLTNextPow2 (Register Reg, MachineRegisterInfo &MRI)
 
static std::pair< Register, unsignedcreateNewIdReg (SPIRVType *SpvType, Register SrcReg, MachineRegisterInfo &MRI, const SPIRVGlobalRegistry &GR)
 
static void setInsertPtAfterDef (MachineIRBuilder &MIB, MachineInstr *Def)
 
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.
 
void llvm::processInstr (MachineInstr &MI, MachineIRBuilder &MIB, MachineRegisterInfo &MRI, SPIRVGlobalRegistry *GR)
 
static void generateAssignInstrs (MachineFunction &MF, SPIRVGlobalRegistry *GR, MachineIRBuilder MIB, DenseMap< MachineInstr *, Type * > &TargetExtConstTypes)
 
bool isTypeFoldingSupported (unsigned Opcode)
 
static void processInstrsWithTypeFolding (MachineFunction &MF, SPIRVGlobalRegistry *GR, MachineIRBuilder MIB)
 
static Register collectInlineAsmInstrOperands (MachineInstr *MI, SmallVector< unsigned, 4 > *Ops=nullptr)
 
static void insertInlineAsmProcess (MachineFunction &MF, SPIRVGlobalRegistry *GR, const SPIRVSubtarget &ST, MachineIRBuilder MIRBuilder, const SmallVector< MachineInstr * > &ToProcess)
 
static void insertInlineAsm (MachineFunction &MF, SPIRVGlobalRegistry *GR, const SPIRVSubtarget &ST, MachineIRBuilder MIRBuilder)
 
static void insertSpirvDecorations (MachineFunction &MF, MachineIRBuilder MIB)
 
static void processSwitchesConstants (MachineFunction &MF, SPIRVGlobalRegistry *GR, MachineIRBuilder MIB)
 
static void cleanupHelperInstructions (MachineFunction &MF)
 
static void processBlockAddr (MachineFunction &MF, SPIRVGlobalRegistry *GR, MachineIRBuilder MIB)
 
static bool isImplicitFallthrough (MachineBasicBlock &MBB)
 
static void removeImplicitFallthroughs (MachineFunction &MF, 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,
const SPIRVSubtarget STI,
DenseMap< MachineInstr *, Type * > &  TargetExtConstTypes,
SmallSet< Register, 4 > &  TrackedConstRegs 
)
static

◆ buildOpBitcast()

static void buildOpBitcast ( SPIRVGlobalRegistry GR,
MachineIRBuilder MIB,
Register  ResVReg,
Register  OpReg 
)
static

◆ cleanupHelperInstructions()

static void cleanupHelperInstructions ( MachineFunction MF)
static

◆ collectInlineAsmInstrOperands()

static Register collectInlineAsmInstrOperands ( MachineInstr MI,
SmallVector< unsigned, 4 > *  Ops = nullptr 
)
static

◆ createNewIdReg()

static std::pair< Register, unsigned > createNewIdReg ( SPIRVType SpvType,
Register  SrcReg,
MachineRegisterInfo MRI,
const SPIRVGlobalRegistry GR 
)
static

◆ findAssignTypeInstr()

static MachineInstr * findAssignTypeInstr ( Register  Reg,
MachineRegisterInfo MRI 
)
static

◆ foldConstantsIntoIntrinsics()

static void foldConstantsIntoIntrinsics ( MachineFunction MF,
const SmallSet< Register, 4 > &  TrackedConstRegs 
)
static

◆ generateAssignInstrs()

static void generateAssignInstrs ( MachineFunction MF,
SPIRVGlobalRegistry GR,
MachineIRBuilder  MIB,
DenseMap< MachineInstr *, Type * > &  TargetExtConstTypes 
)
static

◆ insertBitcasts()

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

◆ insertInlineAsm()

static void insertInlineAsm ( MachineFunction MF,
SPIRVGlobalRegistry GR,
const SPIRVSubtarget ST,
MachineIRBuilder  MIRBuilder 
)
static

◆ insertInlineAsmProcess()

static void insertInlineAsmProcess ( MachineFunction MF,
SPIRVGlobalRegistry GR,
const SPIRVSubtarget ST,
MachineIRBuilder  MIRBuilder,
const SmallVector< MachineInstr * > &  ToProcess 
)
static

◆ insertSpirvDecorations()

static void insertSpirvDecorations ( MachineFunction MF,
MachineIRBuilder  MIB 
)
static

◆ isImplicitFallthrough()

static bool isImplicitFallthrough ( MachineBasicBlock MBB)
static

◆ isTypeFoldingSupported()

bool isTypeFoldingSupported ( unsigned  Opcode)

Definition at line 60 of file SPIRVLegalizerInfo.cpp.

Referenced by processInstrsWithTypeFolding().

◆ processBlockAddr()

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

◆ processInstrsWithTypeFolding()

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

◆ processSwitchesConstants()

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

◆ propagateSPIRVType()

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

◆ removeImplicitFallthroughs()

static void removeImplicitFallthroughs ( MachineFunction MF,
MachineIRBuilder  MIB 
)
static

◆ selectOpBitcasts()

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

◆ setInsertPtAfterDef()

static void setInsertPtAfterDef ( MachineIRBuilder MIB,
MachineInstr Def 
)
static

◆ widenScalarLLTNextPow2()

static void widenScalarLLTNextPow2 ( Register  Reg,
MachineRegisterInfo MRI 
)
static