LoweredValue

scalus.sir.lowering.LoweredValue
See theLoweredValue companion object
trait LoweredValue

SEA of nodes - like representation. E.e. each value is node, which manage dependencies. LoweredValue:

  • represents a value in lowered SIR, which is
  • a generator of a block of code with generate specific SIRType in specific representation. -- (representation is LoweredValueRepresentation, which can be term or data in specoific encoding)
  • some lowered values can be named (see IdentifiableLoweredValue and maintain a set of dependencies) The idea of SEA of nodes -- than we can generate code 'by need' based on dependencies. I.e. if value not used at all - code will not be generated, if value used once -- no intermediate construction will be created and code will be generated directly in place of usage. If value used multiple times -- it will be generated near the usage (i.e. in the nearest block, which contains all depended).

The idea of SEA of nodes described in the paper: Cliff Click. 1995. Global code motion/global value numbering. SIGPLAN Not. 30, 6 (June 1995), 246–257. "https://doi.org/10.1145/223428.207154"

We have a quite different code (non-SSA form, only dominators), but the main idea of relaxing order is the same,

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

add identifiable variable to be updated from this variable

add identifiable variable to be updated from this variable

Attributes

def docDef(ctx: PrettyPrintingContext): Doc

Pretty print this value with all definitona

Pretty print this value with all definitona

Value parameters

style
  • style of printing

Attributes

def docRef(ctx: PrettyPrintingContext): Doc

Pretty print reference to value

Pretty print reference to value

Value parameters

style
  • style of printing

Attributes

Uplevel variables, that shoule be generated before generation of term

Uplevel variables, that shoule be generated before generation of term

Attributes

def findSelfOrSubtems(p: LoweredValue => Boolean): Option[LoweredValue]

The type of representation of this value.

The type of representation of this value.

Attributes

Generates the term for this value.

Generates the term for this value.

Attributes

Uplevel variables, that are used in this value.

Uplevel variables, that are used in this value.

Attributes

Concrete methods

def maybeUpcast(targetType: SIRType, pos: SIRPosition)(using lctx: LoweringContext): LoweredValue

Upcast the value to the target type if needed.

Upcast the value to the target type if needed.

Attributes

def pretty: Doc
def show: String

The UPLC term that represents this value, wrapped in vars if needed.

The UPLC term that represents this value, wrapped in vars if needed.

Value parameters

gctx
  • context for term generation

Attributes

Returns

generated term wrapped in lambdas with definition of needed uplevel variables

Convert this value to the giveb representation,

Convert this value to the giveb representation,

Attributes

def upcastOne(targetType: SIRType, pos: SIRPosition)(using LoweringContext): LoweredValue

Concrete fields

val createdEx: RuntimeException
var debugMark: String