clang 20.0.0git
Flang.cpp
Go to the documentation of this file.
1//===-- Flang.cpp - Flang+LLVM ToolChain Implementations --------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "Flang.h"
10#include "Arch/RISCV.h"
11#include "CommonArgs.h"
12
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"
21
22#include <cassert>
23
24using namespace clang::driver;
25using namespace clang::driver::tools;
26using namespace clang;
27using namespace llvm::opt;
28
29/// Add -x lang to \p CmdArgs for \p Input.
30static void addDashXForInput(const ArgList &Args, const InputInfo &Input,
31 ArgStringList &CmdArgs) {
32 CmdArgs.push_back("-x");
33 // Map the driver type to the frontend type.
34 CmdArgs.push_back(types::getTypeName(Input.getType()));
35}
36
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,
59 options::OPT_frealloc_lhs,
60 options::OPT_fno_realloc_lhs,
61 options::OPT_fsave_main_program});
62}
63
64void Flang::addPreprocessingOptions(const ArgList &Args,
65 ArgStringList &CmdArgs) const {
66 Args.addAllArgs(CmdArgs,
67 {options::OPT_P, options::OPT_D, options::OPT_U,
68 options::OPT_I, options::OPT_cpp, options::OPT_nocpp});
69}
70
71/// @C shouldLoopVersion
72///
73/// Check if Loop Versioning should be enabled.
74/// We look for the last of one of the following:
75/// -Ofast, -O4, -O<number> and -f[no-]version-loops-for-stride.
76/// Loop versioning is disabled if the last option is
77/// -fno-version-loops-for-stride.
78/// Loop versioning is enabled if the last option is one of:
79/// -floop-versioning
80/// -Ofast
81/// -O4
82/// -O3
83/// For all other cases, loop versioning is is disabled.
84///
85/// The gfortran compiler automatically enables the option for -O3 or -Ofast.
86///
87/// @return true if loop-versioning should be enabled, otherwise false.
88static bool shouldLoopVersion(const ArgList &Args) {
89 const Arg *LoopVersioningArg = Args.getLastArg(
90 options::OPT_Ofast, options::OPT_O, options::OPT_O4,
91 options::OPT_floop_versioning, options::OPT_fno_loop_versioning);
92 if (!LoopVersioningArg)
93 return false;
94
95 if (LoopVersioningArg->getOption().matches(options::OPT_fno_loop_versioning))
96 return false;
97
98 if (LoopVersioningArg->getOption().matches(options::OPT_floop_versioning))
99 return true;
100
101 if (LoopVersioningArg->getOption().matches(options::OPT_Ofast) ||
102 LoopVersioningArg->getOption().matches(options::OPT_O4))
103 return true;
104
105 if (LoopVersioningArg->getOption().matches(options::OPT_O)) {
106 StringRef S(LoopVersioningArg->getValue());
107 unsigned OptLevel = 0;
108 // Note -Os or Oz woould "fail" here, so return false. Which is the
109 // desiered behavior.
110 if (S.getAsInteger(10, OptLevel))
111 return false;
112
113 return OptLevel > 2;
114 }
115
116 llvm_unreachable("We should not end up here");
117 return false;
118}
119
120void Flang::addOtherOptions(const ArgList &Args, ArgStringList &CmdArgs) const {
121 Args.addAllArgs(CmdArgs,
122 {options::OPT_module_dir, options::OPT_fdebug_module_writer,
123 options::OPT_fintrinsic_modules_path, options::OPT_pedantic,
124 options::OPT_std_EQ, options::OPT_W_Joined,
125 options::OPT_fconvert_EQ, options::OPT_fpass_plugin_EQ,
126 options::OPT_funderscoring, options::OPT_fno_underscoring,
127 options::OPT_funsigned, options::OPT_fno_unsigned});
128
129 llvm::codegenoptions::DebugInfoKind DebugInfoKind;
130 if (Args.hasArg(options::OPT_gN_Group)) {
131 Arg *gNArg = Args.getLastArg(options::OPT_gN_Group);
132 DebugInfoKind = debugLevelToInfoKind(*gNArg);
133 } else if (Args.hasArg(options::OPT_g_Flag)) {
134 DebugInfoKind = llvm::codegenoptions::FullDebugInfo;
135 } else {
136 DebugInfoKind = llvm::codegenoptions::NoDebugInfo;
137 }
138 addDebugInfoKind(CmdArgs, DebugInfoKind);
139}
140
141void Flang::addCodegenOptions(const ArgList &Args,
142 ArgStringList &CmdArgs) const {
143 Arg *stackArrays =
144 Args.getLastArg(options::OPT_Ofast, options::OPT_fstack_arrays,
145 options::OPT_fno_stack_arrays);
146 if (stackArrays &&
147 !stackArrays->getOption().matches(options::OPT_fno_stack_arrays))
148 CmdArgs.push_back("-fstack-arrays");
149
150 if (shouldLoopVersion(Args))
151 CmdArgs.push_back("-fversion-loops-for-stride");
152
153 Args.addAllArgs(CmdArgs,
154 {options::OPT_flang_experimental_hlfir,
155 options::OPT_flang_deprecated_no_hlfir,
156 options::OPT_fno_ppc_native_vec_elem_order,
157 options::OPT_fppc_native_vec_elem_order,
158 options::OPT_ftime_report, options::OPT_ftime_report_EQ,
159 options::OPT_funroll_loops, options::OPT_fno_unroll_loops});
160}
161
162void Flang::addPicOptions(const ArgList &Args, ArgStringList &CmdArgs) const {
163 // ParsePICArgs parses -fPIC/-fPIE and their variants and returns a tuple of
164 // (RelocationModel, PICLevel, IsPIE).
165 llvm::Reloc::Model RelocationModel;
166 unsigned PICLevel;
167 bool IsPIE;
168 std::tie(RelocationModel, PICLevel, IsPIE) =
169 ParsePICArgs(getToolChain(), Args);
170
171 if (auto *RMName = RelocationModelName(RelocationModel)) {
172 CmdArgs.push_back("-mrelocation-model");
173 CmdArgs.push_back(RMName);
174 }
175 if (PICLevel > 0) {
176 CmdArgs.push_back("-pic-level");
177 CmdArgs.push_back(PICLevel == 1 ? "1" : "2");
178 if (IsPIE)
179 CmdArgs.push_back("-pic-is-pie");
180 }
181}
182
183void Flang::AddAArch64TargetArgs(const ArgList &Args,
184 ArgStringList &CmdArgs) const {
185 // Handle -msve_vector_bits=<bits>
186 if (Arg *A = Args.getLastArg(options::OPT_msve_vector_bits_EQ)) {
187 StringRef Val = A->getValue();
188 const Driver &D = getToolChain().getDriver();
189 if (Val == "128" || Val == "256" || Val == "512" || Val == "1024" ||
190 Val == "2048" || Val == "128+" || Val == "256+" || Val == "512+" ||
191 Val == "1024+" || Val == "2048+") {
192 unsigned Bits = 0;
193 if (!Val.consume_back("+")) {
194 [[maybe_unused]] bool Invalid = Val.getAsInteger(10, Bits);
195 assert(!Invalid && "Failed to parse value");
196 CmdArgs.push_back(
197 Args.MakeArgString("-mvscale-max=" + llvm::Twine(Bits / 128)));
198 }
199
200 [[maybe_unused]] bool Invalid = Val.getAsInteger(10, Bits);
201 assert(!Invalid && "Failed to parse value");
202 CmdArgs.push_back(
203 Args.MakeArgString("-mvscale-min=" + llvm::Twine(Bits / 128)));
204 // Silently drop requests for vector-length agnostic code as it's implied.
205 } else if (Val != "scalable")
206 // Handle the unsupported values passed to msve-vector-bits.
207 D.Diag(diag::err_drv_unsupported_option_argument)
208 << A->getSpelling() << Val;
209 }
210}
211
212void Flang::AddLoongArch64TargetArgs(const ArgList &Args,
213 ArgStringList &CmdArgs) const {
214 const Driver &D = getToolChain().getDriver();
215 // Currently, flang only support `-mabi=lp64d` in LoongArch64.
216 if (const Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) {
217 StringRef V = A->getValue();
218 if (V != "lp64d") {
219 D.Diag(diag::err_drv_argument_not_allowed_with) << "-mabi" << V;
220 }
221 }
222
223 if (const Arg *A = Args.getLastArg(options::OPT_mannotate_tablejump,
224 options::OPT_mno_annotate_tablejump)) {
225 if (A->getOption().matches(options::OPT_mannotate_tablejump)) {
226 CmdArgs.push_back("-mllvm");
227 CmdArgs.push_back("-loongarch-annotate-tablejump");
228 }
229 }
230}
231
232void Flang::AddPPCTargetArgs(const ArgList &Args,
233 ArgStringList &CmdArgs) const {
234 const Driver &D = getToolChain().getDriver();
235 bool VecExtabi = false;
236
237 if (const Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) {
238 StringRef V = A->getValue();
239 if (V == "vec-extabi")
240 VecExtabi = true;
241 else if (V == "vec-default")
242 VecExtabi = false;
243 else
244 D.Diag(diag::err_drv_unsupported_option_argument)
245 << A->getSpelling() << V;
246 }
247
248 const llvm::Triple &T = getToolChain().getTriple();
249 if (VecExtabi) {
250 if (!T.isOSAIX()) {
251 D.Diag(diag::err_drv_unsupported_opt_for_target)
252 << "-mabi=vec-extabi" << T.str();
253 }
254 CmdArgs.push_back("-mabi=vec-extabi");
255 }
256}
257
258void Flang::AddRISCVTargetArgs(const ArgList &Args,
259 ArgStringList &CmdArgs) const {
260 const llvm::Triple &Triple = getToolChain().getTriple();
261 // Handle -mrvv-vector-bits=<bits>
262 if (Arg *A = Args.getLastArg(options::OPT_mrvv_vector_bits_EQ)) {
263 StringRef Val = A->getValue();
264 const Driver &D = getToolChain().getDriver();
265
266 // Get minimum VLen from march.
267 unsigned MinVLen = 0;
268 std::string Arch = riscv::getRISCVArch(Args, Triple);
269 auto ISAInfo = llvm::RISCVISAInfo::parseArchString(
270 Arch, /*EnableExperimentalExtensions*/ true);
271 // Ignore parsing error.
272 if (!errorToBool(ISAInfo.takeError()))
273 MinVLen = (*ISAInfo)->getMinVLen();
274
275 // If the value is "zvl", use MinVLen from march. Otherwise, try to parse
276 // as integer as long as we have a MinVLen.
277 unsigned Bits = 0;
278 if (Val == "zvl" && MinVLen >= llvm::RISCV::RVVBitsPerBlock) {
279 Bits = MinVLen;
280 } else if (!Val.getAsInteger(10, Bits)) {
281 // Only accept power of 2 values beteen RVVBitsPerBlock and 65536 that
282 // at least MinVLen.
283 if (Bits < MinVLen || Bits < llvm::RISCV::RVVBitsPerBlock ||
284 Bits > 65536 || !llvm::isPowerOf2_32(Bits))
285 Bits = 0;
286 }
287
288 // If we got a valid value try to use it.
289 if (Bits != 0) {
290 unsigned VScaleMin = Bits / llvm::RISCV::RVVBitsPerBlock;
291 CmdArgs.push_back(
292 Args.MakeArgString("-mvscale-max=" + llvm::Twine(VScaleMin)));
293 CmdArgs.push_back(
294 Args.MakeArgString("-mvscale-min=" + llvm::Twine(VScaleMin)));
295 } else if (Val != "scalable") {
296 // Handle the unsupported values passed to mrvv-vector-bits.
297 D.Diag(diag::err_drv_unsupported_option_argument)
298 << A->getSpelling() << Val;
299 }
300 }
301}
302
303void Flang::AddX86_64TargetArgs(const ArgList &Args,
304 ArgStringList &CmdArgs) const {
305 if (Arg *A = Args.getLastArg(options::OPT_masm_EQ)) {
306 StringRef Value = A->getValue();
307 if (Value == "intel" || Value == "att") {
308 CmdArgs.push_back(Args.MakeArgString("-mllvm"));
309 CmdArgs.push_back(Args.MakeArgString("-x86-asm-syntax=" + Value));
310 } else {
311 getToolChain().getDriver().Diag(diag::err_drv_unsupported_option_argument)
312 << A->getSpelling() << Value;
313 }
314 }
315}
316
317static void addVSDefines(const ToolChain &TC, const ArgList &Args,
318 ArgStringList &CmdArgs) {
319
320 unsigned ver = 0;
321 const VersionTuple vt = TC.computeMSVCVersion(nullptr, Args);
322 ver = vt.getMajor() * 10000000 + vt.getMinor().value_or(0) * 100000 +
323 vt.getSubminor().value_or(0);
324 CmdArgs.push_back(Args.MakeArgString("-D_MSC_VER=" + Twine(ver / 100000)));
325 CmdArgs.push_back(Args.MakeArgString("-D_MSC_FULL_VER=" + Twine(ver)));
326 CmdArgs.push_back(Args.MakeArgString("-D_WIN32"));
327
328 const llvm::Triple &triple = TC.getTriple();
329 if (triple.isAArch64()) {
330 CmdArgs.push_back("-D_M_ARM64=1");
331 } else if (triple.isX86() && triple.isArch32Bit()) {
332 CmdArgs.push_back("-D_M_IX86=600");
333 } else if (triple.isX86() && triple.isArch64Bit()) {
334 CmdArgs.push_back("-D_M_X64=100");
335 } else {
336 llvm_unreachable(
337 "Flang on Windows only supports X86_32, X86_64 and AArch64");
338 }
339}
340
341static void processVSRuntimeLibrary(const ToolChain &TC, const ArgList &Args,
342 ArgStringList &CmdArgs) {
343 assert(TC.getTriple().isKnownWindowsMSVCEnvironment() &&
344 "can only add VS runtime library on Windows!");
345 // if -fno-fortran-main has been passed, skip linking Fortran_main.a
346 if (TC.getTriple().isKnownWindowsMSVCEnvironment()) {
347 CmdArgs.push_back(Args.MakeArgString(
348 "--dependent-lib=" + TC.getCompilerRTBasename(Args, "builtins")));
349 }
350 unsigned RTOptionID = options::OPT__SLASH_MT;
351 if (auto *rtl = Args.getLastArg(options::OPT_fms_runtime_lib_EQ)) {
352 RTOptionID = llvm::StringSwitch<unsigned>(rtl->getValue())
353 .Case("static", options::OPT__SLASH_MT)
354 .Case("static_dbg", options::OPT__SLASH_MTd)
355 .Case("dll", options::OPT__SLASH_MD)
356 .Case("dll_dbg", options::OPT__SLASH_MDd)
357 .Default(options::OPT__SLASH_MT);
358 }
359 switch (RTOptionID) {
360 case options::OPT__SLASH_MT:
361 CmdArgs.push_back("-D_MT");
362 CmdArgs.push_back("--dependent-lib=libcmt");
363 CmdArgs.push_back("--dependent-lib=FortranRuntime.static.lib");
364 CmdArgs.push_back("--dependent-lib=FortranDecimal.static.lib");
365 break;
366 case options::OPT__SLASH_MTd:
367 CmdArgs.push_back("-D_MT");
368 CmdArgs.push_back("-D_DEBUG");
369 CmdArgs.push_back("--dependent-lib=libcmtd");
370 CmdArgs.push_back("--dependent-lib=FortranRuntime.static_dbg.lib");
371 CmdArgs.push_back("--dependent-lib=FortranDecimal.static_dbg.lib");
372 break;
373 case options::OPT__SLASH_MD:
374 CmdArgs.push_back("-D_MT");
375 CmdArgs.push_back("-D_DLL");
376 CmdArgs.push_back("--dependent-lib=msvcrt");
377 CmdArgs.push_back("--dependent-lib=FortranRuntime.dynamic.lib");
378 CmdArgs.push_back("--dependent-lib=FortranDecimal.dynamic.lib");
379 break;
380 case options::OPT__SLASH_MDd:
381 CmdArgs.push_back("-D_MT");
382 CmdArgs.push_back("-D_DEBUG");
383 CmdArgs.push_back("-D_DLL");
384 CmdArgs.push_back("--dependent-lib=msvcrtd");
385 CmdArgs.push_back("--dependent-lib=FortranRuntime.dynamic_dbg.lib");
386 CmdArgs.push_back("--dependent-lib=FortranDecimal.dynamic_dbg.lib");
387 break;
388 }
389}
390
391void Flang::AddAMDGPUTargetArgs(const ArgList &Args,
392 ArgStringList &CmdArgs) const {
393 if (Arg *A = Args.getLastArg(options::OPT_mcode_object_version_EQ)) {
394 StringRef Val = A->getValue();
395 CmdArgs.push_back(Args.MakeArgString("-mcode-object-version=" + Val));
396 }
397
398 const ToolChain &TC = getToolChain();
400}
401
402void Flang::addTargetOptions(const ArgList &Args,
403 ArgStringList &CmdArgs) const {
404 const ToolChain &TC = getToolChain();
405 const llvm::Triple &Triple = TC.getEffectiveTriple();
406 const Driver &D = TC.getDriver();
407
408 std::string CPU = getCPUName(D, Args, Triple);
409 if (!CPU.empty()) {
410 CmdArgs.push_back("-target-cpu");
411 CmdArgs.push_back(Args.MakeArgString(CPU));
412 }
413
414 addOutlineAtomicsArgs(D, getToolChain(), Args, CmdArgs, Triple);
415
416 // Add the target features.
417 switch (TC.getArch()) {
418 default:
419 break;
420 case llvm::Triple::aarch64:
421 getTargetFeatures(D, Triple, Args, CmdArgs, /*ForAs*/ false);
422 AddAArch64TargetArgs(Args, CmdArgs);
423 break;
424
425 case llvm::Triple::r600:
426 case llvm::Triple::amdgcn:
427 getTargetFeatures(D, Triple, Args, CmdArgs, /*ForAs*/ false);
428 AddAMDGPUTargetArgs(Args, CmdArgs);
429 break;
430 case llvm::Triple::riscv64:
431 getTargetFeatures(D, Triple, Args, CmdArgs, /*ForAs*/ false);
432 AddRISCVTargetArgs(Args, CmdArgs);
433 break;
434 case llvm::Triple::x86_64:
435 getTargetFeatures(D, Triple, Args, CmdArgs, /*ForAs*/ false);
436 AddX86_64TargetArgs(Args, CmdArgs);
437 break;
438 case llvm::Triple::ppc:
439 case llvm::Triple::ppc64:
440 case llvm::Triple::ppc64le:
441 AddPPCTargetArgs(Args, CmdArgs);
442 break;
443 case llvm::Triple::loongarch64:
444 getTargetFeatures(D, Triple, Args, CmdArgs, /*ForAs*/ false);
445 AddLoongArch64TargetArgs(Args, CmdArgs);
446 break;
447 }
448
449 if (Arg *A = Args.getLastArg(options::OPT_fveclib)) {
450 StringRef Name = A->getValue();
451 if (Name == "SVML") {
452 if (Triple.getArch() != llvm::Triple::x86 &&
453 Triple.getArch() != llvm::Triple::x86_64)
454 D.Diag(diag::err_drv_unsupported_opt_for_target)
455 << Name << Triple.getArchName();
456 } else if (Name == "LIBMVEC-X86") {
457 if (Triple.getArch() != llvm::Triple::x86 &&
458 Triple.getArch() != llvm::Triple::x86_64)
459 D.Diag(diag::err_drv_unsupported_opt_for_target)
460 << Name << Triple.getArchName();
461 } else if (Name == "SLEEF" || Name == "ArmPL") {
462 if (Triple.getArch() != llvm::Triple::aarch64 &&
463 Triple.getArch() != llvm::Triple::aarch64_be)
464 D.Diag(diag::err_drv_unsupported_opt_for_target)
465 << Name << Triple.getArchName();
466 }
467
468 if (Triple.isOSDarwin()) {
469 // flang doesn't currently suport nostdlib, nodefaultlibs. Adding these
470 // here incase they are added someday
471 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
472 if (A->getValue() == StringRef{"Accelerate"}) {
473 CmdArgs.push_back("-framework");
474 CmdArgs.push_back("Accelerate");
475 }
476 }
477 }
478 A->render(Args, CmdArgs);
479 }
480
481 if (Triple.isKnownWindowsMSVCEnvironment()) {
482 processVSRuntimeLibrary(TC, Args, CmdArgs);
483 addVSDefines(TC, Args, CmdArgs);
484 }
485
486 // TODO: Add target specific flags, ABI, mtune option etc.
487 if (const Arg *A = Args.getLastArg(options::OPT_mtune_EQ)) {
488 CmdArgs.push_back("-tune-cpu");
489 if (A->getValue() == StringRef{"native"})
490 CmdArgs.push_back(Args.MakeArgString(llvm::sys::getHostCPUName()));
491 else
492 CmdArgs.push_back(A->getValue());
493 }
494}
495
496void Flang::addOffloadOptions(Compilation &C, const InputInfoList &Inputs,
497 const JobAction &JA, const ArgList &Args,
498 ArgStringList &CmdArgs) const {
499 bool IsOpenMPDevice = JA.isDeviceOffloading(Action::OFK_OpenMP);
500 bool IsHostOffloadingAction = JA.isHostOffloading(Action::OFK_OpenMP) ||
501 JA.isHostOffloading(C.getActiveOffloadKinds());
502
503 // Skips the primary input file, which is the input file that the compilation
504 // proccess will be executed upon (e.g. the host bitcode file) and
505 // adds other secondary input (e.g. device bitcode files for embedding to the
506 // -fembed-offload-object argument or the host IR file for proccessing
507 // during device compilation to the fopenmp-host-ir-file-path argument via
508 // OpenMPDeviceInput). This is condensed logic from the ConstructJob
509 // function inside of the Clang driver for pushing on further input arguments
510 // needed for offloading during various phases of compilation.
511 for (size_t i = 1; i < Inputs.size(); ++i) {
512 if (Inputs[i].getType() == types::TY_Nothing) {
513 // contains nothing, so it's skippable
514 } else if (IsHostOffloadingAction) {
515 CmdArgs.push_back(
516 Args.MakeArgString("-fembed-offload-object=" +
517 getToolChain().getInputFilename(Inputs[i])));
518 } else if (IsOpenMPDevice) {
519 if (Inputs[i].getFilename()) {
520 CmdArgs.push_back("-fopenmp-host-ir-file-path");
521 CmdArgs.push_back(Args.MakeArgString(Inputs[i].getFilename()));
522 } else {
523 llvm_unreachable("missing openmp host-ir file for device offloading");
524 }
525 } else {
526 llvm_unreachable(
527 "unexpectedly given multiple inputs or given unknown input");
528 }
529 }
530
531 if (IsOpenMPDevice) {
532 // -fopenmp-is-target-device is passed along to tell the frontend that it is
533 // generating code for a device, so that only the relevant code is emitted.
534 CmdArgs.push_back("-fopenmp-is-target-device");
535
536 // When in OpenMP offloading mode, enable debugging on the device.
537 Args.AddAllArgs(CmdArgs, options::OPT_fopenmp_target_debug_EQ);
538 if (Args.hasFlag(options::OPT_fopenmp_target_debug,
539 options::OPT_fno_openmp_target_debug, /*Default=*/false))
540 CmdArgs.push_back("-fopenmp-target-debug");
541
542 // When in OpenMP offloading mode, forward assumptions information about
543 // thread and team counts in the device.
544 if (Args.hasFlag(options::OPT_fopenmp_assume_teams_oversubscription,
545 options::OPT_fno_openmp_assume_teams_oversubscription,
546 /*Default=*/false))
547 CmdArgs.push_back("-fopenmp-assume-teams-oversubscription");
548 if (Args.hasFlag(options::OPT_fopenmp_assume_threads_oversubscription,
549 options::OPT_fno_openmp_assume_threads_oversubscription,
550 /*Default=*/false))
551 CmdArgs.push_back("-fopenmp-assume-threads-oversubscription");
552 if (Args.hasArg(options::OPT_fopenmp_assume_no_thread_state))
553 CmdArgs.push_back("-fopenmp-assume-no-thread-state");
554 if (Args.hasArg(options::OPT_fopenmp_assume_no_nested_parallelism))
555 CmdArgs.push_back("-fopenmp-assume-no-nested-parallelism");
556 if (Args.hasArg(options::OPT_nogpulib))
557 CmdArgs.push_back("-nogpulib");
558 }
559
560 addOpenMPHostOffloadingArgs(C, JA, Args, CmdArgs);
561}
562
563static void addFloatingPointOptions(const Driver &D, const ArgList &Args,
564 ArgStringList &CmdArgs) {
565 StringRef FPContract;
566 bool HonorINFs = true;
567 bool HonorNaNs = true;
568 bool ApproxFunc = false;
569 bool SignedZeros = true;
570 bool AssociativeMath = false;
571 bool ReciprocalMath = false;
572
573 if (const Arg *A = Args.getLastArg(options::OPT_ffp_contract)) {
574 const StringRef Val = A->getValue();
575 if (Val == "fast" || Val == "off") {
576 FPContract = Val;
577 } else if (Val == "on") {
578 // Warn instead of error because users might have makefiles written for
579 // gfortran (which accepts -ffp-contract=on)
580 D.Diag(diag::warn_drv_unsupported_option_for_flang)
581 << Val << A->getOption().getName() << "off";
582 FPContract = "off";
583 } else
584 // Clang's "fast-honor-pragmas" option is not supported because it is
585 // non-standard
586 D.Diag(diag::err_drv_unsupported_option_argument)
587 << A->getSpelling() << Val;
588 }
589
590 for (const Arg *A : Args) {
591 auto optId = A->getOption().getID();
592 switch (optId) {
593 // if this isn't an FP option, skip the claim below
594 default:
595 continue;
596
597 case options::OPT_fhonor_infinities:
598 HonorINFs = true;
599 break;
600 case options::OPT_fno_honor_infinities:
601 HonorINFs = false;
602 break;
603 case options::OPT_fhonor_nans:
604 HonorNaNs = true;
605 break;
606 case options::OPT_fno_honor_nans:
607 HonorNaNs = false;
608 break;
609 case options::OPT_fapprox_func:
610 ApproxFunc = true;
611 break;
612 case options::OPT_fno_approx_func:
613 ApproxFunc = false;
614 break;
615 case options::OPT_fsigned_zeros:
616 SignedZeros = true;
617 break;
618 case options::OPT_fno_signed_zeros:
619 SignedZeros = false;
620 break;
621 case options::OPT_fassociative_math:
622 AssociativeMath = true;
623 break;
624 case options::OPT_fno_associative_math:
625 AssociativeMath = false;
626 break;
627 case options::OPT_freciprocal_math:
628 ReciprocalMath = true;
629 break;
630 case options::OPT_fno_reciprocal_math:
631 ReciprocalMath = false;
632 break;
633 case options::OPT_Ofast:
634 [[fallthrough]];
635 case options::OPT_ffast_math:
636 HonorINFs = false;
637 HonorNaNs = false;
638 AssociativeMath = true;
639 ReciprocalMath = true;
640 ApproxFunc = true;
641 SignedZeros = false;
642 FPContract = "fast";
643 break;
644 case options::OPT_fno_fast_math:
645 HonorINFs = true;
646 HonorNaNs = true;
647 AssociativeMath = false;
648 ReciprocalMath = false;
649 ApproxFunc = false;
650 SignedZeros = true;
651 // -fno-fast-math should undo -ffast-math so I return FPContract to the
652 // default. It is important to check it is "fast" (the default) so that
653 // --ffp-contract=off -fno-fast-math --> -ffp-contract=off
654 if (FPContract == "fast")
655 FPContract = "";
656 break;
657 }
658
659 // If we handled this option claim it
660 A->claim();
661 }
662
663 if (!HonorINFs && !HonorNaNs && AssociativeMath && ReciprocalMath &&
664 ApproxFunc && !SignedZeros &&
665 (FPContract == "fast" || FPContract.empty())) {
666 CmdArgs.push_back("-ffast-math");
667 return;
668 }
669
670 if (!FPContract.empty())
671 CmdArgs.push_back(Args.MakeArgString("-ffp-contract=" + FPContract));
672
673 if (!HonorINFs)
674 CmdArgs.push_back("-menable-no-infs");
675
676 if (!HonorNaNs)
677 CmdArgs.push_back("-menable-no-nans");
678
679 if (ApproxFunc)
680 CmdArgs.push_back("-fapprox-func");
681
682 if (!SignedZeros)
683 CmdArgs.push_back("-fno-signed-zeros");
684
685 if (AssociativeMath && !SignedZeros)
686 CmdArgs.push_back("-mreassociate");
687
688 if (ReciprocalMath)
689 CmdArgs.push_back("-freciprocal-math");
690}
691
692static void renderRemarksOptions(const ArgList &Args, ArgStringList &CmdArgs,
693 const InputInfo &Input) {
694 StringRef Format = "yaml";
695 if (const Arg *A = Args.getLastArg(options::OPT_fsave_optimization_record_EQ))
696 Format = A->getValue();
697
698 CmdArgs.push_back("-opt-record-file");
699
700 const Arg *A = Args.getLastArg(options::OPT_foptimization_record_file_EQ);
701 if (A) {
702 CmdArgs.push_back(A->getValue());
703 } else {
705
706 if (Args.hasArg(options::OPT_c) || Args.hasArg(options::OPT_S)) {
707 if (Arg *FinalOutput = Args.getLastArg(options::OPT_o))
708 F = FinalOutput->getValue();
709 }
710
711 if (F.empty()) {
712 // Use the input filename.
713 F = llvm::sys::path::stem(Input.getBaseInput());
714 }
715
716 SmallString<32> Extension;
717 Extension += "opt.";
718 Extension += Format;
719
720 llvm::sys::path::replace_extension(F, Extension);
721 CmdArgs.push_back(Args.MakeArgString(F));
722 }
723
724 if (const Arg *A =
725 Args.getLastArg(options::OPT_foptimization_record_passes_EQ)) {
726 CmdArgs.push_back("-opt-record-passes");
727 CmdArgs.push_back(A->getValue());
728 }
729
730 if (!Format.empty()) {
731 CmdArgs.push_back("-opt-record-format");
732 CmdArgs.push_back(Format.data());
733 }
734}
735
737 const InputInfo &Output, const InputInfoList &Inputs,
738 const ArgList &Args, const char *LinkingOutput) const {
739 const auto &TC = getToolChain();
740 const llvm::Triple &Triple = TC.getEffectiveTriple();
741 const std::string &TripleStr = Triple.getTriple();
742
743 const Driver &D = TC.getDriver();
744 ArgStringList CmdArgs;
745 DiagnosticsEngine &Diags = D.getDiags();
746
747 // Invoke ourselves in -fc1 mode.
748 CmdArgs.push_back("-fc1");
749
750 // Add the "effective" target triple.
751 CmdArgs.push_back("-triple");
752 CmdArgs.push_back(Args.MakeArgString(TripleStr));
753
754 if (isa<PreprocessJobAction>(JA)) {
755 CmdArgs.push_back("-E");
756 if (Args.getLastArg(options::OPT_dM)) {
757 CmdArgs.push_back("-dM");
758 }
759 } else if (isa<CompileJobAction>(JA) || isa<BackendJobAction>(JA)) {
760 if (JA.getType() == types::TY_Nothing) {
761 CmdArgs.push_back("-fsyntax-only");
762 } else if (JA.getType() == types::TY_AST) {
763 CmdArgs.push_back("-emit-ast");
764 } else if (JA.getType() == types::TY_LLVM_IR ||
765 JA.getType() == types::TY_LTO_IR) {
766 CmdArgs.push_back("-emit-llvm");
767 } else if (JA.getType() == types::TY_LLVM_BC ||
768 JA.getType() == types::TY_LTO_BC) {
769 CmdArgs.push_back("-emit-llvm-bc");
770 } else if (JA.getType() == types::TY_PP_Asm) {
771 CmdArgs.push_back("-S");
772 } else {
773 assert(false && "Unexpected output type!");
774 }
775 } else if (isa<AssembleJobAction>(JA)) {
776 CmdArgs.push_back("-emit-obj");
777 } else if (isa<PrecompileJobAction>(JA)) {
778 // The precompile job action is only needed for options such as -mcpu=help.
779 // Those will already have been handled by the fc1 driver.
780 } else {
781 assert(false && "Unexpected action class for Flang tool.");
782 }
783
784 const InputInfo &Input = Inputs[0];
785 types::ID InputType = Input.getType();
786
787 // Add preprocessing options like -I, -D, etc. if we are using the
788 // preprocessor (i.e. skip when dealing with e.g. binary files).
790 addPreprocessingOptions(Args, CmdArgs);
791
792 addFortranDialectOptions(Args, CmdArgs);
793
794 // 'flang -E' always produces output that is suitable for use as fixed form
795 // Fortran. However it is only valid free form source if the original is also
796 // free form.
797 if (InputType == types::TY_PP_Fortran &&
798 !Args.getLastArg(options::OPT_ffixed_form, options::OPT_ffree_form))
799 CmdArgs.push_back("-ffixed-form");
800
801 handleColorDiagnosticsArgs(D, Args, CmdArgs);
802
803 // LTO mode is parsed by the Clang driver library.
804 LTOKind LTOMode = D.getLTOMode();
805 assert(LTOMode != LTOK_Unknown && "Unknown LTO mode.");
806 if (LTOMode == LTOK_Full)
807 CmdArgs.push_back("-flto=full");
808 else if (LTOMode == LTOK_Thin) {
809 Diags.Report(
811 "the option '-flto=thin' is a work in progress"));
812 CmdArgs.push_back("-flto=thin");
813 }
814
815 // -fPIC and related options.
816 addPicOptions(Args, CmdArgs);
817
818 // Floating point related options
819 addFloatingPointOptions(D, Args, CmdArgs);
820
821 // Add target args, features, etc.
822 addTargetOptions(Args, CmdArgs);
823
824 llvm::Reloc::Model RelocationModel =
825 std::get<0>(ParsePICArgs(getToolChain(), Args));
826 // Add MCModel information
827 addMCModel(D, Args, Triple, RelocationModel, CmdArgs);
828
829 // Add Codegen options
830 addCodegenOptions(Args, CmdArgs);
831
832 // Add R Group options
833 Args.AddAllArgs(CmdArgs, options::OPT_R_Group);
834
835 // Remarks can be enabled with any of the `-f.*optimization-record.*` flags.
836 if (willEmitRemarks(Args))
837 renderRemarksOptions(Args, CmdArgs, Input);
838
839 // Add other compile options
840 addOtherOptions(Args, CmdArgs);
841
842 // Disable all warnings
843 // TODO: Handle interactions between -w, -pedantic, -Wall, -WOption
844 Args.AddLastArg(CmdArgs, options::OPT_w);
845
846 // Forward flags for OpenMP. We don't do this if the current action is an
847 // device offloading action other than OpenMP.
848 if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
849 options::OPT_fno_openmp, false) &&
852 switch (D.getOpenMPRuntime(Args)) {
855 // Clang can generate useful OpenMP code for these two runtime libraries.
856 CmdArgs.push_back("-fopenmp");
857 Args.AddAllArgs(CmdArgs, options::OPT_fopenmp_version_EQ);
858
859 if (Args.hasArg(options::OPT_fopenmp_force_usm))
860 CmdArgs.push_back("-fopenmp-force-usm");
861 // TODO: OpenMP support isn't "done" yet, so for now we warn that it
862 // is experimental.
863 D.Diag(diag::warn_openmp_experimental);
864
865 // FIXME: Clang supports a whole bunch more flags here.
866 break;
867 default:
868 // By default, if Clang doesn't know how to generate useful OpenMP code
869 // for a specific runtime library, we just don't pass the '-fopenmp' flag
870 // down to the actual compilation.
871 // FIXME: It would be better to have a mode which *only* omits IR
872 // generation based on the OpenMP support so that we get consistent
873 // semantic analysis, etc.
874 const Arg *A = Args.getLastArg(options::OPT_fopenmp_EQ);
875 D.Diag(diag::warn_drv_unsupported_openmp_library)
876 << A->getSpelling() << A->getValue();
877 break;
878 }
879 }
880
881 // Pass the path to compiler resource files.
882 CmdArgs.push_back("-resource-dir");
883 CmdArgs.push_back(D.ResourceDir.c_str());
884
885 // Offloading related options
886 addOffloadOptions(C, Inputs, JA, Args, CmdArgs);
887
888 // Forward -Xflang arguments to -fc1
889 Args.AddAllArgValues(CmdArgs, options::OPT_Xflang);
890
892 getFramePointerKind(Args, Triple);
893
894 const char *FPKeepKindStr = nullptr;
895 switch (FPKeepKind) {
897 FPKeepKindStr = "-mframe-pointer=none";
898 break;
900 FPKeepKindStr = "-mframe-pointer=reserved";
901 break;
903 FPKeepKindStr = "-mframe-pointer=non-leaf";
904 break;
906 FPKeepKindStr = "-mframe-pointer=all";
907 break;
908 }
909 assert(FPKeepKindStr && "unknown FramePointerKind");
910 CmdArgs.push_back(FPKeepKindStr);
911
912 // Forward -mllvm options to the LLVM option parser. In practice, this means
913 // forwarding to `-fc1` as that's where the LLVM parser is run.
914 for (const Arg *A : Args.filtered(options::OPT_mllvm)) {
915 A->claim();
916 A->render(Args, CmdArgs);
917 }
918
919 for (const Arg *A : Args.filtered(options::OPT_mmlir)) {
920 A->claim();
921 A->render(Args, CmdArgs);
922 }
923
924 // Remove any unsupported gfortran diagnostic options
925 for (const Arg *A : Args.filtered(options::OPT_flang_ignored_w_Group)) {
926 A->claim();
927 D.Diag(diag::warn_drv_unsupported_diag_option_for_flang)
928 << A->getOption().getName();
929 }
930
931 // Optimization level for CodeGen.
932 if (const Arg *A = Args.getLastArg(options::OPT_O_Group)) {
933 if (A->getOption().matches(options::OPT_O4)) {
934 CmdArgs.push_back("-O3");
935 D.Diag(diag::warn_O4_is_O3);
936 } else if (A->getOption().matches(options::OPT_Ofast)) {
937 CmdArgs.push_back("-O3");
938 } else {
939 A->render(Args, CmdArgs);
940 }
941 }
942
944
945 assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
946 if (Output.isFilename()) {
947 CmdArgs.push_back("-o");
948 CmdArgs.push_back(Output.getFilename());
949 }
950
951 if (Args.getLastArg(options::OPT_save_temps_EQ))
952 Args.AddLastArg(CmdArgs, options::OPT_save_temps_EQ);
953
954 addDashXForInput(Args, Input, CmdArgs);
955
956 bool FRecordCmdLine = false;
957 bool GRecordCmdLine = false;
958 if (shouldRecordCommandLine(TC, Args, FRecordCmdLine, GRecordCmdLine)) {
959 const char *CmdLine = renderEscapedCommandLine(TC, Args);
960 if (FRecordCmdLine) {
961 CmdArgs.push_back("-record-command-line");
962 CmdArgs.push_back(CmdLine);
963 }
964 if (TC.UseDwarfDebugFlags() || GRecordCmdLine) {
965 CmdArgs.push_back("-dwarf-debug-flags");
966 CmdArgs.push_back(CmdLine);
967 }
968 }
969
970 // The input could be Ty_Nothing when "querying" options such as -mcpu=help
971 // are used.
972 ArrayRef<InputInfo> FrontendInputs = Input;
973 if (Input.isNothing())
974 FrontendInputs = {};
975
976 for (const InputInfo &Input : FrontendInputs) {
977 if (Input.isFilename())
978 CmdArgs.push_back(Input.getFilename());
979 else
980 Input.getInputArg().renderAsInput(Args, CmdArgs);
981 }
982
983 const char *Exec = Args.MakeArgString(D.GetProgramPath("flang", TC));
984 C.addCommand(std::make_unique<Command>(JA, *this,
986 Exec, CmdArgs, Inputs, Output));
987}
988
989Flang::Flang(const ToolChain &TC) : Tool("flang", "flang frontend", TC) {}
990
#define V(N, I)
Definition: ASTContext.h:3453
const Decl * D
static void addDashXForInput(const ArgList &Args, const InputInfo &Input, ArgStringList &CmdArgs)
Add -x lang to CmdArgs for Input.
Definition: Clang.cpp:548
static void renderRemarksOptions(const ArgList &Args, ArgStringList &CmdArgs, const llvm::Triple &Triple, const InputInfo &Input, const InputInfo &Output, const JobAction &JA)
Definition: Clang.cpp:1401
clang::CodeGenOptions::FramePointerKind getFramePointerKind(const llvm::opt::ArgList &Args, const llvm::Triple &Triple)
Definition: CommonArgs.cpp:216
static void processVSRuntimeLibrary(const ToolChain &TC, const ArgList &Args, ArgStringList &CmdArgs)
Definition: Flang.cpp:341
static void addVSDefines(const ToolChain &TC, const ArgList &Args, ArgStringList &CmdArgs)
Definition: Flang.cpp:317
static bool shouldLoopVersion(const ArgList &Args)
@C shouldLoopVersion
Definition: Flang.cpp:88
static void addDashXForInput(const ArgList &Args, const InputInfo &Input, ArgStringList &CmdArgs)
Add -x lang to CmdArgs for Input.
Definition: Flang.cpp:30
static void addFloatingPointOptions(const Driver &D, const ArgList &Args, ArgStringList &CmdArgs)
Definition: Flang.cpp:563
int64_t getID() const
Definition: DeclBase.cpp:1175
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:231
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
Definition: Diagnostic.h:1493
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
Definition: Diagnostic.h:896
types::ID getType() const
Definition: Action.h:149
bool isHostOffloading(unsigned int OKind) const
Check if this action have any offload kinds.
Definition: Action.h:219
bool isDeviceOffloading(OffloadKind OKind) const
Definition: Action.h:222
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:99
DiagnosticBuilder Diag(unsigned DiagID) const
Definition: Driver.h:169
@ OMPRT_IOMP5
The legacy name for the LLVM OpenMP runtime from when it was the Intel OpenMP runtime.
Definition: Driver.h:165
@ OMPRT_OMP
The LLVM OpenMP runtime.
Definition: Driver.h:155
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
const char * getBaseInput() const
Definition: InputInfo.h:78
const llvm::opt::Arg & getInputArg() const
Definition: InputInfo.h:87
const char * getFilename() const
Definition: InputInfo.h:83
bool isNothing() const
Definition: InputInfo.h:74
bool isFilename() const
Definition: InputInfo.h:75
types::ID getType() const
Definition: InputInfo.h:77
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:92
llvm::Triple::ArchType getArch() const
Definition: ToolChain.h:268
const Driver & getDriver() const
Definition: ToolChain.h:252
const llvm::Triple & getEffectiveTriple() const
Get the toolchain's effective clang triple.
Definition: ToolChain.h:282
const llvm::Triple & getTriple() const
Definition: ToolChain.h:254
virtual bool UseDwarfDebugFlags() const
UseDwarfDebugFlags - Embed the compile options to clang into the Dwarf compile unit information.
Definition: ToolChain.h:579
virtual VersionTuple computeMSVCVersion(const Driver *D, const llvm::opt::ArgList &Args) const
On Windows, returns the MSVC compatibility version.
Definition: ToolChain.cpp:1525
virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, Action::OffloadKind DeviceOffloadKind) const
Add options that need to be passed to cc1 for this target.
Definition: ToolChain.cpp:1172
std::string getCompilerRTBasename(const llvm::opt::ArgList &Args, StringRef Component, FileType Type=ToolChain::FT_Static) const
Definition: ToolChain.cpp:725
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
const ToolChain & getToolChain() const
Definition: Tool.h:52
Flang(const ToolChain &TC)
Definition: Flang.cpp:989
void ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, const InputInfoList &Inputs, const llvm::opt::ArgList &TCArgs, const char *LinkingOutput) const override
ConstructJob - Construct jobs to perform the action JA, writing to Output and with Inputs,...
Definition: Flang.cpp:736
std::string getRISCVArch(const llvm::opt::ArgList &Args, const llvm::Triple &Triple)
Definition: RISCV.cpp:249
void addMCModel(const Driver &D, const llvm::opt::ArgList &Args, const llvm::Triple &Triple, const llvm::Reloc::Model &RelocationModel, llvm::opt::ArgStringList &CmdArgs)
void addOutlineAtomicsArgs(const Driver &D, const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const llvm::Triple &Triple)
void getTargetFeatures(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, bool ForAS, bool IsAux=false)
void handleColorDiagnosticsArgs(const Driver &D, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
Handle the -f{no}-color-diagnostics and -f{no}-diagnostics-colors options.
std::string getCPUName(const Driver &D, const llvm::opt::ArgList &Args, const llvm::Triple &T, bool FromAs=false)
bool shouldRecordCommandLine(const ToolChain &TC, const llvm::opt::ArgList &Args, bool &FRecordCommandLine, bool &GRecordCommandLine)
Check if the command line should be recorded in the object file.
void addDebugInfoKind(llvm::opt::ArgStringList &CmdArgs, llvm::codegenoptions::DebugInfoKind DebugInfoKind)
llvm::codegenoptions::DebugInfoKind debugLevelToInfoKind(const llvm::opt::Arg &A)
const char * renderEscapedCommandLine(const ToolChain &TC, const llvm::opt::ArgList &Args)
Join the args in the given ArgList, escape spaces and backslashes and return the joined string.
void renderCommonIntegerOverflowOptions(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
std::tuple< llvm::Reloc::Model, unsigned, bool > ParsePICArgs(const ToolChain &ToolChain, const llvm::opt::ArgList &Args)
const char * RelocationModelName(llvm::Reloc::Model Model)
void addOpenMPHostOffloadingArgs(const Compilation &C, const JobAction &JA, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
Adds offloading options for OpenMP host compilation to CmdArgs.
ID getPreprocessedType(ID Id)
getPreprocessedType - Get the ID of the type for this input when it has been preprocessed,...
Definition: Types.cpp:53
const char * getTypeName(ID Id)
getTypeName - Return the name of the type for Id.
Definition: Types.cpp:49
LTOKind
Describes the kind of LTO mode selected via -f(no-)?lto(=.*)? options.
Definition: Driver.h:58
@ LTOK_Unknown
Definition: Driver.h:62
bool willEmitRemarks(const llvm::opt::ArgList &Args)
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
static constexpr ResponseFileSupport AtFileUTF8()
Definition: Job.h:85