std::vector<const Node *>
Nodes;
38template<
typenameNode>
41assert(Header !=
nullptr);
43Interval.
Nodes.push_back(Header);
44Partitioned.set(
getID(*Header));
50std::queue<const Node *> Worklist;
51llvm::BitVector Workset(Partitioned.size(),
false);
52 for(
const Node*S : Header->succs())
54 if(
autoSID =
getID(*S); !Partitioned.test(SID)) {
68std::vector<const Node *> MaybeSuccessors;
70 while(!Worklist.empty()) {
71 const auto*B = Worklist.front();
78 boolAllInInterval = llvm::all_of(B->preds(), [&](
const Node*
P) {
79return llvm::is_contained(Interval.Nodes, P);
82Interval.
Nodes.push_back(B);
83Partitioned.set(
ID);
84 for(
const Node*S : B->succs())
86 if(
autoSID =
getID(*S);
87!Partitioned.test(SID) && !Workset.test(SID)) {
92MaybeSuccessors.push_back(B);
97 for(
const Node*B : MaybeSuccessors)
98 if(!llvm::is_contained(Interval.
Nodes, B))
104template<
typenameNode>
106std::vector<CFGIntervalNode *> &Index,
107std::queue<const Node *> &Successors,
108llvm::BitVector &Partitioned,
const Node*Header) {
110 for(
const auto*S :
Result.Successors)
119 for(
const auto*N :
Result.Nodes) {
120assert(N !=
nullptr);
121assert(
getID(*N) < Index.size());
122Index[
getID(*N)] = &Interval;
125 if constexpr(std::is_same_v<std::decay_t<Node>,
CFGBlock>)
128std::vector<const CFGBlock *>
Nodes;
131 for(
auto&N :
Result.Nodes)
132Count += N->Nodes.size();
133 Nodes.reserve(Count);
134 for(
auto&N :
Result.Nodes)
135 Nodes.insert(
Nodes.end(), N->Nodes.begin(), N->Nodes.end());
140template<
typenameNode>
142 const Node*EntryBlock) {
143assert(EntryBlock !=
nullptr);
148std::vector<CFGIntervalNode *> Index(NumBlockIDs,
nullptr);
154std::vector<std::pair<const Node *, CFGIntervalNode *>> Intervals;
155llvm::BitVector Partitioned(NumBlockIDs,
false);
156std::queue<const Node *> Successors;
159Intervals.emplace_back(EntryBlock, &Graph.back());
161 while(!Successors.empty()) {
162 const auto*B = Successors.front();
164assert(B !=
nullptr);
165 if(Partitioned.test(
getID(*B)))
171Intervals.emplace_back(B, &Graph.back());
175 for(
auto[H, N] : Intervals) {
178 for(
const Node*
P: H->preds()) {
182assert(
getID(*
P) < NumBlockIDs);
184 if(Pred ==
nullptr)
215 unsignedPrevSize = Cfg.
size();
219 unsignedSize = Graph.size();
220 while(Size > 1 && Size < PrevSize) {
221PrevSize = Graph.size();
230 returnstd::move(Graph[0].
Nodes);
236 autoN = WTO[0]->getParent()->getNumBlockIDs();
238 for(
unsignedI = 0, S = WTO.size(); I < S; ++I)
BoundNodesTreeBuilder Nodes
Represents a single basic block in a source-level CFG.
unsigned getBlockID() const
Represents a source-level, intra-procedural CFG that represents the control-flow of a Stmt.
unsigned size() const
Return the total number of CFGBlocks within the CFG This is simply a renaming of the getNumBlockIDs()...
unsigned getNumBlockIDs() const
Returns the total number of BlockIDs allocated (which start at 0).
static void fillIntervalNode(CFGIntervalGraph &Graph, std::vector< CFGIntervalNode * > &Index, std::queue< const Node * > &Successors, llvm::BitVector &Partitioned, const Node *Header)
static unsigned getID(const CFGBlock &B)
std::vector< const CFGBlock * > buildInterval(const CFGBlock *Header)
std::deque< CFGIntervalNode > CFGIntervalGraph
static CFGIntervalGraph partitionIntoIntervalsImpl(unsigned NumBlockIDs, const Node *EntryBlock)
CFGIntervalGraph partitionIntoIntervals(const CFG &Cfg)
The JSON file list parser is used to communicate input to InstallAPI.
@ Result
The result type of a method or function.
std::vector< const CFGBlock * > WeakTopologicalOrdering
A weak topological ordering (WTO) of CFG nodes provides a total order over the CFG (defined in WTOCom...
std::optional< WeakTopologicalOrdering > getIntervalWTO(const CFG &Cfg)
llvm::SmallDenseSet< const Node * > Successors
std::vector< const Node * > Nodes
std::vector< unsigned > BlockOrder
WTOCompare(const WeakTopologicalOrdering &WTO)
std::vector< const CFGBlock * > Nodes
llvm::SmallDenseSet< const CFGIntervalNode * > Predecessors
llvm::SmallDenseSet< const CFGIntervalNode * > Successors
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4