15#include "llvm/Frontend/Debug/Options.h"
16#include "llvm/Support/FileSystem.h"
17#include "llvm/Support/Path.h"
18#include "llvm/TargetParser/Host.h"
19#include "llvm/TargetParser/RISCVISAInfo.h"
20#include "llvm/TargetParser/RISCVTargetParser.h"
31 ArgStringList &CmdArgs) {
32 CmdArgs.push_back(
"-x");
37void Flang::addFortranDialectOptions(
const ArgList &Args,
38 ArgStringList &CmdArgs)
const {
39 Args.addAllArgs(CmdArgs, {options::OPT_ffixed_form,
40 options::OPT_ffree_form,
41 options::OPT_ffixed_line_length_EQ,
42 options::OPT_fopenacc,
43 options::OPT_finput_charset_EQ,
44 options::OPT_fimplicit_none,
45 options::OPT_fno_implicit_none,
46 options::OPT_fbackslash,
47 options::OPT_fno_backslash,
48 options::OPT_flogical_abbreviations,
49 options::OPT_fno_logical_abbreviations,
50 options::OPT_fxor_operator,
51 options::OPT_fno_xor_operator,
52 options::OPT_falternative_parameter_statement,
53 options::OPT_fdefault_real_8,
54 options::OPT_fdefault_integer_8,
55 options::OPT_fdefault_double_8,
56 options::OPT_flarge_sizes,
57 options::OPT_fno_automatic,
58 options::OPT_fhermetic_module_files});
61void Flang::addPreprocessingOptions(
const ArgList &Args,
62 ArgStringList &CmdArgs)
const {
63 Args.addAllArgs(CmdArgs,
64 {options::OPT_P, options::OPT_D, options::OPT_U,
65 options::OPT_I, options::OPT_cpp, options::OPT_nocpp});
86 const Arg *LoopVersioningArg = Args.getLastArg(
87 options::OPT_Ofast, options::OPT_O, options::OPT_O4,
88 options::OPT_floop_versioning, options::OPT_fno_loop_versioning);
89 if (!LoopVersioningArg)
92 if (LoopVersioningArg->getOption().matches(options::OPT_fno_loop_versioning))
95 if (LoopVersioningArg->getOption().matches(options::OPT_floop_versioning))
98 if (LoopVersioningArg->getOption().matches(options::OPT_Ofast) ||
99 LoopVersioningArg->getOption().matches(options::OPT_O4))
102 if (LoopVersioningArg->getOption().matches(options::OPT_O)) {
103 StringRef S(LoopVersioningArg->getValue());
104 unsigned OptLevel = 0;
107 if (S.getAsInteger(10, OptLevel))
113 llvm_unreachable(
"We should not end up here");
117void Flang::addOtherOptions(
const ArgList &Args, ArgStringList &CmdArgs)
const {
118 Args.addAllArgs(CmdArgs,
119 {options::OPT_module_dir, options::OPT_fdebug_module_writer,
120 options::OPT_fintrinsic_modules_path, options::OPT_pedantic,
121 options::OPT_std_EQ, options::OPT_W_Joined,
122 options::OPT_fconvert_EQ, options::OPT_fpass_plugin_EQ,
123 options::OPT_funderscoring, options::OPT_fno_underscoring});
125 llvm::codegenoptions::DebugInfoKind DebugInfoKind;
126 if (Args.hasArg(options::OPT_gN_Group)) {
127 Arg *gNArg = Args.getLastArg(options::OPT_gN_Group);
129 }
else if (Args.hasArg(options::OPT_g_Flag)) {
130 DebugInfoKind = llvm::codegenoptions::FullDebugInfo;
132 DebugInfoKind = llvm::codegenoptions::NoDebugInfo;
137void Flang::addCodegenOptions(
const ArgList &Args,
138 ArgStringList &CmdArgs)
const {
140 Args.getLastArg(options::OPT_Ofast, options::OPT_fstack_arrays,
141 options::OPT_fno_stack_arrays);
143 !stackArrays->getOption().matches(options::OPT_fno_stack_arrays))
144 CmdArgs.push_back(
"-fstack-arrays");
147 CmdArgs.push_back(
"-fversion-loops-for-stride");
149 Args.addAllArgs(CmdArgs, {options::OPT_flang_experimental_hlfir,
150 options::OPT_flang_deprecated_no_hlfir,
151 options::OPT_flang_experimental_integer_overflow,
152 options::OPT_fno_ppc_native_vec_elem_order,
153 options::OPT_fppc_native_vec_elem_order});
156void Flang::addPicOptions(
const ArgList &Args, ArgStringList &CmdArgs)
const {
159 llvm::Reloc::Model RelocationModel;
162 std::tie(RelocationModel, PICLevel, IsPIE) =
166 CmdArgs.push_back(
"-mrelocation-model");
167 CmdArgs.push_back(RMName);
170 CmdArgs.push_back(
"-pic-level");
171 CmdArgs.push_back(PICLevel == 1 ?
"1" :
"2");
173 CmdArgs.push_back(
"-pic-is-pie");
177void Flang::AddAArch64TargetArgs(
const ArgList &Args,
178 ArgStringList &CmdArgs)
const {
180 if (Arg *A = Args.getLastArg(options::OPT_msve_vector_bits_EQ)) {
181 StringRef Val = A->getValue();
183 if (Val ==
"128" || Val ==
"256" || Val ==
"512" || Val ==
"1024" ||
184 Val ==
"2048" || Val ==
"128+" || Val ==
"256+" || Val ==
"512+" ||
185 Val ==
"1024+" || Val ==
"2048+") {
187 if (!Val.consume_back(
"+")) {
188 [[maybe_unused]]
bool Invalid = Val.getAsInteger(10, Bits);
189 assert(!
Invalid &&
"Failed to parse value");
191 Args.MakeArgString(
"-mvscale-max=" + llvm::Twine(Bits / 128)));
194 [[maybe_unused]]
bool Invalid = Val.getAsInteger(10, Bits);
195 assert(!
Invalid &&
"Failed to parse value");
197 Args.MakeArgString(
"-mvscale-min=" + llvm::Twine(Bits / 128)));
199 }
else if (Val !=
"scalable")
201 D.Diag(diag::err_drv_unsupported_option_argument)
202 << A->getSpelling() << Val;
206void Flang::AddRISCVTargetArgs(
const ArgList &Args,
207 ArgStringList &CmdArgs)
const {
210 if (Arg *A = Args.getLastArg(options::OPT_mrvv_vector_bits_EQ)) {
211 StringRef Val = A->getValue();
215 unsigned MinVLen = 0;
217 auto ISAInfo = llvm::RISCVISAInfo::parseArchString(
220 if (!errorToBool(ISAInfo.takeError()))
221 MinVLen = (*ISAInfo)->getMinVLen();
226 if (Val ==
"zvl" && MinVLen >= llvm::RISCV::RVVBitsPerBlock) {
228 }
else if (!Val.getAsInteger(10, Bits)) {
231 if (Bits < MinVLen || Bits < llvm::RISCV::RVVBitsPerBlock ||
232 Bits > 65536 || !llvm::isPowerOf2_32(Bits))
238 unsigned VScaleMin = Bits / llvm::RISCV::RVVBitsPerBlock;
240 Args.MakeArgString(
"-mvscale-max=" + llvm::Twine(VScaleMin)));
242 Args.MakeArgString(
"-mvscale-min=" + llvm::Twine(VScaleMin)));
243 }
else if (Val !=
"scalable") {
245 D.Diag(diag::err_drv_unsupported_option_argument)
246 << A->getSpelling() << Val;
251void Flang::AddX86_64TargetArgs(
const ArgList &Args,
252 ArgStringList &CmdArgs)
const {
253 if (Arg *A = Args.getLastArg(options::OPT_masm_EQ)) {
254 StringRef
Value = A->getValue();
256 CmdArgs.push_back(Args.MakeArgString(
"-mllvm"));
257 CmdArgs.push_back(Args.MakeArgString(
"-x86-asm-syntax=" +
Value));
260 << A->getSpelling() <<
Value;
266 ArgStringList &CmdArgs) {
270 ver = vt.getMajor() * 10000000 + vt.getMinor().value_or(0) * 100000 +
271 vt.getSubminor().value_or(0);
272 CmdArgs.push_back(Args.MakeArgString(
"-D_MSC_VER=" + Twine(ver / 100000)));
273 CmdArgs.push_back(Args.MakeArgString(
"-D_MSC_FULL_VER=" + Twine(ver)));
274 CmdArgs.push_back(Args.MakeArgString(
"-D_WIN32"));
276 const llvm::Triple &triple = TC.
getTriple();
277 if (triple.isAArch64()) {
278 CmdArgs.push_back(
"-D_M_ARM64=1");
279 }
else if (triple.isX86() && triple.isArch32Bit()) {
280 CmdArgs.push_back(
"-D_M_IX86=600");
281 }
else if (triple.isX86() && triple.isArch64Bit()) {
282 CmdArgs.push_back(
"-D_M_X64=100");
285 "Flang on Windows only supports X86_32, X86_64 and AArch64");
290 ArgStringList &CmdArgs) {
291 assert(TC.
getTriple().isKnownWindowsMSVCEnvironment() &&
292 "can only add VS runtime library on Windows!");
294 if (TC.
getTriple().isKnownWindowsMSVCEnvironment()) {
295 CmdArgs.push_back(Args.MakeArgString(
298 unsigned RTOptionID = options::OPT__SLASH_MT;
299 if (
auto *rtl = Args.getLastArg(options::OPT_fms_runtime_lib_EQ)) {
300 RTOptionID = llvm::StringSwitch<unsigned>(rtl->getValue())
301 .Case(
"static", options::OPT__SLASH_MT)
302 .Case(
"static_dbg", options::OPT__SLASH_MTd)
303 .Case(
"dll", options::OPT__SLASH_MD)
304 .Case(
"dll_dbg", options::OPT__SLASH_MDd)
305 .Default(options::OPT__SLASH_MT);
307 switch (RTOptionID) {
308 case options::OPT__SLASH_MT:
309 CmdArgs.push_back(
"-D_MT");
310 CmdArgs.push_back(
"--dependent-lib=libcmt");
311 CmdArgs.push_back(
"--dependent-lib=FortranRuntime.static.lib");
312 CmdArgs.push_back(
"--dependent-lib=FortranDecimal.static.lib");
314 case options::OPT__SLASH_MTd:
315 CmdArgs.push_back(
"-D_MT");
316 CmdArgs.push_back(
"-D_DEBUG");
317 CmdArgs.push_back(
"--dependent-lib=libcmtd");
318 CmdArgs.push_back(
"--dependent-lib=FortranRuntime.static_dbg.lib");
319 CmdArgs.push_back(
"--dependent-lib=FortranDecimal.static_dbg.lib");
321 case options::OPT__SLASH_MD:
322 CmdArgs.push_back(
"-D_MT");
323 CmdArgs.push_back(
"-D_DLL");
324 CmdArgs.push_back(
"--dependent-lib=msvcrt");
325 CmdArgs.push_back(
"--dependent-lib=FortranRuntime.dynamic.lib");
326 CmdArgs.push_back(
"--dependent-lib=FortranDecimal.dynamic.lib");
328 case options::OPT__SLASH_MDd:
329 CmdArgs.push_back(
"-D_MT");
330 CmdArgs.push_back(
"-D_DEBUG");
331 CmdArgs.push_back(
"-D_DLL");
332 CmdArgs.push_back(
"--dependent-lib=msvcrtd");
333 CmdArgs.push_back(
"--dependent-lib=FortranRuntime.dynamic_dbg.lib");
334 CmdArgs.push_back(
"--dependent-lib=FortranDecimal.dynamic_dbg.lib");
339void Flang::AddAMDGPUTargetArgs(
const ArgList &Args,
340 ArgStringList &CmdArgs)
const {
341 if (Arg *A = Args.getLastArg(options::OPT_mcode_object_version_EQ)) {
342 StringRef Val = A->getValue();
343 CmdArgs.push_back(Args.MakeArgString(
"-mcode-object-version=" + Val));
350void Flang::addTargetOptions(
const ArgList &Args,
351 ArgStringList &CmdArgs)
const {
358 CmdArgs.push_back(
"-target-cpu");
359 CmdArgs.push_back(Args.MakeArgString(CPU));
368 case llvm::Triple::aarch64:
370 AddAArch64TargetArgs(Args, CmdArgs);
373 case llvm::Triple::r600:
374 case llvm::Triple::amdgcn:
376 AddAMDGPUTargetArgs(Args, CmdArgs);
378 case llvm::Triple::riscv64:
380 AddRISCVTargetArgs(Args, CmdArgs);
382 case llvm::Triple::x86_64:
384 AddX86_64TargetArgs(Args, CmdArgs);
388 if (Arg *A = Args.getLastArg(options::OPT_fveclib)) {
389 StringRef Name = A->getValue();
390 if (Name ==
"SVML") {
391 if (Triple.getArch() != llvm::Triple::x86 &&
392 Triple.getArch() != llvm::Triple::x86_64)
393 D.Diag(diag::err_drv_unsupported_opt_for_target)
394 << Name << Triple.getArchName();
395 }
else if (Name ==
"LIBMVEC-X86") {
396 if (Triple.getArch() != llvm::Triple::x86 &&
397 Triple.getArch() != llvm::Triple::x86_64)
398 D.Diag(diag::err_drv_unsupported_opt_for_target)
399 << Name << Triple.getArchName();
400 }
else if (Name ==
"SLEEF" || Name ==
"ArmPL") {
401 if (Triple.getArch() != llvm::Triple::aarch64 &&
402 Triple.getArch() != llvm::Triple::aarch64_be)
403 D.Diag(diag::err_drv_unsupported_opt_for_target)
404 << Name << Triple.getArchName();
407 if (Triple.isOSDarwin()) {
410 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
411 if (A->getValue() == StringRef{
"Accelerate"}) {
412 CmdArgs.push_back(
"-framework");
413 CmdArgs.push_back(
"Accelerate");
417 A->render(Args, CmdArgs);
420 if (Triple.isKnownWindowsMSVCEnvironment()) {
426 if (
const Arg *A = Args.getLastArg(options::OPT_mtune_EQ)) {
427 CmdArgs.push_back(
"-tune-cpu");
428 if (A->getValue() == StringRef{
"native"})
429 CmdArgs.push_back(Args.MakeArgString(llvm::sys::getHostCPUName()));
431 CmdArgs.push_back(A->getValue());
436 const JobAction &JA,
const ArgList &Args,
437 ArgStringList &CmdArgs)
const {
450 for (
size_t i = 1; i < Inputs.size(); ++i) {
451 if (Inputs[i].getType() == types::TY_Nothing) {
453 }
else if (IsHostOffloadingAction) {
455 Args.MakeArgString(
"-fembed-offload-object=" +
457 }
else if (IsOpenMPDevice) {
458 if (Inputs[i].getFilename()) {
459 CmdArgs.push_back(
"-fopenmp-host-ir-file-path");
460 CmdArgs.push_back(Args.MakeArgString(Inputs[i].getFilename()));
462 llvm_unreachable(
"missing openmp host-ir file for device offloading");
466 "unexpectedly given multiple inputs or given unknown input");
470 if (IsOpenMPDevice) {
473 CmdArgs.push_back(
"-fopenmp-is-target-device");
476 Args.AddAllArgs(CmdArgs, options::OPT_fopenmp_target_debug_EQ);
477 if (Args.hasFlag(options::OPT_fopenmp_target_debug,
478 options::OPT_fno_openmp_target_debug,
false))
479 CmdArgs.push_back(
"-fopenmp-target-debug");
483 if (Args.hasFlag(options::OPT_fopenmp_assume_teams_oversubscription,
484 options::OPT_fno_openmp_assume_teams_oversubscription,
486 CmdArgs.push_back(
"-fopenmp-assume-teams-oversubscription");
487 if (Args.hasFlag(options::OPT_fopenmp_assume_threads_oversubscription,
488 options::OPT_fno_openmp_assume_threads_oversubscription,
490 CmdArgs.push_back(
"-fopenmp-assume-threads-oversubscription");
491 if (Args.hasArg(options::OPT_fopenmp_assume_no_thread_state))
492 CmdArgs.push_back(
"-fopenmp-assume-no-thread-state");
493 if (Args.hasArg(options::OPT_fopenmp_assume_no_nested_parallelism))
494 CmdArgs.push_back(
"-fopenmp-assume-no-nested-parallelism");
495 if (Args.hasArg(options::OPT_nogpulib))
496 CmdArgs.push_back(
"-nogpulib");
503 ArgStringList &CmdArgs) {
504 StringRef FPContract;
505 bool HonorINFs =
true;
506 bool HonorNaNs =
true;
507 bool ApproxFunc =
false;
508 bool SignedZeros =
true;
509 bool AssociativeMath =
false;
510 bool ReciprocalMath =
false;
512 if (
const Arg *A = Args.getLastArg(options::OPT_ffp_contract)) {
513 const StringRef Val = A->getValue();
514 if (Val ==
"fast" || Val ==
"off") {
516 }
else if (Val ==
"on") {
519 D.Diag(diag::warn_drv_unsupported_option_for_flang)
520 << Val << A->getOption().getName() <<
"off";
525 D.Diag(diag::err_drv_unsupported_option_argument)
526 << A->getSpelling() << Val;
529 for (
const Arg *A : Args) {
530 auto optId = A->getOption().
getID();
536 case options::OPT_fhonor_infinities:
539 case options::OPT_fno_honor_infinities:
542 case options::OPT_fhonor_nans:
545 case options::OPT_fno_honor_nans:
548 case options::OPT_fapprox_func:
551 case options::OPT_fno_approx_func:
554 case options::OPT_fsigned_zeros:
557 case options::OPT_fno_signed_zeros:
560 case options::OPT_fassociative_math:
561 AssociativeMath =
true;
563 case options::OPT_fno_associative_math:
564 AssociativeMath =
false;
566 case options::OPT_freciprocal_math:
567 ReciprocalMath =
true;
569 case options::OPT_fno_reciprocal_math:
570 ReciprocalMath =
false;
572 case options::OPT_Ofast:
574 case options::OPT_ffast_math:
577 AssociativeMath =
true;
578 ReciprocalMath =
true;
583 case options::OPT_fno_fast_math:
586 AssociativeMath =
false;
587 ReciprocalMath =
false;
593 if (FPContract ==
"fast")
602 if (!HonorINFs && !HonorNaNs && AssociativeMath && ReciprocalMath &&
603 ApproxFunc && !SignedZeros &&
604 (FPContract ==
"fast" || FPContract.empty())) {
605 CmdArgs.push_back(
"-ffast-math");
609 if (!FPContract.empty())
610 CmdArgs.push_back(Args.MakeArgString(
"-ffp-contract=" + FPContract));
613 CmdArgs.push_back(
"-menable-no-infs");
616 CmdArgs.push_back(
"-menable-no-nans");
619 CmdArgs.push_back(
"-fapprox-func");
622 CmdArgs.push_back(
"-fno-signed-zeros");
624 if (AssociativeMath && !SignedZeros)
625 CmdArgs.push_back(
"-mreassociate");
628 CmdArgs.push_back(
"-freciprocal-math");
633 StringRef Format =
"yaml";
634 if (
const Arg *A = Args.getLastArg(options::OPT_fsave_optimization_record_EQ))
635 Format = A->getValue();
637 CmdArgs.push_back(
"-opt-record-file");
639 const Arg *A = Args.getLastArg(options::OPT_foptimization_record_file_EQ);
641 CmdArgs.push_back(A->getValue());
645 if (Args.hasArg(options::OPT_c) || Args.hasArg(options::OPT_S)) {
646 if (Arg *FinalOutput = Args.getLastArg(options::OPT_o))
647 F = FinalOutput->getValue();
659 llvm::sys::path::replace_extension(F, Extension);
660 CmdArgs.push_back(Args.MakeArgString(F));
664 Args.getLastArg(options::OPT_foptimization_record_passes_EQ)) {
665 CmdArgs.push_back(
"-opt-record-passes");
666 CmdArgs.push_back(A->getValue());
669 if (!Format.empty()) {
670 CmdArgs.push_back(
"-opt-record-format");
671 CmdArgs.push_back(Format.data());
677 const ArgList &Args,
const char *LinkingOutput)
const {
680 const std::string &TripleStr = Triple.getTriple();
683 ArgStringList CmdArgs;
687 CmdArgs.push_back(
"-fc1");
690 CmdArgs.push_back(
"-triple");
691 CmdArgs.push_back(Args.MakeArgString(TripleStr));
693 if (isa<PreprocessJobAction>(JA)) {
694 CmdArgs.push_back(
"-E");
695 if (Args.getLastArg(options::OPT_dM)) {
696 CmdArgs.push_back(
"-dM");
698 }
else if (isa<CompileJobAction>(JA) || isa<BackendJobAction>(JA)) {
699 if (JA.
getType() == types::TY_Nothing) {
700 CmdArgs.push_back(
"-fsyntax-only");
701 }
else if (JA.
getType() == types::TY_AST) {
702 CmdArgs.push_back(
"-emit-ast");
703 }
else if (JA.
getType() == types::TY_LLVM_IR ||
704 JA.
getType() == types::TY_LTO_IR) {
705 CmdArgs.push_back(
"-emit-llvm");
706 }
else if (JA.
getType() == types::TY_LLVM_BC ||
707 JA.
getType() == types::TY_LTO_BC) {
708 CmdArgs.push_back(
"-emit-llvm-bc");
709 }
else if (JA.
getType() == types::TY_PP_Asm) {
710 CmdArgs.push_back(
"-S");
712 assert(
false &&
"Unexpected output type!");
714 }
else if (isa<AssembleJobAction>(JA)) {
715 CmdArgs.push_back(
"-emit-obj");
717 assert(
false &&
"Unexpected action class for Flang tool.");
726 addPreprocessingOptions(Args, CmdArgs);
728 addFortranDialectOptions(Args, CmdArgs);
733 Args.getLastArg(options::OPT_fcolor_diagnostics,
734 options::OPT_fno_color_diagnostics);
736 CmdArgs.push_back(
"-fcolor-diagnostics");
742 CmdArgs.push_back(
"-flto=full");
746 "the option '-flto=thin' is a work in progress"));
747 CmdArgs.push_back(
"-flto=thin");
751 addPicOptions(Args, CmdArgs);
757 addTargetOptions(Args, CmdArgs);
759 llvm::Reloc::Model RelocationModel =
762 addMCModel(
D, Args, Triple, RelocationModel, CmdArgs);
765 addCodegenOptions(Args, CmdArgs);
768 Args.AddAllArgs(CmdArgs, options::OPT_R_Group);
775 addOtherOptions(Args, CmdArgs);
779 Args.AddLastArg(CmdArgs, options::OPT_w);
783 if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
784 options::OPT_fno_openmp,
false) &&
787 switch (
D.getOpenMPRuntime(Args)) {
791 CmdArgs.push_back(
"-fopenmp");
792 Args.AddAllArgs(CmdArgs, options::OPT_fopenmp_version_EQ);
794 if (Args.hasArg(options::OPT_fopenmp_force_usm))
795 CmdArgs.push_back(
"-fopenmp-force-usm");
806 const Arg *A = Args.getLastArg(options::OPT_fopenmp_EQ);
807 D.Diag(diag::warn_drv_unsupported_openmp_library)
808 << A->getSpelling() << A->getValue();
814 CmdArgs.push_back(
"-resource-dir");
815 CmdArgs.push_back(
D.ResourceDir.c_str());
818 addOffloadOptions(
C, Inputs, JA, Args, CmdArgs);
821 Args.AddAllArgValues(CmdArgs, options::OPT_Xflang);
826 const char *FPKeepKindStr =
nullptr;
827 switch (FPKeepKind) {
829 FPKeepKindStr =
"-mframe-pointer=none";
832 FPKeepKindStr =
"-mframe-pointer=reserved";
835 FPKeepKindStr =
"-mframe-pointer=non-leaf";
838 FPKeepKindStr =
"-mframe-pointer=all";
841 assert(FPKeepKindStr &&
"unknown FramePointerKind");
842 CmdArgs.push_back(FPKeepKindStr);
846 for (
const Arg *A : Args.filtered(options::OPT_mllvm)) {
848 A->render(Args, CmdArgs);
851 for (
const Arg *A : Args.filtered(options::OPT_mmlir)) {
853 A->render(Args, CmdArgs);
857 for (
const Arg *A : Args.filtered(options::OPT_flang_ignored_w_Group)) {
859 D.Diag(diag::warn_drv_unsupported_diag_option_for_flang)
860 << A->getOption().getName();
864 if (
const Arg *A = Args.getLastArg(options::OPT_O_Group)) {
865 if (A->getOption().matches(options::OPT_O4)) {
866 CmdArgs.push_back(
"-O3");
867 D.Diag(diag::warn_O4_is_O3);
868 }
else if (A->getOption().matches(options::OPT_Ofast)) {
869 CmdArgs.push_back(
"-O3");
871 A->render(Args, CmdArgs);
877 CmdArgs.push_back(
"-o");
881 assert(Input.
isFilename() &&
"Invalid input.");
883 if (Args.getLastArg(options::OPT_save_temps_EQ))
884 Args.AddLastArg(CmdArgs, options::OPT_save_temps_EQ);
892 const char *Exec = Args.MakeArgString(
D.GetProgramPath(
"flang-new", TC));
893 C.addCommand(std::make_unique<Command>(JA, *
this,
895 Exec, CmdArgs, Inputs, Output));
static void addDashXForInput(const ArgList &Args, const InputInfo &Input, ArgStringList &CmdArgs)
Add -x lang to CmdArgs for Input.
static void renderRemarksOptions(const ArgList &Args, ArgStringList &CmdArgs, const llvm::Triple &Triple, const InputInfo &Input, const InputInfo &Output, const JobAction &JA)
clang::CodeGenOptions::FramePointerKind getFramePointerKind(const llvm::opt::ArgList &Args, const llvm::Triple &Triple)
static void processVSRuntimeLibrary(const ToolChain &TC, const ArgList &Args, ArgStringList &CmdArgs)
static void addVSDefines(const ToolChain &TC, const ArgList &Args, ArgStringList &CmdArgs)
static bool shouldLoopVersion(const ArgList &Args)
@C shouldLoopVersion
static void addDashXForInput(const ArgList &Args, const InputInfo &Input, ArgStringList &CmdArgs)
Add -x lang to CmdArgs for Input.
static void addFloatingPointOptions(const Driver &D, const ArgList &Args, ArgStringList &CmdArgs)
Concrete class used by the front-end to report problems and issues.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
DiagnosticOptions & getDiagnosticOptions() const
Retrieve the diagnostic options.
types::ID getType() const
bool isHostOffloading(unsigned int OKind) const
Check if this action have any offload kinds.
bool isDeviceOffloading(OffloadKind OKind) const
Compilation - A set of tasks to perform for a single driver invocation.
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
DiagnosticBuilder Diag(unsigned DiagID) const
@ OMPRT_IOMP5
The legacy name for the LLVM OpenMP runtime from when it was the Intel OpenMP runtime.
@ OMPRT_OMP
The LLVM OpenMP runtime.
ID getPreprocessedType(ID Id)
getPreprocessedType - Get the ID of the type for this input when it has been preprocessed,...
const char * getTypeName(ID Id)
getTypeName - Return the name of the type for Id.
LTOKind
Describes the kind of LTO mode selected via -f(no-)?lto(=.*)? options.
bool willEmitRemarks(const llvm::opt::ArgList &Args)
The JSON file list parser is used to communicate input to InstallAPI.
static constexpr ResponseFileSupport AtFileUTF8()