Skip to content

Compiler IR

tazz edited this page Jun 4, 2026 · 5 revisions

Kura's compiler employs a multi-purpose unified IR for logic, layout, rendering and other tasks.

Core Instructions

The core set of Kura's SSA-friendly IR instructions handle the data-flow and control-flow for Kura views.

The following table represents the current instructions supported by the Kura compiler:

Name Purpose
GraphEntryInstr TBD.
TargetEntryInstr TBD.
JoinEntryInstr TBD.
ConstantInstr TBD.
UnaryOpInstr TBD.
BinaryOpInstr TBD.
NewListInstr TBD.
NewRecordInstr TBD.
NewNodeInstr TBD.
SpreadInstr TBD.
StoreIndexInstr TBD.
LoadIndexInstr TBD.
StorePropertyInstr TBD.
LoadPropertyInstr TBD.
LoadPropertySafelyInstr TBD.
LoadFunctionInstr TBD.
ParameterInstr TBD.
CallInstr TBD.
PipeCallInstr TBD.
ReturnInstr TBD.
GotoInstr TBD.
BranchInstr TBD.
PhiInstr TBD.
StoreLocalInstr TBD.
LoadLocalInstr TBD.
AllocInstr TBD.

Render Instructions

During compilation the compiler will identify all components to render for a specific View. The compiler will start with the high-level representation (HIR), then lower and optimize the HIR into backend specific instructions as needed.

For example:

graph LR
  subgraph HIR
    direction TD
    RENDER_BUTTON[RenderButtonInstr]
  end

  subgraph HIR_LOWERED1[HIR]
    direction TD
    RENDER_QUAD[RenderQuadInstr]
    RENDER_TEXT0[RenderTextInstr]
    RENDER_QUAD --> RENDER_TEXT0
  end
  HIR -.-> HIR_LOWERED1

  subgraph HIR_LOWERED2[HIR]
    subgraph RENDER_QUAD_FRAG["RenderQuadInstr"]
      direction TD
      PUSH_VERTICES[PushVerticesInstr]
      PUSH_INDICES[PushIndicesInstr]
      PUSH_VERTICES --> PUSH_INDICES
    end

    RENDER_TEXT1[RenderTextInstr]
    RENDER_QUAD_FRAG --> RENDER_TEXT1
  end
  HIR_LOWERED1 -.-> HIR_LOWERED2
Loading

Not a guarantee:
The compiler will optimize and lower the instructions per-graphics backend. different backends have different patterns & conventions - which may produce different IR sequences.

OpenGL Specific

Vulkan Specific

TBD

DirectX Specific

TBD

Clone this wiki locally