Lines Matching +full:diag +full:- +full:version

1 //===-- Flang.cpp - Flang+LLVM ToolChain Implementations --------*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
29 /// Add -x lang to \p CmdArgs for \p Input.
32 CmdArgs.push_back("-x"); in addDashXForInput()
72 /// -Ofast, -O4, -O<number> and -f[no-]version-loops-for-stride.
74 /// -fno-version-loops-for-stride.
76 /// -floop-versioning
77 /// -Ofast
78 /// -O4
79 /// -O3
82 /// The gfortran compiler automatically enables the option for -O3 or -Ofast.
84 /// @return true if loop-versioning should be enabled, otherwise false.
92 if (LoopVersioningArg->getOption().matches(options::OPT_fno_loop_versioning)) in shouldLoopVersion()
95 if (LoopVersioningArg->getOption().matches(options::OPT_floop_versioning)) in shouldLoopVersion()
98 if (LoopVersioningArg->getOption().matches(options::OPT_Ofast) || in shouldLoopVersion()
99 LoopVersioningArg->getOption().matches(options::OPT_O4)) in shouldLoopVersion()
102 if (LoopVersioningArg->getOption().matches(options::OPT_O)) { in shouldLoopVersion()
103 StringRef S(LoopVersioningArg->getValue()); in shouldLoopVersion()
105 // Note -Os or Oz woould "fail" here, so return false. Which is the in shouldLoopVersion()
143 !stackArrays->getOption().matches(options::OPT_fno_stack_arrays)) in addCodegenOptions()
144 CmdArgs.push_back("-fstack-arrays"); in addCodegenOptions()
147 CmdArgs.push_back("-fversion-loops-for-stride"); in addCodegenOptions()
157 // ParsePICArgs parses -fPIC/-fPIE and their variants and returns a tuple of in addPicOptions()
166 CmdArgs.push_back("-mrelocation-model"); in addPicOptions()
170 CmdArgs.push_back("-pic-level"); in addPicOptions()
173 CmdArgs.push_back("-pic-is-pie"); in addPicOptions()
179 // Handle -msve_vector_bits=<bits> in AddAArch64TargetArgs()
181 StringRef Val = A->getValue(); in AddAArch64TargetArgs()
191 Args.MakeArgString("-mvscale-max=" + llvm::Twine(Bits / 128))); in AddAArch64TargetArgs()
197 Args.MakeArgString("-mvscale-min=" + llvm::Twine(Bits / 128))); in AddAArch64TargetArgs()
198 // Silently drop requests for vector-length agnostic code as it's implied. in AddAArch64TargetArgs()
200 // Handle the unsupported values passed to msve-vector-bits. in AddAArch64TargetArgs()
201 D.Diag(diag::err_drv_unsupported_option_argument) in AddAArch64TargetArgs()
202 << A->getSpelling() << Val; in AddAArch64TargetArgs()
209 // Handle -mrvv-vector-bits=<bits> in AddRISCVTargetArgs()
211 StringRef Val = A->getValue(); in AddRISCVTargetArgs()
221 MinVLen = (*ISAInfo)->getMinVLen(); in AddRISCVTargetArgs()
240 Args.MakeArgString("-mvscale-max=" + llvm::Twine(VScaleMin))); in AddRISCVTargetArgs()
242 Args.MakeArgString("-mvscale-min=" + llvm::Twine(VScaleMin))); in AddRISCVTargetArgs()
244 // Handle the unsupported values passed to mrvv-vector-bits. in AddRISCVTargetArgs()
245 D.Diag(diag::err_drv_unsupported_option_argument) in AddRISCVTargetArgs()
246 << A->getSpelling() << Val; in AddRISCVTargetArgs()
254 StringRef Value = A->getValue(); in AddX86_64TargetArgs()
256 CmdArgs.push_back(Args.MakeArgString("-mllvm")); in AddX86_64TargetArgs()
257 CmdArgs.push_back(Args.MakeArgString("-x86-asm-syntax=" + Value)); in AddX86_64TargetArgs()
259 getToolChain().getDriver().Diag(diag::err_drv_unsupported_option_argument) in AddX86_64TargetArgs()
260 << A->getSpelling() << Value; in AddX86_64TargetArgs()
272 CmdArgs.push_back(Args.MakeArgString("-D_MSC_VER=" + Twine(ver / 100000))); in addVSDefines()
273 CmdArgs.push_back(Args.MakeArgString("-D_MSC_FULL_VER=" + Twine(ver))); in addVSDefines()
274 CmdArgs.push_back(Args.MakeArgString("-D_WIN32")); in addVSDefines()
278 CmdArgs.push_back("-D_M_ARM64=1"); in addVSDefines()
280 CmdArgs.push_back("-D_M_IX86=600"); in addVSDefines()
282 CmdArgs.push_back("-D_M_X64=100"); in addVSDefines()
293 // if -fno-fortran-main has been passed, skip linking Fortran_main.a in processVSRuntimeLibrary()
296 "--dependent-lib=" + TC.getCompilerRTBasename(Args, "builtins"))); in processVSRuntimeLibrary()
300 RTOptionID = llvm::StringSwitch<unsigned>(rtl->getValue()) in processVSRuntimeLibrary()
309 CmdArgs.push_back("-D_MT"); in processVSRuntimeLibrary()
310 CmdArgs.push_back("--dependent-lib=libcmt"); in processVSRuntimeLibrary()
311 CmdArgs.push_back("--dependent-lib=FortranRuntime.static.lib"); in processVSRuntimeLibrary()
312 CmdArgs.push_back("--dependent-lib=FortranDecimal.static.lib"); in processVSRuntimeLibrary()
315 CmdArgs.push_back("-D_MT"); in processVSRuntimeLibrary()
316 CmdArgs.push_back("-D_DEBUG"); in processVSRuntimeLibrary()
317 CmdArgs.push_back("--dependent-lib=libcmtd"); in processVSRuntimeLibrary()
318 CmdArgs.push_back("--dependent-lib=FortranRuntime.static_dbg.lib"); in processVSRuntimeLibrary()
319 CmdArgs.push_back("--dependent-lib=FortranDecimal.static_dbg.lib"); in processVSRuntimeLibrary()
322 CmdArgs.push_back("-D_MT"); in processVSRuntimeLibrary()
323 CmdArgs.push_back("-D_DLL"); in processVSRuntimeLibrary()
324 CmdArgs.push_back("--dependent-lib=msvcrt"); in processVSRuntimeLibrary()
325 CmdArgs.push_back("--dependent-lib=FortranRuntime.dynamic.lib"); in processVSRuntimeLibrary()
326 CmdArgs.push_back("--dependent-lib=FortranDecimal.dynamic.lib"); in processVSRuntimeLibrary()
329 CmdArgs.push_back("-D_MT"); in processVSRuntimeLibrary()
330 CmdArgs.push_back("-D_DEBUG"); in processVSRuntimeLibrary()
331 CmdArgs.push_back("-D_DLL"); in processVSRuntimeLibrary()
332 CmdArgs.push_back("--dependent-lib=msvcrtd"); in processVSRuntimeLibrary()
333 CmdArgs.push_back("--dependent-lib=FortranRuntime.dynamic_dbg.lib"); in processVSRuntimeLibrary()
334 CmdArgs.push_back("--dependent-lib=FortranDecimal.dynamic_dbg.lib"); in processVSRuntimeLibrary()
342 StringRef Val = A->getValue(); in AddAMDGPUTargetArgs()
343 CmdArgs.push_back(Args.MakeArgString("-mcode-object-version=" + Val)); in AddAMDGPUTargetArgs()
355 CmdArgs.push_back("-target-cpu"); in addTargetOptions()
386 StringRef Name = A->getValue(); in addTargetOptions()
390 D.Diag(diag::err_drv_unsupported_opt_for_target) in addTargetOptions()
392 } else if (Name == "LIBMVEC-X86") { in addTargetOptions()
395 D.Diag(diag::err_drv_unsupported_opt_for_target) in addTargetOptions()
400 D.Diag(diag::err_drv_unsupported_opt_for_target) in addTargetOptions()
408 if (A->getValue() == StringRef{"Accelerate"}) { in addTargetOptions()
409 CmdArgs.push_back("-framework"); in addTargetOptions()
414 A->render(Args, CmdArgs); in addTargetOptions()
424 CmdArgs.push_back("-tune-cpu"); in addTargetOptions()
425 if (A->getValue() == StringRef{"native"}) in addTargetOptions()
428 CmdArgs.push_back(A->getValue()); in addTargetOptions()
442 // -fembed-offload-object argument or the host IR file for proccessing in addOffloadOptions()
443 // during device compilation to the fopenmp-host-ir-file-path argument via in addOffloadOptions()
452 Args.MakeArgString("-fembed-offload-object=" + in addOffloadOptions()
456 CmdArgs.push_back("-fopenmp-host-ir-file-path"); in addOffloadOptions()
459 llvm_unreachable("missing openmp host-ir file for device offloading"); in addOffloadOptions()
468 // -fopenmp-is-target-device is passed along to tell the frontend that it is in addOffloadOptions()
470 CmdArgs.push_back("-fopenmp-is-target-device"); in addOffloadOptions()
476 CmdArgs.push_back("-fopenmp-target-debug"); in addOffloadOptions()
483 CmdArgs.push_back("-fopenmp-assume-teams-oversubscription"); in addOffloadOptions()
487 CmdArgs.push_back("-fopenmp-assume-threads-oversubscription"); in addOffloadOptions()
489 CmdArgs.push_back("-fopenmp-assume-no-thread-state"); in addOffloadOptions()
491 CmdArgs.push_back("-fopenmp-assume-no-nested-parallelism"); in addOffloadOptions()
493 CmdArgs.push_back("-nogpulib"); in addOffloadOptions()
508 const StringRef Val = A->getValue(); in addFloatingPointOptions()
513 // gfortran (which accepts -ffp-contract=on) in addFloatingPointOptions()
514 D.Diag(diag::warn_drv_unsupported_option_for_flang) in addFloatingPointOptions()
515 << Val << A->getOption().getName() << "off"; in addFloatingPointOptions()
518 // Clang's "fast-honor-pragmas" option is not supported because it is in addFloatingPointOptions()
519 // non-standard in addFloatingPointOptions()
520 D.Diag(diag::err_drv_unsupported_option_argument) in addFloatingPointOptions()
521 << A->getSpelling() << Val; in addFloatingPointOptions()
525 auto optId = A->getOption().getID(); in addFloatingPointOptions()
585 // -fno-fast-math should undo -ffast-math so I return FPContract to the in addFloatingPointOptions()
587 // --ffp-contract=off -fno-fast-math --> -ffp-contract=off in addFloatingPointOptions()
594 A->claim(); in addFloatingPointOptions()
600 CmdArgs.push_back("-ffast-math"); in addFloatingPointOptions()
605 CmdArgs.push_back(Args.MakeArgString("-ffp-contract=" + FPContract)); in addFloatingPointOptions()
608 CmdArgs.push_back("-menable-no-infs"); in addFloatingPointOptions()
611 CmdArgs.push_back("-menable-no-nans"); in addFloatingPointOptions()
614 CmdArgs.push_back("-fapprox-func"); in addFloatingPointOptions()
617 CmdArgs.push_back("-fno-signed-zeros"); in addFloatingPointOptions()
620 CmdArgs.push_back("-mreassociate"); in addFloatingPointOptions()
623 CmdArgs.push_back("-freciprocal-math"); in addFloatingPointOptions()
630 Format = A->getValue(); in renderRemarksOptions()
632 CmdArgs.push_back("-opt-record-file"); in renderRemarksOptions()
636 CmdArgs.push_back(A->getValue()); in renderRemarksOptions()
642 F = FinalOutput->getValue(); in renderRemarksOptions()
660 CmdArgs.push_back("-opt-record-passes"); in renderRemarksOptions()
661 CmdArgs.push_back(A->getValue()); in renderRemarksOptions()
665 CmdArgs.push_back("-opt-record-format"); in renderRemarksOptions()
681 // Invoke ourselves in -fc1 mode. in ConstructJob()
682 CmdArgs.push_back("-fc1"); in ConstructJob()
685 CmdArgs.push_back("-triple"); in ConstructJob()
689 CmdArgs.push_back("-E"); in ConstructJob()
691 CmdArgs.push_back("-dM"); in ConstructJob()
695 CmdArgs.push_back("-fsyntax-only"); in ConstructJob()
697 CmdArgs.push_back("-emit-ast"); in ConstructJob()
700 CmdArgs.push_back("-emit-llvm"); in ConstructJob()
703 CmdArgs.push_back("-emit-llvm-bc"); in ConstructJob()
705 CmdArgs.push_back("-S"); in ConstructJob()
710 CmdArgs.push_back("-emit-obj"); in ConstructJob()
718 // Add preprocessing options like -I, -D, etc. if we are using the in ConstructJob()
726 // re-parsed to construct this job; claim any possible color diagnostic here in ConstructJob()
731 CmdArgs.push_back("-fcolor-diagnostics"); in ConstructJob()
737 CmdArgs.push_back("-flto=full"); in ConstructJob()
741 "the option '-flto=thin' is a work in progress")); in ConstructJob()
742 CmdArgs.push_back("-flto=thin"); in ConstructJob()
745 // -fPIC and related options. in ConstructJob()
765 // Remarks can be enabled with any of the `-f.*optimization-record.*` flags. in ConstructJob()
773 // TODO: Handle interactions between -w, -pedantic, -Wall, -WOption in ConstructJob()
786 CmdArgs.push_back("-fopenmp"); in ConstructJob()
790 CmdArgs.push_back("-fopenmp-force-usm"); in ConstructJob()
796 // for a specific runtime library, we just don't pass the '-fopenmp' flag in ConstructJob()
802 D.Diag(diag::warn_drv_unsupported_openmp_library) in ConstructJob()
803 << A->getSpelling() << A->getValue(); in ConstructJob()
809 CmdArgs.push_back("-resource-dir"); in ConstructJob()
815 // Forward -Xflang arguments to -fc1 in ConstructJob()
824 FPKeepKindStr = "-mframe-pointer=none"; in ConstructJob()
827 FPKeepKindStr = "-mframe-pointer=reserved"; in ConstructJob()
830 FPKeepKindStr = "-mframe-pointer=non-leaf"; in ConstructJob()
833 FPKeepKindStr = "-mframe-pointer=all"; in ConstructJob()
839 // Forward -mllvm options to the LLVM option parser. In practice, this means in ConstructJob()
840 // forwarding to `-fc1` as that's where the LLVM parser is run. in ConstructJob()
842 A->claim(); in ConstructJob()
843 A->render(Args, CmdArgs); in ConstructJob()
847 A->claim(); in ConstructJob()
848 A->render(Args, CmdArgs); in ConstructJob()
853 A->claim(); in ConstructJob()
854 D.Diag(diag::warn_drv_unsupported_diag_option_for_flang) in ConstructJob()
855 << A->getOption().getName(); in ConstructJob()
860 if (A->getOption().matches(options::OPT_O4)) { in ConstructJob()
861 CmdArgs.push_back("-O3"); in ConstructJob()
862 D.Diag(diag::warn_O4_is_O3); in ConstructJob()
863 } else if (A->getOption().matches(options::OPT_Ofast)) { in ConstructJob()
864 CmdArgs.push_back("-O3"); in ConstructJob()
866 A->render(Args, CmdArgs); in ConstructJob()
872 CmdArgs.push_back("-o"); in ConstructJob()
885 // TODO: Replace flang-new with flang once the new driver replaces the in ConstructJob()
887 const char *Exec = Args.MakeArgString(D.GetProgramPath("flang-new", TC)); in ConstructJob()
893 Flang::Flang(const ToolChain &TC) : Tool("flang-new", "flang frontend", TC) {} in Flang()