14#ifndef LLVM_SUPPORT_CFGUPDATE_H
15#define LLVM_SUPPORT_CFGUPDATE_H
28template <
typename NodePtr>
class Update {
41 return From ==
RHS.From && ToAndKind ==
RHS.ToAndKind;
48 getTo()->printAsOperand(
OS,
false);
51#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
62template <
typename NodePtr>
65 bool InverseGraph,
bool ReverseResultOrder =
false) {
72 Operations.
reserve(AllUpdates.size());
74 for (
const auto &U : AllUpdates) {
75 NodePtr
From = U.getFrom();
76 NodePtr To = U.getTo();
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)
92 Result.push_back({UK,
Op.first.first,
Op.first.second});
99 for (
size_t i = 0, e = AllUpdates.size(); i != e; ++i) {
100 const auto &U = AllUpdates[i];
102 Operations[{U.getFrom(), U.getTo()}] = int(i);
104 Operations[{U.getTo(), U.getFrom()}] = int(i);
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;
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.