LLVM 22.0.0git
BlockIndexer.cpp
Go to the documentation of this file.
1//===- BlockIndexer.cpp - FDR Block Indexing VIsitor ----------------------===//
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 generates a mapping between a
10// thread and a range of records representing a block.
11//
12//===----------------------------------------------------------------------===//
14
15namespace llvm {
16namespace xray {
17
19
21 CurrentBlock.Records.push_back(&R);
22 CurrentBlock.WallclockTime = &R;
23 return Error::success();
24}
25
27 CurrentBlock.Records.push_back(&R);
28 return Error::success();
29}
30
32 CurrentBlock.Records.push_back(&R);
33 return Error::success();
34}
35
37 CurrentBlock.Records.push_back(&R);
38 return Error::success();
39}
40
42 CurrentBlock.Records.push_back(&R);
43 return Error::success();
44}
45
47 CurrentBlock.Records.push_back(&R);
48 return Error::success();
49}
50
52 CurrentBlock.Records.push_back(&R);
53 return Error::success();
54}
55
57 CurrentBlock.ProcessID = R.pid();
58 CurrentBlock.Records.push_back(&R);
59 return Error::success();
60}
61
63 if (!CurrentBlock.Records.empty())
64 if (auto E = flush())
65 return E;
66
67 CurrentBlock.ThreadID = R.tid();
68 CurrentBlock.Records.push_back(&R);
69 return Error::success();
70}
71
73 CurrentBlock.Records.push_back(&R);
74 return Error::success();
75}
76
78 CurrentBlock.Records.push_back(&R);
79 return Error::success();
80}
81
83 Indices[{CurrentBlock.ProcessID, CurrentBlock.ThreadID}].push_back(
84 {CurrentBlock.ProcessID, CurrentBlock.ThreadID,
85 CurrentBlock.WallclockTime, std::move(CurrentBlock.Records)});
86 CurrentBlock.ProcessID = 0;
87 CurrentBlock.ThreadID = 0;
88 CurrentBlock.Records = {};
89 CurrentBlock.WallclockTime = nullptr;
90 return Error::success();
91}
92
93} // namespace xray
94} // namespace llvm
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
static ErrorSuccess success()
Create a success value.
Definition Error.h:336
Error visit(BufferExtents &) override
Error flush()
The flush() function will clear out the current state of the visitor, to allow for explicitly flushin...
This is an optimization pass for GlobalISel generic memory operations.