LLVM: lib/Bitcode/Reader/ValueList.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13#ifndef LLVM_LIB_BITCODE_READER_VALUELIST_H

14#define LLVM_LIB_BITCODE_READER_VALUELIST_H

15

18#include

19#include

20#include

21

22namespace llvm {

23

27

29

30 std::vector<std::pair<WeakTrackingVH, unsigned>> ValuePtrs;

31

32

33

34 unsigned RefsUpperBound;

35

36 using MaterializeValueFnTy =

37 std::function<Expected<Value *>(unsigned, BasicBlock *)>;

38 MaterializeValueFnTy MaterializeValueFn;

39

40public:

42 MaterializeValueFnTy MaterializeValueFn)

43 : RefsUpperBound(std::min((size_t)std::numeric_limits<unsigned>::max(),

44 RefsUpperBound)),

45 MaterializeValueFn(MaterializeValueFn) {}

46

47

48 unsigned size() const { return ValuePtrs.size(); }

50 ValuePtrs.resize(N);

51 }

53 ValuePtrs.emplace_back(V, TypeID);

54 }

55

57 ValuePtrs.clear();

58 }

59

61 assert(i < ValuePtrs.size());

62 return ValuePtrs[i].first;

63 }

64

65 unsigned getTypeID(unsigned ValNo) const {

66 assert(ValNo < ValuePtrs.size());

67 return ValuePtrs[ValNo].second;

68 }

69

70 Value *back() const { return ValuePtrs.back().first; }

72 ValuePtrs.pop_back();

73 }

74 bool empty() const { return ValuePtrs.empty(); }

75

77 assert(N <= size() && "Invalid shrinkTo request!");

78 ValuePtrs.resize(N);

79 }

80

82 assert(ValNo < ValuePtrs.size());

83 ValuePtrs[ValNo].first = NewV;

84 }

85

88

90};

91

92}

93

94#endif

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

LLVM Basic Block Representation.

BitcodeReaderValueList(size_t RefsUpperBound, MaterializeValueFnTy MaterializeValueFn)

Definition ValueList.h:41

Value * getValueFwdRef(unsigned Idx, Type *Ty, unsigned TyID, BasicBlock *ConstExprInsertBB)

void resize(unsigned N)

Definition ValueList.h:49

Value * operator[](unsigned i) const

Definition ValueList.h:60

void push_back(Value *V, unsigned TypeID)

Definition ValueList.h:52

Value * back() const

Definition ValueList.h:70

void clear()

Definition ValueList.h:56

void replaceValueWithoutRAUW(unsigned ValNo, Value *NewV)

Definition ValueList.h:81

Error assignValue(unsigned Idx, Value *V, unsigned TypeID)

void shrinkTo(unsigned N)

Definition ValueList.h:76

void pop_back()

Definition ValueList.h:71

bool empty() const

Definition ValueList.h:74

unsigned getTypeID(unsigned ValNo) const

Definition ValueList.h:65

unsigned size() const

Definition ValueList.h:48

Lightweight error class with error context and mandatory checking.

The instances of the Type class are immutable: once they are created, they are never changed.

LLVM Value Representation.

This is an optimization pass for GlobalISel generic memory operations.

GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)

Implement std::hash so that hash_code can be used in STL containers.