summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShuxin Yang <shuxin.llvm@gmail.com>2013-08-27 17:15:54 +0000
committerShuxin Yang <shuxin.llvm@gmail.com>2013-08-27 17:15:54 +0000
commit388b52c0ced64ba12abd7746ecb6912b215a6540 (patch)
tree8e8cc1b86e823b8e6ed691a904775ec57ffbb7b4
parent1c71ab00e6d9c0ea6fe95baa309c9cb098c72a35 (diff)
downloadbcm5719-llvm-388b52c0ced64ba12abd7746ecb6912b215a6540.tar.gz
bcm5719-llvm-388b52c0ced64ba12abd7746ecb6912b215a6540.zip
Revert 189297, the original commit message is following.
---- 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. llvm-svn: 189386
-rw-r--r--llvm/include/llvm-c/lto.h18
-rw-r--r--llvm/tools/lto/LTOCodeGenerator.cpp20
-rw-r--r--llvm/tools/lto/LTOCodeGenerator.h12
-rw-r--r--llvm/tools/lto/lto.cpp5
-rw-r--r--llvm/tools/lto/lto.exports1
5 files changed, 2 insertions, 54 deletions
diff --git a/llvm/include/llvm-c/lto.h b/llvm/include/llvm-c/lto.h
index 907007c6525..40110fddfc1 100644
--- a/llvm/include/llvm-c/lto.h
+++ b/llvm/include/llvm-c/lto.h
@@ -27,7 +27,7 @@
* @{
*/
-#define LTO_API_VERSION 5
+#define LTO_API_VERSION 4
typedef enum {
LTO_SYMBOL_ALIGNMENT_MASK = 0x0000001F, /* log2 of alignment */
@@ -284,22 +284,6 @@ 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.
diff --git a/llvm/tools/lto/LTOCodeGenerator.cpp b/llvm/tools/lto/LTOCodeGenerator.cpp
index daeb9648e30..3fe7af25afd 100644
--- a/llvm/tools/lto/LTOCodeGenerator.cpp
+++ b/llvm/tools/lto/LTOCodeGenerator.cpp
@@ -74,7 +74,7 @@ LTOCodeGenerator::LTOCodeGenerator()
_linker(new Module("ld-temp.o", _context)), _target(NULL),
_emitDwarfDebugInfo(false), _scopeRestrictionsDone(false),
_codeModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC),
- _nativeObjectFile(NULL), ObjBufVect(0) {
+ _nativeObjectFile(NULL) {
InitializeAllTargets();
InitializeAllTargetMCs();
InitializeAllAsmPrinters();
@@ -85,7 +85,6 @@ LTOCodeGenerator::~LTOCodeGenerator() {
delete _target;
delete _nativeObjectFile;
delete _linker.getModule();
- delete[] ObjBufVect;
for (std::vector<char*>::iterator I = _codegenOptions.begin(),
E = _codegenOptions.end(); I != E; ++I)
@@ -247,23 +246,6 @@ const void* LTOCodeGenerator::compile(size_t* length, std::string& errMsg) {
return _nativeObjectFile->getBufferStart();
}
-// Currently compile() and compile_parallel() have no difference.
-NativeObjectFile *LTOCodeGenerator::compile_parallel(size_t *count,
- std::string &ErrMsg) {
- assert(ObjBufVect == 0 && "Should be NULL");
-
- size_t Len;
- const void *Buf = compile(&Len, ErrMsg);
- if (!Buf)
- return 0;
-
- *count = 1;
- ObjBufVect = new NativeObjectFile[1];
- ObjBufVect[0].content = Buf;
- ObjBufVect[0].length = Len;
- return ObjBufVect;
-}
-
bool LTOCodeGenerator::determineTarget(std::string &errMsg) {
if (_target != NULL)
return true;
diff --git a/llvm/tools/lto/LTOCodeGenerator.h b/llvm/tools/lto/LTOCodeGenerator.h
index 21c6b212925..8f37cf0e1d5 100644
--- a/llvm/tools/lto/LTOCodeGenerator.h
+++ b/llvm/tools/lto/LTOCodeGenerator.h
@@ -102,17 +102,6 @@ struct LTOCodeGenerator {
//
const void *compile(size_t *length, std::string &errMsg);
- // Corresponding to lto_codegen_compile_parallel() API.
- // 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).
- //
- NativeObjectFile *compile_parallel(size_t *count, std::string &ErrMsg);
-
private:
void initializeLTOPasses();
@@ -138,7 +127,6 @@ private:
std::vector<char*> _codegenOptions;
std::string _mCpu;
std::string _nativeObjectPath;
- NativeObjectFile *ObjBufVect;
};
#endif // LTO_CODE_GENERATOR_H
diff --git a/llvm/tools/lto/lto.cpp b/llvm/tools/lto/lto.cpp
index bbb6071ce8a..db7147c2bc7 100644
--- a/llvm/tools/lto/lto.cpp
+++ b/llvm/tools/lto/lto.cpp
@@ -207,11 +207,6 @@ bool lto_codegen_compile_to_file(lto_code_gen_t cg, const char **name) {
return !cg->compile_to_file(name, sLastErrorString);
}
-extern const struct NativeObjectFile *
-lto_codegen_compile_parallel(lto_code_gen_t cg, size_t *count) {
- return cg->compile_parallel(count, sLastErrorString);
-}
-
/// lto_codegen_debug_options - Used to pass extra options to the code
/// generator.
void lto_codegen_debug_options(lto_code_gen_t cg, const char *opt) {
diff --git a/llvm/tools/lto/lto.exports b/llvm/tools/lto/lto.exports
index 61f0817f335..46d0d74c82a 100644
--- a/llvm/tools/lto/lto.exports
+++ b/llvm/tools/lto/lto.exports
@@ -28,7 +28,6 @@ lto_codegen_set_assembler_args
lto_codegen_set_assembler_path
lto_codegen_set_cpu
lto_codegen_compile_to_file
-lto_codegen_compile_parallel
LLVMCreateDisasm
LLVMCreateDisasmCPU
LLVMDisasmDispose
OpenPOWER on IntegriCloud