CIRCT
20.0.0git
|
#include "circt/Analysis/DebugInfo.h"
#include "circt/Dialect/Comb/CombOps.h"
#include "circt/Dialect/Debug/DebugOps.h"
#include "circt/Dialect/HW/HWOps.h"
#include "circt/Dialect/HW/HWSymCache.h"
#include "circt/Dialect/SV/SVOps.h"
#include "circt/Support/Namespace.h"
#include "circt/Target/DebugInfo.h"
#include "mlir/IR/Threading.h"
#include "mlir/Support/FileUtilities.h"
#include "mlir/Support/IndentedOstream.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/JSON.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/ToolOutputFile.h"
Go to the source code of this file.
Classes | |
struct | llvm::DenseMapInfo< JValue > |
Namespaces | |
llvm | |
Macros | |
#define | DEBUG_TYPE "di" |
Typedefs | |
using | JValue = llvm::json::Value |
using | JArray = llvm::json::Array |
using | JObject = llvm::json::Object |
using | JOStream = llvm::json::OStream |
Functions | |
static void | findLocations (Location loc, unsigned level, SmallVectorImpl< FileLineColLoc > &locs) |
Walk the given loc and collect file-line-column locations that we want to report as source ("HGL") locations or as emitted Verilog ("HDL") locations. More... | |
static FileLineColLoc | findBestLocation (Location loc, bool emitted, bool fileMustExist) |
Find the best location to report as source location ("HGL", emitted = false) or as emitted location ("HDL", emitted = true). More... | |
static bool | makePathRelative (StringRef path, StringRef relativeTo, SmallVectorImpl< char > &relativePath) |
Make the given path relative to the relativeTo path and store the result in relativePath . More... | |
static StringRef | legalizeName (StringRef name, llvm::StringMap< size_t > &nextGeneratedNameIDs) |
Legalize the given name such that it only consists of valid identifier characters in Verilog and does not collide with any Verilog keyword, and uniquify the resulting name such that it does not collide with any of the names stored in the nextGeneratedNameIDs map. More... | |
StringAttr | getVerilogModuleName (DIModule &module) |
StringAttr | getVerilogInstanceName (DIInstance &inst) |
#define DEBUG_TYPE "di" |
Definition at line 26 of file EmitHGLDD.cpp.
using JArray = llvm::json::Array |
Definition at line 36 of file EmitHGLDD.cpp.
using JObject = llvm::json::Object |
Definition at line 37 of file EmitHGLDD.cpp.
using JOStream = llvm::json::OStream |
Definition at line 38 of file EmitHGLDD.cpp.
using JValue = llvm::json::Value |
Definition at line 35 of file EmitHGLDD.cpp.
|
static |
Find the best location to report as source location ("HGL", emitted = false) or as emitted location ("HDL", emitted = true).
Returns any non-FIR file it finds, and only falls back to FIR files if nothing else is found.
Definition at line 81 of file EmitHGLDD.cpp.
References findLocations().
|
static |
Walk the given loc
and collect file-line-column locations that we want to report as source ("HGL") locations or as emitted Verilog ("HDL") locations.
This function treats locations inside a NameLoc
called "emitted" or a FusedLoc
with the metadata attribute string "verilogLocations" as emitted Verilog locations. All other locations are considered to be source locations.
The level
parameter is used to track into how many "emitted" or "verilogLocations" we have already descended. For every one of those we look through the level gets decreased by one. File-line-column locations are only collected at level 0. We don't descend into "emitted" or "verilogLocations" once we've reached level 0. This effectively makes the level
parameter decide behind how many layers of "emitted" or "verilogLocations" we want to collect file-line-column locations. Setting this to 0 effectively collects source locations, i.e., everything not marked as emitted. Setting this to 1 effectively collects emitted locations, i.e., nothing that isn't behind exactly one layer of "emitted" or "verilogLocations".
Definition at line 58 of file EmitHGLDD.cpp.
Referenced by findBestLocation().
StringAttr getVerilogInstanceName | ( | DIInstance & | inst | ) |
Definition at line 562 of file EmitHGLDD.cpp.
References circt::DIInstance::name, and circt::DIInstance::op.
StringAttr getVerilogModuleName | ( | DIModule & | module | ) |
Definition at line 555 of file EmitHGLDD.cpp.
References circt::DIModule::name, and circt::DIModule::op.
Referenced by circt::ExportVerilog::SharedEmitterState::gatherFiles(), and circt::ExportVerilog::getSymOpName().
|
static |
Legalize the given name
such that it only consists of valid identifier characters in Verilog and does not collide with any Verilog keyword, and uniquify the resulting name such that it does not collide with any of the names stored in the nextGeneratedNameIDs
map.
The HGLDD output is likely to be ingested by tools that have been developed to debug Verilog code. These have the limitation of only supporting valid Verilog identifiers for signals and other names. HGLDD therefore requires these names to be valid Verilog identifiers.
Definition at line 172 of file EmitHGLDD.cpp.
|
static |
Make the given path
relative to the relativeTo
path and store the result in relativePath
.
Returns whether the conversion was successful. Fails if the relativeTo
path has a longer prefix of ../
than path
, or if it contains any non-prefix ../
components. Does not clear relativePath
before appending to it.
Definition at line 123 of file EmitHGLDD.cpp.
References append().