LLVM  16.0.0git
ScopedPrinter.h
Go to the documentation of this file.
1 //===-- ScopedPrinter.h ----------------------------------------*- 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 #ifndef LLVM_SUPPORT_SCOPEDPRINTER_H
10 #define LLVM_SUPPORT_SCOPEDPRINTER_H
11 
12 #include "llvm/ADT/APSInt.h"
13 #include "llvm/ADT/ArrayRef.h"
14 #include "llvm/ADT/SmallVector.h"
15 #include "llvm/ADT/StringExtras.h"
16 #include "llvm/ADT/StringRef.h"
17 #include "llvm/Support/DataTypes.h"
18 #include "llvm/Support/Endian.h"
19 #include "llvm/Support/JSON.h"
21 
22 namespace llvm {
23 
24 template <typename T> struct EnumEntry {
26  // While Name suffices in most of the cases, in certain cases
27  // GNU style and LLVM style of ELFDumper do not
28  // display same string for same enum. The AltName if initialized appropriately
29  // will hold the string that GNU style emits.
30  // Example:
31  // "EM_X86_64" string on LLVM style for Elf_Ehdr->e_machine corresponds to
32  // "Advanced Micro Devices X86-64" on GNU style
35  constexpr EnumEntry(StringRef N, StringRef A, T V)
36  : Name(N), AltName(A), Value(V) {}
37  constexpr EnumEntry(StringRef N, T V) : Name(N), AltName(N), Value(V) {}
38 };
39 
40 struct HexNumber {
41  // To avoid sign-extension we have to explicitly cast to the appropriate
42  // unsigned type. The overloads are here so that every type that is implicitly
43  // convertible to an integer (including enums and endian helpers) can be used
44  // without requiring type traits or call-site changes.
45  HexNumber(char Value) : Value(static_cast<unsigned char>(Value)) {}
46  HexNumber(signed char Value) : Value(static_cast<unsigned char>(Value)) {}
47  HexNumber(signed short Value) : Value(static_cast<unsigned short>(Value)) {}
48  HexNumber(signed int Value) : Value(static_cast<unsigned int>(Value)) {}
49  HexNumber(signed long Value) : Value(static_cast<unsigned long>(Value)) {}
50  HexNumber(signed long long Value)
51  : Value(static_cast<unsigned long long>(Value)) {}
52  HexNumber(unsigned char Value) : Value(Value) {}
53  HexNumber(unsigned short Value) : Value(Value) {}
54  HexNumber(unsigned int Value) : Value(Value) {}
55  HexNumber(unsigned long Value) : Value(Value) {}
56  HexNumber(unsigned long long Value) : Value(Value) {}
58 };
59 
60 struct FlagEntry {
62  : Name(Name), Value(static_cast<unsigned char>(Value)) {}
63  FlagEntry(StringRef Name, signed char Value)
64  : Name(Name), Value(static_cast<unsigned char>(Value)) {}
65  FlagEntry(StringRef Name, signed short Value)
66  : Name(Name), Value(static_cast<unsigned short>(Value)) {}
68  : Name(Name), Value(static_cast<unsigned int>(Value)) {}
69  FlagEntry(StringRef Name, signed long Value)
70  : Name(Name), Value(static_cast<unsigned long>(Value)) {}
71  FlagEntry(StringRef Name, signed long long Value)
72  : Name(Name), Value(static_cast<unsigned long long>(Value)) {}
73  FlagEntry(StringRef Name, unsigned char Value) : Name(Name), Value(Value) {}
74  FlagEntry(StringRef Name, unsigned short Value) : Name(Name), Value(Value) {}
75  FlagEntry(StringRef Name, unsigned int Value) : Name(Name), Value(Value) {}
76  FlagEntry(StringRef Name, unsigned long Value) : Name(Name), Value(Value) {}
77  FlagEntry(StringRef Name, unsigned long long Value)
78  : Name(Name), Value(Value) {}
81 };
82 
84 
85 template <class T> std::string to_string(const T &Value) {
86  std::string number;
87  raw_string_ostream stream(number);
88  stream << Value;
89  return stream.str();
90 }
91 
92 template <typename T, typename TEnum>
93 std::string enumToString(T Value, ArrayRef<EnumEntry<TEnum>> EnumValues) {
94  for (const EnumEntry<TEnum> &EnumItem : EnumValues)
95  if (EnumItem.Value == Value)
96  return std::string(EnumItem.AltName);
97  return utohexstr(Value, true);
98 }
99 
101 public:
102  enum class ScopedPrinterKind {
103  Base,
104  JSON,
105  };
106 
109  : OS(OS), Kind(Kind) {}
110 
111  ScopedPrinterKind getKind() const { return Kind; }
112 
113  static bool classof(const ScopedPrinter *SP) {
114  return SP->getKind() == ScopedPrinterKind::Base;
115  }
116 
117  virtual ~ScopedPrinter() = default;
118 
119  void flush() { OS.flush(); }
120 
121  void indent(int Levels = 1) { IndentLevel += Levels; }
122 
123  void unindent(int Levels = 1) {
124  IndentLevel = IndentLevel > Levels ? IndentLevel - Levels : 0;
125  }
126 
127  void resetIndent() { IndentLevel = 0; }
128 
129  int getIndentLevel() { return IndentLevel; }
130 
131  void setPrefix(StringRef P) { Prefix = P; }
132 
133  void printIndent() {
134  OS << Prefix;
135  for (int i = 0; i < IndentLevel; ++i)
136  OS << " ";
137  }
138 
139  template <typename T> HexNumber hex(T Value) { return HexNumber(Value); }
140 
141  template <typename T, typename TEnum>
142  void printEnum(StringRef Label, T Value,
143  ArrayRef<EnumEntry<TEnum>> EnumValues) {
144  StringRef Name;
145  bool Found = false;
146  for (const auto &EnumItem : EnumValues) {
147  if (EnumItem.Value == Value) {
148  Name = EnumItem.Name;
149  Found = true;
150  break;
151  }
152  }
153 
154  if (Found)
155  printHex(Label, Name, Value);
156  else
157  printHex(Label, Value);
158  }
159 
160  template <typename T, typename TFlag>
162  TFlag EnumMask1 = {}, TFlag EnumMask2 = {},
163  TFlag EnumMask3 = {}) {
164  SmallVector<FlagEntry, 10> SetFlags;
165 
166  for (const auto &Flag : Flags) {
167  if (Flag.Value == 0)
168  continue;
169 
170  TFlag EnumMask{};
171  if (Flag.Value & EnumMask1)
172  EnumMask = EnumMask1;
173  else if (Flag.Value & EnumMask2)
174  EnumMask = EnumMask2;
175  else if (Flag.Value & EnumMask3)
176  EnumMask = EnumMask3;
177  bool IsEnum = (Flag.Value & EnumMask) != 0;
178  if ((!IsEnum && (Value & Flag.Value) == Flag.Value) ||
179  (IsEnum && (Value & EnumMask) == Flag.Value)) {
180  SetFlags.emplace_back(Flag.Name, Flag.Value);
181  }
182  }
183 
184  llvm::sort(SetFlags, &flagName);
185  printFlagsImpl(Label, hex(Value), SetFlags);
186  }
187 
188  template <typename T> void printFlags(StringRef Label, T Value) {
190  uint64_t Flag = 1;
191  uint64_t Curr = Value;
192  while (Curr > 0) {
193  if (Curr & 1)
194  SetFlags.emplace_back(Flag);
195  Curr >>= 1;
196  Flag <<= 1;
197  }
198  printFlagsImpl(Label, hex(Value), SetFlags);
199  }
200 
201  virtual void printNumber(StringRef Label, uint64_t Value) {
202  startLine() << Label << ": " << Value << "\n";
203  }
204 
205  virtual void printNumber(StringRef Label, uint32_t Value) {
206  startLine() << Label << ": " << Value << "\n";
207  }
208 
209  virtual void printNumber(StringRef Label, uint16_t Value) {
210  startLine() << Label << ": " << Value << "\n";
211  }
212 
213  virtual void printNumber(StringRef Label, uint8_t Value) {
214  startLine() << Label << ": " << unsigned(Value) << "\n";
215  }
216 
217  virtual void printNumber(StringRef Label, int64_t Value) {
218  startLine() << Label << ": " << Value << "\n";
219  }
220 
221  virtual void printNumber(StringRef Label, int32_t Value) {
222  startLine() << Label << ": " << Value << "\n";
223  }
224 
225  virtual void printNumber(StringRef Label, int16_t Value) {
226  startLine() << Label << ": " << Value << "\n";
227  }
228 
229  virtual void printNumber(StringRef Label, int8_t Value) {
230  startLine() << Label << ": " << int(Value) << "\n";
231  }
232 
233  virtual void printNumber(StringRef Label, const APSInt &Value) {
234  startLine() << Label << ": " << Value << "\n";
235  }
236 
237  template <typename T>
238  void printNumber(StringRef Label, StringRef Str, T Value) {
239  printNumberImpl(Label, Str, to_string(Value));
240  }
241 
242  virtual void printBoolean(StringRef Label, bool Value) {
243  startLine() << Label << ": " << (Value ? "Yes" : "No") << '\n';
244  }
245 
246  template <typename... T> void printVersion(StringRef Label, T... Version) {
247  startLine() << Label << ": ";
248  printVersionInternal(Version...);
249  getOStream() << "\n";
250  }
251 
252  template <typename T>
253  void printList(StringRef Label, const ArrayRef<T> List) {
254  SmallVector<std::string, 10> StringList;
255  for (const auto &Item : List)
256  StringList.emplace_back(to_string(Item));
257  printList(Label, StringList);
258  }
259 
260  virtual void printList(StringRef Label, const ArrayRef<bool> List) {
261  printListImpl(Label, List);
262  }
263 
264  virtual void printList(StringRef Label, const ArrayRef<std::string> List) {
265  printListImpl(Label, List);
266  }
267 
268  virtual void printList(StringRef Label, const ArrayRef<uint64_t> List) {
269  printListImpl(Label, List);
270  }
271 
272  virtual void printList(StringRef Label, const ArrayRef<uint32_t> List) {
273  printListImpl(Label, List);
274  }
275 
276  virtual void printList(StringRef Label, const ArrayRef<uint16_t> List) {
277  printListImpl(Label, List);
278  }
279 
280  virtual void printList(StringRef Label, const ArrayRef<uint8_t> List) {
281  SmallVector<unsigned> NumberList;
282  for (const uint8_t &Item : List)
283  NumberList.emplace_back(Item);
284  printListImpl(Label, NumberList);
285  }
286 
287  virtual void printList(StringRef Label, const ArrayRef<int64_t> List) {
288  printListImpl(Label, List);
289  }
290 
291  virtual void printList(StringRef Label, const ArrayRef<int32_t> List) {
292  printListImpl(Label, List);
293  }
294 
295  virtual void printList(StringRef Label, const ArrayRef<int16_t> List) {
296  printListImpl(Label, List);
297  }
298 
299  virtual void printList(StringRef Label, const ArrayRef<int8_t> List) {
300  SmallVector<int> NumberList;
301  for (const int8_t &Item : List)
302  NumberList.emplace_back(Item);
303  printListImpl(Label, NumberList);
304  }
305 
306  virtual void printList(StringRef Label, const ArrayRef<APSInt> List) {
307  printListImpl(Label, List);
308  }
309 
310  template <typename T, typename U>
311  void printList(StringRef Label, const T &List, const U &Printer) {
312  startLine() << Label << ": [";
313  ListSeparator LS;
314  for (const auto &Item : List) {
315  OS << LS;
316  Printer(OS, Item);
317  }
318  OS << "]\n";
319  }
320 
321  template <typename T> void printHexList(StringRef Label, const T &List) {
322  SmallVector<HexNumber> HexList;
323  for (const auto &Item : List)
324  HexList.emplace_back(Item);
325  printHexListImpl(Label, HexList);
326  }
327 
328  template <typename T> void printHex(StringRef Label, T Value) {
329  printHexImpl(Label, hex(Value));
330  }
331 
332  template <typename T> void printHex(StringRef Label, StringRef Str, T Value) {
333  printHexImpl(Label, Str, hex(Value));
334  }
335 
336  template <typename T>
337  void printSymbolOffset(StringRef Label, StringRef Symbol, T Value) {
338  printSymbolOffsetImpl(Label, Symbol, hex(Value));
339  }
340 
341  virtual void printString(StringRef Value) { startLine() << Value << "\n"; }
342 
343  virtual void printString(StringRef Label, StringRef Value) {
344  startLine() << Label << ": " << Value << "\n";
345  }
346 
348  printStringEscapedImpl(Label, Value);
349  }
350 
352  printBinaryImpl(Label, Str, Value, false);
353  }
354 
356  auto V = makeArrayRef(reinterpret_cast<const uint8_t *>(Value.data()),
357  Value.size());
358  printBinaryImpl(Label, Str, V, false);
359  }
360 
362  printBinaryImpl(Label, StringRef(), Value, false);
363  }
364 
366  auto V = makeArrayRef(reinterpret_cast<const uint8_t *>(Value.data()),
367  Value.size());
368  printBinaryImpl(Label, StringRef(), V, false);
369  }
370 
372  auto V = makeArrayRef(reinterpret_cast<const uint8_t *>(Value.data()),
373  Value.size());
374  printBinaryImpl(Label, StringRef(), V, false);
375  }
376 
378  uint32_t StartOffset) {
379  printBinaryImpl(Label, StringRef(), Value, true, StartOffset);
380  }
381 
383  printBinaryImpl(Label, StringRef(), Value, true);
384  }
385 
387  auto V = makeArrayRef(reinterpret_cast<const uint8_t *>(Value.data()),
388  Value.size());
389  printBinaryImpl(Label, StringRef(), V, true);
390  }
391 
392  template <typename T> void printObject(StringRef Label, const T &Value) {
393  printString(Label, to_string(Value));
394  }
395 
396  virtual void objectBegin() { scopedBegin('{'); }
397 
398  virtual void objectBegin(StringRef Label) { scopedBegin(Label, '{'); }
399 
400  virtual void objectEnd() { scopedEnd('}'); }
401 
402  virtual void arrayBegin() { scopedBegin('['); }
403 
404  virtual void arrayBegin(StringRef Label) { scopedBegin(Label, '['); }
405 
406  virtual void arrayEnd() { scopedEnd(']'); }
407 
408  virtual raw_ostream &startLine() {
409  printIndent();
410  return OS;
411  }
412 
413  virtual raw_ostream &getOStream() { return OS; }
414 
415 private:
416  template <typename T> void printVersionInternal(T Value) {
417  getOStream() << Value;
418  }
419 
420  template <typename S, typename T, typename... TArgs>
421  void printVersionInternal(S Value, T Value2, TArgs... Args) {
422  getOStream() << Value << ".";
423  printVersionInternal(Value2, Args...);
424  }
425 
426  static bool flagName(const FlagEntry &LHS, const FlagEntry &RHS) {
427  return LHS.Name < RHS.Name;
428  }
429 
430  virtual void printBinaryImpl(StringRef Label, StringRef Str,
431  ArrayRef<uint8_t> Value, bool Block,
432  uint32_t StartOffset = 0);
433 
434  virtual void printFlagsImpl(StringRef Label, HexNumber Value,
435  ArrayRef<FlagEntry> Flags) {
436  startLine() << Label << " [ (" << Value << ")\n";
437  for (const auto &Flag : Flags)
438  startLine() << " " << Flag.Name << " (" << hex(Flag.Value) << ")\n";
439  startLine() << "]\n";
440  }
441 
442  virtual void printFlagsImpl(StringRef Label, HexNumber Value,
443  ArrayRef<HexNumber> Flags) {
444  startLine() << Label << " [ (" << Value << ")\n";
445  for (const auto &Flag : Flags)
446  startLine() << " " << Flag << '\n';
447  startLine() << "]\n";
448  }
449 
450  template <typename T> void printListImpl(StringRef Label, const T List) {
451  startLine() << Label << ": [";
452  ListSeparator LS;
453  for (const auto &Item : List)
454  OS << LS << Item;
455  OS << "]\n";
456  }
457 
458  virtual void printHexListImpl(StringRef Label,
459  const ArrayRef<HexNumber> List) {
460  startLine() << Label << ": [";
461  ListSeparator LS;
462  for (const auto &Item : List)
463  OS << LS << hex(Item);
464  OS << "]\n";
465  }
466 
467  virtual void printHexImpl(StringRef Label, HexNumber Value) {
468  startLine() << Label << ": " << Value << "\n";
469  }
470 
471  virtual void printHexImpl(StringRef Label, StringRef Str, HexNumber Value) {
472  startLine() << Label << ": " << Str << " (" << Value << ")\n";
473  }
474 
475  virtual void printSymbolOffsetImpl(StringRef Label, StringRef Symbol,
476  HexNumber Value) {
477  startLine() << Label << ": " << Symbol << '+' << Value << '\n';
478  }
479 
480  virtual void printNumberImpl(StringRef Label, StringRef Str,
481  StringRef Value) {
482  startLine() << Label << ": " << Str << " (" << Value << ")\n";
483  }
484 
485  virtual void printStringEscapedImpl(StringRef Label, StringRef Value) {
486  startLine() << Label << ": ";
487  OS.write_escaped(Value);
488  OS << '\n';
489  }
490 
491  void scopedBegin(char Symbol) {
492  startLine() << Symbol << '\n';
493  indent();
494  }
495 
496  void scopedBegin(StringRef Label, char Symbol) {
497  startLine() << Label;
498  if (!Label.empty())
499  OS << ' ';
500  OS << Symbol << '\n';
501  indent();
502  }
503 
504  void scopedEnd(char Symbol) {
505  unindent();
506  startLine() << Symbol << '\n';
507  }
508 
509  raw_ostream &OS;
510  int IndentLevel = 0;
511  StringRef Prefix;
512  ScopedPrinterKind Kind;
513 };
514 
515 template <>
516 inline void
517 ScopedPrinter::printHex<support::ulittle16_t>(StringRef Label,
519  startLine() << Label << ": " << hex(Value) << "\n";
520 }
521 
522 struct DelimitedScope;
523 
525 private:
526  enum class Scope {
527  Array,
528  Object,
529  };
530 
531  enum class ScopeKind {
532  NoAttribute,
533  Attribute,
534  NestedAttribute,
535  };
536 
537  struct ScopeContext {
538  Scope Context;
539  ScopeKind Kind;
540  ScopeContext(Scope Context, ScopeKind Kind = ScopeKind::NoAttribute)
541  : Context(Context), Kind(Kind) {}
542  };
543 
544  SmallVector<ScopeContext, 8> ScopeHistory;
545  json::OStream JOS;
546  std::unique_ptr<DelimitedScope> OuterScope;
547 
548 public:
549  JSONScopedPrinter(raw_ostream &OS, bool PrettyPrint = false,
550  std::unique_ptr<DelimitedScope> &&OuterScope =
551  std::unique_ptr<DelimitedScope>{});
552 
553  static bool classof(const ScopedPrinter *SP) {
555  }
556 
557  void printNumber(StringRef Label, uint64_t Value) override {
558  JOS.attribute(Label, Value);
559  }
560 
561  void printNumber(StringRef Label, uint32_t Value) override {
562  JOS.attribute(Label, Value);
563  }
564 
565  void printNumber(StringRef Label, uint16_t Value) override {
566  JOS.attribute(Label, Value);
567  }
568 
569  void printNumber(StringRef Label, uint8_t Value) override {
570  JOS.attribute(Label, Value);
571  }
572 
573  void printNumber(StringRef Label, int64_t Value) override {
574  JOS.attribute(Label, Value);
575  }
576 
577  void printNumber(StringRef Label, int32_t Value) override {
578  JOS.attribute(Label, Value);
579  }
580 
581  void printNumber(StringRef Label, int16_t Value) override {
582  JOS.attribute(Label, Value);
583  }
584 
585  void printNumber(StringRef Label, int8_t Value) override {
586  JOS.attribute(Label, Value);
587  }
588 
589  void printNumber(StringRef Label, const APSInt &Value) override {
590  JOS.attributeBegin(Label);
591  printAPSInt(Value);
592  JOS.attributeEnd();
593  }
594 
595  void printBoolean(StringRef Label, bool Value) override {
596  JOS.attribute(Label, Value);
597  }
598 
599  void printList(StringRef Label, const ArrayRef<bool> List) override {
600  printListImpl(Label, List);
601  }
602 
603  void printList(StringRef Label, const ArrayRef<std::string> List) override {
604  printListImpl(Label, List);
605  }
606 
607  void printList(StringRef Label, const ArrayRef<uint64_t> List) override {
608  printListImpl(Label, List);
609  }
610 
611  void printList(StringRef Label, const ArrayRef<uint32_t> List) override {
612  printListImpl(Label, List);
613  }
614 
615  void printList(StringRef Label, const ArrayRef<uint16_t> List) override {
616  printListImpl(Label, List);
617  }
618 
619  void printList(StringRef Label, const ArrayRef<uint8_t> List) override {
620  printListImpl(Label, List);
621  }
622 
623  void printList(StringRef Label, const ArrayRef<int64_t> List) override {
624  printListImpl(Label, List);
625  }
626 
627  void printList(StringRef Label, const ArrayRef<int32_t> List) override {
628  printListImpl(Label, List);
629  }
630 
631  void printList(StringRef Label, const ArrayRef<int16_t> List) override {
632  printListImpl(Label, List);
633  }
634 
635  void printList(StringRef Label, const ArrayRef<int8_t> List) override {
636  printListImpl(Label, List);
637  }
638 
639  void printList(StringRef Label, const ArrayRef<APSInt> List) override {
640  JOS.attributeArray(Label, [&]() {
641  for (const APSInt &Item : List) {
642  printAPSInt(Item);
643  }
644  });
645  }
646 
647  void printString(StringRef Value) override { JOS.value(Value); }
648 
649  void printString(StringRef Label, StringRef Value) override {
650  JOS.attribute(Label, Value);
651  }
652 
653  void objectBegin() override {
654  scopedBegin({Scope::Object, ScopeKind::NoAttribute});
655  }
656 
657  void objectBegin(StringRef Label) override {
658  scopedBegin(Label, Scope::Object);
659  }
660 
661  void objectEnd() override { scopedEnd(); }
662 
663  void arrayBegin() override {
664  scopedBegin({Scope::Array, ScopeKind::NoAttribute});
665  }
666 
667  void arrayBegin(StringRef Label) override {
668  scopedBegin(Label, Scope::Array);
669  }
670 
671  void arrayEnd() override { scopedEnd(); }
672 
673 private:
674  // Output HexNumbers as decimals so that they're easier to parse.
675  uint64_t hexNumberToInt(HexNumber Hex) { return Hex.Value; }
676 
677  void printAPSInt(const APSInt &Value) {
678  JOS.rawValueBegin() << Value;
679  JOS.rawValueEnd();
680  }
681 
682  void printFlagsImpl(StringRef Label, HexNumber Value,
683  ArrayRef<FlagEntry> Flags) override {
684  JOS.attributeObject(Label, [&]() {
685  JOS.attribute("RawFlags", hexNumberToInt(Value));
686  JOS.attributeArray("Flags", [&]() {
687  for (const FlagEntry &Flag : Flags) {
688  JOS.objectBegin();
689  JOS.attribute("Name", Flag.Name);
690  JOS.attribute("Value", Flag.Value);
691  JOS.objectEnd();
692  }
693  });
694  });
695  }
696 
697  void printFlagsImpl(StringRef Label, HexNumber Value,
698  ArrayRef<HexNumber> Flags) override {
699  JOS.attributeObject(Label, [&]() {
700  JOS.attribute("RawFlags", hexNumberToInt(Value));
701  JOS.attributeArray("Flags", [&]() {
702  for (const HexNumber &Flag : Flags) {
703  JOS.value(Flag.Value);
704  }
705  });
706  });
707  }
708 
709  template <typename T> void printListImpl(StringRef Label, const T &List) {
710  JOS.attributeArray(Label, [&]() {
711  for (const auto &Item : List)
712  JOS.value(Item);
713  });
714  }
715 
716  void printHexListImpl(StringRef Label,
717  const ArrayRef<HexNumber> List) override {
718  JOS.attributeArray(Label, [&]() {
719  for (const HexNumber &Item : List) {
720  JOS.value(hexNumberToInt(Item));
721  }
722  });
723  }
724 
725  void printHexImpl(StringRef Label, HexNumber Value) override {
726  JOS.attribute(Label, hexNumberToInt(Value));
727  }
728 
729  void printHexImpl(StringRef Label, StringRef Str, HexNumber Value) override {
730  JOS.attributeObject(Label, [&]() {
731  JOS.attribute("Value", Str);
732  JOS.attribute("RawValue", hexNumberToInt(Value));
733  });
734  }
735 
736  void printSymbolOffsetImpl(StringRef Label, StringRef Symbol,
737  HexNumber Value) override {
738  JOS.attributeObject(Label, [&]() {
739  JOS.attribute("SymName", Symbol);
740  JOS.attribute("Offset", hexNumberToInt(Value));
741  });
742  }
743 
744  void printNumberImpl(StringRef Label, StringRef Str,
745  StringRef Value) override {
746  JOS.attributeObject(Label, [&]() {
747  JOS.attribute("Value", Str);
748  JOS.attributeBegin("RawValue");
749  JOS.rawValueBegin() << Value;
750  JOS.rawValueEnd();
751  JOS.attributeEnd();
752  });
753  }
754 
755  void printBinaryImpl(StringRef Label, StringRef Str, ArrayRef<uint8_t> Value,
756  bool Block, uint32_t StartOffset = 0) override {
757  JOS.attributeObject(Label, [&]() {
758  if (!Str.empty())
759  JOS.attribute("Value", Str);
760  JOS.attribute("Offset", StartOffset);
761  JOS.attributeArray("Bytes", [&]() {
762  for (uint8_t Val : Value)
763  JOS.value(Val);
764  });
765  });
766  }
767 
768  void scopedBegin(ScopeContext ScopeCtx) {
769  if (ScopeCtx.Context == Scope::Object)
770  JOS.objectBegin();
771  else if (ScopeCtx.Context == Scope::Array)
772  JOS.arrayBegin();
773  ScopeHistory.push_back(ScopeCtx);
774  }
775 
776  void scopedBegin(StringRef Label, Scope Ctx) {
777  ScopeKind Kind = ScopeKind::Attribute;
778  if (ScopeHistory.empty() || ScopeHistory.back().Context != Scope::Object) {
779  JOS.objectBegin();
780  Kind = ScopeKind::NestedAttribute;
781  }
782  JOS.attributeBegin(Label);
783  scopedBegin({Ctx, Kind});
784  }
785 
786  void scopedEnd() {
787  ScopeContext ScopeCtx = ScopeHistory.back();
788  if (ScopeCtx.Context == Scope::Object)
789  JOS.objectEnd();
790  else if (ScopeCtx.Context == Scope::Array)
791  JOS.arrayEnd();
792  if (ScopeCtx.Kind == ScopeKind::Attribute ||
793  ScopeCtx.Kind == ScopeKind::NestedAttribute)
794  JOS.attributeEnd();
795  if (ScopeCtx.Kind == ScopeKind::NestedAttribute)
796  JOS.objectEnd();
797  ScopeHistory.pop_back();
798  }
799 };
800 
803  DelimitedScope() : W(nullptr) {}
804  virtual ~DelimitedScope() = default;
805  virtual void setPrinter(ScopedPrinter &W) = 0;
807 };
808 
810  explicit DictScope() = default;
812 
814  W.objectBegin(N);
815  }
816 
817  void setPrinter(ScopedPrinter &W) override {
818  this->W = &W;
819  W.objectBegin();
820  }
821 
823  if (W)
824  W->objectEnd();
825  }
826 };
827 
829  explicit ListScope() = default;
831 
833  W.arrayBegin(N);
834  }
835 
836  void setPrinter(ScopedPrinter &W) override {
837  this->W = &W;
838  W.arrayBegin();
839  }
840 
842  if (W)
843  W->arrayEnd();
844  }
845 };
846 
847 } // namespace llvm
848 
849 #endif
llvm::JSONScopedPrinter::printList
void printList(StringRef Label, const ArrayRef< APSInt > List) override
Definition: ScopedPrinter.h:639
i
i
Definition: README.txt:29
llvm::ScopedPrinter::printNumber
virtual void printNumber(StringRef Label, int8_t Value)
Definition: ScopedPrinter.h:229
llvm::JSONScopedPrinter::printNumber
void printNumber(StringRef Label, int16_t Value) override
Definition: ScopedPrinter.h:581
llvm::json::OStream::attributeBegin
void attributeBegin(llvm::StringRef Key)
Definition: JSON.cpp:880
llvm::ScopedPrinter::printSymbolOffset
void printSymbolOffset(StringRef Label, StringRef Symbol, T Value)
Definition: ScopedPrinter.h:337
llvm::FlagEntry
Definition: ScopedPrinter.h:60
llvm::ScopedPrinter::printVersion
void printVersion(StringRef Label, T... Version)
Definition: ScopedPrinter.h:246
llvm::ScopedPrinter::objectEnd
virtual void objectEnd()
Definition: ScopedPrinter.h:400
llvm::ScopedPrinter::printNumber
void printNumber(StringRef Label, StringRef Str, T Value)
Definition: ScopedPrinter.h:238
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::ScopedPrinter::~ScopedPrinter
virtual ~ScopedPrinter()=default
llvm::ScopedPrinter::ScopedPrinterKind::Base
@ Base
llvm::DictScope::DictScope
DictScope(ScopedPrinter &W, StringRef N)
Definition: ScopedPrinter.h:813
llvm::HexNumber::HexNumber
HexNumber(unsigned long long Value)
Definition: ScopedPrinter.h:56
llvm::ScopedPrinter::printList
virtual void printList(StringRef Label, const ArrayRef< uint16_t > List)
Definition: ScopedPrinter.h:276
llvm::FlagEntry::FlagEntry
FlagEntry(StringRef Name, unsigned long Value)
Definition: ScopedPrinter.h:76
llvm::ScopedPrinter::printList
virtual void printList(StringRef Label, const ArrayRef< int32_t > List)
Definition: ScopedPrinter.h:291
llvm::support::detail::packed_endian_specific_integral
Definition: Endian.h:206
llvm::ScopedPrinter::printNumber
virtual void printNumber(StringRef Label, int64_t Value)
Definition: ScopedPrinter.h:217
llvm::Attribute
Definition: Attributes.h:67
StringRef.h
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::json::OStream::attributeEnd
void attributeEnd()
Definition: JSON.cpp:900
llvm::ScopedPrinter::printBinary
void printBinary(StringRef Label, StringRef Str, ArrayRef< char > Value)
Definition: ScopedPrinter.h:355
llvm::DelimitedScope::DelimitedScope
DelimitedScope()
Definition: ScopedPrinter.h:803
llvm::raw_string_ostream
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:628
llvm::ListScope::ListScope
ListScope()=default
llvm::ScopedPrinter::printNumber
virtual void printNumber(StringRef Label, int32_t Value)
Definition: ScopedPrinter.h:221
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1199
llvm::JSONScopedPrinter::printNumber
void printNumber(StringRef Label, int32_t Value) override
Definition: ScopedPrinter.h:577
llvm::EnumEntry::EnumEntry
constexpr EnumEntry(StringRef N, T V)
Definition: ScopedPrinter.h:37
llvm::raw_ostream::write_escaped
raw_ostream & write_escaped(StringRef Str, bool UseHexEscapes=false)
Output Str, turning '\', '\t', ' ', '"', and anything that doesn't satisfy llvm::isPrint into an esca...
Definition: raw_ostream.cpp:161
llvm::EnumEntry::EnumEntry
constexpr EnumEntry(StringRef N, StringRef A, T V)
Definition: ScopedPrinter.h:35
llvm::JSONScopedPrinter::arrayBegin
void arrayBegin() override
Definition: ScopedPrinter.h:663
llvm::lltok::APSInt
@ APSInt
Definition: LLToken.h:460
llvm::FlagEntry::FlagEntry
FlagEntry(StringRef Name, signed char Value)
Definition: ScopedPrinter.h:63
llvm::DictScope::~DictScope
~DictScope()
Definition: ScopedPrinter.h:822
llvm::ScopedPrinter::printObject
void printObject(StringRef Label, const T &Value)
Definition: ScopedPrinter.h:392
llvm::ScopedPrinter::getOStream
virtual raw_ostream & getOStream()
Definition: ScopedPrinter.h:413
llvm::EnumEntry::AltName
StringRef AltName
Definition: ScopedPrinter.h:33
llvm::ScopedPrinter::printString
virtual void printString(StringRef Label, StringRef Value)
Definition: ScopedPrinter.h:343
llvm::ScopedPrinter::arrayEnd
virtual void arrayEnd()
Definition: ScopedPrinter.h:406
llvm::ScopedPrinter::objectBegin
virtual void objectBegin(StringRef Label)
Definition: ScopedPrinter.h:398
llvm::json::OStream::attributeArray
void attributeArray(llvm::StringRef Key, Block Contents)
Emit an attribute whose value is an array with elements from the Block.
Definition: JSON.h:1016
llvm::JSONScopedPrinter::printList
void printList(StringRef Label, const ArrayRef< std::string > List) override
Definition: ScopedPrinter.h:603
T
#define T
Definition: Mips16ISelLowering.cpp:341
llvm::JSONScopedPrinter::printNumber
void printNumber(StringRef Label, uint16_t Value) override
Definition: ScopedPrinter.h:565
llvm::DelimitedScope::DelimitedScope
DelimitedScope(ScopedPrinter &W)
Definition: ScopedPrinter.h:802
llvm::FlagEntry::FlagEntry
FlagEntry(StringRef Name, signed int Value)
Definition: ScopedPrinter.h:67
llvm::ScopedPrinter::printList
virtual void printList(StringRef Label, const ArrayRef< int16_t > List)
Definition: ScopedPrinter.h:295
llvm::JSONScopedPrinter::printList
void printList(StringRef Label, const ArrayRef< uint64_t > List) override
Definition: ScopedPrinter.h:607
llvm::HexNumber::HexNumber
HexNumber(signed short Value)
Definition: ScopedPrinter.h:47
llvm::ScopedPrinter::getIndentLevel
int getIndentLevel()
Definition: ScopedPrinter.h:129
RHS
Value * RHS
Definition: X86PartialReduction.cpp:76
llvm::ListScope
Definition: ScopedPrinter.h:828
llvm::JSONScopedPrinter::printList
void printList(StringRef Label, const ArrayRef< bool > List) override
Definition: ScopedPrinter.h:599
llvm::FlagEntry::FlagEntry
FlagEntry(StringRef Name, signed long long Value)
Definition: ScopedPrinter.h:71
llvm::JSONScopedPrinter::printList
void printList(StringRef Label, const ArrayRef< uint16_t > List) override
Definition: ScopedPrinter.h:615
llvm::ListScope::ListScope
ListScope(ScopedPrinter &W, StringRef N)
Definition: ScopedPrinter.h:832
llvm::ScopedPrinter::printBinaryBlock
void printBinaryBlock(StringRef Label, ArrayRef< uint8_t > Value)
Definition: ScopedPrinter.h:382
llvm::EnumEntry
Definition: EnumTables.h:18
llvm::ScopedPrinter::printHex
void printHex(StringRef Label, StringRef Str, T Value)
Definition: ScopedPrinter.h:332
llvm::ScopedPrinter::unindent
void unindent(int Levels=1)
Definition: ScopedPrinter.h:123
llvm::HexNumber::HexNumber
HexNumber(unsigned char Value)
Definition: ScopedPrinter.h:52
llvm::HexNumber::HexNumber
HexNumber(signed int Value)
Definition: ScopedPrinter.h:48
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::ScopedPrinter::printList
virtual void printList(StringRef Label, const ArrayRef< bool > List)
Definition: ScopedPrinter.h:260
LHS
Value * LHS
Definition: X86PartialReduction.cpp:75
llvm::ScopedPrinter::ScopedPrinterKind
ScopedPrinterKind
Definition: ScopedPrinter.h:102
llvm::ScopedPrinter::hex
HexNumber hex(T Value)
Definition: ScopedPrinter.h:139
llvm::ScopedPrinter::printFlags
void printFlags(StringRef Label, T Value)
Definition: ScopedPrinter.h:188
llvm::JSONScopedPrinter::printNumber
void printNumber(StringRef Label, uint8_t Value) override
Definition: ScopedPrinter.h:569
llvm::JSONScopedPrinter::printString
void printString(StringRef Label, StringRef Value) override
Definition: ScopedPrinter.h:649
llvm::ScopedPrinter::printNumber
virtual void printNumber(StringRef Label, const APSInt &Value)
Definition: ScopedPrinter.h:233
int
Clang compiles this i1 i64 store i64 i64 store i64 i64 store i64 i64 store i64 align Which gets codegen d xmm0 movaps rbp movaps rbp movaps rbp movaps rbp rbp rbp rbp rbp It would be better to have movq s of instead of the movaps s LLVM produces ret int
Definition: README.txt:536
llvm::ScopedPrinter::printList
virtual void printList(StringRef Label, const ArrayRef< uint32_t > List)
Definition: ScopedPrinter.h:272
llvm::HexNumber::HexNumber
HexNumber(unsigned short Value)
Definition: ScopedPrinter.h:53
llvm::ListScope::setPrinter
void setPrinter(ScopedPrinter &W) override
Definition: ScopedPrinter.h:836
llvm::JSONScopedPrinter::printList
void printList(StringRef Label, const ArrayRef< int8_t > List) override
Definition: ScopedPrinter.h:635
llvm::HexNumber::HexNumber
HexNumber(signed char Value)
Definition: ScopedPrinter.h:46
llvm::FlagEntry::FlagEntry
FlagEntry(StringRef Name, signed long Value)
Definition: ScopedPrinter.h:69
llvm::ScopedPrinter::printBinary
void printBinary(StringRef Label, ArrayRef< char > Value)
Definition: ScopedPrinter.h:365
llvm::DelimitedScope
Definition: ScopedPrinter.h:801
llvm::ScopedPrinter::printStringEscaped
void printStringEscaped(StringRef Label, StringRef Value)
Definition: ScopedPrinter.h:347
llvm::ScopedPrinter::printBinary
void printBinary(StringRef Label, StringRef Value)
Definition: ScopedPrinter.h:371
llvm::MCID::Flag
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Definition: MCInstrDesc.h:147
llvm::ScopedPrinter::getKind
ScopedPrinterKind getKind() const
Definition: ScopedPrinter.h:111
llvm::APSInt
An arbitrary precision integer that knows its signedness.
Definition: APSInt.h:23
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
llvm::FlagEntry::FlagEntry
FlagEntry(StringRef Name, unsigned int Value)
Definition: ScopedPrinter.h:75
llvm::JSONScopedPrinter::printBoolean
void printBoolean(StringRef Label, bool Value) override
Definition: ScopedPrinter.h:595
llvm::raw_ostream::flush
void flush()
Definition: raw_ostream.h:185
llvm::operator<<
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition: APFixedPoint.h:292
llvm::IndexedInstrProf::Version
const uint64_t Version
Definition: InstrProf.h:1056
JSON.h
llvm::JSONScopedPrinter::printString
void printString(StringRef Value) override
Definition: ScopedPrinter.h:647
llvm::ScopedPrinter::arrayBegin
virtual void arrayBegin()
Definition: ScopedPrinter.h:402
llvm::EnumEntry::Name
StringRef Name
Definition: ScopedPrinter.h:25
llvm::JSONScopedPrinter::objectBegin
void objectBegin(StringRef Label) override
Definition: ScopedPrinter.h:657
llvm::ScopedPrinter::printBinary
void printBinary(StringRef Label, StringRef Str, ArrayRef< uint8_t > Value)
Definition: ScopedPrinter.h:351
llvm::ScopedPrinter::flush
void flush()
Definition: ScopedPrinter.h:119
llvm::json::OStream::objectEnd
void objectEnd()
Definition: JSON.cpp:869
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::ScopedPrinter::printNumber
virtual void printNumber(StringRef Label, uint64_t Value)
Definition: ScopedPrinter.h:201
llvm::ScopedPrinter::printNumber
virtual void printNumber(StringRef Label, uint32_t Value)
Definition: ScopedPrinter.h:205
llvm::OutputFileType::Object
@ Object
llvm::sort
void sort(IteratorTy Start, IteratorTy End)
Definition: STLExtras.h:1682
llvm::ScopedPrinter::setPrefix
void setPrefix(StringRef P)
Definition: ScopedPrinter.h:131
llvm::FlagEntry::FlagEntry
FlagEntry(StringRef Name, unsigned char Value)
Definition: ScopedPrinter.h:73
llvm::JSONScopedPrinter::arrayBegin
void arrayBegin(StringRef Label) override
Definition: ScopedPrinter.h:667
llvm::ScopedPrinter::printFlags
void printFlags(StringRef Label, T Value, ArrayRef< EnumEntry< TFlag >> Flags, TFlag EnumMask1={}, TFlag EnumMask2={}, TFlag EnumMask3={})
Definition: ScopedPrinter.h:161
llvm::ScopedPrinter::printList
virtual void printList(StringRef Label, const ArrayRef< uint64_t > List)
Definition: ScopedPrinter.h:268
llvm::json::OStream::rawValueEnd
void rawValueEnd()
Definition: JSON.cpp:915
llvm::DictScope::setPrinter
void setPrinter(ScopedPrinter &W) override
Definition: ScopedPrinter.h:817
llvm::ScopedPrinter::objectBegin
virtual void objectBegin()
Definition: ScopedPrinter.h:396
llvm::json::OStream
json::OStream allows writing well-formed JSON without materializing all structures as json::Value ahe...
Definition: JSON.h:957
uint64_t
llvm::ScopedPrinter::printBoolean
virtual void printBoolean(StringRef Label, bool Value)
Definition: ScopedPrinter.h:242
llvm::ScopedPrinter::printEnum
void printEnum(StringRef Label, T Value, ArrayRef< EnumEntry< TEnum >> EnumValues)
Definition: ScopedPrinter.h:142
llvm::FlagEntry::Name
StringRef Name
Definition: ScopedPrinter.h:79
llvm::json::OStream::arrayBegin
void arrayBegin()
Definition: JSON.cpp:842
StringExtras.h
llvm::HexNumber
Definition: ScopedPrinter.h:40
llvm::JSONScopedPrinter::printList
void printList(StringRef Label, const ArrayRef< int64_t > List) override
Definition: ScopedPrinter.h:623
llvm::ScopedPrinter::printList
virtual void printList(StringRef Label, const ArrayRef< int8_t > List)
Definition: ScopedPrinter.h:299
ArrayRef.h
llvm::DelimitedScope::W
ScopedPrinter * W
Definition: ScopedPrinter.h:806
llvm::JSONScopedPrinter::objectEnd
void objectEnd() override
Definition: ScopedPrinter.h:661
llvm::ScopedPrinter::printBinaryBlock
void printBinaryBlock(StringRef Label, ArrayRef< uint8_t > Value, uint32_t StartOffset)
Definition: ScopedPrinter.h:377
llvm::HexNumber::HexNumber
HexNumber(signed long long Value)
Definition: ScopedPrinter.h:50
llvm::ListScope::ListScope
ListScope(ScopedPrinter &W)
Definition: ScopedPrinter.h:830
APSInt.h
llvm::FlagEntry::FlagEntry
FlagEntry(StringRef Name, unsigned short Value)
Definition: ScopedPrinter.h:74
llvm::ScopedPrinter::printList
virtual void printList(StringRef Label, const ArrayRef< int64_t > List)
Definition: ScopedPrinter.h:287
llvm::JSONScopedPrinter::classof
static bool classof(const ScopedPrinter *SP)
Definition: ScopedPrinter.h:553
llvm::JSONScopedPrinter::printNumber
void printNumber(StringRef Label, uint32_t Value) override
Definition: ScopedPrinter.h:561
llvm::ScopedPrinter::printNumber
virtual void printNumber(StringRef Label, int16_t Value)
Definition: ScopedPrinter.h:225
llvm::DictScope
Definition: ScopedPrinter.h:809
llvm::ScopedPrinter::arrayBegin
virtual void arrayBegin(StringRef Label)
Definition: ScopedPrinter.h:404
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Printer
Memory true print Memory SSA Printer
Definition: MemorySSA.cpp:80
llvm::EnumEntry::Value
T Value
Definition: ScopedPrinter.h:34
llvm::JSONScopedPrinter::printList
void printList(StringRef Label, const ArrayRef< uint32_t > List) override
Definition: ScopedPrinter.h:611
llvm::JSONScopedPrinter::printList
void printList(StringRef Label, const ArrayRef< int32_t > List) override
Definition: ScopedPrinter.h:627
uint32_t
llvm::ScopedPrinter::classof
static bool classof(const ScopedPrinter *SP)
Definition: ScopedPrinter.h:113
llvm::ScopedPrinter::printBinaryBlock
void printBinaryBlock(StringRef Label, StringRef Value)
Definition: ScopedPrinter.h:386
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::DictScope::DictScope
DictScope(ScopedPrinter &W)
Definition: ScopedPrinter.h:811
llvm::ScopedPrinter::printString
virtual void printString(StringRef Value)
Definition: ScopedPrinter.h:341
llvm::ScopedPrinter::printNumber
virtual void printNumber(StringRef Label, uint8_t Value)
Definition: ScopedPrinter.h:213
llvm::ScopedPrinter::startLine
virtual raw_ostream & startLine()
Definition: ScopedPrinter.h:408
llvm::JSONScopedPrinter::printList
void printList(StringRef Label, const ArrayRef< uint8_t > List) override
Definition: ScopedPrinter.h:619
llvm::DelimitedScope::setPrinter
virtual void setPrinter(ScopedPrinter &W)=0
llvm::JSONScopedPrinter::printNumber
void printNumber(StringRef Label, int64_t Value) override
Definition: ScopedPrinter.h:573
llvm::FlagEntry::FlagEntry
FlagEntry(StringRef Name, char Value)
Definition: ScopedPrinter.h:61
llvm::ScopedPrinter::printList
void printList(StringRef Label, const ArrayRef< T > List)
Definition: ScopedPrinter.h:253
llvm::ScopedPrinter::printList
virtual void printList(StringRef Label, const ArrayRef< uint8_t > List)
Definition: ScopedPrinter.h:280
llvm::ScopedPrinter::printHexList
void printHexList(StringRef Label, const T &List)
Definition: ScopedPrinter.h:321
llvm::ScopedPrinter::printBinary
void printBinary(StringRef Label, ArrayRef< uint8_t > Value)
Definition: ScopedPrinter.h:361
llvm::JSONScopedPrinter::JSONScopedPrinter
JSONScopedPrinter(raw_ostream &OS, bool PrettyPrint=false, std::unique_ptr< DelimitedScope > &&OuterScope=std::unique_ptr< DelimitedScope >{})
Definition: ScopedPrinter.cpp:39
llvm::pdb::PDB_SymType::Label
@ Label
llvm::enumToString
std::string enumToString(T Value, ArrayRef< EnumEntry< TEnum >> EnumValues)
Definition: ScopedPrinter.h:93
llvm::FlagEntry::FlagEntry
FlagEntry(StringRef Name, unsigned long long Value)
Definition: ScopedPrinter.h:77
llvm::JSONScopedPrinter::printNumber
void printNumber(StringRef Label, uint64_t Value) override
Definition: ScopedPrinter.h:557
llvm::JSONScopedPrinter
Definition: ScopedPrinter.h:524
uint16_t
llvm::JSONScopedPrinter::printNumber
void printNumber(StringRef Label, int8_t Value) override
Definition: ScopedPrinter.h:585
llvm::ScopedPrinter::printIndent
void printIndent()
Definition: ScopedPrinter.h:133
llvm::JSONScopedPrinter::objectBegin
void objectBegin() override
Definition: ScopedPrinter.h:653
llvm::AArch64CC::LS
@ LS
Definition: AArch64BaseInfo.h:264
llvm::ScopedPrinter::indent
void indent(int Levels=1)
Definition: ScopedPrinter.h:121
llvm::ScopedPrinter
Definition: ScopedPrinter.h:100
llvm::JSONScopedPrinter::printNumber
void printNumber(StringRef Label, const APSInt &Value) override
Definition: ScopedPrinter.h:589
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::json::OStream::value
void value(const Value &V)
Emit a self-contained value (number, string, vector<string> etc).
Definition: JSON.cpp:756
llvm::HexNumber::HexNumber
HexNumber(unsigned long Value)
Definition: ScopedPrinter.h:55
llvm::makeArrayRef
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Definition: ArrayRef.h:475
llvm::ARMBuildAttrs::Symbol
@ Symbol
Definition: ARMBuildAttributes.h:83
llvm::JSONScopedPrinter::printList
void printList(StringRef Label, const ArrayRef< int16_t > List) override
Definition: ScopedPrinter.h:631
llvm::FlagEntry::FlagEntry
FlagEntry(StringRef Name, signed short Value)
Definition: ScopedPrinter.h:65
llvm::ScopedPrinter::printHex
void printHex(StringRef Label, T Value)
Definition: ScopedPrinter.h:328
llvm::JSONScopedPrinter::arrayEnd
void arrayEnd() override
Definition: ScopedPrinter.h:671
SmallVector.h
llvm::ScopedPrinter::printNumber
virtual void printNumber(StringRef Label, uint16_t Value)
Definition: ScopedPrinter.h:209
List
const NodeList & List
Definition: RDFGraph.cpp:199
llvm::HexNumber::HexNumber
HexNumber(signed long Value)
Definition: ScopedPrinter.h:49
llvm::HexNumber::HexNumber
HexNumber(unsigned int Value)
Definition: ScopedPrinter.h:54
N
#define N
llvm::ScopedPrinter::resetIndent
void resetIndent()
Definition: ScopedPrinter.h:127
llvm::json::OStream::arrayEnd
void arrayEnd()
Definition: JSON.cpp:850
llvm::to_string
std::string to_string(const T &Value)
Definition: ScopedPrinter.h:85
llvm::json::OStream::attributeObject
void attributeObject(llvm::StringRef Key, Block Contents)
Emit an attribute whose value is an object with attributes from the Block.
Definition: JSON.h:1020
DataTypes.h
llvm::HexNumber::HexNumber
HexNumber(char Value)
Definition: ScopedPrinter.h:45
llvm::ScopedPrinter::printList
virtual void printList(StringRef Label, const ArrayRef< APSInt > List)
Definition: ScopedPrinter.h:306
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:394
llvm::json::OStream::attribute
void attribute(llvm::StringRef Key, const Value &Contents)
Emit an attribute whose value is self-contained (number, vector<int> etc).
Definition: JSON.h:1012
llvm::DictScope::DictScope
DictScope()=default
llvm::FlagEntry::Value
uint64_t Value
Definition: ScopedPrinter.h:80
llvm::ScopedPrinter::ScopedPrinterKind::JSON
@ JSON
raw_ostream.h
llvm::ScopedPrinter::printList
void printList(StringRef Label, const T &List, const U &Printer)
Definition: ScopedPrinter.h:311
Endian.h
llvm::raw_string_ostream::str
std::string & str()
Returns the string's reference.
Definition: raw_ostream.h:646
llvm::json::OStream::rawValueBegin
raw_ostream & rawValueBegin()
Definition: JSON.cpp:908
llvm::json::OStream::objectBegin
void objectBegin()
Definition: JSON.cpp:861
llvm::DelimitedScope::~DelimitedScope
virtual ~DelimitedScope()=default
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::ListScope::~ListScope
~ListScope()
Definition: ScopedPrinter.h:841
llvm::ScopedPrinter::printList
virtual void printList(StringRef Label, const ArrayRef< std::string > List)
Definition: ScopedPrinter.h:264
llvm::ScopedPrinter::ScopedPrinter
ScopedPrinter(raw_ostream &OS, ScopedPrinterKind Kind=ScopedPrinterKind::Base)
Definition: ScopedPrinter.h:107
llvm::SmallVectorImpl::emplace_back
reference emplace_back(ArgTypes &&... Args)
Definition: SmallVector.h:941
llvm::HexNumber::Value
uint64_t Value
Definition: ScopedPrinter.h:57