|
LLVM
4.0.0
|
C++ class which implements the opaque lto_code_gen_t type. More...
#include <LTOCodeGenerator.h>
Public Member Functions | |
| LTOCodeGenerator (LLVMContext &Context) | |
| ~LTOCodeGenerator () | |
| bool | addModule (struct LTOModule *) |
| Merge given module. More... | |
| void | setModule (std::unique_ptr< LTOModule > M) |
| Set the destination module. More... | |
| void | setAsmUndefinedRefs (struct LTOModule *) |
| void | setTargetOptions (const TargetOptions &Options) |
| void | setDebugInfo (lto_debug_model) |
| void | setCodePICModel (Optional< Reloc::Model > Model) |
| void | setFileType (TargetMachine::CodeGenFileType FT) |
| Set the file type to be emitted (assembly or object code). More... | |
| void | setCpu (StringRef MCpu) |
| void | setAttr (StringRef MAttr) |
| void | setOptLevel (unsigned OptLevel) |
| void | setShouldInternalize (bool Value) |
| void | setShouldEmbedUselists (bool Value) |
| void | setShouldRestoreGlobalsLinkage (bool Value) |
| Restore linkage of globals. More... | |
| void | addMustPreserveSymbol (StringRef Sym) |
| void | setCodeGenDebugOptions (StringRef Opts) |
| Pass options to the driver and optimization passes. More... | |
| void | parseCodeGenDebugOptions () |
| Parse the options set in setCodeGenDebugOptions. More... | |
| bool | writeMergedModules (StringRef Path) |
| Write the merged module to the file specified by the given path. More... | |
| bool | compile_to_file (const char **Name, bool DisableVerify, bool DisableInline, bool DisableGVNLoadPRE, bool DisableVectorization) |
| Compile the merged module into a single output file; the path to output file is returned to the caller via argument "name". More... | |
| std::unique_ptr< MemoryBuffer > | compile (bool DisableVerify, bool DisableInline, bool DisableGVNLoadPRE, bool DisableVectorization) |
| As with compile_to_file(), this function compiles the merged module into single output file. More... | |
| bool | optimize (bool DisableVerify, bool DisableInline, bool DisableGVNLoadPRE, bool DisableVectorization) |
| Optimizes the merged module. More... | |
| std::unique_ptr< MemoryBuffer > | compileOptimized () |
| Compiles the merged optimized module into a single output file. More... | |
| bool | compileOptimized (ArrayRef< raw_pwrite_stream * > Out) |
| Compile the merged optimized module into out.size() output files each representing a linkable partition of the module. More... | |
| void | setDiagnosticHandler (lto_diagnostic_handler_t, void *) |
| LLVMContext & | getContext () |
| void | resetMergedModule () |
Static Public Member Functions | |
| static const char * | getVersionString () |
C++ class which implements the opaque lto_code_gen_t type.
Definition at line 65 of file LTOCodeGenerator.h.
| LTOCodeGenerator::LTOCodeGenerator | ( | LLVMContext & | Context | ) |
Definition at line 106 of file LTOCodeGenerator.cpp.
References llvm::LLVMContext::enableDebugTypeODRUniquing(), llvm::LTODiscardValueNames, and llvm::LLVMContext::setDiscardValueNames().
| LTOCodeGenerator::~LTOCodeGenerator | ( | ) |
Definition at line 114 of file LTOCodeGenerator.cpp.
Merge given module.
Return true on success.
Resets HasVerifiedInput.
Definition at line 151 of file LTOCodeGenerator.cpp.
References assert(), llvm::Module::getContext(), llvm::LTOModule::getModule(), setAsmUndefinedRefs(), and llvm::LTOModule::takeModule().
|
inline |
Definition at line 113 of file LTOCodeGenerator.h.
| std::unique_ptr< MemoryBuffer > LTOCodeGenerator::compile | ( | bool | DisableVerify, |
| bool | DisableInline, | ||
| bool | DisableGVNLoadPRE, | ||
| bool | DisableVectorization | ||
| ) |
As with compile_to_file(), this function compiles the merged module into single output file.
Instead of returning the output file path to the caller (linker), it brings the output to a buffer, and returns the buffer to the caller. This function should delete the intermediate file once its content is brought to memory. Return NULL if the compilation was not successful.
Definition at line 321 of file LTOCodeGenerator.cpp.
References compileOptimized(), and optimize().
| bool LTOCodeGenerator::compile_to_file | ( | const char ** | Name, |
| bool | DisableVerify, | ||
| bool | DisableInline, | ||
| bool | DisableGVNLoadPRE, | ||
| bool | DisableVectorization | ||
| ) |
Compile the merged module into a single output file; the path to output file is returned to the caller via argument "name".
Return true on success.
Definition at line 309 of file LTOCodeGenerator.cpp.
References optimize().
| std::unique_ptr< MemoryBuffer > LTOCodeGenerator::compileOptimized | ( | ) |
Compiles the merged optimized module into a single output file.
It brings the output to a buffer, and returns the buffer to the caller. Return NULL if the compilation was not successful.
Definition at line 289 of file LTOCodeGenerator.cpp.
References llvm::ErrorOr< T >::getError(), llvm::MemoryBuffer::getFile(), name, and llvm::sys::fs::remove().
Referenced by compile().
| bool LTOCodeGenerator::compileOptimized | ( | ArrayRef< raw_pwrite_stream * > | Out | ) |
Compile the merged optimized module into out.size() output files each representing a linkable partition of the module.
If out contains more than one element, code generation is done in parallel with out.size() threads. Output files will be written to members of out. Returns true on success.
Calls verifyMergedModuleOnce().
Definition at line 582 of file LTOCodeGenerator.cpp.
References llvm::legacy::PassManager::add(), llvm::AreStatisticsEnabled(), llvm::createObjCARCContractPass(), llvm::PrintStatistics(), llvm::legacy::PassManager::run(), and llvm::splitCodeGen().
|
inline |
Definition at line 179 of file LTOCodeGenerator.h.
|
static |
Definition at line 66 of file LTOCodeGenerator.cpp.
| bool LTOCodeGenerator::optimize | ( | bool | DisableVerify, |
| bool | DisableInline, | ||
| bool | DisableGVNLoadPRE, | ||
| bool | DisableVectorization | ||
| ) |
Optimizes the merged module.
Optimize merged modules using various IPO passes.
Returns true on success.
Calls verifyMergedModuleOnce().
Definition at line 537 of file LTOCodeGenerator.cpp.
References llvm::legacy::PassManager::add(), llvm::createFunctionInliningPass(), llvm::createTargetTransformInfoWrapperPass(), llvm::PassManagerBuilder::DisableGVNLoadPRE, and llvm::legacy::PassManager::run().
Referenced by compile(), and compile_to_file().
| void LTOCodeGenerator::parseCodeGenDebugOptions | ( | ) |
Parse the options set in setCodeGenDebugOptions.
Like setCodeGenDebugOptions(), this must be called before LTOCodeGenerator::compilexxx() and LTOCodeGenerator::writeMergedModules().
Definition at line 627 of file LTOCodeGenerator.cpp.
References llvm::cl::ParseCommandLineOptions().
|
inline |
Definition at line 181 of file LTOCodeGenerator.h.
| void LTOCodeGenerator::setAsmUndefinedRefs | ( | struct LTOModule * | Mod | ) |
Definition at line 145 of file LTOCodeGenerator.cpp.
References llvm::LTOModule::getAsmUndefinedRefs(), and i.
Referenced by addModule(), and setModule().
|
inline |
Definition at line 91 of file LTOCodeGenerator.h.
| void LTOCodeGenerator::setCodeGenDebugOptions | ( | StringRef | Options | ) |
Pass options to the driver and optimization passes.
setCodeGenDebugOptions - Set codegen debugging options to aid in debugging LTO problems.
These options are not necessarily for debugging purpose (the function name is misleading). This function should be called before LTOCodeGenerator::compilexxx(), and LTOCodeGenerator::writeMergedModules().
Definition at line 621 of file LTOCodeGenerator.cpp.
References llvm::getToken().
|
inline |
Definition at line 84 of file LTOCodeGenerator.h.
|
inline |
Definition at line 90 of file LTOCodeGenerator.h.
| void LTOCodeGenerator::setDebugInfo | ( | lto_debug_model | Debug | ) |
Definition at line 182 of file LTOCodeGenerator.cpp.
References llvm_unreachable, LTO_DEBUG_MODEL_DWARF, and LTO_DEBUG_MODEL_NONE.
| void LTOCodeGenerator::setDiagnosticHandler | ( | lto_diagnostic_handler_t | DiagHandler, |
| void * | Ctxt | ||
| ) |
Definition at line 674 of file LTOCodeGenerator.cpp.
|
inline |
Set the file type to be emitted (assembly or object code).
The default is TargetMachine::CGFT_ObjectFile.
Definition at line 88 of file LTOCodeGenerator.h.
| void LTOCodeGenerator::setModule | ( | std::unique_ptr< LTOModule > | M | ) |
Set the destination module.
Resets HasVerifiedInput.
Definition at line 164 of file LTOCodeGenerator.cpp.
References assert(), llvm::StringMap< ValueTy, AllocatorTy >::clear(), and setAsmUndefinedRefs().
| void LTOCodeGenerator::setOptLevel | ( | unsigned | OptLevel | ) |
Definition at line 195 of file LTOCodeGenerator.cpp.
References llvm::CodeGenOpt::Aggressive, llvm::CodeGenOpt::Default, llvm::CodeGenOpt::Less, llvm_unreachable, and llvm::CodeGenOpt::None.
|
inline |
Definition at line 95 of file LTOCodeGenerator.h.
|
inline |
Definition at line 94 of file LTOCodeGenerator.h.
|
inline |
Restore linkage of globals.
When set, the linkage of globals will be restored prior to code generation. That is, a global symbol that had external linkage prior to LTO will be emitted with external linkage again; and a local will remain local. Note that this option only affects the end result - globals may still be internalized in the process of LTO and may be modified and/or deleted where legal.
The default behavior will internalize globals (unless on the preserve list) and, if parallel code generation is enabled, will externalize all locals.
Definition at line 109 of file LTOCodeGenerator.h.
| void LTOCodeGenerator::setTargetOptions | ( | const TargetOptions & | Options | ) |
Definition at line 178 of file LTOCodeGenerator.cpp.
Write the merged module to the file specified by the given path.
Return true on success.
Calls verifyMergedModuleOnce().
Definition at line 214 of file LTOCodeGenerator.cpp.
References llvm::raw_fd_ostream::clear_error(), llvm::raw_fd_ostream::close(), llvm::sys::fs::F_None, llvm::raw_fd_ostream::has_error(), llvm::tool_output_file::keep(), llvm::tool_output_file::os(), and llvm::WriteBitcodeToFile().
1.8.6