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 {
22namespace xray {
23
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
39public:
40 explicit BlockPrinter(raw_ostream &O, RecordPrinter &P) : OS(O), RP(P) {}
41
42 Error visit(BufferExtents &) override;
43 Error visit(WallclockRecord &) override;
44 Error visit(NewCPUIDRecord &) override;
45 Error visit(TSCWrapRecord &) override;
46 Error visit(CustomEventRecord &) override;
47 Error visit(CallArgRecord &) override;
48 Error visit(PIDRecord &) override;
49 Error visit(NewBufferRecord &) override;
50 Error visit(EndBufferRecord &) override;
51 Error visit(FunctionRecord &) override;
53 Error visit(TypedEventRecord &) override;
54
55 void reset() { CurrentState = State::Start; }
56};
57
58} // namespace xray
59} // namespace llvm
60
61#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)
This is an optimization pass for GlobalISel generic memory operations.