23#ifndef TVM_IR_LOCATION_H_
24#define TVM_IR_LOCATION_H_
26#include <tvm/ffi/container/array.h>
27#include <tvm/ffi/function.h>
28#include <tvm/ffi/reflection/registry.h>
52 namespace refl = tvm::ffi::reflection;
74 explicit SourceName(ffi::UnsafeInit tag, ffi::ObjectPtr<SourceNameNode> n) : ffi::ObjectRef(tag) {
129 namespace refl = tvm::ffi::reflection;
130 refl::ObjectDef<SourceLocNode>()
160 namespace refl = tvm::ffi::reflection;
161 refl::ObjectDef<CallSiteLocNode>()
198 namespace refl = tvm::ffi::reflection;
199 refl::ObjectDef<SourceObj>()
227 namespace refl = tvm::ffi::reflection;
237 explicit SourceMap(ffi::Map<SourceName, Source> source_map);
239 explicit SourceMap(std::initializer_list<std::pair<SourceName, Source>> source_map)
247 TVM_FFI_ICHECK(get() !=
nullptr);
The location of a callee together with its caller's provenance.
Definition location.h:154
Location callee
Definition location.h:156
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.CallSiteLoc", CallSiteLocNode, LocationNode)
static void RegisterReflection()
Definition location.h:159
Location caller
Definition location.h:157
Explicit inline callee/caller provenance.
Definition location.h:170
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(CallSiteLoc, Location, CallSiteLocNode)
TVM_TIRX_DLL CallSiteLoc(Location callee, Location caller)
Base class for immutable source-location metadata.
Definition location.h:82
TVM_FFI_DECLARE_OBJECT_INFO("ir.Location", LocationNode, ffi::Object)
static void RegisterReflection()
Definition location.h:84
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition location.h:86
Non-nullable source-location metadata.
Definition location.h:91
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(Location, ffi::ObjectRef, LocationNode)
A range in one source, retaining frontend coordinate conventions.
Definition location.h:113
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.SourceLoc", SourceLocNode, LocationNode)
SourceLocNode(SourceName source_name)
Definition location.h:115
int start_line
The starting line number.
Definition location.h:120
int start_column
The starting column offset.
Definition location.h:122
static void RegisterReflection()
Definition location.h:128
SourceName source_name
The source name.
Definition location.h:118
SourceLocNode(ffi::UnsafeInit tag)
Definition location.h:116
int end_column
The ending column offset.
Definition location.h:126
int end_line
The ending line number.
Definition location.h:124
A concrete source range.
Definition location.h:142
TVM_TIRX_DLL SourceLoc Merge(const SourceLoc &other) const
Merge two ranges in the same source.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(SourceLoc, Location, SourceLocNode)
TVM_TIRX_DLL SourceLoc(SourceName source_name, int start_line, int start_column, int end_line, int end_column)
Stores locations in frontend source that generated a node.
Definition location.h:221
ffi::Map< SourceName, Source > source_map
The source mapping.
Definition location.h:224
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition location.h:231
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.SourceMap", SourceMapObj, ffi::Object)
static void RegisterReflection()
Definition location.h:226
Definition location.h:235
SourceMap(ffi::Map< SourceName, Source > source_map)
void Add(const Source &source)
SourceMapObj * operator->()
Definition location.h:246
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(SourceMap, ffi::ObjectRef, SourceMapObj)
SourceMap()
Definition location.h:242
SourceMap(std::initializer_list< std::pair< SourceName, Source > > source_map)
Definition location.h:239
The name of a source fragment.
Definition location.h:46
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition location.h:56
static void RegisterReflection()
Definition location.h:51
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.SourceName", SourceNameNode, ffi::Object)
ffi::String name
The source name.
Definition location.h:49
The source name of a file loc.
Definition location.h:64
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(SourceName, ffi::ObjectRef, SourceNameNode)
SourceName(ffi::UnsafeInit tag, ffi::ObjectPtr< SourceNameNode > n)
Definition location.h:74
static TVM_TIRX_DLL 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...
Definition location.h:184
static void RegisterReflection()
Definition location.h:197
SourceObj(SourceName source_name)
Definition location.h:186
SourceObj(ffi::UnsafeInit tag)
Definition location.h:187
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.Source", SourceObj, ffi::Object)
SourceName source_name
The source name.
Definition location.h:189
ffi::String source
The raw source.
Definition location.h:192
std::vector< std::pair< int, int > > line_map
A mapping of line breaks into the raw source.
Definition location.h:195
Definition location.h:206
TVM_TIRX_DLL tvm::ffi::String GetLine(int line)
TVM_TIRX_DLL Source(SourceName src_name, std::string source)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(Source, ffi::ObjectRef, SourceObj)
No source-location information is available.
Definition location.h:97
static void RegisterReflection()
Definition location.h:99
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("ir.UnknownLoc", UnknownLocNode, LocationNode)
Reference to the shared immutable unknown location.
Definition location.h:105
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(UnknownLoc, Location, UnknownLocNode)
TVM_TIRX_DLL UnknownLoc()
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition attr.h:23
#define TVM_TIRX_DLL
Definition base.h:83