slang::analysis::AnalysisManager class

The analysis manager coordinates running various analyses on AST symbols.

Analysis is done downstream from one or more Compilation objects. Once a design has an AST successfully built, analysis passes can be run to check for various issues or extract information.

Constructors, destructors, conversion operators

AnalysisManager(AnalysisOptions options = {}) explicit
Default constructor for the analysis manager.

Public functions

const AnalysisOptions& getOptions() const
Gets the set of options used to construct the analysis manager.
bool hasFlag(bitmask<AnalysisFlags> flags) const
Returns true if the given flag(s) are enabled for this analysis.
AnalyzedDesign analyze(const ast::Compilation& compilation)
Analyzes the given compilation and returns a representation of the design.
DriverList getDrivers(const ast::ValueSymbol& symbol) const
Returns all of the known drivers for the given symbol.
std::optional<InstanceDriverState> getInstanceDriverState(const ast::InstanceBodySymbol& symbol) const
Return the driver state tracked per canonical instance.
Diagnostics getDiagnostics(const SourceManager* sourceManager)
Collects and returns all issued analysis diagnostics.
const AnalyzedScope& analyzeScopeBlocking(const ast::Scope& scope, const AnalyzedProcedure* parentProcedure = nullptr)
Analyzes the given scope, in blocking fashion.
const AnalyzedScope* getAnalyzedScope(const ast::Scope& scope) const
Returns the results of a previous analysis of a scope, if available.
const AnalyzedProcedure* getAnalyzedSubroutine(const ast::SubroutineSymbol& symbol) const
Gets the result of analyzing a subroutine, if available.
const AnalyzedProcedure* addAnalyzedSubroutine(const ast::SubroutineSymbol& symbol, std::unique_ptr<AnalyzedProcedure> procedure)
Adds a new analyzed subroutine to the manager's cache for later lookup.
void noteDriver(const ast::Expression& expr, const ast::Symbol& containingSymbol)
Notes that the given expression is a driver and should be added to the driver tracker.
void noteDrivers(std::span<const SymbolDriverListPair> drivers)
Notes the existence of the given symbol value drivers.
void getFunctionDrivers(const ast::CallExpression& expr, const ast::Symbol& containingSymbol, SmallSet<const ast::SubroutineSymbol*, 2>& visited, std::vector<SymbolDriverListPair>& drivers)
Helper method to get the indirect drivers from a call to a function.
void getTaskTimingControls(const ast::CallExpression& expr, SmallSet<const ast::SubroutineSymbol*, 2>& visited, std::vector<const ast::Statement*>& controls)
Helper method to get all timing controls from a call to a task.

Function documentation

AnalyzedDesign slang::analysis::AnalysisManager::analyze(const ast::Compilation& compilation)

Analyzes the given compilation and returns a representation of the design.

Diagnostics slang::analysis::AnalysisManager::getDiagnostics(const SourceManager* sourceManager)

Collects and returns all issued analysis diagnostics.

If sourceManager is provided it will be used to sort the diagnostics.

const AnalyzedScope& slang::analysis::AnalysisManager::analyzeScopeBlocking(const ast::Scope& scope, const AnalyzedProcedure* parentProcedure = nullptr)

Analyzes the given scope, in blocking fashion.

const AnalyzedProcedure* slang::analysis::AnalysisManager::getAnalyzedSubroutine(const ast::SubroutineSymbol& symbol) const

Gets the result of analyzing a subroutine, if available.

Otherwise returns nullptr.