clang: include/clang/Analysis/FlowSensitive/DataflowWorklist.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12#ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_DATAFLOWWORKLIST_H
13#define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_DATAFLOWWORKLIST_H
14
18#include "llvm/ADT/PriorityQueue.h"
19
21
22
24 llvm::BitVector EnqueuedBlocks;
25 llvm::PriorityQueue<const CFGBlock *,
27 WorkList;
28
29public:
31 : EnqueuedBlocks(Cfg.getNumBlockIDs()), WorkList(C) {}
32
34 if (Block && !EnqueuedBlocks[Block->getBlockID()]) {
35 EnqueuedBlocks[Block->getBlockID()] = true;
36 WorkList.push(Block);
37 }
38 }
39
41 if (WorkList.empty())
42 return nullptr;
43 const CFGBlock *B = WorkList.top();
44 WorkList.pop();
45 EnqueuedBlocks[B->getBlockID()] = false;
46 return B;
47 }
48};
49
53 return Cmp(rhs, lhs);
54 }
55};
56
57
58
59
65
68
70 for (auto B : Block->succs())
72 }
73};
74
75
76
77
81
83 for (auto B : Block->succs())
85 }
86};
87
88
89
90
96
98 for (auto B : Block->preds())
100 }
101};
102
103}
104
105#endif
AnalysisDeclContext contains the context data for the function, method or block under analysis.
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.
A worklist implementation where the enqueued blocks will be dequeued based on the order defined by 'C...
void enqueueBlock(const CFGBlock *Block)
DataflowWorklistBase(const CFG &Cfg, Comp C)
const CFGBlock * dequeue()
The JSON file list parser is used to communicate input to InstallAPI.
A worklist implementation for backward dataflow analysis.
BackwardDataflowWorklist(const CFG &Cfg, AnalysisDeclContext &Ctx)
void enqueuePredecessors(const CFGBlock *Block)
A worklist implementation for forward dataflow analysis.
void enqueueSuccessors(const CFGBlock *Block)
ForwardDataflowWorklist(const CFG &Cfg, AnalysisDeclContext &Ctx)
ForwardDataflowWorklist(const CFG &Cfg, PostOrderCFGView *POV)
PostOrderCFGView::BlockOrderCompare Cmp
bool operator()(const CFGBlock *lhs, const CFGBlock *rhs) const
A worklist implementation for forward dataflow analysis based on a weak topological ordering of the n...
WTODataflowWorklist(const CFG &Cfg, const WTOCompare &Cmp)
void enqueueSuccessors(const CFGBlock *Block)