Go to the documentation of this file.
27 function_ref<std::unique_ptr<TargetMachine>()> TMFactory,
29 std::unique_ptr<TargetMachine>
TM = TMFactory();
30 assert(
TM &&
"Failed to create target machine!");
33 if (
TM->addPassesToEmitFile(CodeGenPasses, OS,
nullptr,
FileType))
35 CodeGenPasses.
run(*
M);
41 const std::function<std::unique_ptr<TargetMachine>()> &TMFactory,
45 if (OSs.
size() == 1) {
60 [&](std::unique_ptr<Module> MPart) {
68 raw_svector_ostream BCOS(BC);
69 WriteBitcodeToFile(*MPart, BCOS);
72 BCOSs[ThreadCount]->write(BC.begin(), BC.size());
73 BCOSs[ThreadCount]->flush();
78 CodegenThreadPool.
async(
81 Expected<std::unique_ptr<Module>> MOrErr = parseBitcodeFile(
82 MemoryBufferRef(StringRef(BC.data(), BC.size()),
86 report_fatal_error(
"Failed to read bitcode");
87 std::unique_ptr<Module> MPartInCtx = std::move(MOrErr.get());
89 codegen(MPartInCtx.get(), *ThreadOS, TMFactory, FileType);
ThreadPoolStrategy hardware_concurrency(unsigned ThreadCount=0)
Returns a default thread strategy where all available hardware resources are to be used,...
This is an optimization pass for GlobalISel generic memory operations.
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
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)
bool empty() const
empty - Check if the array is empty.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
FileType
Defines the file type this file represents.
An efficient, type-erasing, non-owning reference to a callable.
An abstract base class for streams implementations that also support a pwrite operation.
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
print Print MemDeps of function
A Module instance is used to store all the information related to an LLVM module.
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.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
CodeGenFileType
These enums are meant to be passed into addPassesToEmitFile to indicate what type of file to emit,...
auto async(Function &&F, Args &&...ArgList)
Asynchronous submission of a task to the pool.
PassManager manages ModulePassManagers.
size_t size() const
size - Get the array size.
bool run(Module &M)
run - Execute all of the passes scheduled for execution.
const char LLVMTargetMachineRef TM
void SplitModule(Module &M, unsigned N, function_ref< void(std::unique_ptr< Module > MPart)> ModuleCallback, bool PreserveLocals=false)
Splits the module M into N linkable partitions.
void splitCodeGen(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.