LLVM  15.0.0git
SPIRVInstPrinter.cpp
Go to the documentation of this file.
1 //===-- SPIRVInstPrinter.cpp - 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 #include "SPIRVInstPrinter.h"
14 #include "SPIRV.h"
15 #include "SPIRVBaseInfo.h"
16 #include "llvm/CodeGen/Register.h"
17 #include "llvm/MC/MCAsmInfo.h"
18 #include "llvm/MC/MCExpr.h"
19 #include "llvm/MC/MCInst.h"
20 #include "llvm/MC/MCInstrInfo.h"
21 #include "llvm/MC/MCSymbol.h"
22 #include "llvm/Support/Casting.h"
25 
26 using namespace llvm;
27 
28 #define DEBUG_TYPE "asm-printer"
29 
30 // Include the auto-generated portion of the assembly writer.
31 #include "SPIRVGenAsmWriter.inc"
32 
34  unsigned StartIndex,
35  raw_ostream &O,
36  bool SkipFirstSpace,
37  bool SkipImmediates) {
38  const unsigned NumOps = MI->getNumOperands();
39  for (unsigned i = StartIndex; i < NumOps; ++i) {
40  if (!SkipImmediates || !MI->getOperand(i).isImm()) {
41  if (!SkipFirstSpace || i != StartIndex)
42  O << ' ';
43  printOperand(MI, i, O);
44  }
45  }
46 }
47 
49  unsigned StartIndex,
50  raw_ostream &O) {
51  O << ' ';
52  if (MI->getNumOperands() - StartIndex == 2) { // Handle 64 bit literals.
53  uint64_t Imm = MI->getOperand(StartIndex).getImm();
54  Imm |= (MI->getOperand(StartIndex + 1).getImm() << 32);
55  O << Imm;
56  } else {
57  printRemainingVariableOps(MI, StartIndex, O, true, false);
58  }
59 }
60 
61 void SPIRVInstPrinter::recordOpExtInstImport(const MCInst *MI) {
62  llvm_unreachable("Unimplemented recordOpExtInstImport");
63 }
64 
66  StringRef Annot, const MCSubtargetInfo &STI,
67  raw_ostream &OS) {
68  const unsigned OpCode = MI->getOpcode();
69  printInstruction(MI, Address, OS);
70 
71  if (OpCode == SPIRV::OpDecorate) {
72  printOpDecorate(MI, OS);
73  } else if (OpCode == SPIRV::OpExtInstImport) {
74  recordOpExtInstImport(MI);
75  } else if (OpCode == SPIRV::OpExtInst) {
76  printOpExtInst(MI, OS);
77  } else {
78  // Print any extra operands for variadic instructions.
79  MCInstrDesc MCDesc = MII.get(OpCode);
80  if (MCDesc.isVariadic()) {
81  const unsigned NumFixedOps = MCDesc.getNumOperands();
82  const unsigned LastFixedIndex = NumFixedOps - 1;
83  const int FirstVariableIndex = NumFixedOps;
84  if (NumFixedOps > 0 &&
85  MCDesc.OpInfo[LastFixedIndex].OperandType == MCOI::OPERAND_UNKNOWN) {
86  // For instructions where a custom type (not reg or immediate) comes as
87  // the last operand before the variable_ops. This is usually a StringImm
88  // operand, but there are a few other cases.
89  switch (OpCode) {
90  case SPIRV::OpTypeImage:
91  OS << ' ';
92  printAccessQualifier(MI, FirstVariableIndex, OS);
93  break;
94  case SPIRV::OpVariable:
95  OS << ' ';
96  printOperand(MI, FirstVariableIndex, OS);
97  break;
98  case SPIRV::OpEntryPoint: {
99  // Print the interface ID operands, skipping the name's string
100  // literal.
101  printRemainingVariableOps(MI, NumFixedOps, OS, false, true);
102  break;
103  }
104  case SPIRV::OpExecutionMode:
105  case SPIRV::OpExecutionModeId:
106  case SPIRV::OpLoopMerge: {
107  // Print any literals after the OPERAND_UNKNOWN argument normally.
108  printRemainingVariableOps(MI, NumFixedOps, OS);
109  break;
110  }
111  default:
112  break; // printStringImm has already been handled
113  }
114  } else {
115  // For instructions with no fixed ops or a reg/immediate as the final
116  // fixed operand, we can usually print the rest with "printOperand", but
117  // check for a few cases with custom types first.
118  switch (OpCode) {
119  case SPIRV::OpLoad:
120  case SPIRV::OpStore:
121  OS << ' ';
122  printMemoryOperand(MI, FirstVariableIndex, OS);
123  printRemainingVariableOps(MI, FirstVariableIndex + 1, OS);
124  break;
125  case SPIRV::OpImageSampleImplicitLod:
126  case SPIRV::OpImageSampleDrefImplicitLod:
127  case SPIRV::OpImageSampleProjImplicitLod:
128  case SPIRV::OpImageSampleProjDrefImplicitLod:
129  case SPIRV::OpImageFetch:
130  case SPIRV::OpImageGather:
131  case SPIRV::OpImageDrefGather:
132  case SPIRV::OpImageRead:
133  case SPIRV::OpImageWrite:
134  case SPIRV::OpImageSparseSampleImplicitLod:
135  case SPIRV::OpImageSparseSampleDrefImplicitLod:
136  case SPIRV::OpImageSparseSampleProjImplicitLod:
137  case SPIRV::OpImageSparseSampleProjDrefImplicitLod:
138  case SPIRV::OpImageSparseFetch:
139  case SPIRV::OpImageSparseGather:
140  case SPIRV::OpImageSparseDrefGather:
141  case SPIRV::OpImageSparseRead:
142  case SPIRV::OpImageSampleFootprintNV:
143  OS << ' ';
144  printImageOperand(MI, FirstVariableIndex, OS);
145  printRemainingVariableOps(MI, NumFixedOps + 1, OS);
146  break;
147  case SPIRV::OpCopyMemory:
148  case SPIRV::OpCopyMemorySized: {
149  const unsigned NumOps = MI->getNumOperands();
150  for (unsigned i = NumFixedOps; i < NumOps; ++i) {
151  OS << ' ';
152  printMemoryOperand(MI, i, OS);
153  if (MI->getOperand(i).getImm() &
154  static_cast<unsigned>(SPIRV::MemoryOperand::Aligned)) {
155  assert(i + 1 < NumOps && "Missing alignment operand");
156  OS << ' ';
157  printOperand(MI, i + 1, OS);
158  i += 1;
159  }
160  }
161  break;
162  }
163  case SPIRV::OpConstantI:
164  case SPIRV::OpConstantF:
165  printOpConstantVarOps(MI, NumFixedOps, OS);
166  break;
167  default:
168  printRemainingVariableOps(MI, NumFixedOps, OS);
169  break;
170  }
171  }
172  }
173  }
174 
175  printAnnotation(OS, Annot);
176 }
177 
179  llvm_unreachable("Unimplemented printOpExtInst");
180 }
181 
183  // The fixed operands have already been printed, so just need to decide what
184  // type of decoration operands to print based on the Decoration type.
185  MCInstrDesc MCDesc = MII.get(MI->getOpcode());
186  unsigned NumFixedOps = MCDesc.getNumOperands();
187 
188  if (NumFixedOps != MI->getNumOperands()) {
189  auto DecOp = MI->getOperand(NumFixedOps - 1);
190  auto Dec = static_cast<SPIRV::Decoration>(DecOp.getImm());
191 
192  O << ' ';
193 
194  switch (Dec) {
196  printBuiltIn(MI, NumFixedOps, O);
197  break;
199  printScope(MI, NumFixedOps, O);
200  break;
202  printFunctionParameterAttribute(MI, NumFixedOps, O);
203  break;
205  printFPRoundingMode(MI, NumFixedOps, O);
206  break;
208  printFPFastMathMode(MI, NumFixedOps, O);
209  break;
212  printStringImm(MI, NumFixedOps, O);
213  break;
214  default:
215  printRemainingVariableOps(MI, NumFixedOps, O, true);
216  break;
217  }
218  }
219 }
220 
221 static void printExpr(const MCExpr *Expr, raw_ostream &O) {
222 #ifndef NDEBUG
223  const MCSymbolRefExpr *SRE;
224 
225  if (const MCBinaryExpr *BE = dyn_cast<MCBinaryExpr>(Expr))
226  SRE = cast<MCSymbolRefExpr>(BE->getLHS());
227  else
228  SRE = cast<MCSymbolRefExpr>(Expr);
229 
231 
233 #endif
234  O << *Expr;
235 }
236 
237 void SPIRVInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
238  raw_ostream &O, const char *Modifier) {
239  assert((Modifier == 0 || Modifier[0] == 0) && "No modifiers supported");
240  if (OpNo < MI->getNumOperands()) {
241  const MCOperand &Op = MI->getOperand(OpNo);
242  if (Op.isReg())
243  O << '%' << (Register::virtReg2Index(Op.getReg()) + 1);
244  else if (Op.isImm())
245  O << formatImm((int64_t)Op.getImm());
246  else if (Op.isDFPImm())
247  O << formatImm((double)Op.getDFPImm());
248  else if (Op.isExpr())
249  printExpr(Op.getExpr(), O);
250  else
251  llvm_unreachable("Unexpected operand type");
252  }
253 }
254 
255 void SPIRVInstPrinter::printStringImm(const MCInst *MI, unsigned OpNo,
256  raw_ostream &O) {
257  const unsigned NumOps = MI->getNumOperands();
258  unsigned StrStartIndex = OpNo;
259  while (StrStartIndex < NumOps) {
260  if (MI->getOperand(StrStartIndex).isReg())
261  break;
262 
263  std::string Str = getSPIRVStringOperand(*MI, OpNo);
264  if (StrStartIndex != OpNo)
265  O << ' '; // Add a space if we're starting a new string/argument.
266  O << '"';
267  for (char c : Str) {
268  if (c == '"')
269  O.write('\\'); // Escape " characters (might break for complex UTF-8).
270  O.write(c);
271  }
272  O << '"';
273 
274  unsigned numOpsInString = (Str.size() / 4) + 1;
275  StrStartIndex += numOpsInString;
276 
277  // Check for final Op of "OpDecorate %x %stringImm %linkageAttribute".
278  if (MI->getOpcode() == SPIRV::OpDecorate &&
279  MI->getOperand(1).getImm() ==
280  static_cast<unsigned>(SPIRV::Decoration::LinkageAttributes)) {
281  O << ' ';
282  printLinkageType(MI, StrStartIndex, O);
283  break;
284  }
285  }
286 }
287 
288 void SPIRVInstPrinter::printExtInst(const MCInst *MI, unsigned OpNo,
289  raw_ostream &O) {
290  llvm_unreachable("Unimplemented printExtInst");
291 }
292 
293 void SPIRVInstPrinter::printCapability(const MCInst *MI, unsigned OpNo,
294  raw_ostream &O) {
295  if (OpNo < MI->getNumOperands()) {
297  static_cast<SPIRV::Capability>(MI->getOperand(OpNo).getImm());
299  }
300 }
301 
303  raw_ostream &O) {
304  if (OpNo < MI->getNumOperands()) {
306  static_cast<SPIRV::SourceLanguage>(MI->getOperand(OpNo).getImm());
308  }
309 }
310 
312  raw_ostream &O) {
313  if (OpNo < MI->getNumOperands()) {
315  static_cast<SPIRV::ExecutionModel>(MI->getOperand(OpNo).getImm());
317  }
318 }
319 
321  raw_ostream &O) {
322  if (OpNo < MI->getNumOperands()) {
324  static_cast<SPIRV::AddressingModel>(MI->getOperand(OpNo).getImm());
326  }
327 }
328 
329 void SPIRVInstPrinter::printMemoryModel(const MCInst *MI, unsigned OpNo,
330  raw_ostream &O) {
331  if (OpNo < MI->getNumOperands()) {
333  static_cast<SPIRV::MemoryModel>(MI->getOperand(OpNo).getImm());
335  }
336 }
337 
338 void SPIRVInstPrinter::printExecutionMode(const MCInst *MI, unsigned OpNo,
339  raw_ostream &O) {
340  if (OpNo < MI->getNumOperands()) {
342  static_cast<SPIRV::ExecutionMode>(MI->getOperand(OpNo).getImm());
344  }
345 }
346 
347 void SPIRVInstPrinter::printStorageClass(const MCInst *MI, unsigned OpNo,
348  raw_ostream &O) {
349  if (OpNo < MI->getNumOperands()) {
351  static_cast<SPIRV::StorageClass>(MI->getOperand(OpNo).getImm());
353  }
354 }
355 
356 void SPIRVInstPrinter::printDim(const MCInst *MI, unsigned OpNo,
357  raw_ostream &O) {
358  if (OpNo < MI->getNumOperands()) {
359  SPIRV::Dim e = static_cast<SPIRV::Dim>(MI->getOperand(OpNo).getImm());
360  O << SPIRV::getDimName(e);
361  }
362 }
363 
365  unsigned OpNo,
366  raw_ostream &O) {
367  if (OpNo < MI->getNumOperands()) {
369  MI->getOperand(OpNo).getImm());
371  }
372 }
373 
375  raw_ostream &O) {
376  if (OpNo < MI->getNumOperands()) {
378  static_cast<SPIRV::SamplerFilterMode>(MI->getOperand(OpNo).getImm());
380  }
381 }
382 
383 void SPIRVInstPrinter::printImageFormat(const MCInst *MI, unsigned OpNo,
384  raw_ostream &O) {
385  if (OpNo < MI->getNumOperands()) {
387  static_cast<SPIRV::ImageFormat>(MI->getOperand(OpNo).getImm());
389  }
390 }
391 
393  raw_ostream &O) {
394  if (OpNo < MI->getNumOperands()) {
396  static_cast<SPIRV::ImageChannelOrder>(MI->getOperand(OpNo).getImm());
398  }
399 }
400 
402  unsigned OpNo,
403  raw_ostream &O) {
404  if (OpNo < MI->getNumOperands()) {
406  static_cast<SPIRV::ImageChannelDataType>(MI->getOperand(OpNo).getImm());
408  }
409 }
410 
411 void SPIRVInstPrinter::printImageOperand(const MCInst *MI, unsigned OpNo,
412  raw_ostream &O) {
413  if (OpNo < MI->getNumOperands()) {
414  unsigned e = static_cast<unsigned>(MI->getOperand(OpNo).getImm());
416  }
417 }
418 
420  raw_ostream &O) {
421  if (OpNo < MI->getNumOperands()) {
422  unsigned e = static_cast<unsigned>(MI->getOperand(OpNo).getImm());
424  }
425 }
426 
428  raw_ostream &O) {
429  if (OpNo < MI->getNumOperands()) {
431  static_cast<SPIRV::FPRoundingMode>(MI->getOperand(OpNo).getImm());
433  }
434 }
435 
436 void SPIRVInstPrinter::printLinkageType(const MCInst *MI, unsigned OpNo,
437  raw_ostream &O) {
438  if (OpNo < MI->getNumOperands()) {
440  static_cast<SPIRV::LinkageType>(MI->getOperand(OpNo).getImm());
442  }
443 }
444 
446  raw_ostream &O) {
447  if (OpNo < MI->getNumOperands()) {
449  static_cast<SPIRV::AccessQualifier>(MI->getOperand(OpNo).getImm());
451  }
452 }
453 
455  unsigned OpNo,
456  raw_ostream &O) {
457  if (OpNo < MI->getNumOperands()) {
460  MI->getOperand(OpNo).getImm());
462  }
463 }
464 
465 void SPIRVInstPrinter::printDecoration(const MCInst *MI, unsigned OpNo,
466  raw_ostream &O) {
467  if (OpNo < MI->getNumOperands()) {
469  static_cast<SPIRV::Decoration>(MI->getOperand(OpNo).getImm());
471  }
472 }
473 
474 void SPIRVInstPrinter::printBuiltIn(const MCInst *MI, unsigned OpNo,
475  raw_ostream &O) {
476  if (OpNo < MI->getNumOperands()) {
477  SPIRV::BuiltIn e =
478  static_cast<SPIRV::BuiltIn>(MI->getOperand(OpNo).getImm());
480  }
481 }
482 
484  raw_ostream &O) {
485  if (OpNo < MI->getNumOperands()) {
486  unsigned e = static_cast<unsigned>(MI->getOperand(OpNo).getImm());
488  }
489 }
490 
491 void SPIRVInstPrinter::printLoopControl(const MCInst *MI, unsigned OpNo,
492  raw_ostream &O) {
493  if (OpNo < MI->getNumOperands()) {
494  unsigned e = static_cast<unsigned>(MI->getOperand(OpNo).getImm());
496  }
497 }
498 
500  raw_ostream &O) {
501  if (OpNo < MI->getNumOperands()) {
502  unsigned e = static_cast<unsigned>(MI->getOperand(OpNo).getImm());
504  }
505 }
506 
508  raw_ostream &O) {
509  if (OpNo < MI->getNumOperands()) {
510  unsigned e = static_cast<unsigned>(MI->getOperand(OpNo).getImm());
512  }
513 }
514 
515 void SPIRVInstPrinter::printMemoryOperand(const MCInst *MI, unsigned OpNo,
516  raw_ostream &O) {
517  if (OpNo < MI->getNumOperands()) {
518  unsigned e = static_cast<unsigned>(MI->getOperand(OpNo).getImm());
520  }
521 }
522 
523 void SPIRVInstPrinter::printScope(const MCInst *MI, unsigned OpNo,
524  raw_ostream &O) {
525  if (OpNo < MI->getNumOperands()) {
526  SPIRV::Scope e = static_cast<SPIRV::Scope>(MI->getOperand(OpNo).getImm());
527  O << SPIRV::getScopeName(e);
528  }
529 }
530 
532  raw_ostream &O) {
533  if (OpNo < MI->getNumOperands()) {
535  static_cast<SPIRV::GroupOperation>(MI->getOperand(OpNo).getImm());
537  }
538 }
539 
541  raw_ostream &O) {
542  if (OpNo < MI->getNumOperands()) {
544  static_cast<SPIRV::KernelEnqueueFlags>(MI->getOperand(OpNo).getImm());
546  }
547 }
548 
550  raw_ostream &O) {
551  if (OpNo < MI->getNumOperands()) {
553  static_cast<SPIRV::KernelProfilingInfo>(MI->getOperand(OpNo).getImm());
555  }
556 }
llvm::MCSymbolRefExpr::getKind
VariantKind getKind() const
Definition: MCExpr.h:401
i
i
Definition: README.txt:29
llvm::SPIRV::getSamplerAddressingModeName
StringRef getSamplerAddressingModeName(SamplerAddressingMode e)
Definition: SPIRVBaseInfo.cpp:321
llvm::SPIRV::getLoopControlName
std::string getLoopControlName(uint32_t e)
Definition: SPIRVBaseInfo.cpp:802
llvm::SPIRV::Scope
Scope
Definition: SPIRVBaseInfo.h:676
llvm::MCInstPrinter::MII
const MCInstrInfo & MII
Definition: MCInstPrinter.h:50
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:104
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::SPIRV::getSamplerFilterModeName
StringRef getSamplerFilterModeName(SamplerFilterMode e)
Definition: SPIRVBaseInfo.cpp:333
llvm::SPIRVInstPrinter::printOpConstantVarOps
void printOpConstantVarOps(const MCInst *MI, unsigned StartIndex, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:48
llvm::SPIRV::getCapabilityName
StringRef getCapabilityName(Capability e)
Definition: SPIRVBaseInfo.cpp:31
llvm::SPIRVInstPrinter::printImageOperand
void printImageOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:411
llvm::SPIRV::LinkageType
LinkageType
Definition: SPIRVBaseInfo.h:431
llvm::SPIRV::ExecutionMode
ExecutionMode
Definition: SPIRVBaseInfo.h:202
llvm::SPIRVInstPrinter::printFPRoundingMode
void printFPRoundingMode(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:427
llvm::SPIRVInstPrinter::printMemoryModel
void printMemoryModel(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:329
llvm::SPIRV::getFPFastMathModeName
std::string getFPFastMathModeName(uint32_t e)
Definition: SPIRVBaseInfo.cpp:532
llvm::SPIRV::getSourceLanguageName
StringRef getSourceLanguageName(SourceLanguage e)
Definition: SPIRVBaseInfo.cpp:167
llvm::SPIRV::getImageChannelDataTypeName
StringRef getImageChannelDataTypeName(ImageChannelDataType e)
Definition: SPIRVBaseInfo.cpp:416
llvm::SPIRV::getDecorationName
StringRef getDecorationName(Decoration e)
Definition: SPIRVBaseInfo.cpp:615
ErrorHandling.h
llvm::SPIRV::Decoration
Decoration
Definition: SPIRVBaseInfo.h:456
llvm::SPIRV::FunctionParameterAttribute
FunctionParameterAttribute
Definition: SPIRVBaseInfo.h:444
llvm::SPIRVInstPrinter::printMemorySemantics
void printMemorySemantics(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:507
llvm::SPIRVInstPrinter::printKernelEnqueueFlags
void printKernelEnqueueFlags(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:540
llvm::SPIRV::getDimName
StringRef getDimName(Dim dim)
Definition: SPIRVBaseInfo.cpp:307
llvm::SPIRV::Decoration::FPFastMathMode
@ FPFastMathMode
llvm::SPIRV::Decoration::FuncParamAttr
@ FuncParamAttr
llvm::SPIRV::getFunctionParameterAttributeName
StringRef getFunctionParameterAttributeName(FunctionParameterAttribute e)
Definition: SPIRVBaseInfo.cpp:600
llvm::SPIRV::getImageFormatName
StringRef getImageFormatName(ImageFormat e)
Definition: SPIRVBaseInfo.cpp:342
llvm::SPIRV::getMemoryModelName
StringRef getMemoryModelName(MemoryModel e)
Definition: SPIRVBaseInfo.cpp:213
llvm::SPIRV::getKernelEnqueueFlagsName
StringRef getKernelEnqueueFlagsName(KernelEnqueueFlags e)
Definition: SPIRVBaseInfo.cpp:1053
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
llvm::SPIRV::Dim
Dim
Definition: SPIRVBaseInfo.h:279
llvm::SPIRV::Decoration::BuiltIn
@ BuiltIn
llvm::MCBinaryExpr
Binary assembler expressions.
Definition: MCExpr.h:481
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:65
FormattedStream.h
llvm::SPIRVInstPrinter::printImageFormat
void printImageFormat(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:383
llvm::SPIRV::getAddressingModelName
StringRef getAddressingModelName(AddressingModel e)
Definition: SPIRVBaseInfo.cpp:202
llvm::SPIRV::getSelectionControlName
std::string getSelectionControlName(uint32_t e)
Definition: SPIRVBaseInfo.cpp:782
llvm::SPIRV::getLinkageTypeName
StringRef getLinkageTypeName(LinkageType e)
Definition: SPIRVBaseInfo.cpp:581
SPIRVBaseInfo.h
llvm::SPIRV::getAccessQualifierName
StringRef getAccessQualifierName(AccessQualifier e)
Definition: SPIRVBaseInfo.cpp:590
MCInstrInfo.h
MCSymbol.h
llvm::SPIRVInstPrinter::printDecoration
void printDecoration(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:465
llvm::SPIRV::getStorageClassName
StringRef getStorageClassName(StorageClass e)
Definition: SPIRVBaseInfo.cpp:280
llvm::SPIRV::AccessQualifier
AccessQualifier
Definition: SPIRVBaseInfo.h:437
SPIRVInstPrinter.h
llvm::SPIRVInstPrinter::printOperand
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O, const char *Modifier=nullptr)
Definition: SPIRVInstPrinter.cpp:237
llvm::SPIRVInstPrinter::printOpDecorate
void printOpDecorate(const MCInst *MI, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:182
llvm::SPIRVInstPrinter::printBuiltIn
void printBuiltIn(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:474
MCInst.h
llvm::SPIRV::getFPRoundingModeName
StringRef getFPRoundingModeName(FPRoundingMode e)
Definition: SPIRVBaseInfo.cpp:570
llvm::MCInstrDesc
Describe properties that are true of each instruction in the target description file.
Definition: MCInstrDesc.h:197
llvm::SPIRVInstPrinter::printSelectionControl
void printSelectionControl(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:483
printExpr
static void printExpr(const MCExpr *Expr, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:221
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:54
llvm::SPIRV::Decoration::UniformId
@ UniformId
c
the resulting code requires compare and branches when and if the revised code is with conditional branches instead of More there is a byte word extend before each where there should be only and the condition codes are not remembered when the same two values are compared twice More LSR enhancements i8 and i32 load store addressing modes are identical int int c
Definition: README.txt:418
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::MCInstPrinter::printAnnotation
void printAnnotation(raw_ostream &OS, StringRef Annot)
Utility function for printing annotations.
Definition: MCInstPrinter.cpp:50
llvm::SPIRV::getExecutionModeName
StringRef getExecutionModeName(ExecutionMode e)
Definition: SPIRVBaseInfo.cpp:224
llvm::SPIRV::Decoration::LinkageAttributes
@ LinkageAttributes
llvm::SPIRVInstPrinter::printExecutionModel
void printExecutionModel(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:311
llvm::SPIRVInstPrinter::printOpExtInst
void printOpExtInst(const MCInst *MI, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:178
llvm::SPIRVInstPrinter::printStorageClass
void printStorageClass(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:347
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:239
llvm::SPIRV::getImageOperandName
std::string getImageOperandName(uint32_t e)
Definition: SPIRVBaseInfo.cpp:440
llvm::SPIRV::getExecutionModelName
StringRef getExecutionModelName(ExecutionModel e)
Definition: SPIRVBaseInfo.cpp:180
llvm::MCSymbolRefExpr::VariantKind
VariantKind
Definition: MCExpr.h:194
llvm::SPIRV::StorageClass
StorageClass
Definition: SPIRVBaseInfo.h:255
uint64_t
llvm::SPIRV::AddressingModel
AddressingModel
Definition: SPIRVBaseInfo.h:167
llvm::SPIRV::getGroupOperationName
StringRef getGroupOperationName(GroupOperation e)
Definition: SPIRVBaseInfo.cpp:1039
llvm::MCOperandInfo::OperandType
uint8_t OperandType
Information about the type of the operand.
Definition: MCInstrDesc.h:96
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:57
llvm::SPIRV::SamplerFilterMode
SamplerFilterMode
Definition: SPIRVBaseInfo.h:299
llvm::SPIRV::ImageFormat
ImageFormat
Definition: SPIRVBaseInfo.h:305
llvm::SPIRV::getImageChannelOrderName
StringRef getImageChannelOrderName(ImageChannelOrder e)
Definition: SPIRVBaseInfo.cpp:389
llvm::SPIRV::getMemoryOperandName
std::string getMemoryOperandName(uint32_t e)
Definition: SPIRVBaseInfo.cpp:982
llvm::SPIRV::getBuiltInName
StringRef getBuiltInName(BuiltIn e)
Definition: SPIRVBaseInfo.cpp:684
SPIRV.h
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::SPIRV::GroupOperation
GroupOperation
Definition: SPIRVBaseInfo.h:686
llvm::SPIRV::ExecutionModel
ExecutionModel
Definition: SPIRVBaseInfo.h:175
llvm::MCInstrDesc::OpInfo
const MCOperandInfo * OpInfo
Definition: MCInstrDesc.h:208
llvm::SPIRVInstPrinter::printLinkageType
void printLinkageType(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:436
llvm::SPIRV::Capability
Capability
Definition: SPIRVBaseInfo.h:24
getSPIRVStringOperand
std::string getSPIRVStringOperand(const InstType &MI, unsigned StartIndex)
Definition: SPIRVBaseInfo.h:715
llvm::SPIRVInstPrinter::printAddressingModel
void printAddressingModel(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:320
llvm::SPIRVInstPrinter::printImageChannelOrder
void printImageChannelOrder(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:392
llvm::SPIRV::BuiltIn
BuiltIn
Definition: SPIRVBaseInfo.h:522
llvm::MCSymbolRefExpr
Represent a reference to a symbol from inside an expression.
Definition: MCExpr.h:192
llvm::SPIRVInstPrinter::printExecutionMode
void printExecutionMode(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:338
llvm::SPIRV::ImageChannelDataType
ImageChannelDataType
Definition: SPIRVBaseInfo.h:373
llvm::SPIRVInstPrinter::printFPFastMathMode
void printFPFastMathMode(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:419
llvm::MCInstPrinter::formatImm
format_object< int64_t > formatImm(int64_t Value) const
Utility function to print immediates in decimal or hex.
Definition: MCInstPrinter.h:134
llvm::SPIRV::Decoration::UserSemantic
@ UserSemantic
llvm::SPIRV::ImageChannelOrder
ImageChannelOrder
Definition: SPIRVBaseInfo.h:349
MCAsmInfo.h
llvm::SPIRV::MemoryModel
MemoryModel
Definition: SPIRVBaseInfo.h:194
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::SPIRV::SamplerAddressingMode
SamplerAddressingMode
Definition: SPIRVBaseInfo.h:290
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
llvm::SPIRVInstPrinter::printFunctionControl
void printFunctionControl(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:499
llvm::SPIRV::KernelEnqueueFlags
KernelEnqueueFlags
Definition: SPIRVBaseInfo.h:697
llvm::SPIRVInstPrinter::printExtInst
void printExtInst(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:288
llvm::SPIRVInstPrinter::printAccessQualifier
void printAccessQualifier(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:445
llvm::SPIRV::getScopeName
StringRef getScopeName(Scope e)
Definition: SPIRVBaseInfo.cpp:1026
llvm::SPIRVInstPrinter::printLoopControl
void printLoopControl(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:491
llvm::SPIRVInstPrinter::printImageChannelDataType
void printImageChannelDataType(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:401
llvm::SPIRV::getMemorySemanticsName
std::string getMemorySemanticsName(uint32_t e)
Definition: SPIRVBaseInfo.cpp:896
llvm::SPIRVInstPrinter::printRemainingVariableOps
void printRemainingVariableOps(const MCInst *MI, unsigned StartIndex, raw_ostream &O, bool SkipFirstSpace=false, bool SkipImmediates=false)
Definition: SPIRVInstPrinter.cpp:33
llvm::SPIRV::getKernelProfilingInfoName
StringRef getKernelProfilingInfoName(KernelProfilingInfo e)
Definition: SPIRVBaseInfo.cpp:1063
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:345
llvm::SPIRVInstPrinter::printFunctionParameterAttribute
void printFunctionParameterAttribute(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:454
llvm::SPIRVInstPrinter::printScope
void printScope(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:523
Casting.h
llvm::MCInstrDesc::isVariadic
bool isVariadic() const
Return true if this instruction can have a variable number of operands.
Definition: MCInstrDesc.h:258
llvm::SPIRVInstPrinter::printStringImm
void printStringImm(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:255
llvm::SPIRVInstPrinter::printKernelProfilingInfo
void printKernelProfilingInfo(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:549
llvm::SPIRVInstPrinter::printSourceLanguage
void printSourceLanguage(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:302
llvm::SPIRVInstPrinter::printMemoryOperand
void printMemoryOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:515
llvm::RISCVMatInt::Imm
@ Imm
Definition: RISCVMatInt.h:23
llvm::SPIRVInstPrinter::printDim
void printDim(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:356
llvm::SPIRV::FPRoundingMode
FPRoundingMode
Definition: SPIRVBaseInfo.h:423
llvm::SPIRVInstPrinter::printSamplerFilterMode
void printSamplerFilterMode(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:374
llvm::SPIRV::getFunctionControlName
std::string getFunctionControlName(uint32_t e)
Definition: SPIRVBaseInfo.cpp:864
llvm::MCOI::OPERAND_UNKNOWN
@ OPERAND_UNKNOWN
Definition: MCInstrDesc.h:58
llvm::MCOperand
Instances of this class represent operands of the MCInst class.
Definition: MCInst.h:36
llvm::SPIRVInstPrinter::printSamplerAddressingMode
void printSamplerAddressingMode(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:364
Register.h
llvm::MCSymbolRefExpr::VK_None
@ VK_None
Definition: MCExpr.h:195
llvm::MCInstrInfo::get
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode.
Definition: MCInstrInfo.h:63
llvm::Register::virtReg2Index
static unsigned virtReg2Index(Register Reg)
Convert a virtual register number to a 0-based index.
Definition: Register.h:77
llvm::SPIRV::KernelProfilingInfo
KernelProfilingInfo
Definition: SPIRVBaseInfo.h:704
llvm::SPIRV::SourceLanguage
SourceLanguage
Definition: SPIRVBaseInfo.h:157
MCExpr.h
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)
llvm::MCInstrDesc::getNumOperands
unsigned getNumOperands() const
Return the number of declared MachineOperands for this MachineInstruction.
Definition: MCInstrDesc.h:230
llvm::SPIRV::Decoration::FPRoundingMode
@ FPRoundingMode
llvm::MCExpr
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
llvm::SPIRVInstPrinter::printCapability
void printCapability(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:293
llvm::SPIRV::MemoryOperand::Aligned
@ Aligned
llvm::SPIRVInstPrinter::printGroupOperation
void printGroupOperation(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Definition: SPIRVInstPrinter.cpp:531