23 #ifndef TVM_IR_SOURCE_MAP_H_ 24 #define TVM_IR_SOURCE_MAP_H_ 59 static constexpr
const char*
_type_key =
"SourceName";
102 v->Visit(
"source_name", &source_name);
103 v->Visit(
"line", &line);
104 v->Visit(
"column", &column);
105 v->Visit(
"end_line", &end_line);
106 v->Visit(
"end_column", &end_column);
122 TVM_DLL
Span(
SourceName source_name,
int line,
int end_line,
int column,
int end_column);
125 TVM_DLL Span
Merge(
const Span& other)
const;
150 v->Visit(
"source_name", &source_name);
151 v->Visit(
"source", &source);
193 explicit SourceMap(std::initializer_list<std::pair<SourceName, Source>> source_map)
198 void Add(
const Source& source);
201 ICHECK(
get() !=
nullptr);
210 #endif // TVM_IR_SOURCE_MAP_H_ tvm::Span Span
Definition: base.h:65
Stores locations in frontend source that generated a node.
Definition: source_map.h:173
Definitions and helper macros for IR/AST nodes.
bool SEqualReduce(const SpanNode *other, SEqualReducer equal) const
Definition: source_map.h:110
The name of a source fragment.
Definition: source_map.h:46
A Reducer class to reduce the structural equality result of two objects.
Definition: structural_equal.h:124
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
static constexpr bool _type_has_method_sequal_reduce
Definition: source_map.h:53
PrimExpr equal(PrimExpr a, PrimExpr b, Span span=Span())
equal
tvm::SourceName SourceName
Definition: base.h:64
Definition: source_map.h:158
SourceName source_name
The source name.
Definition: source_map.h:90
TVM_DECLARE_FINAL_OBJECT_INFO(SourceNameNode, Object)
SourceMap(std::initializer_list< std::pair< SourceName, Source >> source_map)
Definition: source_map.h:193
base class of all object containers.
Definition: object.h:167
String source
The raw source.
Definition: source_map.h:143
int column
The column offset.
Definition: source_map.h:94
int line
The line number.
Definition: source_map.h:92
Definition: source_map.h:189
void VisitAttrs(AttrVisitor *v)
Definition: source_map.h:149
Visitor class to get the attributes of an AST/IR node. The content is going to be called for each fie...
Definition: reflection.h:52
Definition: source_map.h:137
Definition: source_map.h:120
String name
The source name.
Definition: source_map.h:49
The source name of a file span.
Definition: source_map.h:67
void VisitAttrs(AttrVisitor *v)
Definition: source_map.h:101
int end_column
The end column number.
Definition: source_map.h:98
static constexpr const char * _type_key
Definition: source_map.h:59
Reference to string objects.
Definition: string.h:98
#define TVM_DEFINE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName)
Definition: object.h:713
bool SEqualReduce(const SourceNameNode *other, SEqualReducer equal) const
Definition: source_map.h:55
int end_line
The end line number.
Definition: source_map.h:96
SourceMap()
Definition: source_map.h:196
bool SEqualReduce(const SourceMapNode *other, SEqualReducer equal) const
Definition: source_map.h:181
Base class of all object reference.
Definition: object.h:511
Stores locations in frontend source that generated a node.
Definition: source_map.h:87
A managed object in the TVM runtime.
Map< K, V > Merge(Map< K, V > lhs, const Map< K, V > &rhs)
Merge two Maps.
Definition: map.h:1471
void VisitAttrs(AttrVisitor *v)
Definition: source_map.h:51
Map container of NodeRef->NodeRef in DSL graph. Map implements copy on write semantics, which means map is mutable but copy will happen when array is referenced in more than two places.
Definition: map.h:1271
SourceName source_name
The source name.
Definition: source_map.h:140
void VisitAttrs(AttrVisitor *v)
Definition: source_map.h:179
std::vector< std::pair< int, int > > line_map
A mapping of line breaks into the raw source.
Definition: source_map.h:146
#define TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName)
Definition: object.h:728
SourceMapNode * operator->()
Definition: source_map.h:200
Type-erased function used across TVM API.
This file defines the TVM global function registry.
Map< SourceName, Source > source_map
The source mapping.
Definition: source_map.h:176