LLVM: include/llvm/ADT/StringTable.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9#ifndef LLVM_ADT_STRING_TABLE_H

10#define LLVM_ADT_STRING_TABLE_H

11

14#include

15#include

16

17namespace llvm {

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

35

36public:

37

38

39

40

41

42

43

44

45

46

47

49

50 unsigned Value = 0;

51

52 public:

55

57 return LHS.Value == RHS.Value;

58 }

59

61 return LHS.Value != RHS.Value;

62 }

63

64 constexpr unsigned value() const { return Value; }

65 };

66

67

68

69

70

71 template <size_t N>

72 constexpr StringTable(const char (&RawTable)[N]) : Table(RawTable, N) {

73 static_assert(N <= std::numeric_limits::max(),

74 "We only support table sizes that can be indexed by an "

75 "`unsigned` offset.");

76

77

78

79 assert(!Table.empty() && "Requires at least a valid empty string.");

80 assert(Table.data()[0] == '\0' && "Offset zero must be the empty string.");

81

82

83

84

86 "Last byte must be a null byte.");

88 "Next-to-last byte must be a null byte.");

89 }

90

91

92

93

95 assert(O.value() < Table.size() && "Out of bounds offset!");

96 return Table.data() + O.value();

97 }

98

99

100 constexpr size_t size() const { return Table.size(); }

101

104 const StringRef> {

106

109

110

112

114 : Table(&Table), O(O) {}

115

116 public:

119

121 assert(Table == RHS.Table && "Compared iterators for unrelated tables!");

122 return O == RHS.O;

123 }

124

126 S = (*Table)[O];

127 return S;

128 }

129

131 O = O.value() + (*Table)[O].size() + 1;

132 return *this;

133 }

134 };

135

138};

139

140}

141

142#endif

assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())

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

constexpr bool empty() const

empty - Check if the string is empty.

constexpr size_t size() const

size - Get the string size.

constexpr const char * data() const

data - Get a pointer to the start of the string (which may not be null terminated).

bool operator==(const Iterator &RHS) const

const StringRef & operator*() const

constexpr Iterator(Iterator &&RHS)=default

constexpr Iterator(const Iterator &RHS)=default

constexpr Offset(unsigned Value)

constexpr unsigned value() const

friend constexpr bool operator==(const Offset &LHS, const Offset &RHS)

friend constexpr bool operator!=(const Offset &LHS, const Offset &RHS)

constexpr Offset()=default

A table of densely packed, null-terminated strings indexed by offset.

constexpr size_t size() const

Returns the byte size of the table.

constexpr StringRef operator[](Offset O) const

constexpr Iterator begin() const

constexpr Iterator end() const

constexpr StringTable(const char(&RawTable)[N])

LLVM Value Representation.

CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...

This is an optimization pass for GlobalISel generic memory operations.