LLVM 20.0.0git
BlockVerifier.h
Go to the documentation of this file.
1//===- BlockVerifier.h - FDR Block Verifier -------------------------------===//
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 verifies a sequence of records
10// associated with a block, following the FDR mode log format's specifications.
11//
12//===----------------------------------------------------------------------===//
13#ifndef LLVM_XRAY_BLOCKVERIFIER_H
14#define LLVM_XRAY_BLOCKVERIFIER_H
15
17
18namespace llvm {
19namespace xray {
20
22public:
23 // We force State elements to be size_t, to be used as indices for containers.
24 enum class State : std::size_t {
25 Unknown,
31 TSCWrap,
35 CallArg,
38 };
39
40private:
41 // We keep track of the current record seen by the verifier.
42 State CurrentRecord = State::Unknown;
43
44 // Transitions the current record to the new record, records an error on
45 // invalid transitions.
46 Error transition(State To);
47
48public:
49 Error visit(BufferExtents &) override;
50 Error visit(WallclockRecord &) override;
51 Error visit(NewCPUIDRecord &) override;
52 Error visit(TSCWrapRecord &) override;
53 Error visit(CustomEventRecord &) override;
54 Error visit(CallArgRecord &) override;
55 Error visit(PIDRecord &) override;
56 Error visit(NewBufferRecord &) override;
57 Error visit(EndBufferRecord &) override;
58 Error visit(FunctionRecord &) override;
60 Error visit(TypedEventRecord &) override;
61
62 Error verify();
63 void reset();
64};
65
66} // namespace xray
67} // namespace llvm
68
69#endif // LLVM_XRAY_BLOCKVERIFIER_H
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
Error visit(BufferExtents &) override
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18