A language variant agnostic IRBuilder that constructs any IR of TVM. An idiomatic use of this class is to put this inside the RAII with-scope, call language variant specific methods accordingly. Upon exiting the scope.
More...
#include <base.h>
|
| | TVM_FFI_DECLARE_OBJECT_INFO_FINAL ("script.ir_builder.IRBuilder", IRBuilderObj, ffi::Object) |
| |
| template<typename TFrame > |
| ffi::Optional< TFrame > | FindFrame () const |
| | Find a frame of the given type in the stack this->frames from top to bottom.
|
| |
| template<typename TFrame > |
| ffi::Optional< TFrame > | GetLastFrame () const |
| | Get the top frame if its type is TFrame.
|
| |
| template<typename TObjectRef > |
| TObjectRef | Get () const |
| | Get the IR being constructed.
|
| |
| void | PushLoc (Location loc) |
| | Push a frontend source location for IR constructed in the nested scope.
|
| |
| void | PopLoc () |
| | Pop the innermost frontend source location.
|
| |
| Location | GetCurrentLoc (Location location=UnknownLoc()) const |
| | Return the normalized active source loc, including expansion history.
|
| |
| ffi::ObjectRef | SetCurrentLoc (ffi::ObjectRef obj) const |
| | Compose active source context onto a supported node or construction frame.
|
| |
| ffi::ObjectRef | SetLoc (ffi::ObjectRef obj, Location loc) const |
| | Attach an explicit location composed with the active source-call context.
|
| |
|
| ffi::Array< IRBuilderFrame > | frames |
| | A stack of context frames in the IRBuilder.
|
| |
| ffi::Optional< ffi::ObjectRef > | result |
| | The outcome of IR construction.
|
| |
| std::vector< Location > | locs |
| | Active frontend source locations, from outermost to innermost.
|
| |
A language variant agnostic IRBuilder that constructs any IR of TVM. An idiomatic use of this class is to put this inside the RAII with-scope, call language variant specific methods accordingly. Upon exiting the scope.
{
}
}
Managed reference class to IRModuleNode.
Definition module.h:255
RAII wrapper function to enter and exit a context object similar to python's with syntax.
Definition with_context.h:59
Managed reference to an IRBuilderObj.
Definition base.h:194
TVM_TIRX_DLL IRModuleFrame IRModule()
The IRModule declaration statement.
Definition module.h:248
◆ FindFrame()
template<typename TFrame >
| ffi::Optional< TFrame > tvm::script::ir_builder::IRBuilderObj::FindFrame |
( |
| ) |
const |
|
inline |
Find a frame of the given type in the stack this->frames from top to bottom.
- Template Parameters
-
| T | The type of the frame to find. |
- Returns
- The frame if found, otherwise std::nullopt.
◆ Get()
template<typename TObjectRef >
| TObjectRef tvm::script::ir_builder::IRBuilderObj::Get |
( |
| ) |
const |
|
inline |
Get the IR being constructed.
- Template Parameters
-
| TObjectRef | The type of the IR being constructed. |
- Returns
- The resulting IR. Throw an exception if the IR is not constructed yet.
◆ GetCurrentLoc()
Return the normalized active source loc, including expansion history.
◆ GetLastFrame()
template<typename TFrame >
| ffi::Optional< TFrame > tvm::script::ir_builder::IRBuilderObj::GetLastFrame |
( |
| ) |
const |
|
inline |
Get the top frame if its type is TFrame.
- Template Parameters
-
| TFrame | The assumed type of the last frame on stack. |
- Returns
- The frame if the stack is non-empty and the top of the stack is of type
TFrame. Otherwise std::nullopt.
◆ PopLoc()
| void tvm::script::ir_builder::IRBuilderObj::PopLoc |
( |
| ) |
|
Pop the innermost frontend source location.
◆ PushLoc()
| void tvm::script::ir_builder::IRBuilderObj::PushLoc |
( |
Location |
loc | ) |
|
Push a frontend source location for IR constructed in the nested scope.
◆ RegisterReflection()
| static void tvm::script::ir_builder::IRBuilderObj::RegisterReflection |
( |
| ) |
|
|
inlinestatic |
◆ SetCurrentLoc()
| ffi::ObjectRef tvm::script::ir_builder::IRBuilderObj::SetCurrentLoc |
( |
ffi::ObjectRef |
obj | ) |
const |
Compose active source context onto a supported node or construction frame.
◆ SetLoc()
| ffi::ObjectRef tvm::script::ir_builder::IRBuilderObj::SetLoc |
( |
ffi::ObjectRef |
obj, |
|
|
Location |
loc |
|
) |
| const |
Attach an explicit location composed with the active source-call context.
◆ TVM_FFI_DECLARE_OBJECT_INFO_FINAL()
| tvm::script::ir_builder::IRBuilderObj::TVM_FFI_DECLARE_OBJECT_INFO_FINAL |
( |
"script.ir_builder.IRBuilder" |
, |
|
|
IRBuilderObj |
, |
|
|
ffi::Object |
|
|
) |
| |
◆ _type_mutable
| constexpr const bool tvm::script::ir_builder::IRBuilderObj::_type_mutable = true |
|
staticconstexpr |
◆ frames
| ffi::Array<IRBuilderFrame> tvm::script::ir_builder::IRBuilderObj::frames |
◆ locs
| std::vector<Location> tvm::script::ir_builder::IRBuilderObj::locs |
Active frontend source locations, from outermost to innermost.
◆ result
| ffi::Optional<ffi::ObjectRef> tvm::script::ir_builder::IRBuilderObj::result |
The outcome of IR construction.
The documentation for this class was generated from the following file:
- include/tvm/script/ir_builder/base.h