LLVM 22.0.0git
BlockPrinter.h
Go to the documentation of this file.
1//===- BlockPrinter.h - FDR Block Pretty Printer -------------------------===//
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// An implementation of the RecordVisitor which formats a block of records for
10// easier human consumption.
11//
12//===----------------------------------------------------------------------===//
13#ifndef LLVM_XRAY_BLOCKPRINTER_H
14#define LLVM_XRAY_BLOCKPRINTER_H
15
20
21namespace llvm::xray {
22
24 enum class State {
25 Start,
26 Preamble,
27 Metadata,
28 Function,
29 Arg,
30 CustomEvent,
31 End,
32 };
33
34 raw_ostream &OS;
35 RecordPrinter &RP;
36 State CurrentState = State::Start;
37
38public:
39 explicit BlockPrinter(raw_ostream &O, RecordPrinter &P) : OS(O), RP(P) {}
40
41 Error visit(BufferExtents &) override;
42 Error visit(WallclockRecord &) override;
43 Error visit(NewCPUIDRecord &) override;
44 Error visit(TSCWrapRecord &) override;
45 Error visit(CustomEventRecord &) override;
46 Error visit(CallArgRecord &) override;
47 Error visit(PIDRecord &) override;
48 Error visit(NewBufferRecord &) override;
49 Error visit(EndBufferRecord &) override;
50 Error visit(FunctionRecord &) override;
52 Error visit(TypedEventRecord &) override;
53
54 void reset() { CurrentState = State::Start; }
55};
56
57} // namespace llvm::xray
58
59#endif // LLVM_XRAY_BLOCKPRINTER_H
#define LLVM_ABI
Definition Compiler.h:213
#define P(N)
void visit(MachineFunction &MF, MachineBasicBlock &Start, std::function< void(MachineBasicBlock *)> op)
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
BlockPrinter(raw_ostream &O, RecordPrinter &P)