Lines Matching defs:CodeGenOpts
139 const CodeGenOptions &CodeGenOpts;
196 return CodeGenOpts.PrepareForLTO && !CodeGenOpts.DisableLLVMPasses &&
204 return CodeGenOpts.UnifiedLTO &&
205 (CodeGenOpts.PrepareForThinLTO || shouldEmitRegularLTOSummary());
212 : CI(CI), Diags(CI.getDiagnostics()), CodeGenOpts(CGOpts),
218 if (CodeGenOpts.DisableFree)
290 getCodeModel(const CodeGenOptions &CodeGenOpts) {
291 unsigned CodeModel = llvm::StringSwitch<unsigned>(CodeGenOpts.CodeModel)
357 const auto &CodeGenOpts = CI.getCodeGenOpts();
371 assert((CodeGenOpts.FloatABI == "soft" || CodeGenOpts.FloatABI == "softfp" ||
372 CodeGenOpts.FloatABI == "hard" || CodeGenOpts.FloatABI.empty()) &&
375 llvm::StringSwitch<llvm::FloatABI::ABIType>(CodeGenOpts.FloatABI)
398 llvm::TargetMachine::parseBinutilsVersion(CodeGenOpts.BinutilsVersion);
399 Options.UseInitArray = CodeGenOpts.UseInitArray;
400 Options.DisableIntegratedAS = CodeGenOpts.DisableIntegratedAS;
416 Options.NoZerosInBSS = CodeGenOpts.NoZeroInitializedInBSS;
425 Options.BBAddrMap = CodeGenOpts.BBAddrMap;
427 llvm::StringSwitch<llvm::BasicBlockSection>(CodeGenOpts.BBSections)
435 MemoryBuffer::getFile(CodeGenOpts.BBSections.substr(5));
444 Options.EnableMachineFunctionSplitter = CodeGenOpts.SplitMachineFunctions;
445 Options.FunctionSections = CodeGenOpts.FunctionSections;
446 Options.DataSections = CodeGenOpts.DataSections;
448 Options.UniqueSectionNames = CodeGenOpts.UniqueSectionNames;
450 CodeGenOpts.UniqueBasicBlockSectionNames;
451 Options.SeparateNamedSections = CodeGenOpts.SeparateNamedSections;
452 Options.TLSSize = CodeGenOpts.TLSSize;
453 Options.EnableTLSDESC = CodeGenOpts.EnableTLSDESC;
454 Options.EmulatedTLS = CodeGenOpts.EmulatedTLS;
455 Options.DebuggerTuning = CodeGenOpts.getDebuggerTuning();
456 Options.EmitStackSizeSection = CodeGenOpts.StackSizeSection;
457 Options.StackUsageOutput = CodeGenOpts.StackUsageOutput;
458 Options.EmitAddrsig = CodeGenOpts.Addrsig;
459 Options.ForceDwarfFrameSection = CodeGenOpts.ForceDwarfFrameSection;
460 Options.EmitCallSiteInfo = CodeGenOpts.EmitCallSiteInfo;
462 Options.XRayFunctionIndex = CodeGenOpts.XRayFunctionIndex;
463 Options.LoopAlignment = CodeGenOpts.LoopAlignment;
464 Options.DebugStrictDwarf = CodeGenOpts.DebugStrictDwarf;
465 Options.ObjectFilenameForDebug = CodeGenOpts.ObjectFilenameForDebug;
466 Options.Hotpatch = CodeGenOpts.HotPatch;
467 Options.JMCInstrument = CodeGenOpts.JMCInstrument;
468 Options.XCOFFReadOnlyPointers = CodeGenOpts.XCOFFReadOnlyPointers;
470 switch (CodeGenOpts.getSwiftAsyncFramePointer()) {
485 Options.MCOptions.SplitDwarfFile = CodeGenOpts.SplitDwarfFile;
486 Options.MCOptions.EmitDwarfUnwind = CodeGenOpts.getEmitDwarfUnwind();
488 CodeGenOpts.EmitCompactUnwindNonCanonical;
489 Options.MCOptions.MCRelaxAll = CodeGenOpts.RelaxAll;
490 Options.MCOptions.MCSaveTempLabels = CodeGenOpts.SaveTempLabels;
492 CodeGenOpts.NoDwarfDirectoryAsm
495 Options.MCOptions.MCNoExecStack = CodeGenOpts.NoExecStack;
497 CodeGenOpts.IncrementalLinkerCompatible;
498 Options.MCOptions.MCFatalWarnings = CodeGenOpts.FatalWarnings;
499 Options.MCOptions.MCNoWarn = CodeGenOpts.NoWarn;
500 Options.MCOptions.AsmVerbose = CodeGenOpts.AsmVerbose;
501 Options.MCOptions.Dwarf64 = CodeGenOpts.Dwarf64;
502 Options.MCOptions.PreserveAsmComments = CodeGenOpts.PreserveAsmComments;
503 Options.MCOptions.Crel = CodeGenOpts.Crel;
504 Options.MCOptions.ImplicitMapSyms = CodeGenOpts.ImplicitMapSyms;
505 Options.MCOptions.X86RelaxRelocations = CodeGenOpts.X86RelaxRelocations;
507 CodeGenOpts.getCompressDebugSections();
508 if (CodeGenOpts.OutputAsmVariant != 3) // 3 (default): not specified
509 Options.MCOptions.OutputAsmVariant = CodeGenOpts.OutputAsmVariant;
518 Options.MCOptions.Argv0 = CodeGenOpts.Argv0 ? CodeGenOpts.Argv0 : "";
520 CodeGenOpts.CommandLineArgs, CodeGenOpts.MainFileName);
521 Options.MCOptions.AsSecureLogFile = CodeGenOpts.AsSecureLogFile;
523 CodeGenOpts.PPCUseFullRegisterNames;
524 Options.MisExpect = CodeGenOpts.MisExpect;
530 getGCOVOptions(const CodeGenOptions &CodeGenOpts, const LangOptions &LangOpts) {
531 if (CodeGenOpts.CoverageNotesFile.empty() &&
532 CodeGenOpts.CoverageDataFile.empty())
537 Options.EmitNotes = !CodeGenOpts.CoverageNotesFile.empty();
538 Options.EmitData = !CodeGenOpts.CoverageDataFile.empty();
539 llvm::copy(CodeGenOpts.CoverageVersion, std::begin(Options.Version));
540 Options.NoRedZone = CodeGenOpts.DisableRedZone;
541 Options.Filter = CodeGenOpts.ProfileFilterFiles;
542 Options.Exclude = CodeGenOpts.ProfileExcludeFiles;
543 Options.Atomic = CodeGenOpts.AtomicProfileUpdate;
548 getInstrProfOptions(const CodeGenOptions &CodeGenOpts,
550 if (!CodeGenOpts.hasProfileClangInstr())
553 Options.NoRedZone = CodeGenOpts.DisableRedZone;
554 Options.InstrProfileOutput = CodeGenOpts.InstrProfileOutput;
555 Options.Atomic = CodeGenOpts.AtomicProfileUpdate;
559 static void setCommandLineOpts(const CodeGenOptions &CodeGenOpts) {
562 if (!CodeGenOpts.DebugPass.empty()) {
564 BackendArgs.push_back(CodeGenOpts.DebugPass.c_str());
566 if (!CodeGenOpts.LimitFloatPrecision.empty()) {
568 BackendArgs.push_back(CodeGenOpts.LimitFloatPrecision.c_str());
594 std::optional<llvm::CodeModel::Model> CM = getCodeModel(CodeGenOpts);
597 llvm::Reloc::Model RM = CodeGenOpts.RelocationModel;
599 CodeGenOpt::getLevel(CodeGenOpts.OptimizationLevel);
608 TM->setLargeDataThreshold(CodeGenOpts.LargeDataThreshold);
617 llvm::driver::createTLII(TargetTriple, CodeGenOpts.getVecLib()));
625 /*DisableVerify=*/!CodeGenOpts.VerifyModule)) {
690 const CodeGenOptions &CodeGenOpts,
694 if (CodeGenOpts.hasSanitizeCoverage()) {
695 auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts);
697 SancovOpts, CodeGenOpts.SanitizeCoverageAllowlistFiles,
698 CodeGenOpts.SanitizeCoverageIgnorelistFiles));
701 if (CodeGenOpts.hasSanitizeBinaryMetadata()) {
703 getSanitizerBinaryMetadataOptions(CodeGenOpts),
704 CodeGenOpts.SanitizeMetadataIgnorelistFiles));
709 int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
710 bool Recover = CodeGenOpts.SanitizeRecover.has(Mask);
713 CodeGenOpts.SanitizeMemoryParamRetval);
750 bool UseGlobalGC = asanUseGlobalsGC(TargetTriple, CodeGenOpts);
751 bool UseOdrIndicator = CodeGenOpts.SanitizeAddressUseOdrIndicator;
753 CodeGenOpts.getSanitizeAddressDtor();
756 Opts.Recover = CodeGenOpts.SanitizeRecover.has(Mask);
757 Opts.UseAfterScope = CodeGenOpts.SanitizeAddressUseAfterScope;
758 Opts.UseAfterReturn = CodeGenOpts.getSanitizeAddressUseAfterReturn();
768 bool Recover = CodeGenOpts.SanitizeRecover.has(Mask);
771 /*DisableOptimization=*/CodeGenOpts.OptimizationLevel == 0}));
814 if (CodeGenOpts.hasProfileIRInstr())
817 CodeGenOpts.InstrProfileOutput.empty() ? getDefaultProfileGenName()
818 : CodeGenOpts.InstrProfileOutput,
819 "", "", CodeGenOpts.MemoryProfileUsePath, nullptr, PGOOptions::IRInstr,
821 CodeGenOpts.DebugInfoForProfiling,
822 /*PseudoProbeForProfiling=*/false, CodeGenOpts.AtomicProfileUpdate);
823 else if (CodeGenOpts.hasProfileIRUse()) {
825 auto CSAction = CodeGenOpts.hasProfileCSIRUse() ? PGOOptions::CSIRUse
827 PGOOpt = PGOOptions(CodeGenOpts.ProfileInstrumentUsePath, "",
828 CodeGenOpts.ProfileRemappingFile,
829 CodeGenOpts.MemoryProfileUsePath, VFS,
831 CodeGenOpts.DebugInfoForProfiling);
832 } else if (!CodeGenOpts.SampleProfileFile.empty())
835 CodeGenOpts.SampleProfileFile, "", CodeGenOpts.ProfileRemappingFile,
836 CodeGenOpts.MemoryProfileUsePath, VFS, PGOOptions::SampleUse,
838 CodeGenOpts.DebugInfoForProfiling, CodeGenOpts.PseudoProbeForProfiling);
839 else if (!CodeGenOpts.MemoryProfileUsePath.empty())
841 PGOOpt = PGOOptions("", "", "", CodeGenOpts.MemoryProfileUsePath, VFS,
843 ClPGOColdFuncAttr, CodeGenOpts.DebugInfoForProfiling);
844 else if (CodeGenOpts.PseudoProbeForProfiling)
849 ClPGOColdFuncAttr, CodeGenOpts.DebugInfoForProfiling, true);
850 else if (CodeGenOpts.DebugInfoForProfiling)
857 if (CodeGenOpts.hasProfileCSIRInstr()) {
858 assert(!CodeGenOpts.hasProfileCSIRUse() &&
866 PGOOpt->CSProfileGenFile = CodeGenOpts.InstrProfileOutput.empty()
868 : CodeGenOpts.InstrProfileOutput;
872 CodeGenOpts.InstrProfileOutput.empty()
874 : CodeGenOpts.InstrProfileOutput,
877 ClPGOColdFuncAttr, CodeGenOpts.DebugInfoForProfiling);
883 PTO.LoopUnrolling = CodeGenOpts.UnrollLoops;
886 PTO.LoopInterleaving = CodeGenOpts.UnrollLoops;
887 PTO.LoopVectorization = CodeGenOpts.VectorizeLoop;
888 PTO.SLPVectorization = CodeGenOpts.VectorizeSLP;
889 PTO.MergeFunctions = CodeGenOpts.MergeFunctions;
892 PTO.CallGraphProfile = !CodeGenOpts.DisableIntegratedAS;
893 PTO.UnifiedLTO = CodeGenOpts.UnifiedLTO;
900 bool DebugPassStructure = CodeGenOpts.DebugPass == "Structure";
907 (CodeGenOpts.DebugPassManager || DebugPassStructure),
908 CodeGenOpts.VerifyEach, PrintPassOpts);
913 switch (CodeGenOpts.getAssignmentTrackingMode()) {
923 if (!CodeGenOpts.PrepareForThinLTO && !CodeGenOpts.PrepareForLTO &&
924 CodeGenOpts.getDebuggerTuning() != llvm::DebuggerKind::LLDB) {
940 if (CodeGenOpts.EnableDIPreservationVerify) {
944 if (!CodeGenOpts.DIBugsReportFilePath.empty())
946 CodeGenOpts.DIBugsReportFilePath);
950 for (auto &PluginFN : CodeGenOpts.PassPlugins) {
959 for (const auto &PassCallback : CodeGenOpts.PassBuilderCallbacks)
968 llvm::driver::createTLII(TargetTriple, CodeGenOpts.getVecLib()));
980 if (CodeGenOpts.VerifyModule)
983 if (!CodeGenOpts.DisableLLVMPasses) {
986 OptimizationLevel Level = mapToLevel(CodeGenOpts);
988 const bool PrepareForThinLTO = CodeGenOpts.PrepareForThinLTO;
989 const bool PrepareForLTO = CodeGenOpts.PrepareForLTO;
1014 bool IsThinLTOPostLink = !CodeGenOpts.ThinLTOIndexFile.empty();
1032 if (CodeGenOpts.SanitizeSkipHotCutoffs[SanitizerKind::SO_LocalBounds] ||
1042 CodeGenOpts.SanitizeMergeHandlers.has(SanitizerKind::LocalBounds);
1043 if (!CodeGenOpts.SanitizeTrap.has(SanitizerKind::LocalBounds)) {
1046 CodeGenOpts.SanitizeMinimalRuntime),
1048 CodeGenOpts.SanitizeRecover.has(SanitizerKind::LocalBounds),
1057 addSanitizers(TargetTriple, CodeGenOpts, LangOpts, PB);
1062 getGCOVOptions(CodeGenOpts, LangOpts))
1068 getInstrProfOptions(CodeGenOpts, LangOpts))
1076 if (!CodeGenOpts.MemoryProfileOutput.empty()) {
1085 if (CodeGenOpts.FatLTO) {
1099 if (CodeGenOpts.LinkBitcodePostopt)
1107 if (!actionRequiresCodeGen(Action) && CodeGenOpts.VerifyModule)
1111 CodeGenOpts.FatLTO) {
1112 if (CodeGenOpts.PrepareForThinLTO && !CodeGenOpts.DisableLLVMPasses) {
1115 CodeGenOpts.EnableSplitLTOUnit);
1117 if (!CodeGenOpts.ThinLinkBitcodeFile.empty()) {
1118 ThinLinkOS = openOutputFile(CodeGenOpts.ThinLinkBitcodeFile);
1125 MPM.addPass(PrintModulePass(*OS, "", CodeGenOpts.EmitLLVMUseLists,
1133 if (!TheModule->getModuleFlag("ThinLTO") && !CodeGenOpts.UnifiedLTO)
1140 MPM.addPass(BitcodeWriterPass(*OS, CodeGenOpts.EmitLLVMUseLists,
1143 MPM.addPass(PrintModulePass(*OS, "", CodeGenOpts.EmitLLVMUseLists,
1199 if (!CodeGenOpts.SplitDwarfOutput.empty()) {
1200 DwoOS = openOutputFile(CodeGenOpts.SplitDwarfOutput);
1237 setCommandLineOpts(CodeGenOpts);