28 function_ref<std::unique_ptr<TargetMachine>()> TMFactory,
30 std::unique_ptr<TargetMachine>
TM = TMFactory();
32 if (TM->addPassesToEmitFile(CodeGenPasses, OS,
nullptr, FileType))
34 CodeGenPasses.
run(*M);
40 const std::function<std::unique_ptr<TargetMachine>()> &TMFactory,
44 if (OSs.
size() == 1) {
58 std::move(M), OSs.
size(),
59 [&](std::unique_ptr<Module> MPart) {
71 BCOSs[ThreadCount]->write(BC.
begin(), BC.
size());
72 BCOSs[ThreadCount]->flush();
77 CodegenThreadPool.async(
86 std::unique_ptr<Module> MPartInCtx = std::move(MOrErr.
get());
std::unique_ptr< Module > splitCodeGen(std::unique_ptr< Module > M, ArrayRef< raw_pwrite_stream *> OSs, ArrayRef< llvm::raw_pwrite_stream *> BCOSs, const std::function< std::unique_ptr< TargetMachine >()> &TMFactory, CodeGenFileType FileType=CGFT_ObjectFile, bool PreserveLocals=false)
Split M into OSs.size() partitions, and generate code for each.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
A Module instance is used to store all the information related to an LLVM module. ...
void SplitModule(std::unique_ptr< Module > M, unsigned N, function_ref< void(std::unique_ptr< Module > MPart)> ModuleCallback, bool PreserveLocals=false)
Splits the module M into N linkable partitions.
An efficient, type-erasing, non-owning reference to a callable.
A raw_ostream that writes to an SmallVector or SmallString.
Tagged union holding either a T or a Error.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
A ThreadPool for asynchronous parallel execution on a defined number of threads.
static void codegen(Module *M, llvm::raw_pwrite_stream &OS, function_ref< std::unique_ptr< TargetMachine >()> TMFactory, CodeGenFileType FileType)
PassManager manages ModulePassManagers.
CodeGenFileType
These enums are meant to be passed into addPassesToEmitFile to indicate what type of file to emit...
This is an important class for using LLVM in a threaded context.
size_t size() const
size - Get the array size.
void WriteBitcodeToFile(const Module &M, raw_ostream &Out, bool ShouldPreserveUseListOrder=false, const ModuleSummaryIndex *Index=nullptr, bool GenerateHash=false, ModuleHash *ModHash=nullptr)
Write the specified module to the specified raw output stream.
bool run(Module &M)
run - Execute all of the passes scheduled for execution.
FileType
Defines the file type this file represents.
Module.h This file contains the declarations for the Module class.
reference get()
Returns a reference to the stored T value.
Expected< std::unique_ptr< Module > > parseBitcodeFile(MemoryBufferRef Buffer, LLVMContext &Context)
Read the specified bitcode file, returning the module.
pointer data()
Return a pointer to the vector's buffer, even if empty().
Provides ErrorOr<T> smart pointer.
An abstract base class for streams implementations that also support a pwrite operation.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
print Print MemDeps of function
StringRef - Represent a constant reference to a string, i.e.
bool empty() const
empty - Check if the array is empty.