CIRCT  18.0.0git
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
circt::ExportVerilog::OpLocMap Class Reference

Track the output verilog line,column number information for every op. More...

#include <ExportVerilogInternals.h>

Collaboration diagram for circt::ExportVerilog::OpLocMap:
Collaboration graph
[legend]

Classes

struct  LineColPair
 
struct  LocationRange
 

Public Types

using DataType = std::pair< Operation *, bool >
 Data that is unique to each callback. More...
 

Public Member Functions

 OpLocMap (llvm::formatted_raw_ostream &fStream)
 
 OpLocMap ()=default
 
void setStream (llvm::formatted_raw_ostream &f)
 Set the output stream. More...
 
void operator() (DataType data)
 Callback operator, invoked on the print events indicated by data. More...
 
void updateIRWithLoc (unsigned lineOffset, StringAttr fileName, MLIRContext *context)
 Called after the verilog has been exported and the corresponding locations are recorded in the map. More...
 
void clear ()
 

Private Types

using Locations = SmallVector< LocationRange, 2 >
 

Private Member Functions

void addBeginLoc (Operation *op)
 Record the output location from where the op begins to print. More...
 
void addEndLoc (Operation *op)
 Record the output location where the op ends to print. More...
 

Private Attributes

DenseMap< Operation *, Locationsmap
 Map to store the verilog locations for each op. More...
 
llvm::formatted_raw_ostream * fStream
 The corresponding output stream, which provides the current print location on the stream. More...
 
StringAttr verilogLineAttr
 Cache to store string attributes. More...
 
StringAttr metadataAttr
 

Detailed Description

Track the output verilog line,column number information for every op.

Definition at line 182 of file ExportVerilogInternals.h.

Member Typedef Documentation

◆ DataType

using circt::ExportVerilog::OpLocMap::DataType = std::pair<Operation *, bool>

Data that is unique to each callback.

The op and whether its a begin or end location.

Definition at line 198 of file ExportVerilogInternals.h.

◆ Locations

Definition at line 265 of file ExportVerilogInternals.h.

Constructor & Destructor Documentation

◆ OpLocMap() [1/2]

circt::ExportVerilog::OpLocMap::OpLocMap ( llvm::formatted_raw_ostream &  fStream)
inline

Definition at line 200 of file ExportVerilogInternals.h.

◆ OpLocMap() [2/2]

circt::ExportVerilog::OpLocMap::OpLocMap ( )
default

Member Function Documentation

◆ addBeginLoc()

void circt::ExportVerilog::OpLocMap::addBeginLoc ( Operation *  op)
inlineprivate

Record the output location from where the op begins to print.

Definition at line 184 of file ExportVerilogInternals.h.

References fStream, and map.

Referenced by operator()().

◆ addEndLoc()

void circt::ExportVerilog::OpLocMap::addEndLoc ( Operation *  op)
inlineprivate

Record the output location where the op ends to print.

Definition at line 188 of file ExportVerilogInternals.h.

References assert(), empty, fStream, and map.

Referenced by operator()().

◆ clear()

void circt::ExportVerilog::OpLocMap::clear ( )
inline

Definition at line 248 of file ExportVerilogInternals.h.

References map.

◆ operator()()

void circt::ExportVerilog::OpLocMap::operator() ( DataType  data)
inline

Callback operator, invoked on the print events indicated by data.

Definition at line 206 of file ExportVerilogInternals.h.

References addBeginLoc(), addEndLoc(), assert(), and fStream.

◆ setStream()

void circt::ExportVerilog::OpLocMap::setStream ( llvm::formatted_raw_ostream &  f)
inline

Set the output stream.

Definition at line 204 of file ExportVerilogInternals.h.

References fStream.

Referenced by circt::ExportVerilog::SharedEmitterState::emitOps().

◆ updateIRWithLoc()

void circt::ExportVerilog::OpLocMap::updateIRWithLoc ( unsigned  lineOffset,
StringAttr  fileName,
MLIRContext *  context 
)
inline

Called after the verilog has been exported and the corresponding locations are recorded in the map.

Definition at line 218 of file ExportVerilogInternals.h.

References assert(), circt::calyx::direction::get(), map, metadataAttr, and verilogLineAttr.

Member Data Documentation

◆ fStream

llvm::formatted_raw_ostream* circt::ExportVerilog::OpLocMap::fStream
private

The corresponding output stream, which provides the current print location on the stream.

Definition at line 270 of file ExportVerilogInternals.h.

Referenced by addBeginLoc(), addEndLoc(), operator()(), and setStream().

◆ map

DenseMap<Operation *, Locations> circt::ExportVerilog::OpLocMap::map
private

Map to store the verilog locations for each op.

Definition at line 267 of file ExportVerilogInternals.h.

Referenced by addBeginLoc(), addEndLoc(), clear(), and updateIRWithLoc().

◆ metadataAttr

StringAttr circt::ExportVerilog::OpLocMap::metadataAttr
private

Definition at line 272 of file ExportVerilogInternals.h.

Referenced by updateIRWithLoc().

◆ verilogLineAttr

StringAttr circt::ExportVerilog::OpLocMap::verilogLineAttr
private

Cache to store string attributes.

Definition at line 272 of file ExportVerilogInternals.h.

Referenced by updateIRWithLoc().


The documentation for this class was generated from the following file: