Add new API lto_codegen_compile_parallel().
[oota-llvm.git] / include / llvm-c / lto.h
index 2bc0b543a5b4c1d958a011e36afda57b989f149f..907007c652502e769eb3445c8f03e600ec52da29 100644 (file)
@@ -13,8 +13,8 @@
 |*                                                                            *|
 \*===----------------------------------------------------------------------===*/
 
-#ifndef LTO_H
-#define LTO_H  1
+#ifndef LLVM_C_LTO_H
+#define LLVM_C_LTO_H
 
 #include <stdbool.h>
 #include <stddef.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 */
@@ -250,13 +250,6 @@ extern void
 lto_codegen_set_assembler_args(lto_code_gen_t cg, const char **args,
                                int nargs);
 
-/**
- * If set, then codegen will export all symbols (e.g. the internalize
- * pass won't run).
- */
-extern void
-lto_codegen_set_export_dynamic(lto_code_gen_t cg, bool val);
-
 /**
  * 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
@@ -291,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.