Lines Matching refs:CodeGenOpts
104 const CodeGenOptions &CodeGenOpts; member in __anoncdf3490f0111::EmitAssemblyHelper
155 : Diags(_Diags), HSOpts(HeaderSearchOpts), CodeGenOpts(CGOpts), in EmitAssemblyHelper()
160 if (CodeGenOpts.DisableFree) in ~EmitAssemblyHelper()
382 const CodeGenOptions &CodeGenOpts) { in createTLII() argument
385 switch (CodeGenOpts.getVecLib()) { in createTLII()
426 static CodeGenOpt::Level getCGOptLevel(const CodeGenOptions &CodeGenOpts) { in getCGOptLevel() argument
427 switch (CodeGenOpts.OptimizationLevel) { in getCGOptLevel()
442 getCodeModel(const CodeGenOptions &CodeGenOpts) { in getCodeModel() argument
443 unsigned CodeModel = llvm::StringSwitch<unsigned>(CodeGenOpts.CodeModel) in getCodeModel()
470 const CodeGenOptions &CodeGenOpts, in initTargetOptions() argument
484 assert((CodeGenOpts.FloatABI == "soft" || CodeGenOpts.FloatABI == "softfp" || in initTargetOptions()
485 CodeGenOpts.FloatABI == "hard" || CodeGenOpts.FloatABI.empty()) && in initTargetOptions()
488 llvm::StringSwitch<llvm::FloatABI::ABIType>(CodeGenOpts.FloatABI) in initTargetOptions()
511 llvm::TargetMachine::parseBinutilsVersion(CodeGenOpts.BinutilsVersion); in initTargetOptions()
512 Options.UseInitArray = CodeGenOpts.UseInitArray; in initTargetOptions()
513 Options.DisableIntegratedAS = CodeGenOpts.DisableIntegratedAS; in initTargetOptions()
514 Options.CompressDebugSections = CodeGenOpts.getCompressDebugSections(); in initTargetOptions()
515 Options.RelaxELFRelocations = CodeGenOpts.RelaxELFRelocations; in initTargetOptions()
531 Options.NoZerosInBSS = CodeGenOpts.NoZeroInitializedInBSS; in initTargetOptions()
533 Options.StackAlignmentOverride = CodeGenOpts.StackAlignment; in initTargetOptions()
536 llvm::StringSwitch<llvm::BasicBlockSection>(CodeGenOpts.BBSections) in initTargetOptions()
545 MemoryBuffer::getFile(CodeGenOpts.BBSections.substr(5)); in initTargetOptions()
554 Options.EnableMachineFunctionSplitter = CodeGenOpts.SplitMachineFunctions; in initTargetOptions()
555 Options.FunctionSections = CodeGenOpts.FunctionSections; in initTargetOptions()
556 Options.DataSections = CodeGenOpts.DataSections; in initTargetOptions()
558 Options.UniqueSectionNames = CodeGenOpts.UniqueSectionNames; in initTargetOptions()
560 CodeGenOpts.UniqueBasicBlockSectionNames; in initTargetOptions()
561 Options.TLSSize = CodeGenOpts.TLSSize; in initTargetOptions()
562 Options.EmulatedTLS = CodeGenOpts.EmulatedTLS; in initTargetOptions()
563 Options.ExplicitEmulatedTLS = CodeGenOpts.ExplicitEmulatedTLS; in initTargetOptions()
564 Options.DebuggerTuning = CodeGenOpts.getDebuggerTuning(); in initTargetOptions()
565 Options.EmitStackSizeSection = CodeGenOpts.StackSizeSection; in initTargetOptions()
566 Options.StackUsageOutput = CodeGenOpts.StackUsageOutput; in initTargetOptions()
567 Options.EmitAddrsig = CodeGenOpts.Addrsig; in initTargetOptions()
568 Options.ForceDwarfFrameSection = CodeGenOpts.ForceDwarfFrameSection; in initTargetOptions()
569 Options.EmitCallSiteInfo = CodeGenOpts.EmitCallSiteInfo; in initTargetOptions()
570 Options.EnableAIXExtendedAltivecABI = CodeGenOpts.EnableAIXExtendedAltivecABI; in initTargetOptions()
571 Options.PseudoProbeForProfiling = CodeGenOpts.PseudoProbeForProfiling; in initTargetOptions()
573 CodeGenOpts.ValueTrackingVariableLocations; in initTargetOptions()
574 Options.XRayOmitFunctionIndex = CodeGenOpts.XRayOmitFunctionIndex; in initTargetOptions()
576 Options.MCOptions.SplitDwarfFile = CodeGenOpts.SplitDwarfFile; in initTargetOptions()
577 Options.MCOptions.MCRelaxAll = CodeGenOpts.RelaxAll; in initTargetOptions()
578 Options.MCOptions.MCSaveTempLabels = CodeGenOpts.SaveTempLabels; in initTargetOptions()
579 Options.MCOptions.MCUseDwarfDirectory = !CodeGenOpts.NoDwarfDirectoryAsm; in initTargetOptions()
580 Options.MCOptions.MCNoExecStack = CodeGenOpts.NoExecStack; in initTargetOptions()
582 CodeGenOpts.IncrementalLinkerCompatible; in initTargetOptions()
583 Options.MCOptions.MCFatalWarnings = CodeGenOpts.FatalWarnings; in initTargetOptions()
584 Options.MCOptions.MCNoWarn = CodeGenOpts.NoWarn; in initTargetOptions()
585 Options.MCOptions.AsmVerbose = CodeGenOpts.AsmVerbose; in initTargetOptions()
586 Options.MCOptions.Dwarf64 = CodeGenOpts.Dwarf64; in initTargetOptions()
587 Options.MCOptions.PreserveAsmComments = CodeGenOpts.PreserveAsmComments; in initTargetOptions()
596 Options.MCOptions.Argv0 = CodeGenOpts.Argv0; in initTargetOptions()
597 Options.MCOptions.CommandLineArgs = CodeGenOpts.CommandLineArgs; in initTargetOptions()
598 Options.DebugStrictDwarf = CodeGenOpts.DebugStrictDwarf; in initTargetOptions()
603 static Optional<GCOVOptions> getGCOVOptions(const CodeGenOptions &CodeGenOpts, in getGCOVOptions() argument
605 if (!CodeGenOpts.EmitGcovArcs && !CodeGenOpts.EmitGcovNotes) in getGCOVOptions()
610 Options.EmitNotes = CodeGenOpts.EmitGcovNotes; in getGCOVOptions()
611 Options.EmitData = CodeGenOpts.EmitGcovArcs; in getGCOVOptions()
612 llvm::copy(CodeGenOpts.CoverageVersion, std::begin(Options.Version)); in getGCOVOptions()
613 Options.NoRedZone = CodeGenOpts.DisableRedZone; in getGCOVOptions()
614 Options.Filter = CodeGenOpts.ProfileFilterFiles; in getGCOVOptions()
615 Options.Exclude = CodeGenOpts.ProfileExcludeFiles; in getGCOVOptions()
616 Options.Atomic = CodeGenOpts.AtomicProfileUpdate; in getGCOVOptions()
621 getInstrProfOptions(const CodeGenOptions &CodeGenOpts, in getInstrProfOptions() argument
623 if (!CodeGenOpts.hasProfileClangInstr()) in getInstrProfOptions()
626 Options.NoRedZone = CodeGenOpts.DisableRedZone; in getInstrProfOptions()
627 Options.InstrProfileOutput = CodeGenOpts.InstrProfileOutput; in getInstrProfOptions()
628 Options.Atomic = CodeGenOpts.AtomicProfileUpdate; in getInstrProfOptions()
636 if (CodeGenOpts.DisableLLVMPasses) in CreatePasses()
645 createTLII(TargetTriple, CodeGenOpts)); in CreatePasses()
652 if (!CodeGenOpts.ThinLTOIndexFile.empty()) in CreatePasses()
657 PassManagerBuilderWrapper PMBuilder(TargetTriple, CodeGenOpts, LangOpts); in CreatePasses()
661 if (CodeGenOpts.OptimizationLevel <= 1) { in CreatePasses()
662 bool InsertLifetimeIntrinsics = ((CodeGenOpts.OptimizationLevel != 0 && in CreatePasses()
663 !CodeGenOpts.DisableLifetimeMarkers) || in CreatePasses()
671 CodeGenOpts.OptimizationLevel, CodeGenOpts.OptimizeSize, in CreatePasses()
672 (!CodeGenOpts.SampleProfileFile.empty() && in CreatePasses()
673 CodeGenOpts.PrepareForThinLTO)); in CreatePasses()
676 PMBuilder.OptLevel = CodeGenOpts.OptimizationLevel; in CreatePasses()
677 PMBuilder.SizeLevel = CodeGenOpts.OptimizeSize; in CreatePasses()
678 PMBuilder.SLPVectorize = CodeGenOpts.VectorizeSLP; in CreatePasses()
679 PMBuilder.LoopVectorize = CodeGenOpts.VectorizeLoop; in CreatePasses()
682 PMBuilder.CallGraphProfile = !CodeGenOpts.DisableIntegratedAS; in CreatePasses()
684 PMBuilder.DisableUnrollLoops = !CodeGenOpts.UnrollLoops; in CreatePasses()
687 PMBuilder.LoopsInterleaved = CodeGenOpts.UnrollLoops; in CreatePasses()
688 PMBuilder.MergeFunctions = CodeGenOpts.MergeFunctions; in CreatePasses()
689 PMBuilder.PrepareForThinLTO = CodeGenOpts.PrepareForThinLTO; in CreatePasses()
690 PMBuilder.PrepareForLTO = CodeGenOpts.PrepareForLTO; in CreatePasses()
691 PMBuilder.RerollLoops = CodeGenOpts.RerollLoops; in CreatePasses()
698 if (CodeGenOpts.DebugInfoForProfiling || in CreatePasses()
699 !CodeGenOpts.SampleProfileFile.empty()) in CreatePasses()
716 if (!CodeGenOpts.MemoryProfileOutput.empty()) { in CreatePasses()
730 if (CodeGenOpts.SanitizeCoverageType || in CreatePasses()
731 CodeGenOpts.SanitizeCoverageIndirectCalls || in CreatePasses()
732 CodeGenOpts.SanitizeCoverageTraceCmp) { in CreatePasses()
795 if (CodeGenOpts.InstrumentFunctions || in CreatePasses()
796 CodeGenOpts.InstrumentFunctionEntryBare || in CreatePasses()
797 CodeGenOpts.InstrumentFunctionsAfterInlining || in CreatePasses()
798 CodeGenOpts.InstrumentForProfiling) { in CreatePasses()
811 if (CodeGenOpts.VerifyModule) in CreatePasses()
815 if (!CodeGenOpts.RewriteMapFiles.empty()) in CreatePasses()
816 addSymbolRewriterPass(CodeGenOpts, &MPM); in CreatePasses()
818 if (Optional<GCOVOptions> Options = getGCOVOptions(CodeGenOpts, LangOpts)) { in CreatePasses()
820 if (CodeGenOpts.getDebugInfo() == codegenoptions::NoDebugInfo) in CreatePasses()
825 getInstrProfOptions(CodeGenOpts, LangOpts)) in CreatePasses()
829 if (CodeGenOpts.hasProfileIRInstr()) { in CreatePasses()
833 if (CodeGenOpts.hasProfileCSIRInstr()) { in CreatePasses()
834 assert(!CodeGenOpts.hasProfileCSIRUse() && in CreatePasses()
844 if (!CodeGenOpts.InstrProfileOutput.empty()) in CreatePasses()
845 PMBuilder.PGOInstrGen = CodeGenOpts.InstrProfileOutput; in CreatePasses()
849 if (CodeGenOpts.hasProfileIRUse()) { in CreatePasses()
850 PMBuilder.PGOInstrUse = CodeGenOpts.ProfileInstrumentUsePath; in CreatePasses()
851 PMBuilder.EnablePGOCSInstrUse = CodeGenOpts.hasProfileCSIRUse(); in CreatePasses()
854 if (!CodeGenOpts.SampleProfileFile.empty()) in CreatePasses()
855 PMBuilder.PGOSampleUse = CodeGenOpts.SampleProfileFile; in CreatePasses()
861 static void setCommandLineOpts(const CodeGenOptions &CodeGenOpts) { in setCommandLineOpts() argument
864 if (!CodeGenOpts.DebugPass.empty()) { in setCommandLineOpts()
866 BackendArgs.push_back(CodeGenOpts.DebugPass.c_str()); in setCommandLineOpts()
868 if (!CodeGenOpts.LimitFloatPrecision.empty()) { in setCommandLineOpts()
870 BackendArgs.push_back(CodeGenOpts.LimitFloatPrecision.c_str()); in setCommandLineOpts()
896 Optional<llvm::CodeModel::Model> CM = getCodeModel(CodeGenOpts); in CreateTargetMachine()
899 llvm::Reloc::Model RM = CodeGenOpts.RelocationModel; in CreateTargetMachine()
900 CodeGenOpt::Level OptLevel = getCGOptLevel(CodeGenOpts); in CreateTargetMachine()
903 if (!initTargetOptions(Diags, Options, CodeGenOpts, TargetOpts, LangOpts, in CreateTargetMachine()
917 createTLII(TargetTriple, CodeGenOpts)); in AddEmitPasses()
927 if (CodeGenOpts.OptimizationLevel > 0) in AddEmitPasses()
931 /*DisableVerify=*/!CodeGenOpts.VerifyModule)) { in AddEmitPasses()
941 TimeRegion Region(CodeGenOpts.TimePasses ? &CodeGenerationTime : nullptr); in EmitAssembly()
943 setCommandLineOpts(CodeGenOpts); in EmitAssembly()
957 if (CodeGenOpts.EnableDIPreservationVerify) { in EmitAssembly()
961 if (!CodeGenOpts.DIBugsReportFilePath.empty()) in EmitAssembly()
963 CodeGenOpts.DIBugsReportFilePath); in EmitAssembly()
985 if (CodeGenOpts.PrepareForThinLTO && !CodeGenOpts.DisableLLVMPasses) { in EmitAssembly()
986 if (!CodeGenOpts.ThinLinkBitcodeFile.empty()) { in EmitAssembly()
987 ThinLinkOS = openOutputFile(CodeGenOpts.ThinLinkBitcodeFile); in EmitAssembly()
992 CodeGenOpts.EnableSplitLTOUnit); in EmitAssembly()
999 (CodeGenOpts.PrepareForLTO && in EmitAssembly()
1000 !CodeGenOpts.DisableLLVMPasses && in EmitAssembly()
1011 *OS, CodeGenOpts.EmitLLVMUseLists, EmitLTOSummary)); in EmitAssembly()
1017 createPrintModulePass(*OS, "", CodeGenOpts.EmitLLVMUseLists)); in EmitAssembly()
1021 if (!CodeGenOpts.SplitDwarfOutput.empty()) { in EmitAssembly()
1022 DwoOS = openOutputFile(CodeGenOpts.SplitDwarfOutput); in EmitAssembly()
1098 const CodeGenOptions &CodeGenOpts, in addSanitizers() argument
1102 if (CodeGenOpts.SanitizeCoverageType || in addSanitizers()
1103 CodeGenOpts.SanitizeCoverageIndirectCalls || in addSanitizers()
1104 CodeGenOpts.SanitizeCoverageTraceCmp) { in addSanitizers()
1105 auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts); in addSanitizers()
1107 SancovOpts, CodeGenOpts.SanitizeCoverageAllowlistFiles, in addSanitizers()
1108 CodeGenOpts.SanitizeCoverageIgnorelistFiles)); in addSanitizers()
1113 int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins; in addSanitizers()
1114 bool Recover = CodeGenOpts.SanitizeRecover.has(Mask); in addSanitizers()
1146 bool Recover = CodeGenOpts.SanitizeRecover.has(Mask); in addSanitizers()
1147 bool UseAfterScope = CodeGenOpts.SanitizeAddressUseAfterScope; in addSanitizers()
1148 bool ModuleUseAfterScope = asanUseGlobalsGC(TargetTriple, CodeGenOpts); in addSanitizers()
1149 bool UseOdrIndicator = CodeGenOpts.SanitizeAddressUseOdrIndicator; in addSanitizers()
1151 CodeGenOpts.getSanitizeAddressDtor(); in addSanitizers()
1165 bool Recover = CodeGenOpts.SanitizeRecover.has(Mask); in addSanitizers()
1188 TimeRegion Region(CodeGenOpts.TimePasses ? &CodeGenerationTime : nullptr); in EmitAssemblyWithNewPassManager()
1189 setCommandLineOpts(CodeGenOpts); in EmitAssemblyWithNewPassManager()
1203 if (CodeGenOpts.hasProfileIRInstr()) in EmitAssemblyWithNewPassManager()
1205 PGOOpt = PGOOptions(CodeGenOpts.InstrProfileOutput.empty() in EmitAssemblyWithNewPassManager()
1207 : CodeGenOpts.InstrProfileOutput, in EmitAssemblyWithNewPassManager()
1209 CodeGenOpts.DebugInfoForProfiling); in EmitAssemblyWithNewPassManager()
1210 else if (CodeGenOpts.hasProfileIRUse()) { in EmitAssemblyWithNewPassManager()
1212 auto CSAction = CodeGenOpts.hasProfileCSIRUse() ? PGOOptions::CSIRUse in EmitAssemblyWithNewPassManager()
1214 PGOOpt = PGOOptions(CodeGenOpts.ProfileInstrumentUsePath, "", in EmitAssemblyWithNewPassManager()
1215 CodeGenOpts.ProfileRemappingFile, PGOOptions::IRUse, in EmitAssemblyWithNewPassManager()
1216 CSAction, CodeGenOpts.DebugInfoForProfiling); in EmitAssemblyWithNewPassManager()
1217 } else if (!CodeGenOpts.SampleProfileFile.empty()) in EmitAssemblyWithNewPassManager()
1220 CodeGenOpts.SampleProfileFile, "", CodeGenOpts.ProfileRemappingFile, in EmitAssemblyWithNewPassManager()
1222 CodeGenOpts.DebugInfoForProfiling, CodeGenOpts.PseudoProbeForProfiling); in EmitAssemblyWithNewPassManager()
1223 else if (CodeGenOpts.PseudoProbeForProfiling) in EmitAssemblyWithNewPassManager()
1227 CodeGenOpts.DebugInfoForProfiling, true); in EmitAssemblyWithNewPassManager()
1228 else if (CodeGenOpts.DebugInfoForProfiling) in EmitAssemblyWithNewPassManager()
1234 if (CodeGenOpts.hasProfileCSIRInstr()) { in EmitAssemblyWithNewPassManager()
1235 assert(!CodeGenOpts.hasProfileCSIRUse() && in EmitAssemblyWithNewPassManager()
1243 PGOOpt->CSProfileGenFile = CodeGenOpts.InstrProfileOutput.empty() in EmitAssemblyWithNewPassManager()
1245 : CodeGenOpts.InstrProfileOutput; in EmitAssemblyWithNewPassManager()
1249 CodeGenOpts.InstrProfileOutput.empty() in EmitAssemblyWithNewPassManager()
1251 : CodeGenOpts.InstrProfileOutput, in EmitAssemblyWithNewPassManager()
1253 CodeGenOpts.DebugInfoForProfiling); in EmitAssemblyWithNewPassManager()
1257 PTO.LoopUnrolling = CodeGenOpts.UnrollLoops; in EmitAssemblyWithNewPassManager()
1260 PTO.LoopInterleaving = CodeGenOpts.UnrollLoops; in EmitAssemblyWithNewPassManager()
1261 PTO.LoopVectorization = CodeGenOpts.VectorizeLoop; in EmitAssemblyWithNewPassManager()
1262 PTO.SLPVectorization = CodeGenOpts.VectorizeSLP; in EmitAssemblyWithNewPassManager()
1263 PTO.MergeFunctions = CodeGenOpts.MergeFunctions; in EmitAssemblyWithNewPassManager()
1266 PTO.CallGraphProfile = !CodeGenOpts.DisableIntegratedAS; in EmitAssemblyWithNewPassManager()
1274 bool DebugPassStructure = CodeGenOpts.DebugPass == "Structure"; in EmitAssemblyWithNewPassManager()
1279 StandardInstrumentations SI(CodeGenOpts.DebugPassManager || in EmitAssemblyWithNewPassManager()
1286 for (auto &PluginFN : CodeGenOpts.PassPlugins) { in EmitAssemblyWithNewPassManager()
1306 createTLII(TargetTriple, CodeGenOpts)); in EmitAssemblyWithNewPassManager()
1318 if (!CodeGenOpts.DisableLLVMPasses) { in EmitAssemblyWithNewPassManager()
1321 PassBuilder::OptimizationLevel Level = mapToLevel(CodeGenOpts); in EmitAssemblyWithNewPassManager()
1323 bool IsThinLTO = CodeGenOpts.PrepareForThinLTO; in EmitAssemblyWithNewPassManager()
1324 bool IsLTO = CodeGenOpts.PrepareForLTO; in EmitAssemblyWithNewPassManager()
1348 bool IsThinLTOPostLink = !CodeGenOpts.ThinLTOIndexFile.empty(); in EmitAssemblyWithNewPassManager()
1359 if (CodeGenOpts.InstrumentFunctions || in EmitAssemblyWithNewPassManager()
1360 CodeGenOpts.InstrumentFunctionEntryBare || in EmitAssemblyWithNewPassManager()
1361 CodeGenOpts.InstrumentFunctionsAfterInlining || in EmitAssemblyWithNewPassManager()
1362 CodeGenOpts.InstrumentForProfiling) { in EmitAssemblyWithNewPassManager()
1386 addSanitizers(TargetTriple, CodeGenOpts, LangOpts, PB); in EmitAssemblyWithNewPassManager()
1388 if (Optional<GCOVOptions> Options = getGCOVOptions(CodeGenOpts, LangOpts)) in EmitAssemblyWithNewPassManager()
1395 getInstrProfOptions(CodeGenOpts, LangOpts)) in EmitAssemblyWithNewPassManager()
1402 if (CodeGenOpts.OptimizationLevel == 0) { in EmitAssemblyWithNewPassManager()
1412 if (!CodeGenOpts.MemoryProfileOutput.empty()) { in EmitAssemblyWithNewPassManager()
1430 if (CodeGenOpts.PrepareForThinLTO && !CodeGenOpts.DisableLLVMPasses) { in EmitAssemblyWithNewPassManager()
1431 if (!CodeGenOpts.ThinLinkBitcodeFile.empty()) { in EmitAssemblyWithNewPassManager()
1432 ThinLinkOS = openOutputFile(CodeGenOpts.ThinLinkBitcodeFile); in EmitAssemblyWithNewPassManager()
1437 CodeGenOpts.EnableSplitLTOUnit); in EmitAssemblyWithNewPassManager()
1444 (CodeGenOpts.PrepareForLTO && in EmitAssemblyWithNewPassManager()
1445 !CodeGenOpts.DisableLLVMPasses && in EmitAssemblyWithNewPassManager()
1455 BitcodeWriterPass(*OS, CodeGenOpts.EmitLLVMUseLists, EmitLTOSummary)); in EmitAssemblyWithNewPassManager()
1460 MPM.addPass(PrintModulePass(*OS, "", CodeGenOpts.EmitLLVMUseLists)); in EmitAssemblyWithNewPassManager()
1469 if (!CodeGenOpts.SplitDwarfOutput.empty()) { in EmitAssemblyWithNewPassManager()
1470 DwoOS = openOutputFile(CodeGenOpts.SplitDwarfOutput); in EmitAssemblyWithNewPassManager()