34 #ifndef LLVM_LTO_LTOCODEGENERATOR_H 35 #define LLVM_LTO_LTOCODEGENERATOR_H 56 template <
typename T>
class ArrayRef;
62 class TargetLibraryInfo;
65 class raw_pwrite_stream;
84 void setModule(std::unique_ptr<LTOModule> M);
115 ShouldRestoreGlobalsLinkage =
Value;
149 bool DisableInline,
bool DisableGVNLoadPRE,
150 bool DisableVectorization);
158 std::unique_ptr<MemoryBuffer>
compile(
bool DisableVerify,
bool DisableInline,
159 bool DisableGVNLoadPRE,
160 bool DisableVectorization);
165 bool optimize(
bool DisableVerify,
bool DisableInline,
bool DisableGVNLoadPRE,
166 bool DisableVectorization);
194 void initializeLTOPasses();
200 void verifyMergedModuleOnce();
202 bool compileOptimizedToFile(
const char **Name);
203 void restoreLinkageForExternals();
204 void applyScopeRestrictions();
205 void preserveDiscardableGVs(
209 bool determineTarget();
210 std::unique_ptr<TargetMachine> createTargetMachine();
212 void emitError(
const std::string &ErrMsg);
213 void emitWarning(
const std::string &ErrMsg);
215 void finishOptimizationRemarks();
218 std::unique_ptr<Module> MergedModule;
219 std::unique_ptr<Linker> TheLinker;
220 std::unique_ptr<TargetMachine> TargetMach;
221 bool EmitDwarfDebugInfo =
false;
222 bool ScopeRestrictionsDone =
false;
223 bool HasVerifiedInput =
false;
228 std::vector<std::string> CodegenOptions;
229 std::string FeatureStr;
232 std::string NativeObjectPath;
235 const Target *MArch =
nullptr;
236 std::string TripleStr;
237 unsigned OptLevel = 2;
239 void *DiagContext =
nullptr;
241 bool ShouldEmbedUselists =
false;
242 bool ShouldRestoreGlobalsLinkage =
false;
244 std::unique_ptr<ToolOutputFile> DiagnosticOutputFile;
245 bool Freestanding =
false;
246 std::unique_ptr<ToolOutputFile> StatsFile =
nullptr;
This class represents lattice values for constants.
LLVMContext & getContext()
std::unique_ptr< MemoryBuffer > compileOptimized()
Compiles the merged optimized module into a single output file.
A Module instance is used to store all the information related to an LLVM module. ...
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
An efficient, type-erasing, non-owning reference to a callable.
bool addModule(struct LTOModule *)
Merge given module.
bool optimize(bool DisableVerify, bool DisableInline, bool DisableGVNLoadPRE, bool DisableVectorization)
Optimizes the merged module.
void setShouldRestoreGlobalsLinkage(bool Value)
Restore linkage of globals.
void setAttr(StringRef MAttr)
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...
bool writeMergedModules(StringRef Path)
Write the merged module to the file specified by the given path.
static const char * getVersionString()
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
void setShouldEmbedUselists(bool Value)
CodeGenFileType
These enums are meant to be passed into addPassesToEmitFile to indicate what type of file to emit...
void setCodePICModel(Optional< Reloc::Model > Model)
This is the base abstract class for diagnostic reporting in the backend.
This is an important class for using LLVM in a threaded context.
void setOptLevel(unsigned OptLevel)
void setTargetOptions(const TargetOptions &Options)
void setShouldInternalize(bool Value)
C++ class which implements the opaque lto_module_t type.
llvm::cl::opt< bool > EnableLTOInternalization
Enable global value internalization in LTO.
std::pair< typename base::iterator, bool > insert(StringRef Key)
C++ class which implements the opaque lto_code_gen_t type.
void(* lto_diagnostic_handler_t)(lto_codegen_diagnostic_severity_t severity, const char *diag, void *ctxt)
Diagnostic handler type.
void setCpu(StringRef MCpu)
Module.h This file contains the declarations for the Module class.
Target - Wrapper for Target specific information.
void addMustPreserveSymbol(StringRef Sym)
void DiagnosticHandler(const DiagnosticInfo &DI)
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 calle...
void setCodeGenDebugOptions(ArrayRef< const char *> Opts)
Pass options to the driver and optimization passes.
static bool mustPreserveGV(const GlobalValue &GV)
Predicate for Internalize pass.
void setAsmUndefinedRefs(struct LTOModule *)
LLVM Value Representation.
LTOCodeGenerator(LLVMContext &Context)
void setFileType(CodeGenFileType FT)
Set the file type to be emitted (assembly or object code).
StringSet - A wrapper for StringMap that provides set-like functionality.
StringRef - Represent a constant reference to a string, i.e.
void parseCodeGenDebugOptions()
Parse the options set in setCodeGenDebugOptions.
void setModule(std::unique_ptr< LTOModule > M)
Set the destination module.
void setFreestanding(bool Enabled)
Enable the Freestanding mode: indicate that the optimizer should not assume builtins are present on t...
void setDiagnosticHandler(lto_diagnostic_handler_t, void *)
void setDebugInfo(lto_debug_model)