LLVM: lib/XRay/BlockVerifier.cpp Source File (original) (raw)
1
2
3
4
5
6
7
10
11#include
12
13namespace llvm {
14namespace xray {
15namespace {
16
18 return 1uLL << static_caststd::size\_t\(S);
19}
20
22 return static_caststd::size\_t\(S);
23}
24
26 switch (R) {
28 return "BufferExtents";
30 return "NewBuffer";
32 return "WallClockTime";
34 return "PIDEntry";
36 return "NewCPUId";
38 return "TSCWrap";
40 return "CustomEvent";
42 return "Function";
44 return "CallArg";
46 return "EndOfBuffer";
48 return "TypedEvent";
51 return "Unknown";
52 }
54}
55
56struct Transition {
59};
60
61}
62
63Error BlockVerifier::transition(State To) {
65 static constexpr std::array<const Transition, number(State::StateMax)>
68
70
72
75
77
82
87
92
97
103
109
111
114 std::make_error_code(std::errc::executable_format_error),
115 "BUG (BlockVerifier): Cannot find transition table entry for %s, "
116 "transitioning to %s.",
117 recordToString(CurrentRecord).data(), recordToString(To).data());
118
119
120
123
124 auto &Mapping = TransitionTable[number(CurrentRecord)];
125 auto &Destinations = Mapping.ToStates;
126 assert(Mapping.From == CurrentRecord &&
127 "BUG: Wrong index for record mapping.");
128 if ((Destinations & ToSet(mask(To))) == 0)
130 std::make_error_code(std::errc::executable_format_error),
131 "BlockVerifier: Invalid transition from %s to %s.",
132 recordToString(CurrentRecord).data(), recordToString(To).data());
133
134 CurrentRecord = To;
136}
137
140}
141
144}
145
148}
149
152}
153
156}
157
160}
161
164}
165
168}
169
171
174}
175
178}
179
182}
183
185
186 switch (CurrentRecord) {
195 default:
197 std::make_error_code(std::errc::executable_format_error),
198 "BlockVerifier: Invalid terminal condition %s, malformed block.",
199 recordToString(CurrentRecord).data());
200 }
201}
202
204
205}
206}
std::bitset< number(BlockVerifier::State::StateMax)> ToStates
BlockVerifier::State From
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Error visit(BufferExtents &) override
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
auto mask(ShuffFunc S, unsigned Length, OptArgs... args) -> MaskT