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>
99 refl::ObjectDef<SpanNode>()
111 class Span :
public ObjectRef {
113 TVM_DLL
Span(
SourceName source_name,
int line,
int end_line,
int column,
int end_column);
169 refl::ObjectDef<SourceNode>()
207 explicit SourceMap(ffi::Map<SourceName, Source> source_map);
209 explicit SourceMap(std::initializer_list<std::pair<SourceName, Source>> source_map)
217 ICHECK(get() !=
nullptr);
Store a list of spans for an expr generated from mulitple source exprs.
Definition: source_map.h:124
ffi::Array< Span > spans
The original source list of spans to construct a sequential span.
Definition: source_map.h:127
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.SequentialSpan", SequentialSpanNode, SpanNode)
static void RegisterReflection()
Definition: source_map.h:129
Reference class of SequentialSpanNode.
Definition: source_map.h:140
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(SequentialSpan, Span, SequentialSpanNode)
SequentialSpan(ffi::Array< Span > spans)
SequentialSpan(std::initializer_list< Span > init)
Stores locations in frontend source that generated a node.
Definition: source_map.h:191
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.SourceMap", SourceMapObj, Object)
ffi::Map< SourceName, Source > source_map
The source mapping.
Definition: source_map.h:194
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: source_map.h:201
static void RegisterReflection()
Definition: source_map.h:196
Definition: source_map.h:205
SourceMap(ffi::Map< SourceName, Source > source_map)
void Add(const Source &source)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(SourceMap, ObjectRef, SourceMapObj)
SourceMap()
Definition: source_map.h:212
SourceMapObj * operator->()
Definition: source_map.h:216
SourceMap(std::initializer_list< std::pair< SourceName, Source >> source_map)
Definition: source_map.h:209
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
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.SourceName", SourceNameNode, Object)
ffi::String name
The source name.
Definition: source_map.h:49
The source name of a file span.
Definition: source_map.h:64
static SourceName Get(const ffi::String &name)
Get an SourceName for a given operator name. Will raise an error if the source name has not been regi...
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(SourceName, ObjectRef, SourceNameNode)
Definition: source_map.h:156
ffi::String source
The raw source.
Definition: source_map.h:162
std::vector< std::pair< int, int > > line_map
A mapping of line breaks into the raw source.
Definition: source_map.h:165
static void RegisterReflection()
Definition: source_map.h:167
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.Source", SourceNode, Object)
SourceName source_name
The source name.
Definition: source_map.h:159
Definition: source_map.h:176
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(Source, ObjectRef, SourceNode)
tvm::ffi::String GetLine(int line)
Source(SourceName src_name, std::string source)
Stores locations in frontend source that generated a node.
Definition: source_map.h:84
int column
The column offset.
Definition: source_map.h:91
int line
The line number.
Definition: source_map.h:89
int end_line
The end line number.
Definition: source_map.h:93
static void RegisterReflection()
Definition: source_map.h:97
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: source_map.h:107
TVM_FFI_DECLARE_OBJECT_INFO("ir.Span", SpanNode, Object)
SourceName source_name
The source name.
Definition: source_map.h:87
int end_column
The end column number.
Definition: source_map.h:95
Definition: source_map.h:111
Span(SourceName source_name, int line, int end_line, int column, int end_column)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(Span, ObjectRef, SpanNode)
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.