git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193255
91177308-0d34-0410-b5e6-
96231b3b80d8
#ifndef LLVM_C_LTO_H
#define LLVM_C_LTO_H
#ifndef LLVM_C_LTO_H
#define LLVM_C_LTO_H
-#ifndef __cplusplus
-#include <stdbool.h>
-#endif
#include <stddef.h>
#include <sys/types.h>
#include <stddef.h>
#include <sys/types.h>
/**
* Checks if a file is a loadable object file.
*/
/**
* Checks if a file is a loadable object file.
*/
lto_module_is_object_file(const char* path);
/**
* Checks if a file is a loadable object compiled for requested target.
*/
lto_module_is_object_file(const char* path);
/**
* Checks if a file is a loadable object compiled for requested target.
*/
lto_module_is_object_file_for_target(const char* path,
const char* target_triple_prefix);
lto_module_is_object_file_for_target(const char* path,
const char* target_triple_prefix);
/**
* Checks if a buffer is a loadable object file.
*/
/**
* Checks if a buffer is a loadable object file.
*/
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.
*/
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.
*/
lto_module_is_object_file_in_memory_for_target(const void* mem, size_t length,
const char* target_triple_prefix);
lto_module_is_object_file_in_memory_for_target(const void* mem, size_t length,
const char* target_triple_prefix);
* 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).
*/
* 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).
*/
lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod);
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).
*/
* Sets if debug info should be generated.
* Returns true on error (check lto_get_error_message() for details).
*/
lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model);
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).
*/
* Sets which PIC code model to generated.
* Returns true on error (check lto_get_error_message() for details).
*/
lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model);
lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model);
* merged contents of all modules added so far.
* Returns true on error (check lto_get_error_message() for details).
*/
* merged contents of all modules added so far.
* Returns true on error (check lto_get_error_message() for details).
*/
lto_codegen_write_merged_modules(lto_code_gen_t cg, const char* path);
/**
lto_codegen_write_merged_modules(lto_code_gen_t cg, const char* path);
/**
* Generates code for all added modules into one native object file.
* The name of the file is written to name. Returns true on error.
*/
* Generates code for all added modules into one native object file.
* The name of the file is written to name. Returns true on error.
*/
lto_codegen_compile_to_file(lto_code_gen_t cg, const char** name);
lto_codegen_compile_to_file(lto_code_gen_t cg, const char** name);
}
/// lto_module_is_object_file - Validates if a file is a loadable object file.
}
/// lto_module_is_object_file - Validates if a file is a loadable object file.
-bool lto_module_is_object_file(const char* path) {
+int lto_module_is_object_file(const char* path) {
return LTOModule::isBitcodeFile(path);
}
/// lto_module_is_object_file_for_target - Validates if a file is a loadable
/// object file compilable for requested target.
return LTOModule::isBitcodeFile(path);
}
/// lto_module_is_object_file_for_target - Validates if a file is a loadable
/// object file compilable for requested target.
-bool lto_module_is_object_file_for_target(const char* path,
+int lto_module_is_object_file_for_target(const char* path,
const char* target_triplet_prefix) {
return LTOModule::isBitcodeFileForTarget(path, target_triplet_prefix);
}
/// lto_module_is_object_file_in_memory - Validates if a buffer is a loadable
/// object file.
const char* target_triplet_prefix) {
return LTOModule::isBitcodeFileForTarget(path, target_triplet_prefix);
}
/// lto_module_is_object_file_in_memory - Validates if a buffer is a loadable
/// object file.
-bool lto_module_is_object_file_in_memory(const void* mem, size_t length) {
+int lto_module_is_object_file_in_memory(const void* mem, size_t length) {
return LTOModule::isBitcodeFile(mem, length);
}
/// lto_module_is_object_file_in_memory_for_target - Validates if a buffer is a
/// loadable object file compilable for the target.
return LTOModule::isBitcodeFile(mem, length);
}
/// lto_module_is_object_file_in_memory_for_target - Validates if a buffer is a
/// loadable object file compilable for the target.
lto_module_is_object_file_in_memory_for_target(const void* mem,
size_t length,
const char* target_triplet_prefix) {
lto_module_is_object_file_in_memory_for_target(const void* mem,
size_t length,
const char* target_triplet_prefix) {
/// lto_codegen_add_module - 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).
/// lto_codegen_add_module - 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).
-bool lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod) {
+int lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod) {
return !cg->addModule(mod, sLastErrorString);
}
/// lto_codegen_set_debug_model - Sets what if any format of debug info should
/// be generated. Returns true on error (check lto_get_error_message() for
/// details).
return !cg->addModule(mod, sLastErrorString);
}
/// lto_codegen_set_debug_model - Sets what if any format of debug info should
/// be generated. Returns true on error (check lto_get_error_message() for
/// details).
-bool lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model debug) {
+int lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model debug) {
cg->setDebugInfo(debug);
return false;
}
/// lto_codegen_set_pic_model - Sets what code model to generated. Returns true
/// on error (check lto_get_error_message() for details).
cg->setDebugInfo(debug);
return false;
}
/// lto_codegen_set_pic_model - Sets what code model to generated. Returns true
/// on error (check lto_get_error_message() for details).
-bool lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model model) {
+int lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model model) {
cg->setCodePICModel(model);
return false;
}
cg->setCodePICModel(model);
return false;
}
/// lto_codegen_write_merged_modules - Writes a new 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).
/// lto_codegen_write_merged_modules - Writes a new 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).
-bool lto_codegen_write_merged_modules(lto_code_gen_t cg, const char *path) {
+int lto_codegen_write_merged_modules(lto_code_gen_t cg, const char *path) {
if (!parsedOptions) {
cg->parseCodeGenDebugOptions();
parsedOptions = true;
if (!parsedOptions) {
cg->parseCodeGenDebugOptions();
parsedOptions = true;
/// lto_codegen_compile_to_file - Generates code for all added modules into one
/// native object file. The name of the file is written to name. Returns true on
/// error.
/// lto_codegen_compile_to_file - Generates code for all added modules into one
/// native object file. The name of the file is written to name. Returns true on
/// error.
-bool lto_codegen_compile_to_file(lto_code_gen_t cg, const char **name) {
+int lto_codegen_compile_to_file(lto_code_gen_t cg, const char **name) {
if (!parsedOptions) {
cg->parseCodeGenDebugOptions();
parsedOptions = true;
if (!parsedOptions) {
cg->parseCodeGenDebugOptions();
parsedOptions = true;