10 #ifndef CONVERSION_IMPORTVERILOG_IMPORTVERILOGINTERNALS_H
11 #define CONVERSION_IMPORTVERILOG_IMPORTVERILOGINTERNALS_H
16 #include "mlir/Dialect/SCF/IR/SCF.h"
17 #include "slang/ast/ASTVisitor.h"
18 #include "llvm/ADT/ScopedHashTable.h"
19 #include "llvm/Support/Debug.h"
23 #define DEBUG_TYPE "import-verilog"
26 namespace ImportVerilog {
53 Type
convertType(
const slang::ast::Type &type, LocationAttr loc = {});
54 Type
convertType(
const slang::ast::DeclaredType &type);
81 DenseMap<const slang::ast::InstanceBodySymbol *, moore::SVModuleOp>
moduleOps;
90 llvm::ScopedHashTable<const slang::ast::ValueSymbol *, Value>;
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
A helper class to facilitate the conversion from a Slang AST to MLIR operations.
LogicalResult convertModuleBody(const slang::ast::InstanceBodySymbol *module)
Convert a module's body to the corresponding IR ops.
OpBuilder builder
The builder used to create IR operations.
std::queue< const slang::ast::InstanceBodySymbol * > moduleWorklist
A list of modules for which the header has been created, but the body has not been converted yet.
LogicalResult convertCompilation(slang::ast::Compilation &compilation)
Convert hierarchy and structure AST nodes to MLIR ops.
Value convertExpression(const slang::ast::Expression &expr)
Context(const Context &)=delete
std::map< slang::SourceLocation, Operation * > orderedRootOps
The top-level operations ordered by their Slang source location.
Type convertType(const slang::ast::Type &type, LocationAttr loc={})
Convert a slang type into an MLIR type.
SmallDenseMap< slang::BufferID, StringRef > & bufferFilePaths
DenseMap< const slang::ast::InstanceBodySymbol *, moore::SVModuleOp > moduleOps
How we have lowered modules to MLIR.
ValueSymbols valueSymbols
moore::SVModuleOp convertModuleHeader(const slang::ast::InstanceBodySymbol *module)
Convert a module and its ports to an empty module op in the IR.
ValueSymbols::ScopeTy ValueSymbolScope
Context(mlir::ModuleOp intoModuleOp, const slang::SourceManager &sourceManager, SmallDenseMap< slang::BufferID, StringRef > &bufferFilePaths)
llvm::ScopedHashTable< const slang::ast::ValueSymbol *, Value > ValueSymbols
A table of defined values, such as variables, that may be referred to by name in expressions.
const slang::SourceManager & sourceManager
mlir::ModuleOp intoModuleOp
SymbolTable symbolTable
A symbol table of the MLIR module we are emitting into.
MLIRContext * getContext()
Return the MLIR context.
LogicalResult convertStatement(const slang::ast::Statement &stmt)
SmallVector< Value > lvalueStack
A stack of assignment left-hand side values.
Location convertLocation(slang::SourceLocation loc)
Convert a slang SourceLocation into an MLIR Location.