Skip to content

MoonLiveIr

Source: MoonLiveIr.h

DeclaredControl

struct DeclaredControl
src/core/moonlive/MoonLiveIr.h:192

A member's element type.

The WIDTH is derived from it rather than stored beside it, so the two can never disagree: a record carrying both would let a Uint16 claim one byte.

Public Attributes

const char * name = nullptr

int32_t min = 0

int32_t max = 255

int32_t def = 0

uint8_t nameLen = 0

CtrlType type = CtrlType::Int

uint8_t offset = 0

uint8_t count = 1

IrInst

struct IrInst
src/core/moonlive/MoonLiveIr.h:173

Public Attributes

IrOp op

VReg dst = 0

VReg a = 0

VReg b = 0

VReg c = 0

VReg d = 0

int32_t imm = 0

HostCallFn callFn = nullptr

const void * ptr = nullptr

InlineOp inlineOp {}

IrProgram

struct IrProgram
src/core/moonlive/MoonLiveIr.h:312

Public Attributes

IrInst * ops = nullptr

uint16_t cap = 0

uint16_t count = 0

VReg vregsUsed = kFirstTemp

uint8_t localSlots = 0 : Frame slots the FRONT END allocated for script variables.

uint16_t fnIrStart = {} : Where each named function's code STARTS, filled in as the lowering walks the ops.

uint16_t fnOffset = {}

uint8_t fnCount = 0

Public Methods

IrProgram() = default : Defaulted constructor.

IrProgram(const IrProgram &) = delete : Deleted constructor.

inline bool reserve(uint16_t n) : Size the op array to n entries.

inline bool push(const IrInst & i)

inline void swap(IrProgram & o) : Exchange contents with o.

inline bool hasInline(InlineOp which) const : Which inline ops this program contains, so a backend reserves scratch only for what is there.

inline bool hasScriptCall() const : Does any function call another function of this script? The recursion depth guard is emitted only when one does, so a script that just defines tick() (every shipped script today) carries none of it.