|
LLVM
5.0.0
|
C++ class which implements the opaque lto_code_gen_t type. More...
#include "llvm/LTO/legacy/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 | setFreestanding (bool Enabled) |
| Enable the Freestanding mode: indicate that the optimizer should not assume builtins are present on the target. 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 66 of file LTOCodeGenerator.h.
| LTOCodeGenerator::LTOCodeGenerator | ( | LLVMContext & | Context | ) |
Definition at line 107 of file LTOCodeGenerator.cpp.
References llvm::LLVMContext::enableDebugTypeODRUniquing(), llvm::LTODiscardValueNames, and llvm::LLVMContext::setDiscardValueNames().
| LTOCodeGenerator::~LTOCodeGenerator | ( | ) |
Definition at line 115 of file LTOCodeGenerator.cpp.
Merge given module.
Return true on success.
Resets HasVerifiedInput.
Definition at line 153 of file LTOCodeGenerator.cpp.
References assert(), llvm::Module::getContext(), llvm::LTOModule::getModule(), setAsmUndefinedRefs(), and llvm::LTOModule::takeModule().
|
inline |
Definition at line 114 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 323 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 311 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 291 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 569 of file LTOCodeGenerator.cpp.
References llvm::legacy::PassManager::add(), llvm::AreStatisticsEnabled(), llvm::createObjCARCContractPass(), llvm::PrintStatistics(), llvm::reportAndResetTimings(), llvm::legacy::PassManager::run(), and llvm::splitCodeGen().
|
inline |
Definition at line 184 of file LTOCodeGenerator.h.
Definition at line 67 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 517 of file LTOCodeGenerator.cpp.
References llvm::legacy::PassManager::add(), llvm::createFunctionInliningPass(), llvm::createTargetTransformInfoWrapperPass(), llvm::PassManagerBuilder::DisableGVNLoadPRE, llvm::errs(), llvm::LTOPassRemarksWithHotness, llvm::LTORemarksFilename, llvm::report_fatal_error(), llvm::legacy::PassManager::run(), llvm::lto::setupOptimizationRemarks(), and llvm::toString().
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 615 of file LTOCodeGenerator.cpp.
References llvm::cl::ParseCommandLineOptions().
|
inline |
Definition at line 186 of file LTOCodeGenerator.h.
| void LTOCodeGenerator::setAsmUndefinedRefs | ( | struct LTOModule * | Mod | ) |
Definition at line 147 of file LTOCodeGenerator.cpp.
References llvm::LTOModule::getAsmUndefinedRefs().
Referenced by addModule(), and setModule().
|
inline |
Definition at line 92 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 609 of file LTOCodeGenerator.cpp.
References llvm::getToken().
|
inline |
Definition at line 85 of file LTOCodeGenerator.h.
|
inline |
Definition at line 91 of file LTOCodeGenerator.h.
| void LTOCodeGenerator::setDebugInfo | ( | lto_debug_model | Debug | ) |
Definition at line 184 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 662 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 89 of file LTOCodeGenerator.h.
|
inline |
Enable the Freestanding mode: indicate that the optimizer should not assume builtins are present on the target.
Definition at line 180 of file LTOCodeGenerator.h.
References Enabled.
| void LTOCodeGenerator::setModule | ( | std::unique_ptr< LTOModule > | M | ) |
Set the destination module.
Resets HasVerifiedInput.
Definition at line 166 of file LTOCodeGenerator.cpp.
References assert(), llvm::StringMap< ValueTy, AllocatorTy >::clear(), and setAsmUndefinedRefs().
| void LTOCodeGenerator::setOptLevel | ( | unsigned | OptLevel | ) |
Definition at line 197 of file LTOCodeGenerator.cpp.
References llvm::CodeGenOpt::Aggressive, llvm::CodeGenOpt::Default, llvm::CodeGenOpt::Less, llvm_unreachable(), and llvm::CodeGenOpt::None.
|
inline |
Definition at line 96 of file LTOCodeGenerator.h.
|
inline |
Definition at line 95 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 110 of file LTOCodeGenerator.h.
| void LTOCodeGenerator::setTargetOptions | ( | const TargetOptions & | Options | ) |
Definition at line 180 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 216 of file LTOCodeGenerator.cpp.
References llvm::raw_fd_ostream::clear_error(), llvm::raw_fd_ostream::close(), llvm::ErrMsg, 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