43#define DEBUG_TYPE "asm-printer" 
   52                           std::unique_ptr<MCStreamer> Streamer)
 
   53      : 
AsmPrinter(TM, std::move(Streamer), 
ID), ModuleSectionsEmitted(
false),
 
   54        ST(
nullptr), 
TII(
nullptr), MAI(
nullptr) {}
 
   56  bool ModuleSectionsEmitted;
 
   60  StringRef getPassName()
 const override { 
return "SPIRV Assembly Printer"; }
 
   65  void outputMCInst(
MCInst &Inst);
 
   68  void outputGlobalRequirements();
 
   69  void outputEntryPoints();
 
   70  void outputDebugSourceAndStrings(
const Module &M);
 
   71  void outputOpExtInstImports(
const Module &M);
 
   72  void outputOpMemoryModel();
 
   73  void outputOpFunctionEnd();
 
   74  void outputExtFuncDecls();
 
   76                                     SPIRV::ExecutionMode::ExecutionMode EM,
 
   77                                     unsigned ExpectMDOps, int64_t DefVal);
 
   78  void outputExecutionModeFromNumthreadsAttribute(
 
   80      SPIRV::ExecutionMode::ExecutionMode EM);
 
   81  void outputExecutionModeFromEnableMaximalReconvergenceAttr(
 
   83  void outputExecutionMode(
const Module &M);
 
   84  void outputAnnotations(
const Module &M);
 
   85  void outputModuleSections();
 
   86  void outputFPFastMathDefaultInfo();
 
   88    return MF->getFunction()
 
   94  void emitFunctionEntryLabel()
 override {}
 
   95  void emitFunctionHeader() 
override;
 
   96  void emitFunctionBodyStart()
 override {}
 
   97  void emitFunctionBodyEnd() 
override;
 
  102  void emitEndOfAsmFile(
Module &M) 
override;
 
  103  bool doInitialization(
Module &M) 
override;
 
  113void SPIRVAsmPrinter::getAnalysisUsage(
AnalysisUsage &AU)
 const {
 
  120void SPIRVAsmPrinter::emitEndOfAsmFile(
Module &M) {
 
  121  if (ModuleSectionsEmitted == 
false) {
 
  122    outputModuleSections();
 
  123    ModuleSectionsEmitted = 
true;
 
  126  ST = 
static_cast<const SPIRVTargetMachine &
>(
TM).getSubtargetImpl();
 
  128  uint32_t Major = SPIRVVersion.
getMajor();
 
  129  uint32_t Minor = SPIRVVersion.
getMinor().value_or(0);
 
  132  unsigned Bound = 2 * (ST->
getBound() + 1) + NLabels;
 
  133  if (MCAssembler *Asm = OutStreamer->getAssemblerPtr())
 
  134    static_cast<SPIRVObjectWriter &
>(
Asm->getWriter())
 
  135        .setBuildVersion(Major, Minor, Bound);
 
  142void SPIRVAsmPrinter::cleanUp(
Module &M) {
 
  144  for (StringRef GVName :
 
  145       {
"llvm.global_ctors", 
"llvm.global_dtors", 
"llvm.used"}) {
 
  146    if (GlobalVariable *GV = 
M.getNamedGlobal(GVName))
 
  151void SPIRVAsmPrinter::emitFunctionHeader() {
 
  152  if (ModuleSectionsEmitted == 
false) {
 
  153    outputModuleSections();
 
  154    ModuleSectionsEmitted = 
true;
 
  157  ST = &MF->getSubtarget<SPIRVSubtarget>();
 
  161  if (isVerbose() && !isHidden()) {
 
  162    OutStreamer->getCommentOS()
 
  163        << 
"-- Begin function " 
  167  auto Section = getObjFileLowering().SectionForGlobal(&
F, TM);
 
  168  MF->setSection(Section);
 
  171void SPIRVAsmPrinter::outputOpFunctionEnd() {
 
  172  MCInst FunctionEndInst;
 
  173  FunctionEndInst.
setOpcode(SPIRV::OpFunctionEnd);
 
  174  outputMCInst(FunctionEndInst);
 
  177void SPIRVAsmPrinter::emitFunctionBodyEnd() {
 
  179    outputOpFunctionEnd();
 
  182void SPIRVAsmPrinter::emitOpLabel(
const MachineBasicBlock &
MBB) {
 
  190  outputMCInst(LabelInst);
 
  195void SPIRVAsmPrinter::emitBasicBlockStart(
const MachineBasicBlock &
MBB) {
 
  203    for (
const MachineInstr &
MI : 
MBB)
 
  204      if (
MI.getOpcode() == SPIRV::OpFunction)
 
  212void SPIRVAsmPrinter::printOperand(
const MachineInstr *
MI, 
int OpNum,
 
  214  const MachineOperand &MO = 
MI->getOperand(OpNum);
 
  254bool SPIRVAsmPrinter::PrintAsmOperand(
const MachineInstr *
MI, 
unsigned OpNo,
 
  255                                      const char *ExtraCode, raw_ostream &O) {
 
  256  if (ExtraCode && ExtraCode[0])
 
  265  return TII->isHeaderInstr(*
MI) || 
MI->getOpcode() == SPIRV::OpFunction ||
 
  266         MI->getOpcode() == SPIRV::OpFunctionParameter;
 
 
  269void SPIRVAsmPrinter::outputMCInst(MCInst &Inst) {
 
  270  OutStreamer->emitInstruction(Inst, *OutContext.getSubtargetInfo());
 
  273void SPIRVAsmPrinter::outputInstruction(
const MachineInstr *
MI) {
 
  274  SPIRVMCInstLower MCInstLowering;
 
  276  MCInstLowering.
lower(
MI, TmpInst, MAI);
 
  277  outputMCInst(TmpInst);
 
  280void SPIRVAsmPrinter::emitInstruction(
const MachineInstr *
MI) {
 
  281  SPIRV_MC::verifyInstructionPredicates(
MI->getOpcode(),
 
  282                                        getSubtargetInfo().getFeatureBits());
 
  284  if (!MAI->getSkipEmission(
MI))
 
  285    outputInstruction(
MI);
 
  288  const MachineInstr *NextMI = 
MI->getNextNode();
 
  291    assert(
MI->getParent()->getNumber() == MF->front().getNumber() &&
 
  292           "OpFunction is not in the front MBB of MF");
 
  293    emitOpLabel(*
MI->getParent());
 
  297void SPIRVAsmPrinter::outputModuleSection(SPIRV::ModuleSectionType MSType) {
 
  298  for (
const MachineInstr *
MI : MAI->getMSInstrs(MSType))
 
  299    outputInstruction(
MI);
 
  302void SPIRVAsmPrinter::outputDebugSourceAndStrings(
const Module &M) {
 
  304  for (
auto &Str : MAI->SrcExt) {
 
  306    Inst.
setOpcode(SPIRV::OpSourceExtension);
 
  311  outputModuleSection(SPIRV::MB_DebugStrings);
 
  321void SPIRVAsmPrinter::outputOpExtInstImports(
const Module &M) {
 
  322  for (
auto &CU : MAI->ExtInstSetMap) {
 
  323    unsigned Set = CU.first;
 
  324    MCRegister 
Reg = CU.second;
 
  329                     static_cast<SPIRV::InstructionSet::InstructionSet
>(Set)),
 
  335void SPIRVAsmPrinter::outputOpMemoryModel() {
 
  347void SPIRVAsmPrinter::outputEntryPoints() {
 
  349  DenseSet<MCRegister> InterfaceIDs;
 
  350  for (
const MachineInstr *
MI : MAI->GlobalVarList) {
 
  351    assert(
MI->getOpcode() == SPIRV::OpVariable);
 
  352    auto SC = 
static_cast<SPIRV::StorageClass::StorageClass
>(
 
  359        SC == SPIRV::StorageClass::Input || SC == SPIRV::StorageClass::Output) {
 
  360      const MachineFunction *MF = 
MI->getMF();
 
  361      MCRegister 
Reg = MAI->getRegisterAlias(MF, 
MI->getOperand(0).getReg());
 
  367  for (
const MachineInstr *
MI : MAI->getMSInstrs(SPIRV::MB_EntryPoints)) {
 
  368    SPIRVMCInstLower MCInstLowering;
 
  370    MCInstLowering.
lower(
MI, TmpInst, MAI);
 
  371    for (MCRegister 
Reg : InterfaceIDs) {
 
  375    outputMCInst(TmpInst);
 
  380void SPIRVAsmPrinter::outputGlobalRequirements() {
 
  382  MAI->Reqs.checkSatisfiable(*ST);
 
  384  for (
const auto &Cap : MAI->Reqs.getMinimalCapabilities()) {
 
  392  for (
const auto &Ext : MAI->Reqs.getExtensions()) {
 
  396                     SPIRV::OperandCategory::ExtensionOperand, Ext),
 
  403void SPIRVAsmPrinter::outputExtFuncDecls() {
 
  405  auto I = MAI->getMSInstrs(SPIRV::MB_ExtFuncDecls).begin(),
 
  406       E = MAI->getMSInstrs(SPIRV::MB_ExtFuncDecls).end();
 
  407  for (; 
I != 
E; ++
I) {
 
  408    outputInstruction(*
I);
 
  409    if ((
I + 1) == 
E || (*(
I + 1))->
getOpcode() == SPIRV::OpFunction)
 
  410      outputOpFunctionEnd();
 
  420  if (Ty->isDoubleTy())
 
  423    switch (IntTy->getIntegerBitWidth()) {
 
  437    Type *EleTy = VecTy->getElementType();
 
  438    unsigned Size = VecTy->getNumElements();
 
 
  460void SPIRVAsmPrinter::outputExecutionModeFromMDNode(
 
  461    MCRegister 
Reg, MDNode *Node, SPIRV::ExecutionMode::ExecutionMode EM,
 
  462    unsigned ExpectMDOps, int64_t DefVal) {
 
  470  unsigned NodeSz = 
Node->getNumOperands();
 
  471  if (ExpectMDOps > 0 && NodeSz < ExpectMDOps)
 
  472    for (
unsigned i = NodeSz; i < ExpectMDOps; ++i)
 
  477void SPIRVAsmPrinter::outputExecutionModeFromNumthreadsAttribute(
 
  479    SPIRV::ExecutionMode::ExecutionMode EM) {
 
  480  assert(Attr.
isValid() && 
"Function called with an invalid attribute.");
 
  489  assert(NumThreads.size() == 3 && 
"invalid numthreads");
 
  490  for (uint32_t i = 0; i < 3; ++i) {
 
  492    [[maybe_unused]] 
bool Result = NumThreads[i].getAsInteger(10, V);
 
  493    assert(!Result && 
"Failed to parse numthreads");
 
  500void SPIRVAsmPrinter::outputExecutionModeFromEnableMaximalReconvergenceAttr(
 
  501    const MCRegister &
Reg, 
const SPIRVSubtarget &ST) {
 
  502  assert(
ST.canUseExtension(SPIRV::Extension::SPV_KHR_maximal_reconvergence) &&
 
  503         "Function called when SPV_KHR_maximal_reconvergence is not enabled.");
 
  509      static_cast<unsigned>(SPIRV::ExecutionMode::MaximallyReconvergesKHR);
 
  514void SPIRVAsmPrinter::outputExecutionMode(
const Module &M) {
 
  515  NamedMDNode *
Node = 
M.getNamedMetadata(
"spirv.ExecutionMode");
 
  517    for (
unsigned i = 0; i < 
Node->getNumOperands(); i++) {
 
  521      if (
ST->canUseExtension(SPIRV::Extension::SPV_KHR_float_controls2)) {
 
  527        if (EM == SPIRV::ExecutionMode::FPFastMathDefault ||
 
  528            EM == SPIRV::ExecutionMode::ContractionOff ||
 
  529            EM == SPIRV::ExecutionMode::SignedZeroInfNanPreserve)
 
  538    outputFPFastMathDefaultInfo();
 
  540  for (
auto FI = 
M.begin(), 
E = 
M.end(); FI != 
E; ++FI) {
 
  546    MCRegister FReg = MAI->getFuncReg(&
F);
 
  559            static_cast<unsigned>(SPIRV::ExecutionMode::OriginUpperLeft);
 
  564    if (MDNode *Node = 
F.getMetadata(
"reqd_work_group_size"))
 
  565      outputExecutionModeFromMDNode(FReg, Node, SPIRV::ExecutionMode::LocalSize,
 
  568      outputExecutionModeFromNumthreadsAttribute(
 
  569          FReg, Attr, SPIRV::ExecutionMode::LocalSize);
 
  570    if (
Attribute Attr = 
F.getFnAttribute(
"enable-maximal-reconvergence");
 
  572      outputExecutionModeFromEnableMaximalReconvergenceAttr(FReg, *ST);
 
  574    if (MDNode *Node = 
F.getMetadata(
"work_group_size_hint"))
 
  575      outputExecutionModeFromMDNode(FReg, Node,
 
  576                                    SPIRV::ExecutionMode::LocalSizeHint, 3, 1);
 
  577    if (MDNode *Node = 
F.getMetadata(
"intel_reqd_sub_group_size"))
 
  578      outputExecutionModeFromMDNode(FReg, Node,
 
  579                                    SPIRV::ExecutionMode::SubgroupSize, 0, 0);
 
  580    if (MDNode *Node = 
F.getMetadata(
"vec_type_hint")) {
 
  584      unsigned EM = 
static_cast<unsigned>(SPIRV::ExecutionMode::VecTypeHint);
 
  590    if (
ST->isKernel() && !
M.getNamedMetadata(
"spirv.ExecutionMode") &&
 
  591        !
M.getNamedMetadata(
"opencl.enable.FP_CONTRACT")) {
 
  592      if (
ST->canUseExtension(SPIRV::Extension::SPV_KHR_float_controls2)) {
 
  609        std::vector<const MachineInstr *> SPIRVFloatTypes;
 
  610        const MachineInstr *ConstZero = 
nullptr;
 
  611        for (
const MachineInstr *
MI :
 
  612             MAI->getMSInstrs(SPIRV::MB_TypeConstVars)) {
 
  615          if (OpCode != SPIRV::OpTypeFloat && OpCode != SPIRV::OpConstantNull)
 
  619          if (OpCode == SPIRV::OpTypeFloat) {
 
  621            const unsigned OpTypeFloatSize = 
MI->getOperand(1).getImm();
 
  622            if (OpTypeFloatSize != 16 && OpTypeFloatSize != 32 &&
 
  623                OpTypeFloatSize != 64) {
 
  626            SPIRVFloatTypes.push_back(
MI);
 
  629            const MachineRegisterInfo &
MRI = 
MI->getMF()->getRegInfo();
 
  630            MachineInstr *TypeMI = 
MRI.getVRegDef(
MI->getOperand(1).getReg());
 
  644        for (
const MachineInstr *
MI : SPIRVFloatTypes) {
 
  646          Inst.
setOpcode(SPIRV::OpExecutionModeId);
 
  649              static_cast<unsigned>(SPIRV::ExecutionMode::FPFastMathDefault);
 
  651          const MachineFunction *MF = 
MI->getMF();
 
  653              MAI->getRegisterAlias(MF, 
MI->getOperand(0).getReg());
 
  655          assert(ConstZero && 
"There should be a constant zero.");
 
  656          MCRegister ConstReg = MAI->getRegisterAlias(
 
  666            static_cast<unsigned>(SPIRV::ExecutionMode::ContractionOff);
 
  674void SPIRVAsmPrinter::outputAnnotations(
const Module &M) {
 
  675  outputModuleSection(SPIRV::MB_Annotations);
 
  677  for (
auto F = 
M.global_begin(), 
E = 
M.global_end(); 
F != 
E; ++
F) {
 
  678    if ((*F).getName() != 
"llvm.global.annotations")
 
  680    const GlobalVariable *
V = &(*F);
 
  690      MCRegister 
Reg = MAI->getFuncReg(Func);
 
  693        raw_string_ostream OS(DiagMsg);
 
  694        AnnotatedVar->
print(OS);
 
  695        DiagMsg = 
"Unknown function in llvm.global.annotations: " + DiagMsg;
 
  703      StringRef AnnotationString;
 
  704      [[maybe_unused]] 
bool Success =
 
  710      unsigned Dec = 
static_cast<unsigned>(SPIRV::Decoration::UserSemantic);
 
  718void SPIRVAsmPrinter::outputFPFastMathDefaultInfo() {
 
  721  std::vector<const MachineInstr *> SPIRVFloatTypes;
 
  723  std::unordered_map<int, const MachineInstr *> 
ConstMap;
 
  724  for (
const MachineInstr *
MI : MAI->getMSInstrs(SPIRV::MB_TypeConstVars)) {
 
  727    if (OpCode != SPIRV::OpTypeFloat && OpCode != SPIRV::OpConstantI &&
 
  728        OpCode != SPIRV::OpConstantNull)
 
  732    if (OpCode == SPIRV::OpTypeFloat) {
 
  733      SPIRVFloatTypes.push_back(
MI);
 
  736      const MachineRegisterInfo &
MRI = 
MI->getMF()->getRegInfo();
 
  737      MachineInstr *TypeMI = 
MRI.getVRegDef(
MI->getOperand(1).getReg());
 
  738      if (!TypeMI || TypeMI->
getOpcode() != SPIRV::OpTypeInt ||
 
  742      if (OpCode == SPIRV::OpConstantI)
 
  749  for (
const auto &[Func, FPFastMathDefaultInfoVec] :
 
  750       MAI->FPFastMathDefaultInfoMap) {
 
  751    if (FPFastMathDefaultInfoVec.empty())
 
  754    for (
const MachineInstr *
MI : SPIRVFloatTypes) {
 
  755      unsigned OpTypeFloatSize = 
MI->getOperand(1).getImm();
 
  758      assert(Index < FPFastMathDefaultInfoVec.size() &&
 
  759             "Index out of bounds for FPFastMathDefaultInfoVec");
 
  760      const auto &FPFastMathDefaultInfo = FPFastMathDefaultInfoVec[
Index];
 
  761      assert(FPFastMathDefaultInfo.Ty &&
 
  762             "Expected target type for FPFastMathDefaultInfo");
 
  763      assert(FPFastMathDefaultInfo.Ty->getScalarSizeInBits() ==
 
  765             "Mismatched float type size");
 
  767      Inst.
setOpcode(SPIRV::OpExecutionModeId);
 
  768      MCRegister FuncReg = MAI->getFuncReg(Func);
 
  774          MAI->getRegisterAlias(
MI->getMF(), 
MI->getOperand(0).getReg());
 
  776      unsigned Flags = FPFastMathDefaultInfo.FastMathFlags;
 
  777      if (FPFastMathDefaultInfo.ContractionOff &&
 
  778          (Flags & SPIRV::FPFastMathMode::AllowContract))
 
  780            "Conflicting FPFastMathFlags: ContractionOff and AllowContract");
 
  782      if (FPFastMathDefaultInfo.SignedZeroInfNanPreserve &&
 
  784            (SPIRV::FPFastMathMode::NotNaN | SPIRV::FPFastMathMode::NotInf |
 
  785             SPIRV::FPFastMathMode::NSZ))) {
 
  786        if (FPFastMathDefaultInfo.FPFastMathDefault)
 
  788                             "SignedZeroInfNanPreserve but at least one of " 
  789                             "NotNaN/NotInf/NSZ is enabled.");
 
  793      if (Flags == SPIRV::FPFastMathMode::None &&
 
  794          !FPFastMathDefaultInfo.ContractionOff &&
 
  795          !FPFastMathDefaultInfo.SignedZeroInfNanPreserve &&
 
  796          !FPFastMathDefaultInfo.FPFastMathDefault)
 
  803                           "Mode operand of FPFastMathDefault execution mode.");
 
  804      const MachineInstr *ConstMI = It->second;
 
  805      MCRegister ConstReg = MAI->getRegisterAlias(
 
  813void SPIRVAsmPrinter::outputModuleSections() {
 
  814  const Module *
M = MMI->getModule();
 
  816  ST = 
static_cast<const SPIRVTargetMachine &
>(
TM).getSubtargetImpl();
 
  817  TII = 
ST->getInstrInfo();
 
  819  assert(ST && 
TII && MAI && M && 
"Module analysis is required");
 
  823  outputGlobalRequirements();
 
  825  outputOpExtInstImports(*M);
 
  827  outputOpMemoryModel();
 
  832  outputExecutionMode(*M);
 
  835  outputDebugSourceAndStrings(*M);
 
  837  outputModuleSection(SPIRV::MB_DebugNames);
 
  839  outputModuleSection(SPIRV::MB_DebugModuleProcessed);
 
  842  outputModuleSection(SPIRV::MB_AliasingInsts);
 
  844  outputAnnotations(*M);
 
  849  outputModuleSection(SPIRV::MB_TypeConstVars);
 
  851  outputModuleSection(SPIRV::MB_NonSemanticGlobalDI);
 
  853  outputExtFuncDecls();
 
  858bool SPIRVAsmPrinter::doInitialization(
Module &M) {
 
  859  ModuleSectionsEmitted = 
false;
 
  864char SPIRVAsmPrinter::ID = 0;
 
  871LLVMInitializeSPIRVAsmPrinter() {
 
 
unsigned const MachineRegisterInfo * MRI
 
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
 
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
 
#define LLVM_EXTERNAL_VISIBILITY
 
This file defines the DenseMap class.
 
const HexagonInstrInfo * TII
 
Machine Check Debug Module
 
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
 
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
 
static void addOpsFromMDNode(MDNode *MDN, MCInst &Inst, SPIRV::ModuleAnalysisInfo *MAI)
 
static bool isFuncOrHeaderInstr(const MachineInstr *MI, const SPIRVInstrInfo *TII)
 
static unsigned encodeVecTypeHint(Type *Ty)
 
#define SPIRV_BACKEND_SERVICE_FUN_NAME
 
static bool printOperand(raw_ostream &OS, const SelectionDAG *G, const SDValue Value)
 
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
 
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
 
static std::optional< unsigned > getOpcode(ArrayRef< VPValue * > Values)
Returns the opcode of Values or ~0 if they do not all agree.
 
Represent the analysis usage information of a pass.
 
AnalysisUsage & addRequired()
 
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
 
This class is intended to be used as a driving class for all asm writers.
 
bool doInitialization(Module &M) override
Set up the AsmPrinter when we are working on a new module.
 
void getAnalysisUsage(AnalysisUsage &AU) const override
Record analysis usage.
 
Functions, function parameters, and return types can have attributes to indicate how they should be t...
 
LLVM_ABI bool getValueAsBool() const
Return the attribute's value as a boolean.
 
LLVM_ABI StringRef getValueAsString() const
Return the attribute's value as a string.
 
bool isValid() const
Return true if the attribute is any kind of attribute.
 
This is the shared class of boolean and integer constants.
 
This is an important base class in LLVM.
 
iterator find(const_arg_type_t< KeyT > Val)
 
Class to represent fixed width SIMD vectors.
 
static StringRef dropLLVMManglingEscape(StringRef Name)
If the given string begins with the GlobalValue name mangling escape character '\1',...
 
Class to represent integer types.
 
Instances of this class represent a single low-level machine instruction.
 
void addOperand(const MCOperand Op)
 
void setOpcode(unsigned Op)
 
static MCOperand createReg(MCRegister Reg)
 
static MCOperand createImm(int64_t Val)
 
Wrapper class representing physical registers. Should be passed by value.
 
constexpr bool isValid() const
 
StringRef getName() const
getName - Get the symbol name.
 
ArrayRef< MDOperand > operands() const
 
Tracking metadata reference owned by Metadata.
 
LLVM_ABI MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
 
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
 
Representation of each machine instruction.
 
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
 
LLVM_ABI const MachineFunction * getMF() const
Return the function that contains the basic block that this instruction belongs to.
 
const MachineOperand & getOperand(unsigned i) const
 
const GlobalValue * getGlobal() const
 
MachineBasicBlock * getMBB() const
 
const BlockAddress * getBlockAddress() const
 
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
 
const char * getSymbolName() const
 
Register getReg() const
getReg - Returns the register number.
 
const ConstantFP * getFPImm() const
 
@ MO_Immediate
Immediate operand.
 
@ MO_ConstantPoolIndex
Address of indexed Constant in Constant Pool.
 
@ MO_GlobalAddress
Address of a global value.
 
@ MO_BlockAddress
Address of a basic block.
 
@ MO_MachineBasicBlock
MachineBasicBlock reference.
 
@ MO_Register
Register operand.
 
@ MO_ExternalSymbol
Name of external global symbol.
 
@ MO_JumpTableIndex
Address of indexed Jump Table for switch.
 
@ MO_FPImmediate
Floating-point immediate operand.
 
A Module instance is used to store all the information related to an LLVM module.
 
constexpr bool isValid() const
 
static const char * getRegisterName(MCRegister Reg)
 
void lower(const MachineInstr *MI, MCInst &OutMI, SPIRV::ModuleAnalysisInfo *MAI) const
 
const SPIRVInstrInfo * getInstrInfo() const override
 
bool isAtLeastSPIRVVer(VersionTuple VerToCompareTo) const
 
VersionTuple getSPIRVVersion() const
 
unsigned getBound() const
 
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
 
bool contains(ConstPtrType Ptr) const
 
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
 
StringRef - Represent a constant reference to a string, i.e.
 
std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
 
Primary interface to the complete machine description for the target machine.
 
The instances of the Type class are immutable: once they are created, they are never changed.
 
Value * getOperand(unsigned i) const
 
LLVM_ABI void print(raw_ostream &O, bool IsForDebug=false) const
Implement operator<< on Value.
 
LLVM_ABI const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs and address space casts.
 
unsigned getMajor() const
Retrieve the major version number.
 
std::optional< unsigned > getMinor() const
Retrieve the minor version number, if provided.
 
std::pair< iterator, bool > insert(const ValueT &V)
 
This class implements an extremely fast bulk output stream that can only output to a stream.
 
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
 
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
 
@ C
The default llvm calling convention, compatible with C.
 
NodeAddr< NodeBase * > Node
 
NodeAddr< FuncNode * > Func
 
This is an optimization pass for GlobalISel generic memory operations.
 
FunctionAddr VTableAddr Value
 
Target & getTheSPIRV32Target()
 
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
 
DenseMap< Value *, Constant * > ConstMap
 
LLVM_ABI bool getConstantStringInfo(const Value *V, StringRef &Str, bool TrimAtNul=true)
This function computes the length of a null-terminated C string pointed to by V.
 
std::string getExtInstSetName(SPIRV::InstructionSet::InstructionSet Set)
 
MachineInstr * getImm(const MachineOperand &MO, const MachineRegisterInfo *MRI)
 
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
 
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
 
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
 
std::string getSymbolicOperandMnemonic(SPIRV::OperandCategory::OperandCategory Category, int32_t Value)
 
bool isEntryPoint(const Function &F)
 
Target & getTheSPIRV64Target()
 
Target & getTheSPIRVLogicalTarget()
 
DWARFExpression::Operation Op
 
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
 
Type * getMDOperandAsType(const MDNode *N, unsigned I)
 
void addStringImm(const StringRef &Str, MCInst &Inst)
 
RegisterAsmPrinter - Helper template for registering a target specific assembly printer,...
 
static struct SPIRV::ModuleAnalysisInfo MAI
 
static size_t computeFPFastMathDefaultInfoVecIndex(size_t BitWidth)
 
MCRegister getFuncReg(const Function *F)