LLVM  9.0.0svn
BlockPrinter.cpp
Go to the documentation of this file.
1 //===- BlockPrinter.cpp - FDR Block Pretty Printer Implementation --------===//
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 //===----------------------------------------------------------------------===//
9 
10 namespace llvm {
11 namespace xray {
12 
14  OS << "\n[New Block]\n";
15  CurrentState = State::Preamble;
16  return RP.visit(R);
17 }
18 
19 // Preamble printing.
21  if (CurrentState == State::Start)
22  OS << "\n[New Block]\n";
23 
24  OS << "Preamble: \n";
25  CurrentState = State::Preamble;
26  return RP.visit(R);
27 }
28 
30  CurrentState = State::Preamble;
31  return RP.visit(R);
32 }
33 
35  CurrentState = State::Preamble;
36  return RP.visit(R);
37 }
38 
39 // Metadata printing.
41  if (CurrentState == State::Preamble)
42  OS << "\nBody:\n";
43  if (CurrentState == State::Function)
44  OS << "\nMetadata: ";
45  CurrentState = State::Metadata;
46  OS << " ";
47  auto E = RP.visit(R);
48  return E;
49 }
50 
52  if (CurrentState == State::Function)
53  OS << "\nMetadata:";
54  CurrentState = State::Metadata;
55  OS << " ";
56  auto E = RP.visit(R);
57  return E;
58 }
59 
60 // Custom events will be rendered like "function" events.
62  if (CurrentState == State::Metadata)
63  OS << "\n";
64  CurrentState = State::CustomEvent;
65  OS << "* ";
66  auto E = RP.visit(R);
67  return E;
68 }
69 
71  if (CurrentState == State::Metadata)
72  OS << "\n";
73  CurrentState = State::CustomEvent;
74  OS << "* ";
75  auto E = RP.visit(R);
76  return E;
77 }
78 
80  if (CurrentState == State::Metadata)
81  OS << "\n";
82  CurrentState = State::CustomEvent;
83  OS << "* ";
84  auto E = RP.visit(R);
85  return E;
86 }
87 
88 // Function call printing.
90  if (CurrentState == State::Metadata)
91  OS << "\n";
92  CurrentState = State::Function;
93  OS << "- ";
94  auto E = RP.visit(R);
95  return E;
96 }
97 
99  CurrentState = State::Arg;
100  OS << " : ";
101  auto E = RP.visit(R);
102  return E;
103 }
104 
106  CurrentState = State::End;
107  OS << " *** ";
108  auto E = RP.visit(R);
109  return E;
110 }
111 
112 } // namespace xray
113 } // namespace llvm
This class represents lattice values for constants.
Definition: AllocatorList.h:23
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Error visit(BufferExtents &) override
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
Error visit(BufferExtents &) override