LLVM: lib/IR/SymbolTableListTraitsImpl.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15#ifndef LLVM_LIB_IR_SYMBOLTABLELISTTRAITSIMPL_H

16#define LLVM_LIB_IR_SYMBOLTABLELISTTRAITSIMPL_H

17

20

21namespace llvm {

22

23

24template

27

28

29

30

31template <typename ValueSubClass, typename... Args>

32template

34 TPtr Src) {

35

37

38

39 *Dest = Src;

40

41

43

44

45 if (OldST == NewST) return;

46

47

48 ListTy &ItemList = getList(getListOwner());

49 if (ItemList.empty()) return;

50

51 if (OldST) {

52

53 for (auto I = ItemList.begin(); I != ItemList.end(); ++I)

54 if (I->hasName())

55 OldST->removeValueName(I->getValueName());

56 }

57

58 if (NewST) {

59

60 for (auto I = ItemList.begin(); I != ItemList.end(); ++I)

61 if (I->hasName())

62 NewST->reinsertValue(&*I);

63 }

64}

65

66template <typename ValueSubClass, typename... Args>

68 ValueSubClass *V) {

69 assert(!V->getParent() && "Value already in a container!!");

70 ItemParentClass *Owner = getListOwner();

71 V->setParent(Owner);

73 if (V->hasName())

75 ST->reinsertValue(V);

76}

77

78template <typename ValueSubClass, typename... Args>

80 ValueSubClass *V) {

81 V->setParent(nullptr);

82 if (V->hasName())

84 ST->removeValueName(V->getValueName());

85}

86

87template <typename ValueSubClass, typename... Args>

90

91

92 ItemParentClass *NewIP = getListOwner();

94

95

96 ItemParentClass *OldIP = L2.getListOwner();

97 if (NewIP == OldIP)

98 return;

100

101

104 if (NewST != OldST) {

105 for (; first != last; ++first) {

106 ValueSubClass &V = *first;

107 bool HasName = V.hasName();

108 if (OldST && HasName)

109 OldST->removeValueName(V.getValueName());

110 V.setParent(NewIP);

111 if (NewST && HasName)

112 NewST->reinsertValue(&V);

113 }

114 } else {

115

116

117 for (; first != last; ++first)

118 first->setParent(NewIP);

119 }

120}

121

122}

123

124#endif

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

static ManagedStatic< DebugCounterOwner > Owner

static bool getSymTab(Value *V, ValueSymbolTable *&ST)

void setSymTabObject(TPtr *, TPtr)

setSymTabObject - This is called when (f.e.) the parent of a basic block changes.

Definition SymbolTableListTraitsImpl.h:33

void transferNodesFromList(SymbolTableListTraits &L2, iterator first, iterator last)

Definition SymbolTableListTraitsImpl.h:88

void addNodeToList(ValueSubClass *V)

Definition SymbolTableListTraitsImpl.h:67

void removeNodeFromList(ValueSubClass *V)

Definition SymbolTableListTraitsImpl.h:79

SymbolTableListTraits()=default

This class provides a symbol table of name/value pairs.

This is an optimization pass for GlobalISel generic memory operations.

void invalidateParentIListOrdering(ParentClass *Parent)

Notify basic blocks when an instruction is inserted.

Definition SymbolTableListTraitsImpl.h:25