aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm-c
diff options
context:
space:
mode:
authorShuxin Yang <shuxin.llvm@gmail.com>2013-08-27 00:03:23 +0000
committerShuxin Yang <shuxin.llvm@gmail.com>2013-08-27 00:03:23 +0000
commite3427a5815ca3993584af6db28524f0c424b749e (patch)
tree83b9e74741bc9fa0f523e79bae4b6d87396d6860 /include/llvm-c
parentfdaf0308c8d2d58dc156e553fb11947a0a3dfafb (diff)
downloadexternal_llvm-e3427a5815ca3993584af6db28524f0c424b749e.zip
external_llvm-e3427a5815ca3993584af6db28524f0c424b749e.tar.gz
external_llvm-e3427a5815ca3993584af6db28524f0c424b749e.tar.bz2
Add new API lto_codegen_compile_parallel().
This API is proposed by Nick Kledzik. The semantic is: -------------------------------------------------------------------------- Generate code for merged module into an array of native object files. On success returns a pointer to an array of NativeObjectFile. The count parameter returns the number of elements in the array. Each element is a pointer/length for a generated mach-o/ELF buffer. 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). extern const struct NativeObjectFile* lto_codegen_compile_parallel(lto_code_gen_t cg, size_t *count); --------------------------------------------------------------------------- This API is currently only called on OSX platform. Linux or other Unixes using GNU gold are not supposed to call this function, because on these systems, object files are fed back to linker via disk file instead of memory buffer. In this commit, lto_codegen_compile_parallel() simply calls lto_codegen_compile() to return a single object file. In the near future, this function is the entry point for compilation with partition. Linker can blindly call this function even if partition is turned off; in this case, compiler will return only one object file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189297 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm-c')
-rw-r--r--include/llvm-c/lto.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/llvm-c/lto.h b/include/llvm-c/lto.h
index 40110fd..907007c 100644
--- a/include/llvm-c/lto.h
+++ b/include/llvm-c/lto.h
@@ -27,7 +27,7 @@
* @{
*/
-#define LTO_API_VERSION 4
+#define LTO_API_VERSION 5
typedef enum {
LTO_SYMBOL_ALIGNMENT_MASK = 0x0000001F, /* log2 of alignment */
@@ -284,6 +284,22 @@ lto_codegen_compile(lto_code_gen_t cg, size_t* length);
extern bool
lto_codegen_compile_to_file(lto_code_gen_t cg, const char** name);
+struct NativeObjectFile {
+ const void *content;
+ size_t length;
+};
+
+/**
+ * Generates code for merged module into an array of native object files.
+ * On success returns a pointer to an array of NativeObjectFile. The
+ * count parameter returns the number of elements in the array. Each
+ * element is a pointer/length for a generated mach-o/ELF buffer. 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).
+ */
+extern const struct NativeObjectFile*
+lto_codegen_compile_parallel(lto_code_gen_t cg, size_t *count);
/**
* Sets options to help debug codegen bugs.