CompiledFunctionInfo | Modular

Mojo struct

@register_passable(trivial) struct CompiledFunctionInfo[func_type: __TypeOfAllTypes, func: func_type, target: __mlir_type.`!kgen.target`]

Contains compilation information and results for a function.

Stores assembly/IR code, function metadata, and error information from compiling a function.

Attributes: populate: Function to populate captures

Parameters

  • func_type (__TypeOfAllTypes): Type of the function being compiled.
  • func (func_type): The function being compiled.
  • target (__mlir_type.`!kgen.target`): The target architecture to compile for.

Fields

  • asm (StaticString): Generated assembly/IR code from the compilation process.
  • function_name (StaticString): Mangled name of the compiled function, used for symbol resolution.
  • module_name (StaticString): Name of the module containing the compiled function.
  • num_captures (Int): Number of variables captured by the function closure.
  • capture_sizes (UnsafePointer[UInt64, ImmutExternalOrigin]): Pointer to the sizes of the variables captured by the function closure.
  • emission_kind (StaticString): The emission kind the object was emitted to.

Implemented traits

AnyType, Copyable, ImplicitlyCopyable, ImplicitlyDestructible, Movable, RegisterPassable, TrivialRegisterPassable, Writable

comptime members

__copy_ctor_is_trivial

comptime __copy_ctor_is_trivial = True

__del__is_trivial

comptime __del__is_trivial = True

__move_ctor_is_trivial

comptime __move_ctor_is_trivial = True

populate

comptime populate = rebind[fn(UnsafePointer[NoneType, MutAnyOrigin]) capturing -> None](#kgen.compile_offload_closure<target, #kgen.param.decl.ref<"func"> : !kgen.param<func_type>>)

Function pointer to populate captured variables in the function closure.

Methods

__contains__

__contains__(self, content: String) -> Bool

Checks if content exists in the assembly/IR.

Args:

  • content (String): String to search for.

Returns:

Bool: True if content is found, False otherwise.

write_to

write_to(self, mut writer: T)

Writes the assembly/IR to a writer.

Args:

  • writer (T): Writer object to write the assembly to.

__str__

__str__(self) -> String

Converts the assembly/IR to a string.

Returns:

String: The assembly/IR as a string.

write_text

write_text[path_like: PathLike](self, path: path_like)

Writes the assembly/IR to a file.

Parameters:

  • path_like (PathLike): Type that implements the PathLike interface for file path representation.

Args:

  • path (path_like): Path to write the file to.

Raises:

If file writing operations fail.