Lines Matching defs:CodeGenOpts
137 const CodeGenOptions &CodeGenOpts;
196 return CodeGenOpts.PrepareForLTO && !CodeGenOpts.DisableLLVMPasses &&
204 return CodeGenOpts.UnifiedLTO &&
205 (CodeGenOpts.PrepareForThinLTO || shouldEmitRegularLTOSummary());
215 : Diags(_Diags), HSOpts(HeaderSearchOpts), CodeGenOpts(CGOpts),
221 if (CodeGenOpts.DisableFree)
293 getCodeModel(const CodeGenOptions &CodeGenOpts) {
294 unsigned CodeModel = llvm::StringSwitch<unsigned>(CodeGenOpts.CodeModel)
326 const CodeGenOptions &CodeGenOpts,
340 assert((CodeGenOpts.FloatABI == "soft" || CodeGenOpts.FloatABI == "softfp" ||
341 CodeGenOpts.FloatABI == "hard" || CodeGenOpts.FloatABI.empty()) &&
344 llvm::StringSwitch<llvm::FloatABI::ABIType>(CodeGenOpts.FloatABI)
367 llvm::TargetMachine::parseBinutilsVersion(CodeGenOpts.BinutilsVersion);
368 Options.UseInitArray = CodeGenOpts.UseInitArray;
369 Options.DisableIntegratedAS = CodeGenOpts.DisableIntegratedAS;
385 Options.NoZerosInBSS = CodeGenOpts.NoZeroInitializedInBSS;
394 Options.BBAddrMap = CodeGenOpts.BBAddrMap;
396 llvm::StringSwitch<llvm::BasicBlockSection>(CodeGenOpts.BBSections)
405 MemoryBuffer::getFile(CodeGenOpts.BBSections.substr(5));
414 Options.EnableMachineFunctionSplitter = CodeGenOpts.SplitMachineFunctions;
415 Options.FunctionSections = CodeGenOpts.FunctionSections;
416 Options.DataSections = CodeGenOpts.DataSections;
418 Options.UniqueSectionNames = CodeGenOpts.UniqueSectionNames;
420 CodeGenOpts.UniqueBasicBlockSectionNames;
421 Options.SeparateNamedSections = CodeGenOpts.SeparateNamedSections;
422 Options.TLSSize = CodeGenOpts.TLSSize;
423 Options.EnableTLSDESC = CodeGenOpts.EnableTLSDESC;
424 Options.EmulatedTLS = CodeGenOpts.EmulatedTLS;
425 Options.DebuggerTuning = CodeGenOpts.getDebuggerTuning();
426 Options.EmitStackSizeSection = CodeGenOpts.StackSizeSection;
427 Options.StackUsageOutput = CodeGenOpts.StackUsageOutput;
428 Options.EmitAddrsig = CodeGenOpts.Addrsig;
429 Options.ForceDwarfFrameSection = CodeGenOpts.ForceDwarfFrameSection;
430 Options.EmitCallSiteInfo = CodeGenOpts.EmitCallSiteInfo;
432 Options.XRayFunctionIndex = CodeGenOpts.XRayFunctionIndex;
433 Options.LoopAlignment = CodeGenOpts.LoopAlignment;
434 Options.DebugStrictDwarf = CodeGenOpts.DebugStrictDwarf;
435 Options.ObjectFilenameForDebug = CodeGenOpts.ObjectFilenameForDebug;
436 Options.Hotpatch = CodeGenOpts.HotPatch;
437 Options.JMCInstrument = CodeGenOpts.JMCInstrument;
438 Options.XCOFFReadOnlyPointers = CodeGenOpts.XCOFFReadOnlyPointers;
440 switch (CodeGenOpts.getSwiftAsyncFramePointer()) {
455 Options.MCOptions.SplitDwarfFile = CodeGenOpts.SplitDwarfFile;
456 Options.MCOptions.EmitDwarfUnwind = CodeGenOpts.getEmitDwarfUnwind();
458 CodeGenOpts.EmitCompactUnwindNonCanonical;
459 Options.MCOptions.MCRelaxAll = CodeGenOpts.RelaxAll;
460 Options.MCOptions.MCSaveTempLabels = CodeGenOpts.SaveTempLabels;
462 CodeGenOpts.NoDwarfDirectoryAsm
465 Options.MCOptions.MCNoExecStack = CodeGenOpts.NoExecStack;
467 CodeGenOpts.IncrementalLinkerCompatible;
468 Options.MCOptions.MCFatalWarnings = CodeGenOpts.FatalWarnings;
469 Options.MCOptions.MCNoWarn = CodeGenOpts.NoWarn;
470 Options.MCOptions.AsmVerbose = CodeGenOpts.AsmVerbose;
471 Options.MCOptions.Dwarf64 = CodeGenOpts.Dwarf64;
472 Options.MCOptions.PreserveAsmComments = CodeGenOpts.PreserveAsmComments;
473 Options.MCOptions.Crel = CodeGenOpts.Crel;
474 Options.MCOptions.X86RelaxRelocations = CodeGenOpts.RelaxELFRelocations;
476 CodeGenOpts.getCompressDebugSections();
485 Options.MCOptions.Argv0 = CodeGenOpts.Argv0;
486 Options.MCOptions.CommandLineArgs = CodeGenOpts.CommandLineArgs;
487 Options.MCOptions.AsSecureLogFile = CodeGenOpts.AsSecureLogFile;
489 CodeGenOpts.PPCUseFullRegisterNames;
490 Options.MisExpect = CodeGenOpts.MisExpect;
496 getGCOVOptions(const CodeGenOptions &CodeGenOpts, const LangOptions &LangOpts) {
497 if (CodeGenOpts.CoverageNotesFile.empty() &&
498 CodeGenOpts.CoverageDataFile.empty())
503 Options.EmitNotes = !CodeGenOpts.CoverageNotesFile.empty();
504 Options.EmitData = !CodeGenOpts.CoverageDataFile.empty();
505 llvm::copy(CodeGenOpts.CoverageVersion, std::begin(Options.Version));
506 Options.NoRedZone = CodeGenOpts.DisableRedZone;
507 Options.Filter = CodeGenOpts.ProfileFilterFiles;
508 Options.Exclude = CodeGenOpts.ProfileExcludeFiles;
509 Options.Atomic = CodeGenOpts.AtomicProfileUpdate;
514 getInstrProfOptions(const CodeGenOptions &CodeGenOpts,
516 if (!CodeGenOpts.hasProfileClangInstr())
519 Options.NoRedZone = CodeGenOpts.DisableRedZone;
520 Options.InstrProfileOutput = CodeGenOpts.InstrProfileOutput;
521 Options.Atomic = CodeGenOpts.AtomicProfileUpdate;
525 static void setCommandLineOpts(const CodeGenOptions &CodeGenOpts) {
528 if (!CodeGenOpts.DebugPass.empty()) {
530 BackendArgs.push_back(CodeGenOpts.DebugPass.c_str());
532 if (!CodeGenOpts.LimitFloatPrecision.empty()) {
534 BackendArgs.push_back(CodeGenOpts.LimitFloatPrecision.c_str());
560 std::optional<llvm::CodeModel::Model> CM = getCodeModel(CodeGenOpts);
563 llvm::Reloc::Model RM = CodeGenOpts.RelocationModel;
565 CodeGenOpt::getLevel(CodeGenOpts.OptimizationLevel);
570 if (!initTargetOptions(Diags, Options, CodeGenOpts, TargetOpts, LangOpts,
575 TM->setLargeDataThreshold(CodeGenOpts.LargeDataThreshold);
584 llvm::driver::createTLII(TargetTriple, CodeGenOpts.getVecLib()));
594 if (CodeGenOpts.OptimizationLevel > 0)
598 /*DisableVerify=*/!CodeGenOpts.VerifyModule)) {
663 const CodeGenOptions &CodeGenOpts,
667 if (CodeGenOpts.hasSanitizeCoverage()) {
668 auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts);
670 SancovOpts, CodeGenOpts.SanitizeCoverageAllowlistFiles,
671 CodeGenOpts.SanitizeCoverageIgnorelistFiles));
674 if (CodeGenOpts.hasSanitizeBinaryMetadata()) {
676 getSanitizerBinaryMetadataOptions(CodeGenOpts),
677 CodeGenOpts.SanitizeMetadataIgnorelistFiles));
682 int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
683 bool Recover = CodeGenOpts.SanitizeRecover.has(Mask);
686 CodeGenOpts.SanitizeMemoryParamRetval);
717 bool UseGlobalGC = asanUseGlobalsGC(TargetTriple, CodeGenOpts);
718 bool UseOdrIndicator = CodeGenOpts.SanitizeAddressUseOdrIndicator;
720 CodeGenOpts.getSanitizeAddressDtor();
723 Opts.Recover = CodeGenOpts.SanitizeRecover.has(Mask);
724 Opts.UseAfterScope = CodeGenOpts.SanitizeAddressUseAfterScope;
725 Opts.UseAfterReturn = CodeGenOpts.getSanitizeAddressUseAfterReturn();
735 bool Recover = CodeGenOpts.SanitizeRecover.has(Mask);
738 /*DisableOptimization=*/CodeGenOpts.OptimizationLevel == 0}));
780 if (CodeGenOpts.hasProfileIRInstr())
783 CodeGenOpts.InstrProfileOutput.empty() ? getDefaultProfileGenName()
784 : CodeGenOpts.InstrProfileOutput,
785 "", "", CodeGenOpts.MemoryProfileUsePath, nullptr, PGOOptions::IRInstr,
787 CodeGenOpts.DebugInfoForProfiling,
788 /*PseudoProbeForProfiling=*/false, CodeGenOpts.AtomicProfileUpdate);
789 else if (CodeGenOpts.hasProfileIRUse()) {
791 auto CSAction = CodeGenOpts.hasProfileCSIRUse() ? PGOOptions::CSIRUse
793 PGOOpt = PGOOptions(CodeGenOpts.ProfileInstrumentUsePath, "",
794 CodeGenOpts.ProfileRemappingFile,
795 CodeGenOpts.MemoryProfileUsePath, VFS,
797 CodeGenOpts.DebugInfoForProfiling);
798 } else if (!CodeGenOpts.SampleProfileFile.empty())
801 CodeGenOpts.SampleProfileFile, "", CodeGenOpts.ProfileRemappingFile,
802 CodeGenOpts.MemoryProfileUsePath, VFS, PGOOptions::SampleUse,
804 CodeGenOpts.DebugInfoForProfiling, CodeGenOpts.PseudoProbeForProfiling);
805 else if (!CodeGenOpts.MemoryProfileUsePath.empty())
807 PGOOpt = PGOOptions("", "", "", CodeGenOpts.MemoryProfileUsePath, VFS,
809 ClPGOColdFuncAttr, CodeGenOpts.DebugInfoForProfiling);
810 else if (CodeGenOpts.PseudoProbeForProfiling)
815 ClPGOColdFuncAttr, CodeGenOpts.DebugInfoForProfiling, true);
816 else if (CodeGenOpts.DebugInfoForProfiling)
823 if (CodeGenOpts.hasProfileCSIRInstr()) {
824 assert(!CodeGenOpts.hasProfileCSIRUse() &&
832 PGOOpt->CSProfileGenFile = CodeGenOpts.InstrProfileOutput.empty()
834 : CodeGenOpts.InstrProfileOutput;
838 CodeGenOpts.InstrProfileOutput.empty()
840 : CodeGenOpts.InstrProfileOutput,
843 ClPGOColdFuncAttr, CodeGenOpts.DebugInfoForProfiling);
849 PTO.LoopUnrolling = CodeGenOpts.UnrollLoops;
852 PTO.LoopInterleaving = CodeGenOpts.UnrollLoops;
853 PTO.LoopVectorization = CodeGenOpts.VectorizeLoop;
854 PTO.SLPVectorization = CodeGenOpts.VectorizeSLP;
855 PTO.MergeFunctions = CodeGenOpts.MergeFunctions;
858 PTO.CallGraphProfile = !CodeGenOpts.DisableIntegratedAS;
859 PTO.UnifiedLTO = CodeGenOpts.UnifiedLTO;
866 bool DebugPassStructure = CodeGenOpts.DebugPass == "Structure";
873 (CodeGenOpts.DebugPassManager || DebugPassStructure),
874 CodeGenOpts.VerifyEach, PrintPassOpts);
879 switch (CodeGenOpts.getAssignmentTrackingMode()) {
889 if (!CodeGenOpts.PrepareForThinLTO && !CodeGenOpts.PrepareForLTO &&
890 CodeGenOpts.getDebuggerTuning() != llvm::DebuggerKind::LLDB) {
906 if (CodeGenOpts.EnableDIPreservationVerify) {
910 if (!CodeGenOpts.DIBugsReportFilePath.empty())
912 CodeGenOpts.DIBugsReportFilePath);
916 for (auto &PluginFN : CodeGenOpts.PassPlugins) {
925 for (const auto &PassCallback : CodeGenOpts.PassBuilderCallbacks)
934 llvm::driver::createTLII(TargetTriple, CodeGenOpts.getVecLib()));
946 if (CodeGenOpts.VerifyModule)
949 if (!CodeGenOpts.DisableLLVMPasses) {
952 OptimizationLevel Level = mapToLevel(CodeGenOpts);
954 const bool PrepareForThinLTO = CodeGenOpts.PrepareForThinLTO;
955 const bool PrepareForLTO = CodeGenOpts.PrepareForLTO;
979 bool IsThinLTOPostLink = !CodeGenOpts.ThinLTOIndexFile.empty();
1001 addSanitizers(TargetTriple, CodeGenOpts, LangOpts, PB);
1006 getGCOVOptions(CodeGenOpts, LangOpts))
1012 getInstrProfOptions(CodeGenOpts, LangOpts))
1020 if (!CodeGenOpts.MemoryProfileOutput.empty()) {
1028 if (CodeGenOpts.FatLTO) {
1042 if (CodeGenOpts.LinkBitcodePostopt)
1050 if (!actionRequiresCodeGen(Action) && CodeGenOpts.VerifyModule)
1054 CodeGenOpts.FatLTO) {
1055 if (CodeGenOpts.PrepareForThinLTO && !CodeGenOpts.DisableLLVMPasses) {
1058 CodeGenOpts.EnableSplitLTOUnit);
1060 if (!CodeGenOpts.ThinLinkBitcodeFile.empty()) {
1061 ThinLinkOS = openOutputFile(CodeGenOpts.ThinLinkBitcodeFile);
1068 MPM.addPass(PrintModulePass(*OS, "", CodeGenOpts.EmitLLVMUseLists,
1076 if (!TheModule->getModuleFlag("ThinLTO") && !CodeGenOpts.UnifiedLTO)
1083 MPM.addPass(BitcodeWriterPass(*OS, CodeGenOpts.EmitLLVMUseLists,
1086 MPM.addPass(PrintModulePass(*OS, "", CodeGenOpts.EmitLLVMUseLists,
1133 if (!CodeGenOpts.SplitDwarfOutput.empty()) {
1134 DwoOS = openOutputFile(CodeGenOpts.SplitDwarfOutput);
1164 TimeRegion Region(CodeGenOpts.TimePasses ? &CodeGenerationTime : nullptr);
1165 setCommandLineOpts(CodeGenOpts);