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 specific 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,
Also reconciles the value's representation with any uplcRepr annotation on the target type. Even if structural unification succeeds (annotations are stripped by SIRUnify), the target may declare a representation hint that this value's actual representation doesn't satisfy — in that case, convert via toRepresentation so the returned value's type and repr stay consistent for downstream consumers.
Routes through SumDispatch.toRepresentation, which inspects the source value's actual typegen and dispatches accordingly (Sum-side typegens go through the centralized toRepresentationImpl helpers; non-Sum typegens fall back to their direct toRepresentation). We can't split by SIRType.isSum/isProd here because sum-shaped constructors have CaseClass SIR types (e.g. List.Cons is a CaseClass whose typegen is SumBuiltinList).
Simple name of the user function that was being lowered when this value was created, or "" when it was created outside any named binding. Captured from LoweringContext.currentFunction at construction time, because term generation runs as a separate pass after lowering has finished and no longer knows where a value came from.
Simple name of the user function that was being lowered when this value was created, or "" when it was created outside any named binding. Captured from LoweringContext.currentFunction at construction time, because term generation runs as a separate pass after lowering has finished and no longer knows where a value came from.
Pure metadata: it is copied into the scalus.uplc.UplcAnnotation of every term this value emits (see ann) so tooling can group the compiled UPLC by source function. It never influences the generated code.