rocm.bindings.llvm.c.cylto#
2026-09-24
20 min read time
Applies to Linux and Windows
Advanced Micro Devices, Inc.
Cython declarations for the C-level interface. Use
cimport rocm.bindings.llvm.c.cylto from your Cython code to access
these declarations directly.
See also
The high-level Python API is documented at rocm.bindings.llvm.c.lto.
# MIT License
#
# Copyright (c) 2021-2026 Advanced Micro Devices, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# This file has been autogenerated, do not modify.
from libc.stdint cimport *
ctypedef bint _Bool # bool is not a reserved keyword in C, _Bool is
from rocm.bindings.llvm.c.cyvisibility cimport *
cdef extern from "llvm-c/lto.h":
ctypedef _Bool lto_bool_t
ctypedef enum lto_symbol_attributes:
LTO_SYMBOL_ALIGNMENT_MASK
LTO_SYMBOL_PERMISSIONS_MASK
LTO_SYMBOL_PERMISSIONS_CODE
LTO_SYMBOL_PERMISSIONS_DATA
LTO_SYMBOL_PERMISSIONS_RODATA
LTO_SYMBOL_DEFINITION_MASK
LTO_SYMBOL_DEFINITION_REGULAR
LTO_SYMBOL_DEFINITION_TENTATIVE
LTO_SYMBOL_DEFINITION_WEAK
LTO_SYMBOL_DEFINITION_UNDEFINED
LTO_SYMBOL_DEFINITION_WEAKUNDEF
LTO_SYMBOL_SCOPE_MASK
LTO_SYMBOL_SCOPE_INTERNAL
LTO_SYMBOL_SCOPE_HIDDEN
LTO_SYMBOL_SCOPE_PROTECTED
LTO_SYMBOL_SCOPE_DEFAULT
LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN
LTO_SYMBOL_COMDAT
LTO_SYMBOL_ALIAS
ctypedef enum lto_debug_model:
LTO_DEBUG_MODEL_NONE
LTO_DEBUG_MODEL_DWARF
ctypedef enum lto_codegen_model:
LTO_CODEGEN_PIC_MODEL_STATIC
LTO_CODEGEN_PIC_MODEL_DYNAMIC
LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC
LTO_CODEGEN_PIC_MODEL_DEFAULT
cdef struct LLVMOpaqueLTOModule:
pass
ctypedef LLVMOpaqueLTOModule * lto_module_t
cdef struct LLVMOpaqueLTOCodeGenerator:
pass
ctypedef LLVMOpaqueLTOCodeGenerator * lto_code_gen_t
cdef struct LLVMOpaqueThinLTOCodeGenerator:
pass
ctypedef LLVMOpaqueThinLTOCodeGenerator * thinlto_code_gen_t
#
# Returns a printable string.
#
# \since prior to LTO_API_VERSION=3
cdef const char * lto_get_version() except? NULL nogil
#
# Returns the last error string or NULL if last operation was successful.
#
# \since prior to LTO_API_VERSION=3
cdef const char * lto_get_error_message() except? NULL nogil
#
# Checks if a file is a loadable object file.
#
# \since prior to LTO_API_VERSION=3
cdef _Bool lto_module_is_object_file(const char * path) except? -1 nogil
#
# Checks if a file is a loadable object compiled for requested target.
#
# \since prior to LTO_API_VERSION=3
cdef _Bool lto_module_is_object_file_for_target(const char * path,const char * target_triple_prefix) except? -1 nogil
#
# Return true if \p Buffer contains a bitcode file with ObjC code (category
# or class) in it.
#
# \since LTO_API_VERSION=20
cdef _Bool lto_module_has_objc_category(const void * mem,size_t length) except? -1 nogil
#
# Checks if a buffer is a loadable object file.
#
# \since prior to LTO_API_VERSION=3
cdef _Bool lto_module_is_object_file_in_memory(const void * mem,size_t length) except? -1 nogil
#
# Checks if a buffer is a loadable object compiled for requested target.
#
# \since prior to LTO_API_VERSION=3
cdef _Bool lto_module_is_object_file_in_memory_for_target(const void * mem,size_t length,const char * target_triple_prefix) except? -1 nogil
#
# Loads an object file from disk.
# Returns NULL on error (check lto_get_error_message() for details).
#
# \since prior to LTO_API_VERSION=3
cdef lto_module_t lto_module_create(const char * path) except? NULL nogil
#
# Loads an object file from memory.
# Returns NULL on error (check lto_get_error_message() for details).
#
# \since prior to LTO_API_VERSION=3
cdef lto_module_t lto_module_create_from_memory(const void * mem,size_t length) except? NULL nogil
#
# Loads an object file from memory with an extra path argument.
# Returns NULL on error (check lto_get_error_message() for details).
#
# \since LTO_API_VERSION=9
cdef lto_module_t lto_module_create_from_memory_with_path(const void * mem,size_t length,const char * path) except? NULL nogil
#
# Loads an object file in its own context.
#
# Loads an object file in its own LLVMContext. This function call is
# thread-safe. However, modules created this way should not be merged into an
# lto_code_gen_t using \a lto_codegen_add_module().
#
# Returns NULL on error (check lto_get_error_message() for details).
#
# \since LTO_API_VERSION=11
cdef lto_module_t lto_module_create_in_local_context(const void * mem,size_t length,const char * path) except? NULL nogil
#
# Loads an object file in the codegen context.
#
# Loads an object file into the same context as \c cg. The module is safe to
# add using \a lto_codegen_add_module().
#
# Returns NULL on error (check lto_get_error_message() for details).
#
# \since LTO_API_VERSION=11
cdef lto_module_t lto_module_create_in_codegen_context(const void * mem,size_t length,const char * path,lto_code_gen_t cg) except? NULL nogil
#
# Loads an object file from disk. The seek point of fd is not preserved.
# Returns NULL on error (check lto_get_error_message() for details).
#
# \since LTO_API_VERSION=5
cdef lto_module_t lto_module_create_from_fd(int fd,const char * path,size_t file_size) except? NULL nogil
#
# Loads an object file from disk. The seek point of fd is not preserved.
# Returns NULL on error (check lto_get_error_message() for details).
#
# \since LTO_API_VERSION=5
cdef lto_module_t lto_module_create_from_fd_at_offset(int fd,const char * path,size_t file_size,size_t map_size,long offset) except? NULL nogil
#
# Frees all memory internally allocated by the module.
# Upon return the lto_module_t is no longer valid.
#
# \since prior to LTO_API_VERSION=3
cdef void lto_module_dispose(lto_module_t mod) noexcept nogil
#
# Returns triple string which the object module was compiled under.
#
# \since prior to LTO_API_VERSION=3
cdef const char * lto_module_get_target_triple(lto_module_t mod) except? NULL nogil
#
# Sets triple string with which the object will be codegened.
#
# \since LTO_API_VERSION=4
cdef void lto_module_set_target_triple(lto_module_t mod,const char * triple) noexcept nogil
#
# Returns the number of symbols in the object module.
#
# \since prior to LTO_API_VERSION=3
cdef unsigned int lto_module_get_num_symbols(lto_module_t mod) except? -1 nogil
#
# Returns the name of the ith symbol in the object module.
#
# \since prior to LTO_API_VERSION=3
cdef const char * lto_module_get_symbol_name(lto_module_t mod,unsigned int index) except? NULL nogil
#
# Returns the attributes of the ith symbol in the object module.
#
# \since prior to LTO_API_VERSION=3
cdef lto_symbol_attributes lto_module_get_symbol_attribute(lto_module_t mod,unsigned int index) except? <lto_symbol_attributes>-1 nogil
#
# Returns the number of asm undefined symbols in the object module.
#
# \since prior to LTO_API_VERSION=30
cdef unsigned int lto_module_get_num_asm_undef_symbols(lto_module_t mod) except? -1 nogil
#
# Returns the name of the ith asm undefined symbol in the object module.
#
# \since prior to LTO_API_VERSION=30
cdef const char * lto_module_get_asm_undef_symbol_name(lto_module_t mod,unsigned int index) except? NULL nogil
#
# Returns the module's linker options.
#
# The linker options may consist of multiple flags. It is the linker's
# responsibility to split the flags using a platform-specific mechanism.
#
# \since LTO_API_VERSION=16
cdef const char * lto_module_get_linkeropts(lto_module_t mod) except? NULL nogil
#
# If targeting mach-o on darwin, this function gets the CPU type and subtype
# that will end up being encoded in the mach-o header. These are the values
# that can be found in mach/machine.h.
#
# \p out_cputype and \p out_cpusubtype must be non-NULL.
#
# Returns true on error (check lto_get_error_message() for details).
#
# \since LTO_API_VERSION=27
cdef _Bool lto_module_get_macho_cputype(lto_module_t mod,unsigned int * out_cputype,unsigned int * out_cpusubtype) except? -1 nogil
#
# This function can be used by the linker to check if a given module has
# any constructor or destructor functions.
#
# Returns true if the module has either the @llvm.global_ctors or the
# @llvm.global_dtors symbol. Otherwise returns false.
#
# \since LTO_API_VERSION=29
cdef _Bool lto_module_has_ctor_dtor(lto_module_t mod) except? -1 nogil
cdef extern from "llvm-c/lto.h":
ctypedef enum lto_codegen_diagnostic_severity_t:
LTO_DS_ERROR
LTO_DS_WARNING
LTO_DS_REMARK
LTO_DS_NOTE
ctypedef void (*lto_diagnostic_handler_t) (lto_codegen_diagnostic_severity_t,const char *,void *)
#
# Set a diagnostic handler and the related context (void *).
# This is more general than lto_get_error_message, as the diagnostic handler
# can be called at anytime within lto.
#
# \since LTO_API_VERSION=7
cdef void lto_codegen_set_diagnostic_handler(lto_code_gen_t arg0,lto_diagnostic_handler_t arg1,void * arg2)
#
# Instantiates a code generator.
# Returns NULL on error (check lto_get_error_message() for details).
#
# All modules added using \a lto_codegen_add_module() must have been created
# in the same context as the codegen.
#
# \since prior to LTO_API_VERSION=3
cdef lto_code_gen_t lto_codegen_create() except? NULL nogil
#
# Instantiate a code generator in its own context.
#
# Instantiates a code generator in its own context. Modules added via \a
# lto_codegen_add_module() must have all been created in the same context,
# using \a lto_module_create_in_codegen_context().
#
# \since LTO_API_VERSION=11
cdef lto_code_gen_t lto_codegen_create_in_local_context() except? NULL nogil
#
# Frees all code generator and all memory it internally allocated.
# Upon return the lto_code_gen_t is no longer valid.
#
# \since prior to LTO_API_VERSION=3
cdef void lto_codegen_dispose(lto_code_gen_t arg0) noexcept nogil
#
# Add an object module to the set of modules for which code will be generated.
# Returns true on error (check lto_get_error_message() for details).
#
# \c cg and \c mod must both be in the same context. See \a
# lto_codegen_create_in_local_context() and \a
# lto_module_create_in_codegen_context().
#
# \since prior to LTO_API_VERSION=3
cdef _Bool lto_codegen_add_module(lto_code_gen_t cg,lto_module_t mod) except? -1 nogil
#
# Sets the object module for code generation. This will transfer the ownership
# of the module to the code generator.
#
# \c cg and \c mod must both be in the same context.
#
# \since LTO_API_VERSION=13
cdef void lto_codegen_set_module(lto_code_gen_t cg,lto_module_t mod) noexcept nogil
#
# Sets if debug info should be generated.
# Returns true on error (check lto_get_error_message() for details).
#
# \since prior to LTO_API_VERSION=3
cdef _Bool lto_codegen_set_debug_model(lto_code_gen_t cg,lto_debug_model arg1) except? -1 nogil
#
# Sets which PIC code model to generated.
# Returns true on error (check lto_get_error_message() for details).
#
# \since prior to LTO_API_VERSION=3
cdef _Bool lto_codegen_set_pic_model(lto_code_gen_t cg,lto_codegen_model arg1) except? -1 nogil
#
# Sets the cpu to generate code for.
#
# \since LTO_API_VERSION=4
cdef void lto_codegen_set_cpu(lto_code_gen_t cg,const char * cpu) noexcept nogil
#
# Sets the location of the assembler tool to run. If not set, libLTO
# will use gcc to invoke the assembler.
#
# \since LTO_API_VERSION=3
cdef void lto_codegen_set_assembler_path(lto_code_gen_t cg,const char * path) noexcept nogil
#
# Sets extra arguments that libLTO should pass to the assembler.
#
# \since LTO_API_VERSION=4
cdef void lto_codegen_set_assembler_args(lto_code_gen_t cg,const char ** args,int nargs) noexcept nogil
#
# Adds to a list of all global symbols that must exist in the final generated
# code. If a function is not listed there, it might be inlined into every usage
# and optimized away.
#
# \since prior to LTO_API_VERSION=3
cdef void lto_codegen_add_must_preserve_symbol(lto_code_gen_t cg,const char * symbol) noexcept nogil
#
# Writes a new object file at the specified path that contains the
# merged contents of all modules added so far.
# Returns true on error (check lto_get_error_message() for details).
#
# \since LTO_API_VERSION=5
cdef _Bool lto_codegen_write_merged_modules(lto_code_gen_t cg,const char * path) except? -1 nogil
#
# Generates code for all added modules into one native object file.
# This calls lto_codegen_optimize then lto_codegen_compile_optimized.
#
# On success returns a pointer to a generated mach-o/ELF buffer and
# length set to the buffer size. The buffer is owned by the
# lto_code_gen_t and will be freed when lto_codegen_dispose()
# is called, or lto_codegen_compile() is called again.
# On failure, returns NULL (check lto_get_error_message() for details).
#
# \since prior to LTO_API_VERSION=3
cdef const void * lto_codegen_compile(lto_code_gen_t cg,size_t * length) except? NULL nogil
#
# Generates code for all added modules into one native object file.
# This calls lto_codegen_optimize then lto_codegen_compile_optimized (instead
# of returning a generated mach-o/ELF buffer, it writes to a file).
#
# The name of the file is written to name. Returns true on error.
#
# \since LTO_API_VERSION=5
cdef _Bool lto_codegen_compile_to_file(lto_code_gen_t cg,const char ** name) except? -1 nogil
#
# Runs optimization for the merged module. Returns true on error.
#
# \since LTO_API_VERSION=12
cdef _Bool lto_codegen_optimize(lto_code_gen_t cg) except? -1 nogil
#
# Generates code for the optimized merged module into one native object file.
# It will not run any IR optimizations on the merged module.
#
# On success returns a pointer to a generated mach-o/ELF buffer and length set
# to the buffer size. The buffer is owned by the lto_code_gen_t and will be
# freed when lto_codegen_dispose() is called, or
# lto_codegen_compile_optimized() is called again. On failure, returns NULL
# (check lto_get_error_message() for details).
#
# \since LTO_API_VERSION=12
cdef const void * lto_codegen_compile_optimized(lto_code_gen_t cg,size_t * length) except? NULL nogil
#
# Returns the runtime API version.
#
# \since LTO_API_VERSION=12
cdef unsigned int lto_api_version() except? -1 nogil
#
# Parses options immediately, making them available as early as possible. For
# example during executing codegen::InitTargetOptionsFromCodeGenFlags. Since
# parsing shud only happen once, only one of lto_codegen_debug_options or
# lto_set_debug_options should be called.
#
# This function takes one or more options separated by spaces.
# Warning: passing file paths through this function may confuse the argument
# parser if the paths contain spaces.
#
# \since LTO_API_VERSION=28
cdef void lto_set_debug_options(const char *const * options,int number) noexcept nogil
#
# Sets options to help debug codegen bugs. Since parsing shud only happen once,
# only one of lto_codegen_debug_options or lto_set_debug_options
# should be called.
#
# This function takes one or more options separated by spaces.
# Warning: passing file paths through this function may confuse the argument
# parser if the paths contain spaces.
#
# \since prior to LTO_API_VERSION=3
cdef void lto_codegen_debug_options(lto_code_gen_t cg,const char * arg1) noexcept nogil
#
# Same as the previous function, but takes every option separately through an
# array.
#
# \since prior to LTO_API_VERSION=26
cdef void lto_codegen_debug_options_array(lto_code_gen_t cg,const char *const * arg1,int number) noexcept nogil
#
# Initializes LLVM disassemblers.
# FIXME: This doesn't really belong here.
#
# \since LTO_API_VERSION=5
cdef void lto_initialize_disassembler() noexcept nogil
#
# Sets if we should run internalize pass during optimization and code
# generation.
#
# \since LTO_API_VERSION=14
cdef void lto_codegen_set_should_internalize(lto_code_gen_t cg,_Bool ShouldInternalize) noexcept nogil
#
# Set whether to embed uselists in bitcode.
#
# Sets whether \a lto_codegen_write_merged_modules() should embed uselists in
# output bitcode. This should be turned on for all -save-temps output.
#
# \since LTO_API_VERSION=15
cdef void lto_codegen_set_should_embed_uselists(lto_code_gen_t cg,_Bool ShouldEmbedUselists) noexcept nogil
cdef extern from "llvm-c/lto.h":
cdef struct LLVMOpaqueLTOInput:
pass
ctypedef LLVMOpaqueLTOInput * lto_input_t
#
# Creates an LTO input file from a buffer. The path
# argument is used for diagnotics as this function
# otherwise does not know which file the given buffer
# is associated with.
#
# \since LTO_API_VERSION=24
cdef lto_input_t lto_input_create(const void * buffer,size_t buffer_size,const char * path) except? NULL nogil
#
# Frees all memory internally allocated by the LTO input file.
# Upon return the lto_module_t is no longer valid.
#
# \since LTO_API_VERSION=24
cdef void lto_input_dispose(lto_input_t input) noexcept nogil
#
# Returns the number of dependent library specifiers
# for the given LTO input file.
#
# \since LTO_API_VERSION=24
cdef unsigned int lto_input_get_num_dependent_libraries(lto_input_t input) except? -1 nogil
#
# Returns the ith dependent library specifier
# for the given LTO input file. The returned
# string is not null-terminated.
#
# \since LTO_API_VERSION=24
cdef const char * lto_input_get_dependent_library(lto_input_t input,size_t index,size_t * size) except? NULL nogil
#
# Returns the list of libcall symbols that can be generated by LTO
# that might not be visible from the symbol table of bitcode files.
#
# \since prior to LTO_API_VERSION=25
cdef const char *const * lto_runtime_lib_symbols_list(size_t * size) except? NULL nogil
cdef extern from "llvm-c/lto.h":
ctypedef struct LTOObjectBuffer:
const char * Buffer
size_t Size
#
# Instantiates a ThinLTO code generator.
# Returns NULL on error (check lto_get_error_message() for details).
#
#
# The ThinLTOCodeGenerator is not intended to be reuse for multiple
# compilation: the model is that the client adds modules to the generator and
# ask to perform the ThinLTO optimizations / codegen, and finally destroys the
# codegenerator.
#
# \since LTO_API_VERSION=18
cdef thinlto_code_gen_t thinlto_create_codegen() except? NULL nogil
#
# Frees the generator and all memory it internally allocated.
# Upon return the thinlto_code_gen_t is no longer valid.
#
# \since LTO_API_VERSION=18
cdef void thinlto_codegen_dispose(thinlto_code_gen_t cg) noexcept nogil
#
# Add a module to a ThinLTO code generator. Identifier has to be unique among
# all the modules in a code generator. The data buffer stays owned by the
# client, and is expected to be available for the entire lifetime of the
# thinlto_code_gen_t it is added to.
#
# On failure, returns NULL (check lto_get_error_message() for details).
#
#
# \since LTO_API_VERSION=18
cdef void thinlto_codegen_add_module(thinlto_code_gen_t cg,const char * identifier,const char * data,int length) noexcept nogil
#
# Optimize and codegen all the modules added to the codegenerator using
# ThinLTO. Resulting objects are accessible using thinlto_module_get_object().
#
# \since LTO_API_VERSION=18
cdef void thinlto_codegen_process(thinlto_code_gen_t cg) noexcept nogil
#
# Returns the number of object files produced by the ThinLTO CodeGenerator.
#
# It usually matches the number of input files, but this is not a guarantee of
# the API and may change in future implementation, so the client should not
# assume it.
#
# \since LTO_API_VERSION=18
cdef unsigned int thinlto_module_get_num_objects(thinlto_code_gen_t cg) except? -1 nogil
#
# Returns a reference to the ith object file produced by the ThinLTO
# CodeGenerator.
#
# Client should use \p thinlto_module_get_num_objects() to get the number of
# available objects.
#
# \since LTO_API_VERSION=18
cdef LTOObjectBuffer thinlto_module_get_object(thinlto_code_gen_t cg,unsigned int index) noexcept nogil
#
# Returns the number of object files produced by the ThinLTO CodeGenerator.
#
# It usually matches the number of input files, but this is not a guarantee of
# the API and may change in future implementation, so the client should not
# assume it.
#
# \since LTO_API_VERSION=21
cdef unsigned int thinlto_module_get_num_object_files(thinlto_code_gen_t cg) except? -1 nogil
#
# Returns the path to the ith object file produced by the ThinLTO
# CodeGenerator.
#
# Client should use \p thinlto_module_get_num_object_files() to get the number
# of available objects.
#
# \since LTO_API_VERSION=21
cdef const char * thinlto_module_get_object_file(thinlto_code_gen_t cg,unsigned int index) except? NULL nogil
#
# Sets which PIC code model to generate.
# Returns true on error (check lto_get_error_message() for details).
#
# \since LTO_API_VERSION=18
cdef _Bool thinlto_codegen_set_pic_model(thinlto_code_gen_t cg,lto_codegen_model arg1) except? -1 nogil
#
# Sets the path to a directory to use as a storage for temporary bitcode files.
# The intention is to make the bitcode files available for debugging at various
# stage of the pipeline.
#
# \since LTO_API_VERSION=18
cdef void thinlto_codegen_set_savetemps_dir(thinlto_code_gen_t cg,const char * save_temps_dir) noexcept nogil
#
# Set the path to a directory where to save generated object files. This
# path can be used by a linker to request on-disk files instead of in-memory
# buffers. When set, results are available through
# thinlto_module_get_object_file() instead of thinlto_module_get_object().
#
# \since LTO_API_VERSION=21
cdef void thinlto_set_generated_objects_dir(thinlto_code_gen_t cg,const char * save_temps_dir) noexcept nogil
#
# Sets the cpu to generate code for.
#
# \since LTO_API_VERSION=18
cdef void thinlto_codegen_set_cpu(thinlto_code_gen_t cg,const char * cpu) noexcept nogil
#
# Disable CodeGen, only run the stages till codegen and stop. The output will
# be bitcode.
#
# \since LTO_API_VERSION=19
cdef void thinlto_codegen_disable_codegen(thinlto_code_gen_t cg,_Bool disable) noexcept nogil
#
# Perform CodeGen only: disable all other stages.
#
# \since LTO_API_VERSION=19
cdef void thinlto_codegen_set_codegen_only(thinlto_code_gen_t cg,_Bool codegen_only) noexcept nogil
#
# Parse -mllvm style debug options.
#
# \since LTO_API_VERSION=18
cdef void thinlto_debug_options(const char *const * options,int number) noexcept nogil
#
# Test if a module has support for ThinLTO linking.
#
# \since LTO_API_VERSION=18
cdef _Bool lto_module_is_thinlto(lto_module_t mod) except? -1 nogil
#
# Adds a symbol to the list of global symbols that must exist in the final
# generated code. If a function is not listed there, it might be inlined into
# every usage and optimized away. For every single module, the functions
# referenced from code outside of the ThinLTO modules need to be added here.
#
# \since LTO_API_VERSION=18
cdef void thinlto_codegen_add_must_preserve_symbol(thinlto_code_gen_t cg,const char * name,int length) noexcept nogil
#
# Adds a symbol to the list of global symbols that are cross-referenced between
# ThinLTO files. If the ThinLTO CodeGenerator can ensure that every
# references from a ThinLTO module to this symbol is optimized away, then
# the symbol can be discarded.
#
# \since LTO_API_VERSION=18
cdef void thinlto_codegen_add_cross_referenced_symbol(thinlto_code_gen_t cg,const char * name,int length) noexcept nogil
#
# Sets the path to a directory to use as a cache storage for incremental build.
# Setting this activates caching.
#
# \since LTO_API_VERSION=18
cdef void thinlto_codegen_set_cache_dir(thinlto_code_gen_t cg,const char * cache_dir) noexcept nogil
#
# Sets the cache pruning interval (in seconds). A negative value disables the
# pruning. An unspecified default value will be applied, and a value of 0 will
# force prunning to occur.
#
# \since LTO_API_VERSION=18
cdef void thinlto_codegen_set_cache_pruning_interval(thinlto_code_gen_t cg,int interval) noexcept nogil
#
# Sets the maximum cache size that can be persistent across build, in terms of
# percentage of the available space on the disk. Set to 100 to indicate
# no limit, 50 to indicate that the cache size will not be left over half the
# available space. A value over 100 will be reduced to 100, a value of 0 will
# be ignored. An unspecified default value will be applied.
#
# The formula looks like:
# AvailableSpace = FreeSpace + ExistingCacheSize
# NewCacheSize = AvailableSpace * P/100
#
# \since LTO_API_VERSION=18
cdef void thinlto_codegen_set_final_cache_size_relative_to_available_space(thinlto_code_gen_t cg,unsigned int percentage) noexcept nogil
#
# Sets the expiration (in seconds) for an entry in the cache. An unspecified
# default value will be applied. A value of 0 will be ignored.
#
# \since LTO_API_VERSION=18
cdef void thinlto_codegen_set_cache_entry_expiration(thinlto_code_gen_t cg,unsigned int expiration) noexcept nogil
#
# Sets the maximum size of the cache directory (in bytes). A value over the
# amount of available space on the disk will be reduced to the amount of
# available space. An unspecified default value will be applied. A value of 0
# will be ignored.
#
# \since LTO_API_VERSION=22
cdef void thinlto_codegen_set_cache_size_bytes(thinlto_code_gen_t cg,unsigned int max_size_bytes) noexcept nogil
#
# Same as thinlto_codegen_set_cache_size_bytes, except the maximum size is in
# megabytes (2^20 bytes).
#
# \since LTO_API_VERSION=23
cdef void thinlto_codegen_set_cache_size_megabytes(thinlto_code_gen_t cg,unsigned int max_size_megabytes) noexcept nogil
#
# Sets the maximum number of files in the cache directory. An unspecified
# default value will be applied. A value of 0 will be ignored.
#
# \since LTO_API_VERSION=22
cdef void thinlto_codegen_set_cache_size_files(thinlto_code_gen_t cg,unsigned int max_size_files) noexcept nogil
cdef bint __lto_has_symbol(const char* name) noexcept nogil