Resolves intrinsic implementations for method calls based on argument representation and protocol version.
When the lowering encounters a method call like list.isEmpty, the resolver checks if there is an optimized intrinsic implementation for the argument's runtime representation (e.g., SumDataList). If found, it substitutes the provider's body (with the actual argument SIR) and re-lowers it. The already-lowered argument is cached in lctx.precomputedValues so that re-lowering the substituted SIR finds it without recomputation.
The registry is hardcoded — adding new intrinsic providers requires editing the registry and creating the @Compile provider object.
Try to resolve an intrinsic for the given application.
Try to resolve an intrinsic for the given application.
Called after lowering the argument. Uses the already-lowered arg's representation to decide whether an intrinsic applies. If found, caches the lowered arg, substitutes at the SIR level, re-lowers, and removes the cache entry.
Value parameters
appType
the SIR type of the application result
argSir
the original SIR argument node (used for substitution and as cache key)
f
the function being applied (Var or ExternalVar with qualified name)
loweredArg
the already-lowered argument (cached to avoid recomputation)
pos
source position
Attributes
Returns
Some(LoweredValue) if an intrinsic was applied, None otherwise
Default intrinsic modules, loaded at compile time by the plugin. The plugin intercepts compiledModules(...) and replaces it with SIRLinker.readModules(...) that accesses the objects' sirModule vals.
Default intrinsic modules, loaded at compile time by the plugin. The plugin intercepts compiledModules(...) and replaces it with SIRLinker.readModules(...) that accesses the objects' sirModule vals.
Support modules — their bindings are added to scope for normal function calls from intrinsic provider bodies. Unlike intrinsic modules, these are NOT used for provider substitution.
Support modules — their bindings are added to scope for normal function calls from intrinsic provider bodies. Unlike intrinsic modules, these are NOT used for provider substitution.