Class LLVMLTO
- java.lang.Object
-
- org.lwjgl.llvm.LLVMLTO
-
public class LLVMLTO extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LLVMLTO.Functions
Contains the function pointers loaded from the LTOSharedLibrary
.
-
Field Summary
Fields Modifier and Type Field Description static int
LTOAPI_VERSION
static int
LTOCODEGEN_PIC_MODEL_DEFAULT
LTOCODEGEN_PIC_MODEL_DYNAMIC
LTOCODEGEN_PIC_MODEL_DYNAMIC_NO_PIC
LTOCODEGEN_PIC_MODEL_STATIClto_codegen_model
static int
LTODEBUG_MODEL_DWARF
LTODEBUG_MODEL_NONElto_debug_model
static int
LTODS_ERROR
LTODS_NOTE
LTODS_REMARK
LTODS_WARNINGDiagnostic severity.static int
LTOSYMBOL_ALIAS
LTOSYMBOL_ALIGNMENT_MASK
LTOSYMBOL_COMDAT
LTOSYMBOL_DEFINITION_MASK
LTOSYMBOL_DEFINITION_REGULAR
LTOSYMBOL_DEFINITION_TENTATIVE
LTOSYMBOL_DEFINITION_UNDEFINED
LTOSYMBOL_DEFINITION_WEAK
LTOSYMBOL_DEFINITION_WEAKUNDEF
LTOSYMBOL_PERMISSIONS_CODE
LTOSYMBOL_PERMISSIONS_DATA
LTOSYMBOL_PERMISSIONS_MASK
LTOSYMBOL_PERMISSIONS_RODATA
LTOSYMBOL_SCOPE_DEFAULT
LTOSYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN
LTOSYMBOL_SCOPE_HIDDEN
LTOSYMBOL_SCOPE_INTERNAL
LTOSYMBOL_SCOPE_MASK
LTOSYMBOL_SCOPE_PROTECTEDlto_symbol_attributes
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.lwjgl.system.SharedLibrary
getLibrary()
Returns the LTOSharedLibrary
.static int
lto_api_version()
Returns the runtime API version.static boolean
lto_codegen_add_module(long cg, long mod)
Add an object module to the set of modules for which code will be generated.static void
lto_codegen_add_must_preserve_symbol(long cg, java.lang.CharSequence symbol)
Adds to a list of all global symbols that must exist in the final generated code.static void
lto_codegen_add_must_preserve_symbol(long cg, java.nio.ByteBuffer symbol)
Adds to a list of all global symbols that must exist in the final generated code.static java.nio.ByteBuffer
lto_codegen_compile(long cg)
Generates code for all added modules into one native object file.static java.nio.ByteBuffer
lto_codegen_compile_optimized(long cg)
Generates code for the optimized merged module into one native object file.static boolean
lto_codegen_compile_to_file(long cg, org.lwjgl.PointerBuffer name)
Generates code for all added modules into one native object file.static long
lto_codegen_create()
Instantiates a code generator.static long
lto_codegen_create_in_local_context()
Instantiate a code generator in its own context.static void
lto_codegen_debug_options(long cg, java.lang.CharSequence options)
Sets options to help debug codegen bugs.static void
lto_codegen_debug_options(long cg, java.nio.ByteBuffer options)
Sets options to help debug codegen bugs.static void
lto_codegen_dispose(long cg)
Frees all code generator and all memory it internally allocated.static boolean
lto_codegen_optimize(long cg)
Runs optimization for the merged module.static void
lto_codegen_set_assembler_args(long cg, org.lwjgl.PointerBuffer args)
Sets extra arguments that libLTO should pass to the assembler.static void
lto_codegen_set_assembler_path(long cg, java.lang.CharSequence path)
Sets the location of the assembler tool to run.static void
lto_codegen_set_assembler_path(long cg, java.nio.ByteBuffer path)
Sets the location of the assembler tool to run.static void
lto_codegen_set_cpu(long cg, java.lang.CharSequence cpu)
Sets the cpu to generate code for.static void
lto_codegen_set_cpu(long cg, java.nio.ByteBuffer cpu)
Sets the cpu to generate code for.static boolean
lto_codegen_set_debug_model(long cg, int model)
Sets if debug info should be generated.static void
lto_codegen_set_diagnostic_handler(long cg, LTODiagnosticHandlerI handler, long ctxt)
Set a diagnostic handler and the related context (void *
).static void
lto_codegen_set_module(long cg, long mod)
Sets the object module for code generation.static boolean
lto_codegen_set_pic_model(long cg, int model)
Sets which PIC code model to generated.static void
lto_codegen_set_should_embed_uselists(long cg, boolean ShouldEmbedUselists)
Set whether to embed uselists in bitcode.static void
lto_codegen_set_should_internalize(long cg, boolean ShouldInternalize)
Sets if we should run internalize pass during optimization and code generation.static boolean
lto_codegen_write_merged_modules(long cg, java.lang.CharSequence path)
Writes a new object file at the specified path that contains the merged contents of all modules added so far.static boolean
lto_codegen_write_merged_modules(long cg, java.nio.ByteBuffer path)
Writes a new object file at the specified path that contains the merged contents of all modules added so far.static java.lang.String
lto_get_error_message()
Returns the last error string orNULL
if last operation was successful.static java.lang.String
lto_get_version()
Returns a printable string.static void
lto_initialize_disassembler()
Initializes LLVM disassemblers.static long
lto_module_create(java.lang.CharSequence path)
Loads an object file from disk.static long
lto_module_create(java.nio.ByteBuffer path)
Loads an object file from disk.static long
lto_module_create_from_fd(int fd, java.lang.CharSequence path, long file_size)
Loads an object file from disk.static long
lto_module_create_from_fd(int fd, java.nio.ByteBuffer path, long file_size)
Loads an object file from disk.static long
lto_module_create_from_fd_at_offset(int fd, java.lang.CharSequence path, long file_size, long map_size, long offset)
Loads an object file from disk.static long
lto_module_create_from_fd_at_offset(int fd, java.nio.ByteBuffer path, long file_size, long map_size, long offset)
Loads an object file from disk.static long
lto_module_create_from_memory(java.nio.ByteBuffer mem)
Loads an object file from memory.static long
lto_module_create_from_memory_with_path(java.nio.ByteBuffer mem, java.lang.CharSequence path)
Loads an object file from memory with an extra path argument.static long
lto_module_create_from_memory_with_path(java.nio.ByteBuffer mem, java.nio.ByteBuffer path)
Loads an object file from memory with an extra path argument.static long
lto_module_create_in_codegen_context(java.nio.ByteBuffer mem, java.lang.CharSequence path, long cg)
Loads an object file in the codegen context.static long
lto_module_create_in_codegen_context(java.nio.ByteBuffer mem, java.nio.ByteBuffer path, long cg)
Loads an object file in the codegen context.static long
lto_module_create_in_local_context(java.nio.ByteBuffer mem, java.lang.CharSequence path)
Loads an object file in its own context.static long
lto_module_create_in_local_context(java.nio.ByteBuffer mem, java.nio.ByteBuffer path)
Loads an object file in its own context.static void
lto_module_dispose(long mod)
Frees all memory internally allocated by the module.static java.lang.String
lto_module_get_linkeropts(long mod)
Returns the module's linker options.static int
lto_module_get_num_symbols(long mod)
Returns the number of symbols in the object module.static int
lto_module_get_symbol_attribute(long mod, int index)
Returns the attributes of the ith symbol in the object module.static java.lang.String
lto_module_get_symbol_name(long mod, int index)
Returns the name of the ith symbol in the object module.static java.lang.String
lto_module_get_target_triple(long mod)
Returns triple string which the object module was compiled under.static boolean
lto_module_has_objc_category(java.nio.ByteBuffer mem)
Return true ifBuffer
contains a bitcode file with ObjC code (category or class) in it.static boolean
lto_module_is_object_file(java.lang.CharSequence path)
Checks if a file is a loadable object file.static boolean
lto_module_is_object_file(java.nio.ByteBuffer path)
Checks if a file is a loadable object file.static boolean
lto_module_is_object_file_for_target(java.lang.CharSequence path, java.lang.CharSequence target_triple_prefix)
Checks if a file is a loadable object compiled for requested target.static boolean
lto_module_is_object_file_for_target(java.nio.ByteBuffer path, java.nio.ByteBuffer target_triple_prefix)
Checks if a file is a loadable object compiled for requested target.static boolean
lto_module_is_object_file_in_memory(java.nio.ByteBuffer mem)
Checks if a buffer is a loadable object file.static boolean
lto_module_is_object_file_in_memory_for_target(java.nio.ByteBuffer mem, java.lang.CharSequence target_triple_prefix)
Checks if a buffer is a loadable object compiled for requested target.static boolean
lto_module_is_object_file_in_memory_for_target(java.nio.ByteBuffer mem, java.nio.ByteBuffer target_triple_prefix)
Checks if a buffer is a loadable object compiled for requested target.static boolean
lto_module_is_thinlto(long mod)
Test if a module has support for ThinLTO linking.static void
lto_module_set_target_triple(long mod, java.lang.CharSequence triple)
Sets triple string with which the object will be codegened.static void
lto_module_set_target_triple(long mod, java.nio.ByteBuffer triple)
Sets triple string with which the object will be codegened.static void
nlto_codegen_add_must_preserve_symbol(long cg, long symbol)
Unsafe version of:codegen_add_must_preserve_symbol
static long
nlto_codegen_compile(long cg, long length)
Unsafe version of:codegen_compile
static long
nlto_codegen_compile_optimized(long cg, long length)
Unsafe version of:codegen_compile_optimized
static boolean
nlto_codegen_compile_to_file(long cg, long name)
Unsafe version of:codegen_compile_to_file
static void
nlto_codegen_debug_options(long cg, long options)
Unsafe version of:codegen_debug_options
static void
nlto_codegen_set_assembler_args(long cg, long args, int nargs)
Unsafe version of:codegen_set_assembler_args
static void
nlto_codegen_set_assembler_path(long cg, long path)
Unsafe version of:codegen_set_assembler_path
static void
nlto_codegen_set_cpu(long cg, long cpu)
Unsafe version of:codegen_set_cpu
static void
nlto_codegen_set_diagnostic_handler(long cg, long handler, long ctxt)
Unsafe version of:codegen_set_diagnostic_handler
static boolean
nlto_codegen_write_merged_modules(long cg, long path)
Unsafe version of:codegen_write_merged_modules
static long
nlto_get_error_message()
Unsafe version of:get_error_message
static long
nlto_get_version()
Unsafe version of:get_version
static long
nlto_module_create(long path)
Unsafe version of:module_create
static long
nlto_module_create_from_fd(int fd, long path, long file_size)
Unsafe version of:module_create_from_fd
static long
nlto_module_create_from_fd_at_offset(int fd, long path, long file_size, long map_size, long offset)
Unsafe version of:module_create_from_fd_at_offset
static long
nlto_module_create_from_memory(long mem, long length)
Unsafe version of:module_create_from_memory
static long
nlto_module_create_from_memory_with_path(long mem, long length, long path)
Unsafe version of:module_create_from_memory_with_path
static long
nlto_module_create_in_codegen_context(long mem, long length, long path, long cg)
Unsafe version of:module_create_in_codegen_context
static long
nlto_module_create_in_local_context(long mem, long length, long path)
Unsafe version of:module_create_in_local_context
static long
nlto_module_get_linkeropts(long mod)
Unsafe version of:module_get_linkeropts
static long
nlto_module_get_symbol_name(long mod, int index)
Unsafe version of:module_get_symbol_name
static long
nlto_module_get_target_triple(long mod)
Unsafe version of:module_get_target_triple
static boolean
nlto_module_has_objc_category(long mem, long length)
Unsafe version of:module_has_objc_category
static boolean
nlto_module_is_object_file(long path)
Unsafe version of:module_is_object_file
static boolean
nlto_module_is_object_file_for_target(long path, long target_triple_prefix)
Unsafe version of:module_is_object_file_for_target
static boolean
nlto_module_is_object_file_in_memory(long mem, long length)
Unsafe version of:module_is_object_file_in_memory
static boolean
nlto_module_is_object_file_in_memory_for_target(long mem, long length, long target_triple_prefix)
Unsafe version of:module_is_object_file_in_memory_for_target
static void
nlto_module_set_target_triple(long mod, long triple)
Unsafe version of:module_set_target_triple
static void
nthinlto_codegen_add_cross_referenced_symbol(long cg, long name, int length)
Unsafe version of:thinlto_codegen_add_cross_referenced_symbol(long, java.nio.ByteBuffer)
static void
nthinlto_codegen_add_module(long cg, long identifier, long data, int length)
Unsafe version of:thinlto_codegen_add_module(long, java.nio.ByteBuffer, java.nio.ByteBuffer)
static void
nthinlto_codegen_add_must_preserve_symbol(long cg, long name, int length)
Unsafe version of:thinlto_codegen_add_must_preserve_symbol(long, java.nio.ByteBuffer)
static void
nthinlto_codegen_set_cache_dir(long cg, long cache_dir)
Unsafe version of:thinlto_codegen_set_cache_dir(long, java.nio.ByteBuffer)
static void
nthinlto_codegen_set_cpu(long cg, long cpu)
Unsafe version of:thinlto_codegen_set_cpu(long, java.nio.ByteBuffer)
static void
nthinlto_codegen_set_savetemps_dir(long cg, long save_temps_dir)
Unsafe version of:thinlto_codegen_set_savetemps_dir(long, java.nio.ByteBuffer)
static void
nthinlto_debug_options(long options, int number)
Unsafe version of:thinlto_debug_options(org.lwjgl.PointerBuffer)
static void
nthinlto_module_get_object(long cg, int index, long __result)
Unsafe version of:thinlto_module_get_object(long, int, org.lwjgl.llvm.LTOObjectBuffer)
static void
nthinlto_module_get_object(long cg, int index, long __functionAddress, long __result)
Unsafe version of:thinlto_module_get_object(long, int, org.lwjgl.llvm.LTOObjectBuffer)
static long
nthinlto_module_get_object_file(long cg, int index)
Unsafe version of:thinlto_module_get_object_file(long, int)
static void
nthinlto_set_generated_objects_dir(long cg, long save_temps_dir)
Unsafe version of:thinlto_set_generated_objects_dir(long, java.nio.ByteBuffer)
static void
thinlto_codegen_add_cross_referenced_symbol(long cg, java.lang.CharSequence name)
Adds a symbol to the list of global symbols that are cross-referenced between ThinLTO files.static void
thinlto_codegen_add_cross_referenced_symbol(long cg, java.nio.ByteBuffer name)
Adds a symbol to the list of global symbols that are cross-referenced between ThinLTO files.static void
thinlto_codegen_add_module(long cg, java.lang.CharSequence identifier, java.nio.ByteBuffer data)
Add a module to a ThinLTO code generator.static void
thinlto_codegen_add_module(long cg, java.nio.ByteBuffer identifier, java.nio.ByteBuffer data)
Add a module to a ThinLTO code generator.static void
thinlto_codegen_add_must_preserve_symbol(long cg, java.lang.CharSequence name)
Adds a symbol to the list of global symbols that must exist in the final generated code.static void
thinlto_codegen_add_must_preserve_symbol(long cg, java.nio.ByteBuffer name)
Adds a symbol to the list of global symbols that must exist in the final generated code.static void
thinlto_codegen_disable_codegen(long cg, boolean disable)
Disable CodeGen, only run the stages till codegen and stop.static void
thinlto_codegen_dispose(long cg)
Frees the generator and all memory it internally allocated.static void
thinlto_codegen_process(long cg)
Optimize and codegen all the modules added to the codegenerator using ThinLTO.static void
thinlto_codegen_set_cache_dir(long cg, java.lang.CharSequence cache_dir)
Sets the path to a directory to use as a cache storage for incremental build.static void
thinlto_codegen_set_cache_dir(long cg, java.nio.ByteBuffer cache_dir)
Sets the path to a directory to use as a cache storage for incremental build.static void
thinlto_codegen_set_cache_entry_expiration(long cg, int expiration)
Sets the expiration (in seconds) for an entry in the cache.static void
thinlto_codegen_set_cache_pruning_interval(long cg, int interval)
Sets the cache pruning interval (in seconds).static void
thinlto_codegen_set_cache_size_bytes(long cg, int max_size_bytes)
Sets the maximum size of the cache directory (in bytes).static void
thinlto_codegen_set_cache_size_files(long cg, int max_size_files)
Sets the maximum number of files in the cache directory.static void
thinlto_codegen_set_cache_size_megabytes(long cg, int max_size_megabytes)
Same asthinlto_codegen_set_cache_size_bytes(long, int)
, except the maximum size is in megabytes (220 bytes).static void
thinlto_codegen_set_codegen_only(long cg, boolean codegen_only)
Perform CodeGen only: disable all other stages.static void
thinlto_codegen_set_cpu(long cg, java.lang.CharSequence cpu)
Sets the cpu to generate code for.static void
thinlto_codegen_set_cpu(long cg, java.nio.ByteBuffer cpu)
Sets the cpu to generate code for.static void
thinlto_codegen_set_final_cache_size_relative_to_available_space(long cg, int percentage)
Sets the maximum cache size that can be persistent across build, in terms of percentage of the available space on the disk.static boolean
thinlto_codegen_set_pic_model(long cg, int model)
Sets which PIC code model to generate.static void
thinlto_codegen_set_savetemps_dir(long cg, java.lang.CharSequence save_temps_dir)
Sets the path to a directory to use as a storage for temporary bitcode files.static void
thinlto_codegen_set_savetemps_dir(long cg, java.nio.ByteBuffer save_temps_dir)
Sets the path to a directory to use as a storage for temporary bitcode files.static long
thinlto_create_codegen()
Instantiates a ThinLTO code generator.static void
thinlto_debug_options(org.lwjgl.PointerBuffer options)
Parse-mllvm
style debug options.static int
thinlto_module_get_num_object_files(long cg)
Returns the number of object files produced by the ThinLTO CodeGenerator.static int
thinlto_module_get_num_objects(long cg)
Returns the number of object files produced by the ThinLTO CodeGenerator.static LTOObjectBuffer
thinlto_module_get_object(long cg, int index, LTOObjectBuffer __result)
Returns a reference to the ith object file produced by the ThinLTO CodeGenerator.static java.lang.String
thinlto_module_get_object_file(long cg, int index)
Returns the path to the ith object file produced by the ThinLTO CodeGenerator.static void
thinlto_set_generated_objects_dir(long cg, java.lang.CharSequence save_temps_dir)
Set the path to a directory where to save generated object files.static void
thinlto_set_generated_objects_dir(long cg, java.nio.ByteBuffer save_temps_dir)
Set the path to a directory where to save generated object files.
-
-
-
Field Detail
-
LTOAPI_VERSION
- See Also:
- Constant Field Values
-
LTOSYMBOL_ALIGNMENT_MASK, LTOSYMBOL_PERMISSIONS_MASK, LTOSYMBOL_PERMISSIONS_CODE, LTOSYMBOL_PERMISSIONS_DATA, LTOSYMBOL_PERMISSIONS_RODATA, LTOSYMBOL_DEFINITION_MASK, LTOSYMBOL_DEFINITION_REGULAR, LTOSYMBOL_DEFINITION_TENTATIVE, LTOSYMBOL_DEFINITION_WEAK, LTOSYMBOL_DEFINITION_UNDEFINED, LTOSYMBOL_DEFINITION_WEAKUNDEF, LTOSYMBOL_SCOPE_MASK, LTOSYMBOL_SCOPE_INTERNAL, LTOSYMBOL_SCOPE_HIDDEN, LTOSYMBOL_SCOPE_PROTECTED, LTOSYMBOL_SCOPE_DEFAULT, LTOSYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN, LTOSYMBOL_COMDAT, LTOSYMBOL_ALIAS
lto_symbol_attributes
Enum values:
SYMBOL_ALIGNMENT_MASK
- log2 of alignmentSYMBOL_PERMISSIONS_MASK
SYMBOL_PERMISSIONS_CODE
SYMBOL_PERMISSIONS_DATA
SYMBOL_PERMISSIONS_RODATA
SYMBOL_DEFINITION_MASK
SYMBOL_DEFINITION_REGULAR
SYMBOL_DEFINITION_TENTATIVE
SYMBOL_DEFINITION_WEAK
SYMBOL_DEFINITION_UNDEFINED
SYMBOL_DEFINITION_WEAKUNDEF
SYMBOL_SCOPE_MASK
SYMBOL_SCOPE_INTERNAL
SYMBOL_SCOPE_HIDDEN
SYMBOL_SCOPE_PROTECTED
SYMBOL_SCOPE_DEFAULT
SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN
SYMBOL_COMDAT
SYMBOL_ALIAS
-
LTOCODEGEN_PIC_MODEL_STATIC, LTOCODEGEN_PIC_MODEL_DYNAMIC, LTOCODEGEN_PIC_MODEL_DYNAMIC_NO_PIC, LTOCODEGEN_PIC_MODEL_DEFAULT
lto_codegen_model
Enum values:
-
LTODS_ERROR, LTODS_WARNING, LTODS_REMARK, LTODS_NOTE
Diagnostic severity.(
lto_codegen_diagnostic_severity_t
)Enum values:
DS_ERROR
DS_WARNING
DS_REMARK
- Added in LTO_API_VERSION=10.DS_NOTE
-
-
Method Detail
-
getLibrary
public static org.lwjgl.system.SharedLibrary getLibrary()
Returns the LTOSharedLibrary
.
-
nlto_get_version
public static long nlto_get_version()
Unsafe version of:get_version
-
lto_get_version
public static java.lang.String lto_get_version()
Returns a printable string.
-
nlto_get_error_message
public static long nlto_get_error_message()
Unsafe version of:get_error_message
-
lto_get_error_message
@Nullable public static java.lang.String lto_get_error_message()
Returns the last error string orNULL
if last operation was successful.
-
nlto_module_is_object_file
public static boolean nlto_module_is_object_file(long path)
Unsafe version of:module_is_object_file
-
lto_module_is_object_file
public static boolean lto_module_is_object_file(java.nio.ByteBuffer path) public static boolean lto_module_is_object_file(java.lang.CharSequence path)
Checks if a file is a loadable object file.
-
nlto_module_is_object_file_for_target
public static boolean nlto_module_is_object_file_for_target(long path, long target_triple_prefix)
Unsafe version of:module_is_object_file_for_target
-
lto_module_is_object_file_for_target
public static boolean lto_module_is_object_file_for_target(java.nio.ByteBuffer path, java.nio.ByteBuffer target_triple_prefix) public static boolean lto_module_is_object_file_for_target(java.lang.CharSequence path, java.lang.CharSequence target_triple_prefix)
Checks if a file is a loadable object compiled for requested target.
-
nlto_module_has_objc_category
public static boolean nlto_module_has_objc_category(long mem, long length)
Unsafe version of:module_has_objc_category
-
lto_module_has_objc_category
public static boolean lto_module_has_objc_category(java.nio.ByteBuffer mem)
Return true ifBuffer
contains a bitcode file with ObjC code (category or class) in it.
-
nlto_module_is_object_file_in_memory
public static boolean nlto_module_is_object_file_in_memory(long mem, long length)
Unsafe version of:module_is_object_file_in_memory
-
lto_module_is_object_file_in_memory
public static boolean lto_module_is_object_file_in_memory(java.nio.ByteBuffer mem)
Checks if a buffer is a loadable object file.
-
nlto_module_is_object_file_in_memory_for_target
public static boolean nlto_module_is_object_file_in_memory_for_target(long mem, long length, long target_triple_prefix)
Unsafe version of:module_is_object_file_in_memory_for_target
-
lto_module_is_object_file_in_memory_for_target
public static boolean lto_module_is_object_file_in_memory_for_target(java.nio.ByteBuffer mem, java.nio.ByteBuffer target_triple_prefix) public static boolean lto_module_is_object_file_in_memory_for_target(java.nio.ByteBuffer mem, java.lang.CharSequence target_triple_prefix)
Checks if a buffer is a loadable object compiled for requested target.
-
nlto_module_create
public static long nlto_module_create(long path)
Unsafe version of:module_create
-
lto_module_create
public static long lto_module_create(java.nio.ByteBuffer path) public static long lto_module_create(java.lang.CharSequence path)
Loads an object file from disk. ReturnsNULL
on error (checkget_error_message
for details).
-
nlto_module_create_from_memory
public static long nlto_module_create_from_memory(long mem, long length)
Unsafe version of:module_create_from_memory
-
lto_module_create_from_memory
public static long lto_module_create_from_memory(java.nio.ByteBuffer mem)
Loads an object file from memory. ReturnsNULL
on error (checkget_error_message
for details).
-
nlto_module_create_from_memory_with_path
public static long nlto_module_create_from_memory_with_path(long mem, long length, long path)
Unsafe version of:module_create_from_memory_with_path
-
lto_module_create_from_memory_with_path
public static long lto_module_create_from_memory_with_path(java.nio.ByteBuffer mem, java.nio.ByteBuffer path) public static long lto_module_create_from_memory_with_path(java.nio.ByteBuffer mem, java.lang.CharSequence path)
Loads an object file from memory with an extra path argument. ReturnsNULL
on error (checkget_error_message
for details).
-
nlto_module_create_in_local_context
public static long nlto_module_create_in_local_context(long mem, long length, long path)
Unsafe version of:module_create_in_local_context
-
lto_module_create_in_local_context
public static long lto_module_create_in_local_context(java.nio.ByteBuffer mem, java.nio.ByteBuffer path) public static long lto_module_create_in_local_context(java.nio.ByteBuffer mem, java.lang.CharSequence path)
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
usingcodegen_add_module
.Returns
NULL
on error (checkget_error_message
for details).
-
nlto_module_create_in_codegen_context
public static long nlto_module_create_in_codegen_context(long mem, long length, long path, long cg)
Unsafe version of:module_create_in_codegen_context
-
lto_module_create_in_codegen_context
public static long lto_module_create_in_codegen_context(java.nio.ByteBuffer mem, java.nio.ByteBuffer path, long cg) public static long lto_module_create_in_codegen_context(java.nio.ByteBuffer mem, java.lang.CharSequence path, long cg)
Loads an object file in the codegen context.Loads an object file into the same context as
cg
. The module is safe to add usingcodegen_add_module
.Returns
NULL
on error (checkget_error_message
for details).
-
nlto_module_create_from_fd
public static long nlto_module_create_from_fd(int fd, long path, long file_size)
Unsafe version of:module_create_from_fd
-
lto_module_create_from_fd
public static long lto_module_create_from_fd(int fd, java.nio.ByteBuffer path, long file_size) public static long lto_module_create_from_fd(int fd, java.lang.CharSequence path, long file_size)
Loads an object file from disk. The seek point offd
is not preserved. ReturnsNULL
on error (checkget_error_message
for details).
-
nlto_module_create_from_fd_at_offset
public static long nlto_module_create_from_fd_at_offset(int fd, long path, long file_size, long map_size, long offset)
Unsafe version of:module_create_from_fd_at_offset
-
lto_module_create_from_fd_at_offset
public static long lto_module_create_from_fd_at_offset(int fd, java.nio.ByteBuffer path, long file_size, long map_size, long offset) public static long lto_module_create_from_fd_at_offset(int fd, java.lang.CharSequence path, long file_size, long map_size, long offset)
Loads an object file from disk. The seek point offd
is not preserved. ReturnsNULL
on error (checkget_error_message
for details).
-
lto_module_dispose
public static void lto_module_dispose(long mod)
Frees all memory internally allocated by the module. Upon return thelto_module_t
is no longer valid.
-
nlto_module_get_target_triple
public static long nlto_module_get_target_triple(long mod)
Unsafe version of:module_get_target_triple
-
lto_module_get_target_triple
@Nullable public static java.lang.String lto_module_get_target_triple(long mod)
Returns triple string which the object module was compiled under.
-
nlto_module_set_target_triple
public static void nlto_module_set_target_triple(long mod, long triple)
Unsafe version of:module_set_target_triple
-
lto_module_set_target_triple
public static void lto_module_set_target_triple(long mod, java.nio.ByteBuffer triple) public static void lto_module_set_target_triple(long mod, java.lang.CharSequence triple)
Sets triple string with which the object will be codegened.
-
lto_module_get_num_symbols
public static int lto_module_get_num_symbols(long mod)
Returns the number of symbols in the object module.
-
nlto_module_get_symbol_name
public static long nlto_module_get_symbol_name(long mod, int index)
Unsafe version of:module_get_symbol_name
-
lto_module_get_symbol_name
@Nullable public static java.lang.String lto_module_get_symbol_name(long mod, int index)
Returns the name of the ith symbol in the object module.
-
lto_module_get_symbol_attribute
public static int lto_module_get_symbol_attribute(long mod, int index)
Returns the attributes of the ith symbol in the object module.
-
nlto_module_get_linkeropts
public static long nlto_module_get_linkeropts(long mod)
Unsafe version of:module_get_linkeropts
-
lto_module_get_linkeropts
@Nullable public static java.lang.String lto_module_get_linkeropts(long mod)
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.
-
nlto_codegen_set_diagnostic_handler
public static void nlto_codegen_set_diagnostic_handler(long cg, long handler, long ctxt)
Unsafe version of:codegen_set_diagnostic_handler
-
lto_codegen_set_diagnostic_handler
public static void lto_codegen_set_diagnostic_handler(long cg, LTODiagnosticHandlerI handler, long ctxt)
Set a diagnostic handler and the related context (void *
). This is more general thanget_error_message
, as the diagnostic handler can be called at anytime within lto.
-
lto_codegen_create
public static long lto_codegen_create()
Instantiates a code generator. ReturnsNULL
on error (checkget_error_message
for details).All modules added using
codegen_add_module
must have been created in the same context as the codegen.
-
lto_codegen_create_in_local_context
public static long lto_codegen_create_in_local_context()
Instantiate a code generator in its own context.Instantiates a code generator in its own context. Modules added via
codegen_add_module
must have all been created in the same context, usingmodule_create_in_codegen_context
.
-
lto_codegen_dispose
public static void lto_codegen_dispose(long cg)
Frees all code generator and all memory it internally allocated. Upon return thelto_code_gen_t
is no longer valid.
-
lto_codegen_add_module
public static boolean lto_codegen_add_module(long cg, long mod)
Add an object module to the set of modules for which code will be generated. Returns true on error (checkget_error_message
for details).cg
andmod
must both be in the same context. Seecodegen_create_in_local_context
andmodule_create_in_codegen_context
.
-
lto_codegen_set_module
public static void lto_codegen_set_module(long cg, long mod)
Sets the object module for code generation. This will transfer the ownership of the module to the code generator.cg
andmod
must both be in the same context.
-
lto_codegen_set_debug_model
public static boolean lto_codegen_set_debug_model(long cg, int model)
Sets if debug info should be generated. Returns true on error (checkget_error_message
for details).
-
lto_codegen_set_pic_model
public static boolean lto_codegen_set_pic_model(long cg, int model)
Sets which PIC code model to generated. Returns true on error (checkget_error_message
for details).
-
nlto_codegen_set_cpu
public static void nlto_codegen_set_cpu(long cg, long cpu)
Unsafe version of:codegen_set_cpu
-
lto_codegen_set_cpu
public static void lto_codegen_set_cpu(long cg, java.nio.ByteBuffer cpu) public static void lto_codegen_set_cpu(long cg, java.lang.CharSequence cpu)
Sets the cpu to generate code for.
-
nlto_codegen_set_assembler_path
public static void nlto_codegen_set_assembler_path(long cg, long path)
Unsafe version of:codegen_set_assembler_path
-
lto_codegen_set_assembler_path
public static void lto_codegen_set_assembler_path(long cg, java.nio.ByteBuffer path) public static void lto_codegen_set_assembler_path(long cg, java.lang.CharSequence path)
Sets the location of the assembler tool to run. If not set, libLTO will use gcc to invoke the assembler.
-
nlto_codegen_set_assembler_args
public static void nlto_codegen_set_assembler_args(long cg, long args, int nargs)
Unsafe version of:codegen_set_assembler_args
-
lto_codegen_set_assembler_args
public static void lto_codegen_set_assembler_args(long cg, org.lwjgl.PointerBuffer args)
Sets extra arguments that libLTO should pass to the assembler.
-
nlto_codegen_add_must_preserve_symbol
public static void nlto_codegen_add_must_preserve_symbol(long cg, long symbol)
Unsafe version of:codegen_add_must_preserve_symbol
-
lto_codegen_add_must_preserve_symbol
public static void lto_codegen_add_must_preserve_symbol(long cg, java.nio.ByteBuffer symbol) public static void lto_codegen_add_must_preserve_symbol(long cg, java.lang.CharSequence symbol)
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.
-
nlto_codegen_write_merged_modules
public static boolean nlto_codegen_write_merged_modules(long cg, long path)
Unsafe version of:codegen_write_merged_modules
-
lto_codegen_write_merged_modules
public static boolean lto_codegen_write_merged_modules(long cg, java.nio.ByteBuffer path) public static boolean lto_codegen_write_merged_modules(long cg, java.lang.CharSequence path)
Writes a new object file at the specified path that contains the merged contents of all modules added so far. Returns true on error (checkget_error_message
for details).
-
nlto_codegen_compile
public static long nlto_codegen_compile(long cg, long length)
Unsafe version of:codegen_compile
-
lto_codegen_compile
@Nullable public static java.nio.ByteBuffer lto_codegen_compile(long cg)
Generates code for all added modules into one native object file. This callscodegen_optimize
thencodegen_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 whencodegen_dispose
is called, orlto_codegen_compile()
is called again. On failure, returnsNULL
(checkget_error_message
for details).
-
nlto_codegen_compile_to_file
public static boolean nlto_codegen_compile_to_file(long cg, long name)
Unsafe version of:codegen_compile_to_file
-
lto_codegen_compile_to_file
public static boolean lto_codegen_compile_to_file(long cg, org.lwjgl.PointerBuffer name)
Generates code for all added modules into one native object file. This callscodegen_optimize
thencodegen_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.
-
lto_codegen_optimize
public static boolean lto_codegen_optimize(long cg)
Runs optimization for the merged module. Returns true on error.
-
nlto_codegen_compile_optimized
public static long nlto_codegen_compile_optimized(long cg, long length)
Unsafe version of:codegen_compile_optimized
-
lto_codegen_compile_optimized
@Nullable public static java.nio.ByteBuffer lto_codegen_compile_optimized(long cg)
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 whencodegen_dispose
is called, orlto_codegen_compile_optimized()
is called again. On failure, returnsNULL
(checkget_error_message
for details).
-
lto_api_version
public static int lto_api_version()
Returns the runtime API version.
-
nlto_codegen_debug_options
public static void nlto_codegen_debug_options(long cg, long options)
Unsafe version of:codegen_debug_options
-
lto_codegen_debug_options
public static void lto_codegen_debug_options(long cg, java.nio.ByteBuffer options) public static void lto_codegen_debug_options(long cg, java.lang.CharSequence options)
Sets options to help debug codegen bugs.
-
lto_initialize_disassembler
public static void lto_initialize_disassembler()
Initializes LLVM disassemblers.
-
lto_codegen_set_should_internalize
public static void lto_codegen_set_should_internalize(long cg, boolean ShouldInternalize)
Sets if we should run internalize pass during optimization and code generation.
-
lto_codegen_set_should_embed_uselists
public static void lto_codegen_set_should_embed_uselists(long cg, boolean ShouldEmbedUselists)
Set whether to embed uselists in bitcode.Sets whether
codegen_write_merged_modules
should embed uselists in output bitcode. This should be turned on for all-save-temps
output.
-
thinlto_create_codegen
public static long thinlto_create_codegen()
Instantiates a ThinLTO code generator. ReturnsNULL
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.
-
thinlto_codegen_dispose
public static void thinlto_codegen_dispose(long cg)
Frees the generator and all memory it internally allocated. Upon return thethinlto_code_gen_t
is no longer valid.
-
nthinlto_codegen_add_module
public static void nthinlto_codegen_add_module(long cg, long identifier, long data, int length)
Unsafe version of:thinlto_codegen_add_module(long, java.nio.ByteBuffer, java.nio.ByteBuffer)
-
thinlto_codegen_add_module
public static void thinlto_codegen_add_module(long cg, java.nio.ByteBuffer identifier, java.nio.ByteBuffer data) public static void thinlto_codegen_add_module(long cg, java.lang.CharSequence identifier, java.nio.ByteBuffer data)
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 thethinlto_code_gen_t
it is added to.On failure, returns
NULL
(checkget_error_message
for details).
-
thinlto_codegen_process
public static void thinlto_codegen_process(long cg)
Optimize and codegen all the modules added to the codegenerator using ThinLTO. Resulting objects are accessible usingthinlto_module_get_object(long, int, org.lwjgl.llvm.LTOObjectBuffer)
.
-
thinlto_module_get_num_objects
public static int thinlto_module_get_num_objects(long cg)
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.
-
nthinlto_module_get_object
public static void nthinlto_module_get_object(long cg, int index, long __functionAddress, long __result) public static void nthinlto_module_get_object(long cg, int index, long __result)
Unsafe version of:thinlto_module_get_object(long, int, org.lwjgl.llvm.LTOObjectBuffer)
-
thinlto_module_get_object
public static LTOObjectBuffer thinlto_module_get_object(long cg, int index, LTOObjectBuffer __result)
Returns a reference to the ith object file produced by the ThinLTO CodeGenerator.Client should use
thinlto_module_get_num_objects(long)
to get the number of available objects.
-
thinlto_module_get_num_object_files
public static int thinlto_module_get_num_object_files(long cg)
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.
-
nthinlto_module_get_object_file
public static long nthinlto_module_get_object_file(long cg, int index)
Unsafe version of:thinlto_module_get_object_file(long, int)
-
thinlto_module_get_object_file
@Nullable public static java.lang.String thinlto_module_get_object_file(long cg, int index)
Returns the path to the ith object file produced by the ThinLTO CodeGenerator.Client should use
thinlto_module_get_num_object_files(long)
to get the number of available objects.
-
thinlto_codegen_set_pic_model
public static boolean thinlto_codegen_set_pic_model(long cg, int model)
Sets which PIC code model to generate. Returns true on error (checkget_error_message
for details).
-
nthinlto_codegen_set_savetemps_dir
public static void nthinlto_codegen_set_savetemps_dir(long cg, long save_temps_dir)
Unsafe version of:thinlto_codegen_set_savetemps_dir(long, java.nio.ByteBuffer)
-
thinlto_codegen_set_savetemps_dir
public static void thinlto_codegen_set_savetemps_dir(long cg, java.nio.ByteBuffer save_temps_dir) public static void thinlto_codegen_set_savetemps_dir(long cg, java.lang.CharSequence save_temps_dir)
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.
-
nthinlto_set_generated_objects_dir
public static void nthinlto_set_generated_objects_dir(long cg, long save_temps_dir)
Unsafe version of:thinlto_set_generated_objects_dir(long, java.nio.ByteBuffer)
-
thinlto_set_generated_objects_dir
public static void thinlto_set_generated_objects_dir(long cg, java.nio.ByteBuffer save_temps_dir) public static void thinlto_set_generated_objects_dir(long cg, java.lang.CharSequence save_temps_dir)
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 throughthinlto_module_get_object_file(long, int)
instead ofthinlto_module_get_object(long, int, org.lwjgl.llvm.LTOObjectBuffer)
.
-
nthinlto_codegen_set_cpu
public static void nthinlto_codegen_set_cpu(long cg, long cpu)
Unsafe version of:thinlto_codegen_set_cpu(long, java.nio.ByteBuffer)
-
thinlto_codegen_set_cpu
public static void thinlto_codegen_set_cpu(long cg, java.nio.ByteBuffer cpu) public static void thinlto_codegen_set_cpu(long cg, java.lang.CharSequence cpu)
Sets the cpu to generate code for.
-
thinlto_codegen_disable_codegen
public static void thinlto_codegen_disable_codegen(long cg, boolean disable)
Disable CodeGen, only run the stages till codegen and stop. The output will be bitcode.
-
thinlto_codegen_set_codegen_only
public static void thinlto_codegen_set_codegen_only(long cg, boolean codegen_only)
Perform CodeGen only: disable all other stages.
-
nthinlto_debug_options
public static void nthinlto_debug_options(long options, int number)
Unsafe version of:thinlto_debug_options(org.lwjgl.PointerBuffer)
-
thinlto_debug_options
public static void thinlto_debug_options(org.lwjgl.PointerBuffer options)
Parse-mllvm
style debug options.
-
lto_module_is_thinlto
public static boolean lto_module_is_thinlto(long mod)
Test if a module has support for ThinLTO linking.
-
nthinlto_codegen_add_must_preserve_symbol
public static void nthinlto_codegen_add_must_preserve_symbol(long cg, long name, int length)
Unsafe version of:thinlto_codegen_add_must_preserve_symbol(long, java.nio.ByteBuffer)
-
thinlto_codegen_add_must_preserve_symbol
public static void thinlto_codegen_add_must_preserve_symbol(long cg, java.nio.ByteBuffer name) public static void thinlto_codegen_add_must_preserve_symbol(long cg, java.lang.CharSequence name)
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.
-
nthinlto_codegen_add_cross_referenced_symbol
public static void nthinlto_codegen_add_cross_referenced_symbol(long cg, long name, int length)
Unsafe version of:thinlto_codegen_add_cross_referenced_symbol(long, java.nio.ByteBuffer)
-
thinlto_codegen_add_cross_referenced_symbol
public static void thinlto_codegen_add_cross_referenced_symbol(long cg, java.nio.ByteBuffer name) public static void thinlto_codegen_add_cross_referenced_symbol(long cg, java.lang.CharSequence name)
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.
-
nthinlto_codegen_set_cache_dir
public static void nthinlto_codegen_set_cache_dir(long cg, long cache_dir)
Unsafe version of:thinlto_codegen_set_cache_dir(long, java.nio.ByteBuffer)
-
thinlto_codegen_set_cache_dir
public static void thinlto_codegen_set_cache_dir(long cg, java.nio.ByteBuffer cache_dir) public static void thinlto_codegen_set_cache_dir(long cg, java.lang.CharSequence cache_dir)
Sets the path to a directory to use as a cache storage for incremental build. Setting this activates caching.
-
thinlto_codegen_set_cache_pruning_interval
public static void thinlto_codegen_set_cache_pruning_interval(long cg, int interval)
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.
-
thinlto_codegen_set_final_cache_size_relative_to_available_space
public static void thinlto_codegen_set_final_cache_size_relative_to_available_space(long cg, int percentage)
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
-
thinlto_codegen_set_cache_entry_expiration
public static void thinlto_codegen_set_cache_entry_expiration(long cg, int expiration)
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.
-
thinlto_codegen_set_cache_size_bytes
public static void thinlto_codegen_set_cache_size_bytes(long cg, int max_size_bytes)
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.
-
thinlto_codegen_set_cache_size_megabytes
public static void thinlto_codegen_set_cache_size_megabytes(long cg, int max_size_megabytes)
Same asthinlto_codegen_set_cache_size_bytes(long, int)
, except the maximum size is in megabytes (220 bytes).
-
thinlto_codegen_set_cache_size_files
public static void thinlto_codegen_set_cache_size_files(long cg, int max_size_files)
Sets the maximum number of files in the cache directory. An unspecified default value will be applied. A value of 0 will be ignored.
-
-