LLVM  8.0.1
BlockPrinter.h
Go to the documentation of this file.
1 //===- BlockPrinter.h - FDR Block Pretty Printer -------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // An implementation of the RecordVisitor which formats a block of records for
11 // easier human consumption.
12 //
13 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_INCLUDE_LLVM_XRAY_BLOCKPRINTER_H_
15 #define LLVM_INCLUDE_LLVM_XRAY_BLOCKPRINTER_H_
16 
18 #include "llvm/XRay/FDRRecords.h"
20 
21 namespace llvm {
22 namespace xray {
23 
24 class BlockPrinter : public RecordVisitor {
25  enum class State {
26  Start,
27  Preamble,
28  Metadata,
29  Function,
30  Arg,
31  CustomEvent,
32  End,
33  };
34 
35  raw_ostream &OS;
36  RecordPrinter &RP;
37  State CurrentState = State::Start;
38 
39 public:
41  : RecordVisitor(), OS(O), RP(P) {}
42 
43  Error visit(BufferExtents &) override;
44  Error visit(WallclockRecord &) override;
45  Error visit(NewCPUIDRecord &) override;
46  Error visit(TSCWrapRecord &) override;
47  Error visit(CustomEventRecord &) override;
48  Error visit(CallArgRecord &) override;
49  Error visit(PIDRecord &) override;
50  Error visit(NewBufferRecord &) override;
51  Error visit(EndBufferRecord &) override;
52  Error visit(FunctionRecord &) override;
53  Error visit(CustomEventRecordV5 &) override;
54  Error visit(TypedEventRecord &) override;
55 
56  void reset() { CurrentState = State::Start; }
57 };
58 
59 } // namespace xray
60 } // namespace llvm
61 
62 #endif // LLVM_INCLUDE_LLVM_XRAY_BLOCKPRINTER_H_
This class represents lattice values for constants.
Definition: AllocatorList.h:24
#define P(N)
amdgpu Simplify well known AMD library false Value Value * Arg
BlockPrinter(raw_ostream &O, RecordPrinter &P)
Definition: BlockPrinter.h:40
Error visit(BufferExtents &) override
Lightweight error class with error context and mandatory checking.
Definition: Error.h:158
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46
Root of the metadata hierarchy.
Definition: Metadata.h:58