23 #ifndef TVM_IR_SOURCE_MAP_H_
24 #define TVM_IR_SOURCE_MAP_H_
26 #include <tvm/ffi/function.h>
27 #include <tvm/ffi/reflection/registry.h>
57 static constexpr
const char*
_type_key =
"ir.SourceName";
100 refl::ObjectDef<SpanNode>()
113 class Span :
public ObjectRef {
115 TVM_DLL
Span(
SourceName source_name,
int line,
int end_line,
int column,
int end_column);
136 static constexpr
const char*
_type_key =
"ir.SequentialSpan";
173 refl::ObjectDef<SourceNode>()
208 static constexpr
const char*
_type_key =
"ir.SourceMap";
216 explicit SourceMap(std::initializer_list<std::pair<SourceName, Source>> source_map)
224 ICHECK(get() !=
nullptr);
Store a list of spans for an expr generated from mulitple source exprs.
Definition: source_map.h:126
Array< Span > spans
The original source list of spans to construct a sequential span.
Definition: source_map.h:129
static constexpr const char * _type_key
Definition: source_map.h:136
static void RegisterReflection()
Definition: source_map.h:131
TVM_DECLARE_FINAL_OBJECT_INFO(SequentialSpanNode, SpanNode)
Reference class of SequentialSpanNode.
Definition: source_map.h:144
SequentialSpan(Array< Span > spans)
TVM_DEFINE_OBJECT_REF_METHODS(SequentialSpan, Span, SequentialSpanNode)
SequentialSpan(std::initializer_list< Span > init)
Stores locations in frontend source that generated a node.
Definition: source_map.h:197
TVM_DECLARE_FINAL_OBJECT_INFO(SourceMapObj, Object)
static constexpr const char * _type_key
Definition: source_map.h:208
Map< SourceName, Source > source_map
The source mapping.
Definition: source_map.h:200
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: source_map.h:207
static void RegisterReflection()
Definition: source_map.h:202
Definition: source_map.h:212
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(SourceMap, ObjectRef, SourceMapObj)
void Add(const Source &source)
SourceMap()
Definition: source_map.h:219
SourceMapObj * operator->()
Definition: source_map.h:223
SourceMap(Map< SourceName, Source > source_map)
SourceMap(std::initializer_list< std::pair< SourceName, Source >> source_map)
Definition: source_map.h:216
The name of a source fragment.
Definition: source_map.h:46
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: source_map.h:56
static void RegisterReflection()
Definition: source_map.h:51
static constexpr const char * _type_key
Definition: source_map.h:57
TVM_DECLARE_FINAL_OBJECT_INFO(SourceNameNode, Object)
String name
The source name.
Definition: source_map.h:49
The source name of a file span.
Definition: source_map.h:65
static SourceName Get(const String &name)
Get an SourceName for a given operator name. Will raise an error if the source name has not been regi...
TVM_DEFINE_OBJECT_REF_METHODS(SourceName, ObjectRef, SourceNameNode)
Definition: source_map.h:160
std::vector< std::pair< int, int > > line_map
A mapping of line breaks into the raw source.
Definition: source_map.h:169
TVM_DECLARE_FINAL_OBJECT_INFO(SourceNode, Object)
String source
The raw source.
Definition: source_map.h:166
static constexpr const char * _type_key
Definition: source_map.h:178
static void RegisterReflection()
Definition: source_map.h:171
SourceName source_name
The source name.
Definition: source_map.h:163
Definition: source_map.h:182
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(Source, ObjectRef, SourceNode)
Source(SourceName src_name, std::string source)
tvm::String GetLine(int line)
Stores locations in frontend source that generated a node.
Definition: source_map.h:85
TVM_DECLARE_BASE_OBJECT_INFO(SpanNode, Object)
static constexpr const char * _type_key
Definition: source_map.h:109
int column
The column offset.
Definition: source_map.h:92
int line
The line number.
Definition: source_map.h:90
int end_line
The end line number.
Definition: source_map.h:94
static void RegisterReflection()
Definition: source_map.h:98
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: source_map.h:108
SourceName source_name
The source name.
Definition: source_map.h:88
int end_column
The end column number.
Definition: source_map.h:96
Definition: source_map.h:113
TVM_DEFINE_OBJECT_REF_METHODS(Span, ObjectRef, SpanNode)
Span(SourceName source_name, int line, int end_line, int column, int end_column)
Span Merge(const Span &other) const
Merge two spans into one which captures the combined regions.
Definition: repr_printer.h:91
Performance counters for profiling via the PAPI library.
Definition: analyzer.h:37
Definitions and helper macros for IR/AST nodes.
A managed object in the TVM runtime.