FlowAnalysisBase class
A base class for flow analysis passes that contains non-specialized helper functions.
Derived classes
-
template<typename TDerived, typename TState>class AbstractFlowAnalysis
- An abstract class for flow analysis passes over SystemVerilog code.
-
template<typename TDerived, typename TState>class AbstractFlowAnalysis
- An abstract class for flow analysis passes over SystemVerilog code.
Constructors, destructors, conversion operators
- FlowAnalysisBase(const Symbol& symbol, AnalysisOptions options, Diagnostics* diagnostics = nullptr) protected
- Constructs a new flow analysis pass.
Public functions
- EvalContext& getEvalContext() const
- Gets an evaluation context for use during analysis.
Public variables
- const Symbol& rootSymbol
- The symbol being analyzed (procedure, function, etc).
- AnalysisOptions options
- Various options controlling the behavior of the analysis.
- bool bad
- Set to true if the analysis detected an error.
Protected functions
- void checkLoopVars(const Statement& loopStmt)
- Perform loop variable checks in a single pass over the loop body:
Protected variables
- uint32_t forLoopSteps
- Tracking for how many steps we've taken while analyzing the body of a loop.
- bool inUnrolledForLoop
- Set to true if we're currently walking through an unrolled for loop.
- bool inCheckLoopVars
- Set to true while the main flow pass is visiting the body of a for/foreach loop.
- Diagnostics* diagnostics
- An optional diagnostics collection.
- EvalContext evalContext
- An EvalContext that can be used for constant evaluation during analysis.
Function documentation
void slang:: analysis:: FlowAnalysisBase:: checkLoopVars(const Statement& loopStmt) protected
Perform loop variable checks in a single pass over the loop body:
- Warn when a loop variable (for loops) is both stepped in the header and incremented/decremented inside the body (double-step).
- Warn when none of the variables in the stop condition are ever modified by the step expressions or the body (for loops only).
- Warn when a loop variable is referenced inside a fork-join_any or fork-join_none block in the body (captures stale value).
Variable documentation
bool slang:: analysis:: FlowAnalysisBase:: inCheckLoopVars protected
Set to true while the main flow pass is visiting the body of a for/foreach loop.
Prevents nested loops encountered during that traversal from re-triggering checkLoopVars; checkLoopVars already handles nested loops internally via its own visitor.
Diagnostics* slang:: analysis:: FlowAnalysisBase:: diagnostics protected
An optional diagnostics collection.
If provided, warnings encountered during analysis will be added to it.