LLVM  16.0.0git
SPIRVInstPrinter.h
Go to the documentation of this file.
1 //===-- SPIRVInstPrinter.h - Output SPIR-V MCInsts as ASM -------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This class prints a SPIR-V MCInst to a .s file.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_SPIRV_INSTPRINTER_SPIRVINSTPRINTER_H
14 #define LLVM_LIB_TARGET_SPIRV_INSTPRINTER_SPIRVINSTPRINTER_H
15 
17 #include "llvm/ADT/DenseSet.h"
18 #include "llvm/MC/MCInstPrinter.h"
19 
20 namespace llvm {
22 private:
24  void recordOpExtInstImport(const MCInst *MI);
25 
26 public:
28 
29  void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
30  const MCSubtargetInfo &STI, raw_ostream &OS) override;
31  void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O,
32  const char *Modifier = nullptr);
33 
34  void printStringImm(const MCInst *MI, unsigned OpNo, raw_ostream &O);
35 
36  void printOpDecorate(const MCInst *MI, raw_ostream &O);
37  void printOpExtInst(const MCInst *MI, raw_ostream &O);
38  void printRemainingVariableOps(const MCInst *MI, unsigned StartIndex,
39  raw_ostream &O, bool SkipFirstSpace = false,
40  bool SkipImmediates = false);
41  void printOpConstantVarOps(const MCInst *MI, unsigned StartIndex,
42  raw_ostream &O);
43 
44  void printExtension(const MCInst *MI, unsigned OpNo, raw_ostream &O);
45  template <SPIRV::OperandCategory::OperandCategory category>
46  void printSymbolicOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
47 
48  // Autogenerated by tblgen.
49  std::pair<const char *, uint64_t> getMnemonic(const MCInst *MI) override;
50  void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
51  static const char *getRegisterName(unsigned RegNo);
52 };
53 } // namespace llvm
54 
55 #endif // LLVM_LIB_TARGET_SPIRV_INSTPRINTER_SPIRVINSTPRINTER_H
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:108
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::SPIRVInstPrinter::printOpConstantVarOps
void printOpConstantVarOps(const MCInst *MI, unsigned StartIndex, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:49
llvm::SmallDenseMap< unsigned, SPIRV::InstructionSet::InstructionSet >
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
llvm::SPIRVInstPrinter::printInst
void printInst(const MCInst *MI, uint64_t Address, StringRef Annot, const MCSubtargetInfo &STI, raw_ostream &OS) override
Print the specified MCInst to the specified raw_ostream.
Definition: SPIRVInstPrinter.cpp:69
SPIRVBaseInfo.h
llvm::SPIRVInstPrinter::getRegisterName
static const char * getRegisterName(unsigned RegNo)
llvm::SPIRVInstPrinter::getMnemonic
std::pair< const char *, uint64_t > getMnemonic(const MCInst *MI) override
Returns a pair containing the mnemonic for MI and the number of bits left for further processing by p...
llvm::SPIRVInstPrinter::printOperand
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O, const char *Modifier=nullptr)
Definition: SPIRVInstPrinter.cpp:258
llvm::SPIRVInstPrinter::printOpDecorate
void printOpDecorate(const MCInst *MI, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:200
DenseSet.h
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
MCInstPrinter.h
llvm::SPIRVInstPrinter::printOpExtInst
void printOpExtInst(const MCInst *MI, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:185
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:264
uint64_t
llvm::MCInstPrinter
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:43
llvm::MCInstPrinter::MCInstPrinter
MCInstPrinter(const MCAsmInfo &mai, const MCInstrInfo &mii, const MCRegisterInfo &mri)
Definition: MCInstPrinter.h:82
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm::SPIRVInstPrinter::printRemainingVariableOps
void printRemainingVariableOps(const MCInst *MI, unsigned StartIndex, raw_ostream &O, bool SkipFirstSpace=false, bool SkipImmediates=false)
Definition: SPIRVInstPrinter.cpp:34
llvm::SPIRVInstPrinter::printSymbolicOperand
void printSymbolicOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:319
llvm::SPIRVInstPrinter::printExtension
void printExtension(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:310
llvm::SPIRVInstPrinter::printStringImm
void printStringImm(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:276
llvm::SPIRVInstPrinter
Definition: SPIRVInstPrinter.h:21
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:76
llvm::SPIRVInstPrinter::printInstruction
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O)