Lines Matching refs:CodeGenOpts
105 const CodeGenOptions &CodeGenOpts; member in __anon701d26f80111::EmitAssemblyHelper
156 : Diags(_Diags), HSOpts(HeaderSearchOpts), CodeGenOpts(CGOpts), in EmitAssemblyHelper()
161 if (CodeGenOpts.DisableFree) in ~EmitAssemblyHelper()
391 const CodeGenOptions &CodeGenOpts) { in createTLII() argument
394 switch (CodeGenOpts.getVecLib()) { in createTLII()
435 static CodeGenOpt::Level getCGOptLevel(const CodeGenOptions &CodeGenOpts) { in getCGOptLevel() argument
436 switch (CodeGenOpts.OptimizationLevel) { in getCGOptLevel()
451 getCodeModel(const CodeGenOptions &CodeGenOpts) { in getCodeModel() argument
452 unsigned CodeModel = llvm::StringSwitch<unsigned>(CodeGenOpts.CodeModel) in getCodeModel()
479 const CodeGenOptions &CodeGenOpts, in initTargetOptions() argument
493 assert((CodeGenOpts.FloatABI == "soft" || CodeGenOpts.FloatABI == "softfp" || in initTargetOptions()
494 CodeGenOpts.FloatABI == "hard" || CodeGenOpts.FloatABI.empty()) && in initTargetOptions()
497 llvm::StringSwitch<llvm::FloatABI::ABIType>(CodeGenOpts.FloatABI) in initTargetOptions()
520 llvm::TargetMachine::parseBinutilsVersion(CodeGenOpts.BinutilsVersion); in initTargetOptions()
521 Options.UseInitArray = CodeGenOpts.UseInitArray; in initTargetOptions()
522 Options.DisableIntegratedAS = CodeGenOpts.DisableIntegratedAS; in initTargetOptions()
523 Options.CompressDebugSections = CodeGenOpts.getCompressDebugSections(); in initTargetOptions()
524 Options.RelaxELFRelocations = CodeGenOpts.RelaxELFRelocations; in initTargetOptions()
540 Options.NoZerosInBSS = CodeGenOpts.NoZeroInitializedInBSS; in initTargetOptions()
544 llvm::StringSwitch<llvm::BasicBlockSection>(CodeGenOpts.BBSections) in initTargetOptions()
553 MemoryBuffer::getFile(CodeGenOpts.BBSections.substr(5)); in initTargetOptions()
562 Options.EnableMachineFunctionSplitter = CodeGenOpts.SplitMachineFunctions; in initTargetOptions()
563 Options.FunctionSections = CodeGenOpts.FunctionSections; in initTargetOptions()
564 Options.DataSections = CodeGenOpts.DataSections; in initTargetOptions()
566 Options.UniqueSectionNames = CodeGenOpts.UniqueSectionNames; in initTargetOptions()
568 CodeGenOpts.UniqueBasicBlockSectionNames; in initTargetOptions()
569 Options.TLSSize = CodeGenOpts.TLSSize; in initTargetOptions()
570 Options.EmulatedTLS = CodeGenOpts.EmulatedTLS; in initTargetOptions()
571 Options.ExplicitEmulatedTLS = CodeGenOpts.ExplicitEmulatedTLS; in initTargetOptions()
572 Options.DebuggerTuning = CodeGenOpts.getDebuggerTuning(); in initTargetOptions()
573 Options.EmitStackSizeSection = CodeGenOpts.StackSizeSection; in initTargetOptions()
574 Options.StackUsageOutput = CodeGenOpts.StackUsageOutput; in initTargetOptions()
575 Options.EmitAddrsig = CodeGenOpts.Addrsig; in initTargetOptions()
576 Options.ForceDwarfFrameSection = CodeGenOpts.ForceDwarfFrameSection; in initTargetOptions()
577 Options.EmitCallSiteInfo = CodeGenOpts.EmitCallSiteInfo; in initTargetOptions()
578 Options.EnableAIXExtendedAltivecABI = CodeGenOpts.EnableAIXExtendedAltivecABI; in initTargetOptions()
579 Options.PseudoProbeForProfiling = CodeGenOpts.PseudoProbeForProfiling; in initTargetOptions()
581 CodeGenOpts.ValueTrackingVariableLocations; in initTargetOptions()
582 Options.XRayOmitFunctionIndex = CodeGenOpts.XRayOmitFunctionIndex; in initTargetOptions()
584 Options.MCOptions.SplitDwarfFile = CodeGenOpts.SplitDwarfFile; in initTargetOptions()
585 Options.MCOptions.MCRelaxAll = CodeGenOpts.RelaxAll; in initTargetOptions()
586 Options.MCOptions.MCSaveTempLabels = CodeGenOpts.SaveTempLabels; in initTargetOptions()
587 Options.MCOptions.MCUseDwarfDirectory = !CodeGenOpts.NoDwarfDirectoryAsm; in initTargetOptions()
588 Options.MCOptions.MCNoExecStack = CodeGenOpts.NoExecStack; in initTargetOptions()
590 CodeGenOpts.IncrementalLinkerCompatible; in initTargetOptions()
591 Options.MCOptions.MCFatalWarnings = CodeGenOpts.FatalWarnings; in initTargetOptions()
592 Options.MCOptions.MCNoWarn = CodeGenOpts.NoWarn; in initTargetOptions()
593 Options.MCOptions.AsmVerbose = CodeGenOpts.AsmVerbose; in initTargetOptions()
594 Options.MCOptions.Dwarf64 = CodeGenOpts.Dwarf64; in initTargetOptions()
595 Options.MCOptions.PreserveAsmComments = CodeGenOpts.PreserveAsmComments; in initTargetOptions()
604 Options.MCOptions.Argv0 = CodeGenOpts.Argv0; in initTargetOptions()
605 Options.MCOptions.CommandLineArgs = CodeGenOpts.CommandLineArgs; in initTargetOptions()
606 Options.DebugStrictDwarf = CodeGenOpts.DebugStrictDwarf; in initTargetOptions()
611 static Optional<GCOVOptions> getGCOVOptions(const CodeGenOptions &CodeGenOpts, in getGCOVOptions() argument
613 if (!CodeGenOpts.EmitGcovArcs && !CodeGenOpts.EmitGcovNotes) in getGCOVOptions()
618 Options.EmitNotes = CodeGenOpts.EmitGcovNotes; in getGCOVOptions()
619 Options.EmitData = CodeGenOpts.EmitGcovArcs; in getGCOVOptions()
620 llvm::copy(CodeGenOpts.CoverageVersion, std::begin(Options.Version)); in getGCOVOptions()
621 Options.NoRedZone = CodeGenOpts.DisableRedZone; in getGCOVOptions()
622 Options.Filter = CodeGenOpts.ProfileFilterFiles; in getGCOVOptions()
623 Options.Exclude = CodeGenOpts.ProfileExcludeFiles; in getGCOVOptions()
624 Options.Atomic = CodeGenOpts.AtomicProfileUpdate; in getGCOVOptions()
629 getInstrProfOptions(const CodeGenOptions &CodeGenOpts, in getInstrProfOptions() argument
631 if (!CodeGenOpts.hasProfileClangInstr()) in getInstrProfOptions()
634 Options.NoRedZone = CodeGenOpts.DisableRedZone; in getInstrProfOptions()
635 Options.InstrProfileOutput = CodeGenOpts.InstrProfileOutput; in getInstrProfOptions()
636 Options.Atomic = CodeGenOpts.AtomicProfileUpdate; in getInstrProfOptions()
644 if (CodeGenOpts.DisableLLVMPasses) in CreatePasses()
653 createTLII(TargetTriple, CodeGenOpts)); in CreatePasses()
660 if (!CodeGenOpts.ThinLTOIndexFile.empty()) in CreatePasses()
665 PassManagerBuilderWrapper PMBuilder(TargetTriple, CodeGenOpts, LangOpts); in CreatePasses()
669 if (CodeGenOpts.OptimizationLevel <= 1) { in CreatePasses()
670 bool InsertLifetimeIntrinsics = ((CodeGenOpts.OptimizationLevel != 0 && in CreatePasses()
671 !CodeGenOpts.DisableLifetimeMarkers) || in CreatePasses()
679 CodeGenOpts.OptimizationLevel, CodeGenOpts.OptimizeSize, in CreatePasses()
680 (!CodeGenOpts.SampleProfileFile.empty() && in CreatePasses()
681 CodeGenOpts.PrepareForThinLTO)); in CreatePasses()
684 PMBuilder.OptLevel = CodeGenOpts.OptimizationLevel; in CreatePasses()
685 PMBuilder.SizeLevel = CodeGenOpts.OptimizeSize; in CreatePasses()
686 PMBuilder.SLPVectorize = CodeGenOpts.VectorizeSLP; in CreatePasses()
687 PMBuilder.LoopVectorize = CodeGenOpts.VectorizeLoop; in CreatePasses()
690 PMBuilder.CallGraphProfile = !CodeGenOpts.DisableIntegratedAS; in CreatePasses()
692 PMBuilder.DisableUnrollLoops = !CodeGenOpts.UnrollLoops; in CreatePasses()
695 PMBuilder.LoopsInterleaved = CodeGenOpts.UnrollLoops; in CreatePasses()
696 PMBuilder.MergeFunctions = CodeGenOpts.MergeFunctions; in CreatePasses()
697 PMBuilder.PrepareForThinLTO = CodeGenOpts.PrepareForThinLTO; in CreatePasses()
698 PMBuilder.PrepareForLTO = CodeGenOpts.PrepareForLTO; in CreatePasses()
699 PMBuilder.RerollLoops = CodeGenOpts.RerollLoops; in CreatePasses()
706 if (CodeGenOpts.DebugInfoForProfiling || in CreatePasses()
707 !CodeGenOpts.SampleProfileFile.empty()) in CreatePasses()
724 if (!CodeGenOpts.MemoryProfileOutput.empty()) { in CreatePasses()
738 if (CodeGenOpts.hasSanitizeCoverage()) { in CreatePasses()
801 if (CodeGenOpts.InstrumentFunctions || in CreatePasses()
802 CodeGenOpts.InstrumentFunctionEntryBare || in CreatePasses()
803 CodeGenOpts.InstrumentFunctionsAfterInlining || in CreatePasses()
804 CodeGenOpts.InstrumentForProfiling) { in CreatePasses()
817 if (CodeGenOpts.VerifyModule) in CreatePasses()
821 if (!CodeGenOpts.RewriteMapFiles.empty()) in CreatePasses()
822 addSymbolRewriterPass(CodeGenOpts, &MPM); in CreatePasses()
824 if (Optional<GCOVOptions> Options = getGCOVOptions(CodeGenOpts, LangOpts)) { in CreatePasses()
826 if (CodeGenOpts.getDebugInfo() == codegenoptions::NoDebugInfo) in CreatePasses()
831 getInstrProfOptions(CodeGenOpts, LangOpts)) in CreatePasses()
835 if (CodeGenOpts.hasProfileIRInstr()) { in CreatePasses()
839 if (CodeGenOpts.hasProfileCSIRInstr()) { in CreatePasses()
840 assert(!CodeGenOpts.hasProfileCSIRUse() && in CreatePasses()
850 if (!CodeGenOpts.InstrProfileOutput.empty()) in CreatePasses()
851 PMBuilder.PGOInstrGen = CodeGenOpts.InstrProfileOutput; in CreatePasses()
855 if (CodeGenOpts.hasProfileIRUse()) { in CreatePasses()
856 PMBuilder.PGOInstrUse = CodeGenOpts.ProfileInstrumentUsePath; in CreatePasses()
857 PMBuilder.EnablePGOCSInstrUse = CodeGenOpts.hasProfileCSIRUse(); in CreatePasses()
860 if (!CodeGenOpts.SampleProfileFile.empty()) in CreatePasses()
861 PMBuilder.PGOSampleUse = CodeGenOpts.SampleProfileFile; in CreatePasses()
867 static void setCommandLineOpts(const CodeGenOptions &CodeGenOpts) { in setCommandLineOpts() argument
870 if (!CodeGenOpts.DebugPass.empty()) { in setCommandLineOpts()
872 BackendArgs.push_back(CodeGenOpts.DebugPass.c_str()); in setCommandLineOpts()
874 if (!CodeGenOpts.LimitFloatPrecision.empty()) { in setCommandLineOpts()
876 BackendArgs.push_back(CodeGenOpts.LimitFloatPrecision.c_str()); in setCommandLineOpts()
902 Optional<llvm::CodeModel::Model> CM = getCodeModel(CodeGenOpts); in CreateTargetMachine()
905 llvm::Reloc::Model RM = CodeGenOpts.RelocationModel; in CreateTargetMachine()
906 CodeGenOpt::Level OptLevel = getCGOptLevel(CodeGenOpts); in CreateTargetMachine()
909 if (!initTargetOptions(Diags, Options, CodeGenOpts, TargetOpts, LangOpts, in CreateTargetMachine()
923 createTLII(TargetTriple, CodeGenOpts)); in AddEmitPasses()
933 if (CodeGenOpts.OptimizationLevel > 0) in AddEmitPasses()
937 /*DisableVerify=*/!CodeGenOpts.VerifyModule)) { in AddEmitPasses()
947 TimeRegion Region(CodeGenOpts.TimePasses ? &CodeGenerationTime : nullptr); in EmitAssembly()
949 setCommandLineOpts(CodeGenOpts); in EmitAssembly()
963 if (CodeGenOpts.EnableDIPreservationVerify) { in EmitAssembly()
967 if (!CodeGenOpts.DIBugsReportFilePath.empty()) in EmitAssembly()
969 CodeGenOpts.DIBugsReportFilePath); in EmitAssembly()
991 if (CodeGenOpts.PrepareForThinLTO && !CodeGenOpts.DisableLLVMPasses) { in EmitAssembly()
992 if (!CodeGenOpts.ThinLinkBitcodeFile.empty()) { in EmitAssembly()
993 ThinLinkOS = openOutputFile(CodeGenOpts.ThinLinkBitcodeFile); in EmitAssembly()
998 CodeGenOpts.EnableSplitLTOUnit); in EmitAssembly()
1005 (CodeGenOpts.PrepareForLTO && in EmitAssembly()
1006 !CodeGenOpts.DisableLLVMPasses && in EmitAssembly()
1017 *OS, CodeGenOpts.EmitLLVMUseLists, EmitLTOSummary)); in EmitAssembly()
1023 createPrintModulePass(*OS, "", CodeGenOpts.EmitLLVMUseLists)); in EmitAssembly()
1027 if (!CodeGenOpts.SplitDwarfOutput.empty()) { in EmitAssembly()
1028 DwoOS = openOutputFile(CodeGenOpts.SplitDwarfOutput); in EmitAssembly()
1104 const CodeGenOptions &CodeGenOpts, in addSanitizers() argument
1108 if (CodeGenOpts.hasSanitizeCoverage()) { in addSanitizers()
1109 auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts); in addSanitizers()
1111 SancovOpts, CodeGenOpts.SanitizeCoverageAllowlistFiles, in addSanitizers()
1112 CodeGenOpts.SanitizeCoverageIgnorelistFiles)); in addSanitizers()
1117 int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins; in addSanitizers()
1118 bool Recover = CodeGenOpts.SanitizeRecover.has(Mask); in addSanitizers()
1150 bool Recover = CodeGenOpts.SanitizeRecover.has(Mask); in addSanitizers()
1151 bool UseAfterScope = CodeGenOpts.SanitizeAddressUseAfterScope; in addSanitizers()
1152 bool ModuleUseAfterScope = asanUseGlobalsGC(TargetTriple, CodeGenOpts); in addSanitizers()
1153 bool UseOdrIndicator = CodeGenOpts.SanitizeAddressUseOdrIndicator; in addSanitizers()
1155 CodeGenOpts.getSanitizeAddressDtor(); in addSanitizers()
1157 CodeGenOpts.getSanitizeAddressUseAfterReturn(); in addSanitizers()
1171 bool Recover = CodeGenOpts.SanitizeRecover.has(Mask); in addSanitizers()
1174 /*DisableOptimization=*/CodeGenOpts.OptimizationLevel == 0)); in addSanitizers()
1196 TimeRegion Region(CodeGenOpts.TimePasses ? &CodeGenerationTime : nullptr); in EmitAssemblyWithNewPassManager()
1197 setCommandLineOpts(CodeGenOpts); in EmitAssemblyWithNewPassManager()
1211 if (CodeGenOpts.hasProfileIRInstr()) in EmitAssemblyWithNewPassManager()
1213 PGOOpt = PGOOptions(CodeGenOpts.InstrProfileOutput.empty() in EmitAssemblyWithNewPassManager()
1215 : CodeGenOpts.InstrProfileOutput, in EmitAssemblyWithNewPassManager()
1217 CodeGenOpts.DebugInfoForProfiling); in EmitAssemblyWithNewPassManager()
1218 else if (CodeGenOpts.hasProfileIRUse()) { in EmitAssemblyWithNewPassManager()
1220 auto CSAction = CodeGenOpts.hasProfileCSIRUse() ? PGOOptions::CSIRUse in EmitAssemblyWithNewPassManager()
1222 PGOOpt = PGOOptions(CodeGenOpts.ProfileInstrumentUsePath, "", in EmitAssemblyWithNewPassManager()
1223 CodeGenOpts.ProfileRemappingFile, PGOOptions::IRUse, in EmitAssemblyWithNewPassManager()
1224 CSAction, CodeGenOpts.DebugInfoForProfiling); in EmitAssemblyWithNewPassManager()
1225 } else if (!CodeGenOpts.SampleProfileFile.empty()) in EmitAssemblyWithNewPassManager()
1228 CodeGenOpts.SampleProfileFile, "", CodeGenOpts.ProfileRemappingFile, in EmitAssemblyWithNewPassManager()
1230 CodeGenOpts.DebugInfoForProfiling, CodeGenOpts.PseudoProbeForProfiling); in EmitAssemblyWithNewPassManager()
1231 else if (CodeGenOpts.PseudoProbeForProfiling) in EmitAssemblyWithNewPassManager()
1235 CodeGenOpts.DebugInfoForProfiling, true); in EmitAssemblyWithNewPassManager()
1236 else if (CodeGenOpts.DebugInfoForProfiling) in EmitAssemblyWithNewPassManager()
1242 if (CodeGenOpts.hasProfileCSIRInstr()) { in EmitAssemblyWithNewPassManager()
1243 assert(!CodeGenOpts.hasProfileCSIRUse() && in EmitAssemblyWithNewPassManager()
1251 PGOOpt->CSProfileGenFile = CodeGenOpts.InstrProfileOutput.empty() in EmitAssemblyWithNewPassManager()
1253 : CodeGenOpts.InstrProfileOutput; in EmitAssemblyWithNewPassManager()
1257 CodeGenOpts.InstrProfileOutput.empty() in EmitAssemblyWithNewPassManager()
1259 : CodeGenOpts.InstrProfileOutput, in EmitAssemblyWithNewPassManager()
1261 CodeGenOpts.DebugInfoForProfiling); in EmitAssemblyWithNewPassManager()
1265 PTO.LoopUnrolling = CodeGenOpts.UnrollLoops; in EmitAssemblyWithNewPassManager()
1268 PTO.LoopInterleaving = CodeGenOpts.UnrollLoops; in EmitAssemblyWithNewPassManager()
1269 PTO.LoopVectorization = CodeGenOpts.VectorizeLoop; in EmitAssemblyWithNewPassManager()
1270 PTO.SLPVectorization = CodeGenOpts.VectorizeSLP; in EmitAssemblyWithNewPassManager()
1271 PTO.MergeFunctions = CodeGenOpts.MergeFunctions; in EmitAssemblyWithNewPassManager()
1274 PTO.CallGraphProfile = !CodeGenOpts.DisableIntegratedAS; in EmitAssemblyWithNewPassManager()
1281 bool DebugPassStructure = CodeGenOpts.DebugPass == "Structure"; in EmitAssemblyWithNewPassManager()
1286 StandardInstrumentations SI(CodeGenOpts.DebugPassManager || in EmitAssemblyWithNewPassManager()
1293 for (auto &PluginFN : CodeGenOpts.PassPlugins) { in EmitAssemblyWithNewPassManager()
1313 createTLII(TargetTriple, CodeGenOpts)); in EmitAssemblyWithNewPassManager()
1325 if (!CodeGenOpts.DisableLLVMPasses) { in EmitAssemblyWithNewPassManager()
1328 PassBuilder::OptimizationLevel Level = mapToLevel(CodeGenOpts); in EmitAssemblyWithNewPassManager()
1330 bool IsThinLTO = CodeGenOpts.PrepareForThinLTO; in EmitAssemblyWithNewPassManager()
1331 bool IsLTO = CodeGenOpts.PrepareForLTO; in EmitAssemblyWithNewPassManager()
1355 bool IsThinLTOPostLink = !CodeGenOpts.ThinLTOIndexFile.empty(); in EmitAssemblyWithNewPassManager()
1366 if (CodeGenOpts.InstrumentFunctions || in EmitAssemblyWithNewPassManager()
1367 CodeGenOpts.InstrumentFunctionEntryBare || in EmitAssemblyWithNewPassManager()
1368 CodeGenOpts.InstrumentFunctionsAfterInlining || in EmitAssemblyWithNewPassManager()
1369 CodeGenOpts.InstrumentForProfiling) { in EmitAssemblyWithNewPassManager()
1393 addSanitizers(TargetTriple, CodeGenOpts, LangOpts, PB); in EmitAssemblyWithNewPassManager()
1395 if (Optional<GCOVOptions> Options = getGCOVOptions(CodeGenOpts, LangOpts)) in EmitAssemblyWithNewPassManager()
1402 getInstrProfOptions(CodeGenOpts, LangOpts)) in EmitAssemblyWithNewPassManager()
1409 if (CodeGenOpts.OptimizationLevel == 0) { in EmitAssemblyWithNewPassManager()
1419 if (!CodeGenOpts.MemoryProfileOutput.empty()) { in EmitAssemblyWithNewPassManager()
1437 if (CodeGenOpts.PrepareForThinLTO && !CodeGenOpts.DisableLLVMPasses) { in EmitAssemblyWithNewPassManager()
1438 if (!CodeGenOpts.ThinLinkBitcodeFile.empty()) { in EmitAssemblyWithNewPassManager()
1439 ThinLinkOS = openOutputFile(CodeGenOpts.ThinLinkBitcodeFile); in EmitAssemblyWithNewPassManager()
1444 CodeGenOpts.EnableSplitLTOUnit); in EmitAssemblyWithNewPassManager()
1451 (CodeGenOpts.PrepareForLTO && in EmitAssemblyWithNewPassManager()
1452 !CodeGenOpts.DisableLLVMPasses && in EmitAssemblyWithNewPassManager()
1462 BitcodeWriterPass(*OS, CodeGenOpts.EmitLLVMUseLists, EmitLTOSummary)); in EmitAssemblyWithNewPassManager()
1467 MPM.addPass(PrintModulePass(*OS, "", CodeGenOpts.EmitLLVMUseLists)); in EmitAssemblyWithNewPassManager()
1476 if (!CodeGenOpts.SplitDwarfOutput.empty()) { in EmitAssemblyWithNewPassManager()
1477 DwoOS = openOutputFile(CodeGenOpts.SplitDwarfOutput); in EmitAssemblyWithNewPassManager()