Skip to content

Naming & inlining

Naming

  • NameGenerator ensures unique, readable identifiers
  • Reserved words and CUDA builtins are avoided; leading underscores are escaped
  • Custom names from the user are respected (with suffixing if duplicated)

Inlining

  • Each single-result expression starts as INLINE_UNCLAIMED if PURE/READ
  • Uses are tracked; second claim switches to NO_INLINE
  • Epoch tracking (control/memory) invalidates inlining if an operand crosses epochs
  • Short-circuit ops and calls/asm/raw exprs / statements disable inlining for involved operands

Results

  • Inline simple arithmetic and casts
  • Hoist pointer writes, allocations, calls, loops, and control expressions into statements/declarations
  • Produce readable code without too many temporary variables