LLVM: include/llvm/Support/CFGUpdate.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_SUPPORT_CFGUPDATE_H

15#define LLVM_SUPPORT_CFGUPDATE_H

16

23

24namespace llvm {

25namespace cfg {

27

28template class Update {

30 NodePtr From;

32

33public:

35 : From(From), ToAndKind(To, Kind) {}

36

41 return From == RHS.From && ToAndKind == RHS.ToAndKind;

42 }

43

46 getFrom()->printAsOperand(OS, false);

47 OS << " -> ";

48 getTo()->printAsOperand(OS, false);

49 }

50

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

53#endif

54};

55

56

57

58

59

60

61

62template

65 bool InverseGraph, bool ReverseResultOrder = false) {

66

67

68

69

70

72 Operations.reserve(AllUpdates.size());

73

74 for (const auto &U : AllUpdates) {

75 NodePtr From = U.getFrom();

76 NodePtr To = U.getTo();

77 if (InverseGraph)

78 std::swap(From, To);

79

81 }

82

83 Result.clear();

84 Result.reserve(Operations.size());

85 for (auto &Op : Operations) {

86 const int NumInsertions = Op.second;

87 assert(std::abs(NumInsertions) <= 1 && "Unbalanced operations!");

88 if (NumInsertions == 0)

89 continue;

92 Result.push_back({UK, Op.first.first, Op.first.second});

93 }

94

95

96

97

98

99 for (size_t i = 0, e = AllUpdates.size(); i != e; ++i) {

100 const auto &U = AllUpdates[i];

101 if (!InverseGraph)

102 Operations[{U.getFrom(), U.getTo()}] = int(i);

103 else

104 Operations[{U.getTo(), U.getFrom()}] = int(i);

105 }

106

108 const auto &OpA = Operations[{A.getFrom(), A.getTo()}];

109 const auto &OpB = Operations[{B.getFrom(), B.getTo()}];

110 return ReverseResultOrder ? OpA < OpB : OpA > OpB;

111 });

112}

113

114}

115}

116

117#endif

BlockVerifier::State From

static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")

static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")

#define LLVM_DUMP_METHOD

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

This file defines the DenseMap class.

This file defines the PointerIntPair class.

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

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

This class represents an Operation in the Expression.

void reserve(size_type NumEntries)

Grow the densemap so that it can contain at least NumEntries items before resizing again.

PointerTy getPointer() const

This class consists of common code factored out of the SmallVector class to reduce code duplication b...

UpdateKind getKind() const

Update(UpdateKind Kind, NodePtr From, NodePtr To)

bool operator==(const Update &RHS) const

void print(raw_ostream &OS) const

LLVM_DUMP_METHOD void dump() const

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

void LegalizeUpdates(ArrayRef< Update< NodePtr > > AllUpdates, SmallVectorImpl< Update< NodePtr > > &Result, bool InverseGraph, bool ReverseResultOrder=false)

This is an optimization pass for GlobalISel generic memory operations.

void sort(IteratorTy Start, IteratorTy End)

raw_ostream & dbgs()

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

void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)

Implement std::swap in terms of BitVector swap.