diff options
Diffstat (limited to 'tools/lto/LTOCodeGenerator.cpp')
-rw-r--r-- | tools/lto/LTOCodeGenerator.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp index 3fe7af2..daeb964 100644 --- a/tools/lto/LTOCodeGenerator.cpp +++ b/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) { + _nativeObjectFile(NULL), ObjBufVect(0) { InitializeAllTargets(); InitializeAllTargetMCs(); InitializeAllAsmPrinters(); @@ -85,6 +85,7 @@ 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) @@ -246,6 +247,23 @@ 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; |