24 #ifndef TVM_RUNTIME_VM_BYTECODE_H_
25 #define TVM_RUNTIME_VM_BYTECODE_H_
28 #include <tvm/runtime/logging.h>
109 TVM_FFI_THROW(InternalError)
110 <<
"Internal error: "
111 <<
"Invalid ArgKind with integer value " <<
static_cast<int>(kind);
The auxiliary data structure for instruction argument.
Definition: bytecode.h:119
static Arg ConstIdx(Index index)
construct a ConstIdx arg.
Definition: bytecode.h:139
static Arg FuncIdx(Index index)
construct a FuncIdx arg.
Definition: bytecode.h:151
static Arg Immediate(int64_t imm_value)
construct a immediate arg.
Definition: bytecode.h:145
ArgKind kind() const
Get the kind of argument.
Definition: bytecode.h:156
ExecWord value() const
Get the value of argument.
Definition: bytecode.h:165
ExecWord data() const
Get the raw data repr of the arg.
Definition: bytecode.h:170
Arg()
Construct a void argument.
Definition: bytecode.h:122
static Arg Register(RegName reg)
construct a register Arg.
Definition: bytecode.h:133
static Arg FromData(ExecWord data)
construct Arg from data.
Definition: bytecode.h:127
ExecWord Index
An alias for the integer type used ubiquitously in the VM.
Definition: bytecode.h:48
int64_t ExecWord
The storage type for the bytecode in the VM.
Definition: bytecode.h:40
Opcode
An enumeration of Relax's opcodes.
Definition: bytecode.h:56
ExecWord RegName
A register name.
Definition: bytecode.h:43
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition: analyzer.h:37
A single virtual machine instruction.
Definition: bytecode.h:72
static constexpr RegName kVMRegister
Random magic number that represents the VM context.
Definition: bytecode.h:88
RegName cond
The register containing the cond value.
Definition: bytecode.h:207
static constexpr ExecWord kValueMask
The bit mask of the value part.
Definition: bytecode.h:78
static constexpr ExecWord kValueBit
The number of bit for storing value.
Definition: bytecode.h:76
RegName dst
The destination register.
Definition: bytecode.h:189
static constexpr RegName kVoidRegister
Random magic number that represents void argument, indicate null value.
Definition: bytecode.h:86
Index false_offset
The program counter offset for the false branch.
Definition: bytecode.h:209
static Instruction If(RegName cond, Index false_offset)
Construct an If instruction.
static constexpr ExecWord kValueMinLimit
Minimum possible value, remove 1 slot to keep things symmetric.
Definition: bytecode.h:82
Index num_args
The number of arguments to the packed function.
Definition: bytecode.h:193
Index func_idx
The index into the packed function table.
Definition: bytecode.h:191
static Instruction Call(Index func_idx, Index num_args, Arg *args, RegName dst)
Construct a Call instruction.
Index pc_offset
The jump offset.
Definition: bytecode.h:203
static constexpr RegName kBeginSpecialReg
Beginning of special register section.
Definition: bytecode.h:84
static constexpr ExecWord kKindBit
The number of bit for storing value.
Definition: bytecode.h:74
Opcode op
The instruction opcode.
Definition: bytecode.h:185
friend std::ostream & operator<<(std::ostream &os, const ArgKind &kind)
Definition: bytecode.h:94
ArgKind
The kind of instruction's argument.
Definition: bytecode.h:92
static Instruction Ret(RegName result)
Construct a return instruction.
RegName result
The return result.
Definition: bytecode.h:199
Arg * args
The arguments of the packed function.
Definition: bytecode.h:195
static constexpr ExecWord kValueMaxLimit
Maximum possible value, use 1 bit for sign.
Definition: bytecode.h:80
static Instruction Goto(RegName pc_offset)
Construct a goto instruction.