LLVM: include/llvm/ProfileData/HashKeyMap.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15#ifndef LLVM_PROFILEDATA_HASHKEYMAP_H

16#define LLVM_PROFILEDATA_HASHKEYMAP_H

17

19#include

20#include

21

22namespace llvm {

23

24namespace sampleprof {

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50template <template <typename, typename, typename...> typename MapT,

51 typename KeyT, typename ValueT, typename... MapTArgs>

53 public MapT<decltype(hash_value(KeyT())), ValueT, MapTArgs...> {

54public:

59 using value_type = typename base_type::value_type;

60

61 using iterator = typename base_type::iterator;

63

64 template <typename... Ts>

67 Ts &&...Args) {

69 return base_type::try_emplace(Hash, std::forward(Args)...);

70 }

71

72 template <typename... Ts>

74 Ts &&...Args) {

76 }

77

78 template <typename... Ts> std::pair<iterator, bool> emplace(Ts &&...Args) {

79 return try_emplace(std::forward(Args)...);

80 }

81

84 }

85

87 auto It = base_type::find(hash_value(Key));

88 if (It != base_type::end())

89 return It;

90 return base_type::end();

91 }

92

94 auto It = base_type::find(hash_value(Key));

95 if (It != base_type::end())

96 return It;

97 return base_type::end();

98 }

99

101 auto It = base_type::find(hash_value(Key));

102 if (It != base_type::end())

103 return It->second;

105 }

106

108 return base_type::count(hash_value(Key));

109 }

110

112 auto It = find(Ctx);

113 if (It != base_type::end()) {

114 base_type::erase(It);

115 return 1;

116 }

117 return 0;

118 }

119

121 return base_type::erase(It);

122 }

123};

124

125}

126

127}

128

129#endif

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

This class is a wrapper to associative container MapT<KeyT, ValueT> using the hash value of the origi...

MapT< decltype(hash_value(KeyT())), ValueT, MapTArgs... > base_type

std::pair< iterator, bool > emplace(Ts &&...Args)

std::pair< iterator, bool > try_emplace(const key_type &Hash, const original_key_type &Key, Ts &&...Args)

typename base_type::iterator iterator

const_iterator find(const original_key_type &Key) const

typename base_type::value_type value_type

std::pair< iterator, bool > try_emplace(const original_key_type &Key, Ts &&...Args)

decltype(hash_value(KeyT())) key_type

size_t erase(const original_key_type &Ctx)

mapped_type & operator[](const original_key_type &Key)

size_t count(const original_key_type &Key) const

iterator find(const original_key_type &Key)

mapped_type lookup(const original_key_type &Key) const

typename base_type::const_iterator const_iterator

iterator erase(const_iterator It)

uint64_t hash_value(const FunctionId &Obj)

This is an optimization pass for GlobalISel generic memory operations.