LLVM: lib/XRay/BlockVerifier.cpp Source File (original) (raw)

1

2

3

4

5

6

7

10

11#include

12

13using namespace llvm;

15

17 return 1uLL << static_caststd::size\_t\(S);

18}

19

21 return static_caststd::size\_t\(S);

22}

23

25 switch (R) {

27 return "BufferExtents";

29 return "NewBuffer";

31 return "WallClockTime";

33 return "PIDEntry";

35 return "NewCPUId";

37 return "TSCWrap";

39 return "CustomEvent";

41 return "Function";

43 return "CallArg";

45 return "EndOfBuffer";

47 return "TypedEvent";

50 return "Unknown";

51 }

53}

54

55namespace {

56

57struct Transition {

59 std::bitset<number(BlockVerifier::State::StateMax)> ToStates;

60};

61

62}

63

64Error BlockVerifier::transition(State To) {

69

71

73

76

78

83

88

93

98

104

110

112

115 std::make_error_code(std::errc::executable_format_error),

116 "BUG (BlockVerifier): Cannot find transition table entry for %s, "

117 "transitioning to %s.",

119

120

121

124

125 auto &Mapping = TransitionTable[number(CurrentRecord)];

126 auto &Destinations = Mapping.ToStates;

127 assert(Mapping.From == CurrentRecord &&

128 "BUG: Wrong index for record mapping.");

129 if ((Destinations & ToSet(mask(To))) == 0)

131 std::make_error_code(std::errc::executable_format_error),

132 "BlockVerifier: Invalid transition from %s to %s.",

134

135 CurrentRecord = To;

137}

138

142

146

150

154

158

162

166

170

172

176

180

184

186

187 switch (CurrentRecord) {

196 default:

198 std::make_error_code(std::errc::executable_format_error),

199 "BlockVerifier: Invalid terminal condition %s, malformed block.",

201 }

202}

203

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

static constexpr unsigned long long mask(BlockVerifier::State S)

Definition BlockVerifier.cpp:16

static StringRef recordToString(BlockVerifier::State R)

Definition BlockVerifier.cpp:24

static constexpr std::size_t number(BlockVerifier::State S)

Definition BlockVerifier.cpp:20

Lightweight error class with error context and mandatory checking.

static ErrorSuccess success()

Create a success value.

StringRef - Represent a constant reference to a string, i.e.

Error verify()

Definition BlockVerifier.cpp:185

Error visit(BufferExtents &) override

Definition BlockVerifier.cpp:139

void reset()

Definition BlockVerifier.cpp:204

#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.