LLVM: lib/Analysis/DomTreeUpdater.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

21#include

22

23namespace llvm {

24

27

31

34 applyUpdatesImpl<true>();

37 applyUpdatesImpl<false>();

38

39bool DomTreeUpdater::forceFlushDeletedBB() {

41 return false;

42

44

45

46

47

49 "DelBB has been modified while awaiting deletion.");

51 BB->eraseFromParent();

52 }

54 Callbacks.clear();

55 return true;

56}

57

58

59

60

61

62

64 validateDeleteBB(DelBB);

65 if (Strategy == UpdateStrategy::Lazy) {

67 return;

68 }

69

72}

73

76 validateDeleteBB(DelBB);

77 if (Strategy == UpdateStrategy::Lazy) {

78 Callbacks.push_back(CallBackOnDeletion(DelBB, Callback));

80 return;

81 }

82

85 Callback(DelBB);

86 delete DelBB;

87}

88

89void DomTreeUpdater::validateDeleteBB(BasicBlock *DelBB) {

90 assert(DelBB && "Invalid push_back of nullptr DelBB.");

91 assert(pred_empty(DelBB) && "DelBB has one or more predecessors.");

92

93 while (!DelBB->empty()) {

95

96 if (I.use_empty())

99 }

100

101

102 new UnreachableInst(DelBB->getContext(), DelBB);

103}

104

108#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)

110 OS << "Pending Callbacks:\n";

111 int Index = 0;

112 for (const auto &BB : Callbacks) {

113 OS << " " << Index << " : ";

114 ++Index;

115 if (BB->hasName())

116 OS << BB->getName() << "(";

117 else

118 OS << "(no_name)(";

119 OS << BB << ")\n";

120 }

121#endif

122}

123

124}

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

#define LLVM_DUMP_METHOD

Mark debug helper function definitions like dump() that should not be stripped from debug builds.

#define LLVM_EXPORT_TEMPLATE

This file contains the declarations for the subclasses of Constant, which represent the different fla...

This file defines a set of templates that efficiently compute a dominator tree over a generic graph.

LLVM Basic Block Representation.

const Instruction & back() const

LLVM_ABI void removeFromParent()

Unlink 'this' from the containing function, but do not delete it.

LLVM_ABI SymbolTableList< BasicBlock >::iterator eraseFromParent()

Unlink 'this' from the containing function and delete it.

LLVM_ABI LLVMContext & getContext() const

Get the context in which this basic block lives.

LLVM_ABI LLVM_DUMP_METHOD void dump() const

Debug method to help view the internal state of this class.

Definition DomTreeUpdater.cpp:106

LLVM_ABI void callbackDeleteBB(BasicBlock *DelBB, std::function< void(BasicBlock *)> Callback)

Delete DelBB.

Definition DomTreeUpdater.cpp:74

LLVM_ABI void deleteBB(BasicBlock *DelBB)

Delete DelBB.

Definition DomTreeUpdater.cpp:63

Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.

SmallPtrSet< BasicBlockT *, 8 > DeletedBBs

void eraseDelBBNode(BasicBlockT *DelBB)

const UpdateStrategy Strategy

LLVM_DUMP_METHOD void dump() const

LLVM_ABI InstListType::iterator eraseFromParent()

This method unlinks 'this' from the containing basic block and deletes it.

static LLVM_ABI PoisonValue * get(Type *T)

Static factory methods - Return an 'poison' object of the specified type.

PostDominatorTree Class - Concrete subclass of DominatorTree that is used to compute the post-dominat...

This class implements an extremely fast bulk output stream that can only output to a stream.

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI raw_ostream & dbgs()

dbgs() - This returns a reference to a raw_ostream for debugging messages.

bool isa(const From &Val)

isa - Return true if the parameter to the template is an instance of one of the template type argu...

bool pred_empty(const BasicBlock *BB)