Changeset View
Changeset View
Standalone View
Standalone View
lib/CodeGen/BackendUtil.cpp
Show First 20 Lines • Show All 959 Lines • ▼ Show 20 Lines | |||||
/// | /// | ||||
/// This API is planned to have its functionality finished and then to replace | /// This API is planned to have its functionality finished and then to replace | ||||
/// `EmitAssembly` at some point in the future when the default switches. | /// `EmitAssembly` at some point in the future when the default switches. | ||||
void EmitAssemblyHelper::EmitAssemblyWithNewPassManager( | void EmitAssemblyHelper::EmitAssemblyWithNewPassManager( | ||||
BackendAction Action, std::unique_ptr<raw_pwrite_stream> OS) { | BackendAction Action, std::unique_ptr<raw_pwrite_stream> OS) { | ||||
TimeRegion Region(FrontendTimesIsEnabled ? &CodeGenerationTime : nullptr); | TimeRegion Region(FrontendTimesIsEnabled ? &CodeGenerationTime : nullptr); | ||||
setCommandLineOpts(CodeGenOpts); | setCommandLineOpts(CodeGenOpts); | ||||
// The new pass manager always makes a target machine available to passes | bool RequiresCodeGen = (Action != Backend_EmitNothing && | ||||
// during construction. | Action != Backend_EmitBC && | ||||
CreateTargetMachine(/*MustCreateTM*/ true); | Action != Backend_EmitLL); | ||||
if (!TM) | CreateTargetMachine(RequiresCodeGen); | ||||
// This will already be diagnosed, just bail. | |||||
if (RequiresCodeGen && !TM) | |||||
return; | return; | ||||
if (TM) | |||||
TheModule->setDataLayout(TM->createDataLayout()); | TheModule->setDataLayout(TM->createDataLayout()); | ||||
Optional<PGOOptions> PGOOpt; | Optional<PGOOptions> PGOOpt; | ||||
if (CodeGenOpts.hasProfileIRInstr()) | if (CodeGenOpts.hasProfileIRInstr()) | ||||
// -fprofile-generate. | // -fprofile-generate. | ||||
PGOOpt = PGOOptions(CodeGenOpts.InstrProfileOutput.empty() | PGOOpt = PGOOptions(CodeGenOpts.InstrProfileOutput.empty() | ||||
? DefaultProfileGenName | ? DefaultProfileGenName | ||||
: CodeGenOpts.InstrProfileOutput, | : CodeGenOpts.InstrProfileOutput, | ||||
▲ Show 20 Lines • Show All 610 Lines • Show Last 20 Lines |