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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20#ifndef LLVM_ADT_INDEXEDMAP_H

21#define LLVM_ADT_INDEXEDMAP_H

22

25#include

26

27namespace llvm {

28

32

33 Ty &operator()(Ty &self) const { return self; }

34 const Ty &operator()(const Ty &self) const { return self; }

35};

36}

37

38template <typename T, typename ToIndexT = detail::IdentityIndex<unsigned>>

40 using IndexT = typename ToIndexT::argument_type;

41

42

43

45

46 StorageT Storage;

47 T NullVal = T();

48 ToIndexT ToIndex;

49

50public:

52

53 explicit IndexedMap(const T &Val) : NullVal(Val) {}

54

56 assert(ToIndex(N) < Storage.size() && "index out of bounds!");

57 return Storage[ToIndex(N)];

58 }

59

61 assert(ToIndex(N) < Storage.size() && "index out of bounds!");

62 return Storage[ToIndex(N)];

63 }

64

66

68

69 void clear() { Storage.clear(); }

70

72 unsigned NewSize = ToIndex(N) + 1;

73 if (NewSize > Storage.size())

75 }

76

77 bool inBounds(IndexT N) const { return ToIndex(N) < Storage.size(); }

78

80};

81

82}

83

84#endif

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

This file defines the SmallVector class.

StorageT::size_type size() const

Definition IndexedMap.h:79

StorageT::const_reference operator[](IndexT N) const

Definition IndexedMap.h:60

void grow(IndexT N)

Definition IndexedMap.h:71

void resize(typename StorageT::size_type S)

Definition IndexedMap.h:67

void reserve(typename StorageT::size_type S)

Definition IndexedMap.h:65

StorageT::reference operator[](IndexT N)

Definition IndexedMap.h:55

IndexedMap(const T &Val)

Definition IndexedMap.h:53

bool inBounds(IndexT N) const

Definition IndexedMap.h:77

void clear()

Definition IndexedMap.h:69

const T & const_reference

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

A self-contained host- and target-independent arbitrary-precision floating-point software implementat...

This is an optimization pass for GlobalISel generic memory operations.

Definition IndexedMap.h:30

Ty argument_type

Definition IndexedMap.h:31

Ty & operator()(Ty &self) const

Definition IndexedMap.h:33

const Ty & operator()(const Ty &self) const

Definition IndexedMap.h:34