LLVM  15.0.0git
Functions
SPIRVUtils.cpp File Reference
#include "SPIRVUtils.h"
#include "MCTargetDesc/SPIRVBaseInfo.h"
#include "SPIRV.h"
#include "SPIRVInstrInfo.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/IR/IntrinsicsSPIRV.h"
Include dependency graph for SPIRVUtils.cpp:

Go to the source code of this file.

Functions

static uint32_t convertCharsToWord (const StringRef &Str, unsigned i)
 
static size_t getPaddedLen (const StringRef &Str)
 
void addStringImm (const StringRef &Str, MachineInstrBuilder &MIB)
 
void addStringImm (const StringRef &Str, IRBuilder<> &B, std::vector< Value * > &Args)
 
std::string getStringImm (const MachineInstr &MI, unsigned StartIndex)
 
void addNumImm (const APInt &Imm, MachineInstrBuilder &MIB)
 
void buildOpName (Register Target, const StringRef &Name, MachineIRBuilder &MIRBuilder)
 
static void finishBuildOpDecorate (MachineInstrBuilder &MIB, const std::vector< uint32_t > &DecArgs, StringRef StrImm)
 
void buildOpDecorate (Register Reg, MachineIRBuilder &MIRBuilder, llvm::SPIRV::Decoration Dec, const std::vector< uint32_t > &DecArgs, StringRef StrImm)
 
void buildOpDecorate (Register Reg, MachineInstr &I, const SPIRVInstrInfo &TII, llvm::SPIRV::Decoration Dec, const std::vector< uint32_t > &DecArgs, StringRef StrImm)
 
unsigned storageClassToAddressSpace (SPIRV::StorageClass SC)
 
SPIRV::StorageClass addressSpaceToStorageClass (unsigned AddrSpace)
 
SPIRV::MemorySemantics getMemSemanticsForStorageClass (SPIRV::StorageClass SC)
 
MachineInstrgetDefInstrMaybeConstant (Register &ConstReg, const MachineRegisterInfo *MRI)
 
uint64_t getIConstVal (Register ConstReg, const MachineRegisterInfo *MRI)
 
TypegetMDOperandAsType (const MDNode *N, unsigned I)
 

Function Documentation

◆ addNumImm()

void addNumImm ( const APInt Imm,
MachineInstrBuilder MIB 
)

◆ addressSpaceToStorageClass()

SPIRV::StorageClass addressSpaceToStorageClass ( unsigned  AddrSpace)

◆ addStringImm() [1/2]

void addStringImm ( const StringRef Str,
IRBuilder<> &  B,
std::vector< Value * > &  Args 
)

◆ addStringImm() [2/2]

void addStringImm ( const StringRef Str,
MachineInstrBuilder MIB 
)

◆ buildOpDecorate() [1/2]

void buildOpDecorate ( Register  Reg,
MachineInstr I,
const SPIRVInstrInfo TII,
llvm::SPIRV::Decoration  Dec,
const std::vector< uint32_t > &  DecArgs,
StringRef  StrImm 
)

◆ buildOpDecorate() [2/2]

void buildOpDecorate ( Register  Reg,
MachineIRBuilder MIRBuilder,
llvm::SPIRV::Decoration  Dec,
const std::vector< uint32_t > &  DecArgs,
StringRef  StrImm 
)

◆ buildOpName()

void buildOpName ( Register  Target,
const StringRef Name,
MachineIRBuilder MIRBuilder 
)

◆ convertCharsToWord()

static uint32_t convertCharsToWord ( const StringRef Str,
unsigned  i 
)
static

Definition at line 29 of file SPIRVUtils.cpp.

References i.

Referenced by addStringImm().

◆ finishBuildOpDecorate()

static void finishBuildOpDecorate ( MachineInstrBuilder MIB,
const std::vector< uint32_t > &  DecArgs,
StringRef  StrImm 
)
static

◆ getDefInstrMaybeConstant()

MachineInstr* getDefInstrMaybeConstant ( Register ConstReg,
const MachineRegisterInfo MRI 
)

◆ getIConstVal()

uint64_t getIConstVal ( Register  ConstReg,
const MachineRegisterInfo MRI 
)

Definition at line 199 of file SPIRVUtils.cpp.

References assert(), getDefInstrMaybeConstant(), MI, and MRI.

Referenced by processSwitches().

◆ getMDOperandAsType()

Type* getMDOperandAsType ( const MDNode N,
unsigned  I 
)

Definition at line 205 of file SPIRVUtils.cpp.

References I, and N.

Referenced by generateAssignInstrs().

◆ getMemSemanticsForStorageClass()

SPIRV::MemorySemantics getMemSemanticsForStorageClass ( SPIRV::StorageClass  SC)

◆ getPaddedLen()

static size_t getPaddedLen ( const StringRef Str)
static

Definition at line 43 of file SPIRVUtils.cpp.

Referenced by addStringImm().

◆ getStringImm()

std::string getStringImm ( const MachineInstr MI,
unsigned  StartIndex 
)

Definition at line 65 of file SPIRVUtils.cpp.

References getSPIRVStringOperand(), and MI.

◆ storageClassToAddressSpace()

unsigned storageClassToAddressSpace ( SPIRV::StorageClass  SC)