Skip to main content

Mojo struct

Info

@register_passable(trivial) struct Info[func_type: AnyTrivialRegType, func: func_type, target: 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 (AnyTrivialRegType): Type of the function being compiled.
  • func (func_type): The function being compiled.
  • target (target): The target architecture to compile for.

Fields

  • asm (StringSlice[StaticConstantOrigin]): Generated assembly/IR code from the compilation process.
  • function_name (StringSlice[StaticConstantOrigin]): Mangled name of the compiled function, used for symbol resolution.
  • module_name (StringSlice[StaticConstantOrigin]): Name of the module containing the compiled function.
  • num_captures (Int): Number of variables captured by the function closure.

Implemented traits

AnyType, Copyable, Movable, Stringable, UnknownDestructibility, Writable

Aliases

populate

alias populate = rebind[AnyTrivialRegType,AnyTrivialRegType](#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:

True if content is found, False otherwise.

write_to

write_to[W: Writer](self, mut writer: W)

Writes the assembly/IR to a writer.

Parameters:

  • W (Writer): Type that implements the Writer interface for writing data.

Args:

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

__str__

__str__(self) -> String

Converts the assembly/IR to a string.

Returns:

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.

Was this page helpful?