Loom C API
Public Loom compiler C API
Loading...
Searching...
No Matches
emit.h File Reference

LLVMIR emission option space. More...

Go to the source code of this file.

Detailed Description

LLVMIR emission option space.

Link the LLVMIR target binding package to make the generic loomc_emit_module operation capable of producing LOOMC_ARTIFACT_FORMAT_LLVMIR_TEXT and LOOMC_ARTIFACT_FORMAT_LLVMIR_BITCODE artifacts.

Example
Emit a prepared LLVMIR target-low module as textual LLVM IR:
loomc_emit_options_t emit_options = {
.structure_size = sizeof(loomc_emit_options_t),
.artifact_format =
loomc_make_cstring_view(LOOMC_ARTIFACT_FORMAT_LLVMIR_TEXT),
.identifier = loomc_make_cstring_view("kernel.ll"),
};
loomc_result_t* emit_result = NULL;
target_environment, workspace, module, &emit_options,
loomc_allocator_system(), &emit_result);
if (!loomc_status_is_ok(status)) return status;
if (!loomc_result_succeeded(emit_result)) {
// Inspect typed diagnostics from emit_result.
}
loomc_result_release(emit_result);
loomc_allocator_t loomc_allocator_system(void)
Returns a process-global system allocator.
@ LOOMC_STRUCTURE_TYPE_EMIT_OPTIONS
loomc_emit_options_t.
Definition base.h:234
struct iree_status_handle_t * loomc_status_t
Opaque status handle.
Definition base.h:55
loomc_status_t loomc_emit_module(loomc_target_environment_t *target_environment, loomc_workspace_t *workspace, loomc_module_t *module, const loomc_emit_options_t *options, loomc_allocator_t allocator, loomc_result_t **out_result)
Emits target artifacts from a prepared module.
void loomc_result_release(loomc_result_t *result)
Releases result from one owner.
bool loomc_result_succeeded(const loomc_result_t *result)
Returns true when result succeeded.
struct loomc_result_t loomc_result_t
Immutable operation result.
Definition result.h:63
Target emission options.
Definition emit.h:118
#define LOOMC_ARTIFACT_FORMAT_LLVMIR_TEXT
Textual LLVM IR artifact format.
Definition target/llvmir/base.h:25