X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm-c%2Flto.h;h=02105bcde96311ed9307a73b5d22bc0e4de9f753;hb=07d5aef3057b2e403b20d683e7477c93fde67d99;hp=c0f4c6b30c8c1d7297480123f73d17345826539c;hpb=3029a0c56a1e4249746ff6b54d825e88fee6cddf;p=oota-llvm.git diff --git a/include/llvm-c/lto.h b/include/llvm-c/lto.h index c0f4c6b30c8..02105bcde96 100644 --- a/include/llvm-c/lto.h +++ b/include/llvm-c/lto.h @@ -13,12 +13,25 @@ |* *| \*===----------------------------------------------------------------------===*/ -#ifndef LTO_H -#define LTO_H 1 +#ifndef LLVM_C_LTO_H +#define LLVM_C_LTO_H -#include #include -#include +#include + +#ifndef __cplusplus +#if !defined(_MSC_VER) +#include +typedef bool lto_bool_t; +#else +// MSVC in particular does not have anything like _Bool or bool in C, but we can +// at least make sure the type is the same size. The implementation side will +// use C++ bool. +typedef unsigned char lto_bool_t; +#endif +#else +typedef bool lto_bool_t; +#endif /** * @defgroup LLVMCLTO LTO @@ -27,7 +40,7 @@ * @{ */ -#define LTO_API_VERSION 4 +#define LTO_API_VERSION 5 typedef enum { LTO_SYMBOL_ALIGNMENT_MASK = 0x0000001F, /* log2 of alignment */ @@ -87,14 +100,14 @@ lto_get_error_message(void); /** * Checks if a file is a loadable object file. */ -extern bool +extern lto_bool_t lto_module_is_object_file(const char* path); /** * Checks if a file is a loadable object compiled for requested target. */ -extern bool +extern lto_bool_t lto_module_is_object_file_for_target(const char* path, const char* target_triple_prefix); @@ -102,14 +115,14 @@ lto_module_is_object_file_for_target(const char* path, /** * Checks if a buffer is a loadable object file. */ -extern bool +extern lto_bool_t lto_module_is_object_file_in_memory(const void* mem, size_t length); /** * Checks if a buffer is a loadable object compiled for requested target. */ -extern bool +extern lto_bool_t lto_module_is_object_file_in_memory_for_target(const void* mem, size_t length, const char* target_triple_prefix); @@ -208,7 +221,7 @@ lto_codegen_dispose(lto_code_gen_t); * 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). */ -extern bool +extern lto_bool_t lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod); @@ -217,7 +230,7 @@ lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod); * Sets if debug info should be generated. * Returns true on error (check lto_get_error_message() for details). */ -extern bool +extern lto_bool_t lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model); @@ -225,7 +238,7 @@ lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model); * Sets which PIC code model to generated. * Returns true on error (check lto_get_error_message() for details). */ -extern bool +extern lto_bool_t lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model); @@ -251,25 +264,27 @@ lto_codegen_set_assembler_args(lto_code_gen_t cg, const char **args, int nargs); /** - * Enables the internalize pass during LTO optimizations. + * Tells LTO optimization passes that this symbol must be preserved + * because it is referenced by native code or a command line option. */ extern void -lto_codegen_whole_program_optimization(lto_code_gen_t cg); +lto_codegen_add_must_preserve_symbol(lto_code_gen_t cg, const char* symbol); + /** - * Adds to a list of all global symbols that must exist in the final - * generated code. If a function is not listed, it might be - * inlined into every usage and optimized away. + * Tells LTO optimization passes that a dynamic shared library is being + * built and this symbol may be exported. Unless IR semantics allow the symbol + * to be made local to the library, it should remain so it can be exported by + * the shared library. */ -extern void -lto_codegen_add_must_preserve_symbol(lto_code_gen_t cg, const char* symbol); +extern void lto_codegen_add_dso_symbol(lto_code_gen_t cg, const char *symbol); /** * 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). */ -extern bool +extern lto_bool_t lto_codegen_write_merged_modules(lto_code_gen_t cg, const char* path); /** @@ -287,7 +302,7 @@ lto_codegen_compile(lto_code_gen_t cg, size_t* length); * Generates code for all added modules into one native object file. * The name of the file is written to name. Returns true on error. */ -extern bool +extern lto_bool_t lto_codegen_compile_to_file(lto_code_gen_t cg, const char** name); @@ -297,6 +312,13 @@ lto_codegen_compile_to_file(lto_code_gen_t cg, const char** name); extern void lto_codegen_debug_options(lto_code_gen_t cg, const char *); +/** + * Initializes LLVM disassemblers. + * FIXME: This doesn't really belong here. + */ +extern void +lto_initialize_disassembler(void); + #ifdef __cplusplus } #endif