CIRCT 23.0.0git
Loading...
Searching...
No Matches
Functions
CaptureAnalysis.cpp File Reference
#include "CaptureAnalysis.h"
#include "slang/ast/ASTVisitor.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/Support/SaveAndRestore.h"
Include dependency graph for CaptureAnalysis.cpp:

Go to the source code of this file.

Functions

static bool isLocalToFunction (const ValueSymbol &var, const SubroutineSymbol &func)
 Check whether var is local to func.
 
static bool isVirtualInterfaceMemberAccess (const ValueSymbol &var)
 Workaround for a slang deficiency: when accessing a member of a virtual interface (e.g., vif.data), slang resolves the entire dotted path during name lookup and produces a NamedValueExpression that directly references the signal symbol inside the interface's InstanceBody.
 
static bool isGlobalVariable (const ValueSymbol &var)
 Check whether var is a global variable.
 

Function Documentation

◆ isGlobalVariable()

static bool isGlobalVariable ( const ValueSymbol &  var)
static

Check whether var is a global variable.

Walk up from the variable's parent scope; if we hit a function or instance body, it's not global. Otherwise (package, compilation unit, root) it is.

Definition at line 62 of file CaptureAnalysis.cpp.

◆ isLocalToFunction()

static bool isLocalToFunction ( const ValueSymbol &  var,
const SubroutineSymbol &  func 
)
static

Check whether var is local to func.

Walk up from the variable's parent scope; if we reach func before hitting another function boundary, the variable is local.

Definition at line 21 of file CaptureAnalysis.cpp.

◆ isVirtualInterfaceMemberAccess()

static bool isVirtualInterfaceMemberAccess ( const ValueSymbol &  var)
static

Workaround for a slang deficiency: when accessing a member of a virtual interface (e.g., vif.data), slang resolves the entire dotted path during name lookup and produces a NamedValueExpression that directly references the signal symbol inside the interface's InstanceBody.

Unlike struct fields and class properties, which produce a MemberAccessExpression, there is no syntactic indication on the expression that this was a member projection.

This check matches variables that live inside an interface instance body. A NamedValueExpression referencing such a symbol is the result of slang's virtual interface member resolution, not a genuine variable capture. This is expected to be fixed upstream in slang.

See https://github.com/MikePopoloski/slang/discussions/1770

Definition at line 47 of file CaptureAnalysis.cpp.