35 #ifndef LLVM_LTO_LTOCODEGENERATOR_H
36 #define LLVM_LTO_LTOCODEGENERATOR_H
52 template <
typename T>
class ArrayRef;
58 class TargetLibraryInfo;
61 class raw_pwrite_stream;
80 void setModule(std::unique_ptr<LTOModule> M);
111 ShouldRestoreGlobalsLinkage = Value;
145 bool DisableInline,
bool DisableGVNLoadPRE,
146 bool DisableVectorization);
154 std::unique_ptr<MemoryBuffer>
compile(
bool DisableVerify,
bool DisableInline,
155 bool DisableGVNLoadPRE,
156 bool DisableVectorization);
161 bool optimize(
bool DisableVerify,
bool DisableInline,
bool DisableGVNLoadPRE,
162 bool DisableVectorization);
189 void initializeLTOPasses();
195 void verifyMergedModuleOnce();
197 bool compileOptimizedToFile(
const char **
Name);
198 void restoreLinkageForExternals();
199 void applyScopeRestrictions();
200 void preserveDiscardableGVs(
204 bool determineTarget();
205 std::unique_ptr<TargetMachine> createTargetMachine();
207 static void DiagnosticHandler(
const DiagnosticInfo &DI,
void *Context);
211 void emitError(
const std::string &
ErrMsg);
212 void emitWarning(
const std::string &
ErrMsg);
214 void finishOptimizationRemarks();
217 std::unique_ptr<Module> MergedModule;
218 std::unique_ptr<Linker> TheLinker;
219 std::unique_ptr<TargetMachine> TargetMach;
220 bool EmitDwarfDebugInfo =
false;
221 bool ScopeRestrictionsDone =
false;
222 bool HasVerifiedInput =
false;
227 std::vector<std::string> CodegenOptions;
228 std::string FeatureStr;
231 std::string NativeObjectPath;
234 const Target *MArch =
nullptr;
235 std::string TripleStr;
236 unsigned OptLevel = 2;
238 void *DiagContext =
nullptr;
239 bool ShouldInternalize =
true;
240 bool ShouldEmbedUselists =
false;
241 bool ShouldRestoreGlobalsLinkage =
false;
243 std::unique_ptr<tool_output_file> DiagnosticOutputFile;
244 bool Freestanding =
false;
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. ...
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...
void setFileType(TargetMachine::CodeGenFileType FT)
Set the file type to be emitted (assembly or object code).
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)
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.
void setCodeGenDebugOptions(StringRef Opts)
Pass options to the driver and optimization passes.
void(* lto_diagnostic_handler_t)(lto_codegen_diagnostic_severity_t severity, const char *diag, void *ctxt)
Diagnostic handler type.
C++ class which implements the opaque lto_code_gen_t type.
void setCpu(StringRef MCpu)
Module.h This file contains the declarations for the Module class.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
Target - Wrapper for Target specific information.
void addMustPreserveSymbol(StringRef Sym)
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 setAsmUndefinedRefs(struct LTOModule *)
LLVM Value Representation.
LTOCodeGenerator(LLVMContext &Context)
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.
CodeGenFileType
These enums are meant to be passed into addPassesToEmitFile to indicate what type of file to emit...
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)