|
Loom C API
Public Loom compiler C API
|
Prepared target environments and target lowering pipelines. More...
Go to the source code of this file.
Data Structures | |
| struct | loomc_context_target_options_t |
| Context option extension that registers a target environment. More... | |
| struct | loomc_target_specialization_t |
| One function version to specialize to one structured target profile. More... | |
| struct | loomc_target_specialization_options_t |
| Option extension carrying per-function target specializations. More... | |
| struct | loomc_target_pipeline_options_t |
| Target pipeline creation options. More... | |
Typedefs | |
| typedef struct loomc_target_environment_t | loomc_target_environment_t |
| Prepared immutable target environment. | |
| typedef struct loomc_target_profile_t | loomc_target_profile_t |
| Prepared immutable target profile. | |
Enumerations | |
| enum | loomc_target_fact_state_t { LOOMC_TARGET_FACT_STATE_UNKNOWN = 0 , LOOMC_TARGET_FACT_STATE_FALSE = 1 , LOOMC_TARGET_FACT_STATE_TRUE = 2 } |
| Three-valued target fact state. More... | |
| enum | loomc_target_pipeline_kind_t { LOOMC_TARGET_PIPELINE_KIND_PREPARED_LOW = 0 , LOOMC_TARGET_PIPELINE_KIND_SOURCE_LOW = 1 } |
| Target lowering pipeline boundary. More... | |
| enum | loomc_target_control_flow_lowering_t { LOOMC_TARGET_CONTROL_FLOW_LOWERING_CFG = 0 , LOOMC_TARGET_CONTROL_FLOW_LOWERING_STRUCTURED_LOW = 1 } |
| Control-flow shape selected for source-to-low lowering. More... | |
Functions | |
| loomc_status_t | loomc_pass_program_create_from_target_pipeline (loomc_context_t *context, const loomc_target_pipeline_options_t *options, loomc_allocator_t allocator, loomc_pass_program_t **out_pass_program, loomc_result_t **out_result) |
| Creates a prepared target lowering pass program. | |
| void | loomc_target_profile_retain (loomc_target_profile_t *profile) |
| Retains a target profile for another owner. | |
| void | loomc_target_profile_release (loomc_target_profile_t *profile) |
| Releases a target profile from one owner. | |
| void | loomc_target_environment_retain (loomc_target_environment_t *target_environment) |
| Retains a target environment for another owner. | |
| void | loomc_target_environment_release (loomc_target_environment_t *target_environment) |
| Releases a target environment from one owner. | |
Prepared target environments and target lowering pipelines.
A target environment is the reusable compiler capability package selected by the embedding binary. It describes target dialects, target-low descriptor registries, source-to-low policy tables, target math policies, pass registries, and target-aware pass predicates. It is not a device handle and does not require hardware to exist.
Target environments are prepared before contexts because target dialects must be registered while the context is still mutable. A context created with a target environment can parse and build IR for those target dialects. Prepared compilers and target pipelines created from that context reuse the same environment-derived tables.
A target profile is a reusable, immutable, target-family-typed set of facts for a concrete, partial, saved, or synthetic target. Compile invocations borrow profiles in per-function specialization rows. This lets a JIT share cached device profiles across worker threads while independently choosing the exact target of every function version in a multi-target module.
| typedef struct loomc_target_environment_t loomc_target_environment_t |
Prepared immutable target environment.
A target environment owns target provider composition selected by the linked binary. It should be created once per target provider set and reused across contexts, compilers, pass programs, and worker threads.
| typedef struct loomc_target_profile_t loomc_target_profile_t |
Prepared immutable target profile.
A target profile owns normalized target facts and any target-family payload needed by compiler passes or emitters. Profiles are separate from contexts and compilers so embedders can cache one profile per device, saved hardware profile, or cross-compilation bucket.
Three-valued target fact state.
Target profiles distinguish unavailable, available, and not-yet-known facts because partial targets are valid inputs. Unknown is not false: a later live probe, saved profile, or user override may refine it.
Target lowering pipeline boundary.
| loomc_status_t loomc_pass_program_create_from_target_pipeline | ( | loomc_context_t * | context, |
| const loomc_target_pipeline_options_t * | options, | ||
| loomc_allocator_t | allocator, | ||
| loomc_pass_program_t ** | out_pass_program, | ||
| loomc_result_t ** | out_result ) |
Creates a prepared target lowering pass program.
The context must have been created with a target environment using loomc_context_target_options_t. The returned pass program is an ordinary loomc_pass_program_t and is passed to loomc_compile_module like any other prepared pipeline.
| context | Context whose target environment selects the target package. |
| options | Target pipeline options, or NULL for defaults. |
| allocator | Host allocator used for pass-program and result storage. |
| out_pass_program | Receives one retained pass program when the result succeeds. Receives NULL when target pipeline preparation fails. |
| out_result | Receives a retained result containing pipeline preparation diagnostics and operation state. |
| void loomc_target_environment_release | ( | loomc_target_environment_t * | target_environment | ) |
Releases a target environment from one owner.
| target_environment | Target environment to release. Passing NULL is allowed. |
| void loomc_target_environment_retain | ( | loomc_target_environment_t * | target_environment | ) |
Retains a target environment for another owner.
| target_environment | Target environment to retain. |
| void loomc_target_profile_release | ( | loomc_target_profile_t * | profile | ) |
Releases a target profile from one owner.
| profile | Target profile to release. Passing NULL is allowed. |
| void loomc_target_profile_retain | ( | loomc_target_profile_t * | profile | ) |
Retains a target profile for another owner.
| profile | Target profile to retain. |