@@ -36,8 +36,7 @@ enum class CallControlFlowAction { EnterCallee, ExitCallee, ExternalCallee };
3636// ===----------------------------------------------------------------------===//
3737
3838// / This class represents a dense lattice. A dense lattice is attached to
39- // / operations to represent the program state after their execution or to blocks
40- // / to represent the program state at the beginning of the block. A dense
39+ // / program point to represent the program state at the program point.
4140// / lattice is propagated through the IR by dense data-flow analysis.
4241class AbstractDenseLattice : public AnalysisState {
4342public:
@@ -59,15 +58,13 @@ class AbstractDenseLattice : public AnalysisState {
5958// ===----------------------------------------------------------------------===//
6059
6160// / Base class for dense forward data-flow analyses. Dense data-flow analysis
62- // / attaches a lattice between the execution of operations and implements a
63- // / transfer function from the lattice before each operation to the lattice
64- // / after. The lattice contains information about the state of the program at
65- // / that point.
61+ // / attaches a lattice to program points and implements a transfer function from
62+ // / the lattice before each operation to the lattice after. The lattice contains
63+ // / information about the state of the program at that program point.
6664// /
67- // / In this implementation, a lattice attached to an operation represents the
68- // / state of the program after its execution, and a lattice attached to block
69- // / represents the state of the program right before it starts executing its
70- // / body.
65+ // / Visit a program point in forward dense data-flow analysis will invoke the
66+ // / transfer function of the operation preceding the program point iterator.
67+ // / Visit a program point at the begining of block will visit the block itself.
7168class AbstractDenseForwardDataFlowAnalysis : public DataFlowAnalysis {
7269public:
7370 using DataFlowAnalysis::DataFlowAnalysis;
@@ -76,13 +73,14 @@ class AbstractDenseForwardDataFlowAnalysis : public DataFlowAnalysis {
7673 // / may modify the program state; that is, every operation and block.
7774 LogicalResult initialize (Operation *top) override ;
7875
79- // / Visit a program point that modifies the state of the program. If this is a
80- // / block, then the state is propagated from control-flow predecessors or
81- // / callsites. If this is a call operation or region control-flow operation,
82- // / then the state after the execution of the operation is set by control-flow
83- // / or the callgraph. Otherwise, this function invokes the operation transfer
84- // / function.
85- LogicalResult visit (ProgramPoint point) override ;
76+ // / Visit a program point that modifies the state of the program. If the
77+ // / program point is at the beginning of a block, then the state is propagated
78+ // / from control-flow predecessors or callsites. If the operation before
79+ // / program point iterator is a call operation or region control-flow
80+ // / operation, then the state after the execution of the operation is set by
81+ // / control-flow or the callgraph. Otherwise, this function invokes the
82+ // / operation transfer function before the program point iterator.
83+ LogicalResult visit (ProgramPoint *point) override ;
8684
8785protected:
8886 // / Propagate the dense lattice before the execution of an operation to the
@@ -91,15 +89,14 @@ class AbstractDenseForwardDataFlowAnalysis : public DataFlowAnalysis {
9189 const AbstractDenseLattice &before,
9290 AbstractDenseLattice *after) = 0;
9391
94- // / Get the dense lattice after the execution of the given lattice anchor.
92+ // / Get the dense lattice on the given lattice anchor.
9593 virtual AbstractDenseLattice *getLattice (LatticeAnchor anchor) = 0;
9694
97- // / Get the dense lattice after the execution of the given program point and
98- // / add it as a dependency to a lattice anchor. That is, every time the
99- // / lattice after anchor is updated, the dependent program point must be
100- // / visited, and the newly triggered visit might update the lattice after
101- // / dependent.
102- const AbstractDenseLattice *getLatticeFor (ProgramPoint dependent,
95+ // / Get the dense lattice on the given lattice anchor and add dependent as its
96+ // / dependency. That is, every time the lattice after anchor is updated, the
97+ // / dependent program point must be visited, and the newly triggered visit
98+ // / might update the lattice on dependent.
99+ const AbstractDenseLattice *getLatticeFor (ProgramPoint *dependent,
103100 LatticeAnchor anchor);
104101
105102 // / Set the dense lattice at control flow entry point and propagate an update
@@ -153,7 +150,7 @@ class AbstractDenseForwardDataFlowAnalysis : public DataFlowAnalysis {
153150 // / Visit a program point within a region branch operation with predecessors
154151 // / in it. This can either be an entry block of one of the regions of the
155152 // / parent operation itself.
156- void visitRegionBranchOperation (ProgramPoint point,
153+ void visitRegionBranchOperation (ProgramPoint * point,
157154 RegionBranchOpInterface branch,
158155 AbstractDenseLattice *after);
159156
@@ -294,14 +291,12 @@ class DenseForwardDataFlowAnalysis
294291// ===----------------------------------------------------------------------===//
295292
296293// / Base class for dense backward dataflow analyses. Such analyses attach a
297- // / lattice between the execution of operations and implement a transfer
298- // / function from the lattice after the operation ot the lattice before it, thus
299- // / propagating backward.
294+ // / lattice to program point and implement a transfer function from the lattice
295+ // / after the operation to the lattice before it, thus propagating backward.
300296// /
301- // / In this implementation, a lattice attached to an operation represents the
302- // / state of the program before its execution, and a lattice attached to a block
303- // / represents the state of the program before the end of the block, i.e., after
304- // / its terminator.
297+ // / Visit a program point in dense backward data-flow analysis will invoke the
298+ // / transfer function of the operation following the program point iterator.
299+ // / Visit a program point at the end of block will visit the block itself.
305300class AbstractDenseBackwardDataFlowAnalysis : public DataFlowAnalysis {
306301public:
307302 // / Construct the analysis in the given solver. Takes a symbol table
@@ -321,9 +316,9 @@ class AbstractDenseBackwardDataFlowAnalysis : public DataFlowAnalysis {
321316 // / operations, the state is propagated using the transfer function
322317 // / (visitOperation).
323318 // /
324- // / Note: the transfer function is currently *not* invoked for operations with
325- // / region or call interface, but *is* invoked for block terminators.
326- LogicalResult visit (ProgramPoint point) override ;
319+ // / Note: the transfer function is currently *not* invoked before operations
320+ // / with region or call interface, but *is* invoked before block terminators.
321+ LogicalResult visit (ProgramPoint * point) override ;
327322
328323protected:
329324 // / Propagate the dense lattice after the execution of an operation to the
@@ -337,10 +332,11 @@ class AbstractDenseBackwardDataFlowAnalysis : public DataFlowAnalysis {
337332 // / block.
338333 virtual AbstractDenseLattice *getLattice (LatticeAnchor anchor) = 0;
339334
340- // / Get the dense lattice before the execution of the program point in
341- // / `anchor` and declare that the `dependent` program point must be updated
342- // / every time `point` is.
343- const AbstractDenseLattice *getLatticeFor (ProgramPoint dependent,
335+ // / Get the dense lattice on the given lattice anchor and add dependent as its
336+ // / dependency. That is, every time the lattice after anchor is updated, the
337+ // / dependent program point must be visited, and the newly triggered visit
338+ // / might update the lattice before dependent.
339+ const AbstractDenseLattice *getLatticeFor (ProgramPoint *dependent,
344340 LatticeAnchor anchor);
345341
346342 // / Set the dense lattice before at the control flow exit point and propagate
@@ -400,7 +396,7 @@ class AbstractDenseBackwardDataFlowAnalysis : public DataFlowAnalysis {
400396 // / (from which the state is propagated) in or after it. `regionNo` indicates
401397 // / the region that contains the successor, `nullopt` indicating the successor
402398 // / of the branch operation itself.
403- void visitRegionBranchOperation (ProgramPoint point,
399+ void visitRegionBranchOperation (ProgramPoint * point,
404400 RegionBranchOpInterface branch,
405401 RegionBranchPoint branchPoint,
406402 AbstractDenseLattice *before);
0 commit comments