33 #ifndef LLVM_ANALYSIS_INTERVALITERATOR_H 34 #define LLVM_ANALYSIS_INTERVALITERATOR_H 74 Int->
Nodes.push_back(BB);
88 template<
class NodeTy,
class OrigContainer_t,
class GT = GraphTraits<NodeTy *>,
89 class IGT = GraphTraits<Inverse<NodeTy *>>>
91 std::vector<std::pair<Interval *, typename Interval::succ_iterator>> IntStack;
92 std::set<BasicBlock *> Visited;
93 OrigContainer_t *OrigContainer;
104 if (!ProcessInterval(&M->
front())) {
110 : IntStack(
std::move(x.IntStack)), Visited(
std::move(x.Visited)),
111 OrigContainer(x.OrigContainer), IOwnMem(x.IOwnMem) {
124 while (!IntStack.empty()) {
131 return IntStack == x.IntStack;
141 assert(!IntStack.empty() &&
"Attempting to use interval iterator at end!");
146 EndIt =
succ_end(IntStack.back().first);
147 while (SuccIt != EndIt) {
150 if (Done)
return *
this;
154 if (IOwnMem)
delete IntStack.back().first;
158 }
while (!IntStack.empty());
177 bool ProcessInterval(NodeTy *Node) {
179 if (!Visited.insert(Header).second)
185 for (
typename GT::ChildIteratorType
I = GT::child_begin(Node),
186 E = GT::child_end(Node);
I !=
E; ++
I)
189 IntStack.push_back(std::make_pair(Int,
succ_begin(Int)));
201 void ProcessNode(
Interval *Int, NodeTy *Node) {
202 assert(Int &&
"Null interval == bad!");
203 assert(Node &&
"Null Node == bad!");
207 if (Visited.count(NodeHeader)) {
215 for (
typename IGT::ChildIteratorType
I = IGT::child_begin(Node),
216 E = IGT::child_end(Node);
I !=
E; ++
I) {
227 Visited.insert(NodeHeader);
238 for (
typename GT::ChildIteratorType It = GT::child_begin(Node),
239 End = GT::child_end(Node); It != End; ++It)
250 bool DeleteInts =
true) {
268 #endif // LLVM_ANALYSIS_INTERVALITERATOR_H const Interval * operator*() const
function_interval_iterator intervals_end(Function *)
This class represents lattice values for constants.
Interval Class - An Interval is a set of nodes defined such that every node in the interval has all o...
std::error_code remove(const Twine &path, bool IgnoreNonExisting=true)
Remove path.
BasicBlock * getNodeHeader(BasicBlock *BB)
std::vector< BasicBlock * >::iterator succ_iterator
std::pair< uint32_t, uint32_t > Interval
Interval::succ_iterator succ_begin(Interval *I)
succ_begin/succ_end - define methods so that Intervals may be used just like BasicBlocks can with the...
bool contains(BasicBlock *BB) const
contains - Find out if a basic block is in this interval
function_interval_iterator intervals_begin(Function *F, bool DeleteInts=true)
void addNodeToInterval(Interval *Int, BasicBlock *BB)
Interval::succ_iterator succ_end(Interval *I)
BasicBlock * getHeaderNode() const
LLVM Basic Block Representation.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
bool isSuccessor(BasicBlock *BB) const
isSuccessor - find out if a basic block is a successor of this Interval
std::vector< BasicBlock * > Nodes
Nodes - The basic blocks in this interval.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
IntervalIterator< Interval, IntervalPartition > interval_part_interval_iterator
BasicBlock * getSourceGraphNode(Function *, BasicBlock *BB)
IntervalIterator< BasicBlock, Function > function_interval_iterator
const Interval * operator->() const
IntervalIterator(Function *M, bool OwnMemory)
Interval * getRootInterval()
std::vector< BasicBlock * > Successors
Successors - List of BasicBlocks that are reachable directly from nodes in this interval, but are not in the interval themselves.
bool operator!=(const IntervalIterator &x) const
This file provides various utilities for inspecting and working with the control flow graph in LLVM I...
std::forward_iterator_tag iterator_category
bool operator==(const IntervalIterator &x) const
IntervalIterator operator++(int)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const BasicBlock & front() const
IntervalIterator()=default
IntervalIterator(IntervalIterator &&x)
IntervalIterator(IntervalPartition &IP, bool OwnMemory)
IntervalIterator & operator++()
Interval * getBlockInterval(BasicBlock *BB)