clang 24.0.0git
CommonArgs.h
Go to the documentation of this file.
1//===--- CommonArgs.h - Args handling for multiple toolchains ---*- 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#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_COMMONARGS_H
10#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_COMMONARGS_H
11
13#include "clang/Driver/Driver.h"
16#include "clang/Driver/Tool.h"
18#include "llvm/ADT/StringRef.h"
19#include "llvm/Option/Arg.h"
20#include "llvm/Option/ArgList.h"
21#include "llvm/Support/CodeGen.h"
22
23namespace clang {
24namespace driver {
25namespace tools {
26
28 enum class Kind { Missing, Invalid, Jobserver, Fixed };
29
31 llvm::opt::Arg *A = nullptr;
32 StringRef Value;
33 unsigned NumThreads = 0;
34
35 bool isValid() const { return K == Kind::Jobserver || K == Kind::Fixed; }
36};
37
38OffloadJobsOpt parseOffloadJobs(const llvm::opt::ArgList &Args);
39
40void addPathIfExists(const Driver &D, const Twine &Path,
42
43void AddLinkerInputs(const ToolChain &TC, const InputInfoList &Inputs,
44 const llvm::opt::ArgList &Args,
45 llvm::opt::ArgStringList &CmdArgs, const JobAction &JA);
46
47const char *getLDMOption(const llvm::Triple &T, const llvm::opt::ArgList &Args);
48
50 const llvm::opt::ArgList &Args,
51 llvm::opt::ArgStringList &CmdArgs);
52
53void renderDebugInfoCompressionArgs(const llvm::opt::ArgList &Args,
54 llvm::opt::ArgStringList &CmdArgs,
55 const Driver &D, const ToolChain &TC);
56
57void claimNoWarnArgs(const llvm::opt::ArgList &Args);
58
59bool addSanitizerRuntimes(const ToolChain &TC, const llvm::opt::ArgList &Args,
60 llvm::opt::ArgStringList &CmdArgs);
61
63 const llvm::opt::ArgList &Args,
64 llvm::opt::ArgStringList &CmdArgs);
65
66bool addXRayRuntime(const ToolChain &TC, const llvm::opt::ArgList &Args,
67 llvm::opt::ArgStringList &CmdArgs);
68
69void linkXRayRuntimeDeps(const ToolChain &TC, const llvm::opt::ArgList &Args,
70 llvm::opt::ArgStringList &CmdArgs);
71
72void AddRunTimeLibs(const ToolChain &TC, const Driver &D,
73 llvm::opt::ArgStringList &CmdArgs,
74 const llvm::opt::ArgList &Args);
75
77 const JobAction &JA,
78 const InputInfoList &Inputs,
79 const llvm::opt::ArgList &DriverArgs,
80 llvm::opt::ArgStringList &CmdArgs,
81 StringRef Arch, StringRef Target,
82 bool isBitCodeSDL);
83void AddStaticDeviceLibs(Compilation *C, const Tool *T, const JobAction *JA,
84 const InputInfoList *Inputs, const Driver &D,
85 const llvm::opt::ArgList &DriverArgs,
86 llvm::opt::ArgStringList &CmdArgs, StringRef Arch,
87 StringRef Target, bool isBitCodeSDL);
88
89const char *SplitDebugName(const JobAction &JA, const llvm::opt::ArgList &Args,
90 const InputInfo &Input, const InputInfo &Output);
91
92void SplitDebugInfo(const ToolChain &TC, Compilation &C, const Tool &T,
93 const JobAction &JA, const llvm::opt::ArgList &Args,
94 const InputInfo &Output, const char *OutFile);
95
96void addDTLTOOptions(const ToolChain &ToolChain, const llvm::opt::ArgList &Args,
97 llvm::opt::ArgStringList &CmdArgs);
98
99void addLTOOptions(const ToolChain &ToolChain, const llvm::opt::ArgList &Args,
100 llvm::opt::ArgStringList &CmdArgs, const InputInfo &Output,
101 const InputInfoList &Inputs, bool IsThinLTO);
102
103const char *RelocationModelName(llvm::Reloc::Model Model);
104
105std::tuple<llvm::Reloc::Model, unsigned, bool>
106ParsePICArgs(const ToolChain &ToolChain, const llvm::opt::ArgList &Args);
107
108bool getStaticPIE(const llvm::opt::ArgList &Args, const ToolChain &TC);
109
111 const llvm::opt::ArgList &Args);
112
113void addDebugInfoKind(llvm::opt::ArgStringList &CmdArgs,
114 llvm::codegenoptions::DebugInfoKind DebugInfoKind);
115
116llvm::codegenoptions::DebugInfoKind
117debugLevelToInfoKind(const llvm::opt::Arg &A);
118
119// Extract the integer N from a string spelled "-dwarf-N", returning 0
120// on mismatch. The StringRef input (rather than an Arg) allows
121// for use by the "-Xassembler" option parser.
122unsigned DwarfVersionNum(StringRef ArgValue);
123// Find a DWARF format version option.
124// This function is a complementary for DwarfVersionNum().
125const llvm::opt::Arg *getDwarfNArg(const llvm::opt::ArgList &Args);
126unsigned getDwarfVersion(const ToolChain &TC, const llvm::opt::ArgList &Args);
127
129
131 const llvm::opt::ArgList &Args,
132 llvm::opt::Arg *&Arg);
133
134bool checkDebugInfoOption(const llvm::opt::Arg *A,
135 const llvm::opt::ArgList &Args, const Driver &D,
136 const ToolChain &TC);
137
139 const llvm::opt::ArgList &Args,
140 llvm::opt::ArgStringList &CmdArgs);
141
143 const llvm::opt::ArgList &Args,
144 llvm::opt::ArgStringList &CmdArgs);
145
146void addArchSpecificRPath(const ToolChain &TC, const llvm::opt::ArgList &Args,
147 llvm::opt::ArgStringList &CmdArgs);
149 const llvm::opt::ArgList &Args,
150 llvm::opt::ArgStringList &CmdArgs);
151
153 llvm::opt::ArgStringList &CmdArgs,
154 const ToolChain &TC,
155 const llvm::opt::ArgList &Args);
156
157/// Returns true, if an OpenMP runtime has been added.
158bool addOpenMPRuntime(const Compilation &C, llvm::opt::ArgStringList &CmdArgs,
159 const ToolChain &TC, const llvm::opt::ArgList &Args,
160 bool ForceStaticHostRuntime = false,
161 bool IsOffloadingHost = false, bool GompNeedsRT = false);
162
163/// Adds offloading options for OpenMP host compilation to \p CmdArgs.
165 const llvm::opt::ArgList &Args,
166 llvm::opt::ArgStringList &CmdArgs);
167
169 const llvm::opt::ArgList &Args,
170 llvm::opt::ArgStringList &CmdArgs);
171
172void addAsNeededOption(const ToolChain &TC, const llvm::opt::ArgList &Args,
173 llvm::opt::ArgStringList &CmdArgs, bool as_needed);
174
175llvm::opt::Arg *getLastCSProfileGenerateArg(const llvm::opt::ArgList &Args);
176llvm::opt::Arg *getLastProfileUseArg(const llvm::opt::ArgList &Args);
177llvm::opt::Arg *getLastProfileSampleUseArg(const llvm::opt::ArgList &Args);
178
179bool isObjCAutoRefCount(const llvm::opt::ArgList &Args);
180
181llvm::StringRef getLTOParallelism(const llvm::opt::ArgList &Args,
182 const Driver &D);
183
184bool areOptimizationsEnabled(const llvm::opt::ArgList &Args);
185
186bool isUseSeparateSections(const llvm::Triple &Triple);
187/// Append -ffunction-sections / -fdata-sections to \p CmdArgs when the
188/// corresponding flags are enabled (explicitly or by target default).
189void addSeparateSectionFlags(const llvm::Triple &Triple,
190 const llvm::opt::ArgList &Args,
191 llvm::opt::ArgStringList &CmdArgs);
192// Parse -mtls-dialect=. Return true if the target supports both general-dynamic
193// and TLSDESC, and TLSDESC is requested.
194bool isTLSDESCEnabled(const ToolChain &TC, const llvm::opt::ArgList &Args);
195
196/// \p EnvVar is split by system delimiter for environment variables.
197/// If \p ArgName is "-I", "-L", or an empty string, each entry from \p EnvVar
198/// is prefixed by \p ArgName then added to \p Args. Otherwise, for each
199/// entry of \p EnvVar, \p ArgName is added to \p Args first, then the entry
200/// itself is added.
201void addDirectoryList(const llvm::opt::ArgList &Args,
202 llvm::opt::ArgStringList &CmdArgs, const char *ArgName,
203 const char *EnvVar);
204
205void AddTargetFeature(const llvm::opt::ArgList &Args,
206 std::vector<StringRef> &Features,
207 llvm::opt::OptSpecifier OnOpt,
208 llvm::opt::OptSpecifier OffOpt, StringRef FeatureName);
209
210std::string getCPUName(const Driver &D, const llvm::opt::ArgList &Args,
211 const llvm::Triple &T, bool FromAs = false);
212
213void getTargetFeatures(const Driver &D, const llvm::Triple &Triple,
214 const llvm::opt::ArgList &Args,
215 llvm::opt::ArgStringList &CmdArgs, bool ForAS,
216 bool IsAux = false);
217
218/// Iterate \p Args and convert -mxxx to +xxx and -mno-xxx to -xxx and
219/// append it to \p Features.
220///
221/// Note: Since \p Features may contain default values before calling
222/// this function, or may be appended with entries to override arguments,
223/// entries in \p Features are not unique.
224void handleTargetFeaturesGroup(const Driver &D, const llvm::Triple &Triple,
225 const llvm::opt::ArgList &Args,
226 std::vector<StringRef> &Features,
227 llvm::opt::OptSpecifier Group);
228
229/// If there are multiple +xxx or -xxx features, keep the last one.
231
232/// Handles the -save-stats option and returns the filename to save statistics
233/// to.
234SmallString<128> getStatsFileName(const llvm::opt::ArgList &Args,
235 const InputInfo &Output,
236 const InputInfo &Input, const Driver &D);
237
238/// \p Flag must be a flag accepted by the driver.
239void addMultilibFlag(bool Enabled, const StringRef Flag,
240 Multilib::flags_list &Flags);
241
242void addX86AlignBranchArgs(const Driver &D, const llvm::opt::ArgList &Args,
243 llvm::opt::ArgStringList &CmdArgs, bool IsLTO,
244 const StringRef PluginOptPrefix = "");
245
247 const llvm::opt::ArgList &Args);
248
249unsigned getAMDGPUCodeObjectVersion(const Driver &D,
250 const llvm::opt::ArgList &Args);
251
253 const llvm::opt::ArgList &Args);
254
255void addMachineOutlinerArgs(const Driver &D, const llvm::opt::ArgList &Args,
256 llvm::opt::ArgStringList &CmdArgs,
257 const llvm::Triple &Triple, bool IsLTO,
258 const StringRef PluginOptPrefix = "");
259
260void addOpenMPDeviceRTL(const Driver &D, const llvm::opt::ArgList &DriverArgs,
261 llvm::opt::ArgStringList &CC1Args,
262 StringRef BitcodeSuffix, const llvm::Triple &Triple,
263 const ToolChain &HostTC);
264
265/// Try to link libclc, depending on the target ABI and command line
266/// arguments.
267///
268/// \return true if libclc should be linked for the compile.
269bool addOpenCLBuiltinsLib(const Driver &D, const llvm::Triple &TT,
270 const llvm::opt::ArgList &DriverArgs,
271 llvm::opt::ArgStringList &CC1Args);
272
273void addOutlineAtomicsArgs(const Driver &D, const ToolChain &TC,
274 const llvm::opt::ArgList &Args,
275 llvm::opt::ArgStringList &CmdArgs,
276 const llvm::Triple &Triple);
277void addOffloadCompressArgs(const llvm::opt::ArgList &TCArgs,
278 llvm::opt::ArgStringList &CmdArgs);
279void addMCModel(const Driver &D, const llvm::opt::ArgList &Args,
280 const llvm::Triple &Triple,
281 const llvm::Reloc::Model &RelocationModel,
282 llvm::opt::ArgStringList &CmdArgs);
283
284/// Handle the -f{no}-color-diagnostics and -f{no}-diagnostics-colors options.
285void handleColorDiagnosticsArgs(const Driver &D, const llvm::opt::ArgList &Args,
286 llvm::opt::ArgStringList &CmdArgs);
287
288/// Add backslashes to escape spaces and other backslashes.
289/// This is used for the space-separated argument list specified with
290/// the -dwarf-debug-flags option.
291void escapeSpacesAndBackslashes(const char *Arg,
293
294/// Join the args in the given ArgList, escape spaces and backslashes and
295/// return the joined string. This is used when saving the command line as a
296/// result of using either the -frecord-command-line or -grecord-command-line
297/// options. The lifetime of the returned c-string will match that of the Args
298/// argument.
299const char *renderEscapedCommandLine(const ToolChain &TC,
300 const llvm::opt::ArgList &Args);
301
302/// Check if the command line should be recorded in the object file. This is
303/// done if either -frecord-command-line or -grecord-command-line options have
304/// been passed. This also does some error checking since -frecord-command-line
305/// is currently only supported on ELF platforms. The last two boolean
306/// arguments are out parameters and will be set depending on the command
307/// line options that were passed.
309 const llvm::opt::ArgList &Args,
310 bool &FRecordCommandLine, bool &GRecordCommandLine,
311 bool &DXRecordCommandLine);
312
313void renderGlobalISelOptions(const Driver &D, const llvm::opt::ArgList &Args,
314 llvm::opt::ArgStringList &CmdArgs,
315 const llvm::Triple &Triple);
316
317void renderCommonIntegerOverflowOptions(const llvm::opt::ArgList &Args,
318 llvm::opt::ArgStringList &CmdArgs,
319 bool IsMSVCCompat);
320
321bool shouldEnableVectorizerAtOLevel(const llvm::opt::ArgList &Args,
322 bool isSlpVec);
323
324/// Enable -floop-interchange based on the optimization level selected.
325void handleInterchangeLoopsArgs(const llvm::opt::ArgList &Args,
326 llvm::opt::ArgStringList &CmdArgs);
327
328/// Enable -fvectorize based on the optimization level selected.
329void handleVectorizeLoopsArgs(const llvm::opt::ArgList &Args,
330 llvm::opt::ArgStringList &CmdArgs);
331
332/// Enable -fslp-vectorize based on the optimization level selected.
333void handleVectorizeSLPArgs(const llvm::opt::ArgList &Args,
334 llvm::opt::ArgStringList &CmdArgs);
335
336// Convert ComplexRangeKind to a string that can be passed as a frontend option.
338
339// Render a frontend option corresponding to ComplexRangeKind.
341
342// Set the complex range and output a warning as needed.
343void setComplexRange(const Driver &D, StringRef NewOpt,
344 LangOptions::ComplexRangeKind NewRange, StringRef &LastOpt,
346
347// This function expects that the inputs to llvm-link will be specified by the
348// caller, but the output is handled by this function, with the optional ability
349// to set the output filename.
351 const JobAction &JA,
352 const InputInfoList &JobInputs,
353 const llvm::opt::ArgStringList &LinkerInputs,
354 const InputInfo &Output,
355 const llvm::opt::ArgList &Args,
356 const char *OutputFilename = nullptr);
357
358} // end namespace tools
359} // end namespace driver
360} // end namespace clang
361
363getFramePointerKind(const llvm::opt::ArgList &Args, const llvm::Triple &Triple);
364
365#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_COMMONARGS_H
clang::CodeGenOptions::FramePointerKind getFramePointerKind(const llvm::opt::ArgList &Args, const llvm::Triple &Triple)
ComplexRangeKind
Controls the various implementations for complex multiplication and.
Compilation - A set of tasks to perform for a single driver invocation.
Definition Compilation.h:46
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition Driver.h:95
InputInfo - Wrapper for information about an input source.
Definition InputInfo.h:22
std::vector< std::string > flags_list
Definition Multilib.h:37
ToolChain - Access to tools for a single platform.
Definition ToolChain.h:96
SmallVector< std::string, 16 > path_list
Definition ToolChain.h:98
Tool - Information on a specific compilation tool.
Definition Tool.h:32
void AddStaticDeviceLibs(Compilation *C, const Tool *T, const JobAction *JA, const InputInfoList *Inputs, const Driver &D, const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CmdArgs, StringRef Arch, StringRef Target, bool isBitCodeSDL)
void addX86AlignBranchArgs(const Driver &D, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, bool IsLTO, const StringRef PluginOptPrefix="")
void addMachineOutlinerArgs(const Driver &D, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const llvm::Triple &Triple, bool IsLTO, const StringRef PluginOptPrefix="")
unsigned ParseFunctionAlignment(const ToolChain &TC, const llvm::opt::ArgList &Args)
void addOffloadCompressArgs(const llvm::opt::ArgList &TCArgs, llvm::opt::ArgStringList &CmdArgs)
void handleTargetFeaturesGroup(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args, std::vector< StringRef > &Features, llvm::opt::OptSpecifier Group)
Iterate Args and convert -mxxx to +xxx and -mno-xxx to -xxx and append it to Features.
void addMCModel(const Driver &D, const llvm::opt::ArgList &Args, const llvm::Triple &Triple, const llvm::Reloc::Model &RelocationModel, llvm::opt::ArgStringList &CmdArgs)
SmallVector< StringRef > unifyTargetFeatures(ArrayRef< StringRef > Features)
If there are multiple +xxx or -xxx features, keep the last one.
llvm::opt::Arg * getLastProfileSampleUseArg(const llvm::opt::ArgList &Args)
void handleVectorizeSLPArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
Enable -fslp-vectorize based on the optimization level selected.
void addOpenMPDeviceRTL(const Driver &D, const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, StringRef BitcodeSuffix, const llvm::Triple &Triple, const ToolChain &HostTC)
OffloadJobsOpt parseOffloadJobs(const llvm::opt::ArgList &Args)
const char * SplitDebugName(const JobAction &JA, const llvm::opt::ArgList &Args, const InputInfo &Input, const InputInfo &Output)
void addOutlineAtomicsArgs(const Driver &D, const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const llvm::Triple &Triple)
void checkAMDGPUCodeObjectVersion(const Driver &D, const llvm::opt::ArgList &Args)
void getTargetFeatures(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, bool ForAS, bool IsAux=false)
void renderDebugInfoCompressionArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const Driver &D, const ToolChain &TC)
void AddStaticDeviceLibsLinking(Compilation &C, const Tool &T, const JobAction &JA, const InputInfoList &Inputs, const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CmdArgs, StringRef Arch, StringRef Target, bool isBitCodeSDL)
std::string complexRangeKindToStr(LangOptions::ComplexRangeKind Range)
void addAsNeededOption(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, bool as_needed)
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.
bool getStaticPIE(const llvm::opt::ArgList &Args, const ToolChain &TC)
std::string getCPUName(const Driver &D, const llvm::opt::ArgList &Args, const llvm::Triple &T, bool FromAs=false)
void addHIPRuntimeLibArgs(const ToolChain &TC, Compilation &C, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
void addLTOOptions(const ToolChain &ToolChain, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const InputInfo &Output, const InputInfoList &Inputs, bool IsThinLTO)
void addMultilibFlag(bool Enabled, const StringRef Flag, Multilib::flags_list &Flags)
Flag must be a flag accepted by the driver.
bool isUseSeparateSections(const llvm::Triple &Triple)
void linkXRayRuntimeDeps(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
void AddRunTimeLibs(const ToolChain &TC, const Driver &D, llvm::opt::ArgStringList &CmdArgs, const llvm::opt::ArgList &Args)
void SplitDebugInfo(const ToolChain &TC, Compilation &C, const Tool &T, const JobAction &JA, const llvm::opt::ArgList &Args, const InputInfo &Output, const char *OutFile)
void linkSanitizerRuntimeDeps(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
void addDirectoryList(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const char *ArgName, const char *EnvVar)
EnvVar is split by system delimiter for environment variables.
bool addLLVMOffloadingRuntime(const Compilation &C, llvm::opt::ArgStringList &CmdArgs, const ToolChain &TC, const llvm::opt::ArgList &Args)
bool addSanitizerRuntimes(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
bool areOptimizationsEnabled(const llvm::opt::ArgList &Args)
void addOpenMPRuntimeLibraryPath(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
void setComplexRange(const Driver &D, StringRef NewOpt, LangOptions::ComplexRangeKind NewRange, StringRef &LastOpt, LangOptions::ComplexRangeKind &Range)
bool addXRayRuntime(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
void AddAssemblerKPIC(const ToolChain &ToolChain, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
bool haveAMDGPUCodeObjectVersionArgument(const Driver &D, const llvm::opt::ArgList &Args)
bool isTLSDESCEnabled(const ToolChain &TC, const llvm::opt::ArgList &Args)
void addDebugInfoForProfilingArgs(const Driver &D, const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
void addDebugInfoKind(llvm::opt::ArgStringList &CmdArgs, llvm::codegenoptions::DebugInfoKind DebugInfoKind)
void addPathIfExists(const Driver &D, const Twine &Path, ToolChain::path_list &Paths)
llvm::codegenoptions::DebugInfoKind debugLevelToInfoKind(const llvm::opt::Arg &A)
llvm::opt::Arg * getLastCSProfileGenerateArg(const llvm::opt::ArgList &Args)
void renderGlobalISelOptions(const Driver &D, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const llvm::Triple &Triple)
llvm::opt::Arg * getLastProfileUseArg(const llvm::opt::ArgList &Args)
void addDTLTOOptions(const ToolChain &ToolChain, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
std::string renderComplexRangeOption(LangOptions::ComplexRangeKind Range)
DwarfFissionKind getDebugFissionKind(const Driver &D, const llvm::opt::ArgList &Args, llvm::opt::Arg *&Arg)
llvm::StringRef getLTOParallelism(const llvm::opt::ArgList &Args, const Driver &D)
void addLinkerCompressDebugSectionsOption(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
void constructLLVMLinkCommand(Compilation &C, const Tool &T, const JobAction &JA, const InputInfoList &JobInputs, const llvm::opt::ArgStringList &LinkerInputs, const InputInfo &Output, const llvm::opt::ArgList &Args, const char *OutputFilename=nullptr)
void handleInterchangeLoopsArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
Enable -floop-interchange based on the optimization level selected.
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, bool IsMSVCCompat)
bool addOpenMPRuntime(const Compilation &C, llvm::opt::ArgStringList &CmdArgs, const ToolChain &TC, const llvm::opt::ArgList &Args, bool ForceStaticHostRuntime=false, bool IsOffloadingHost=false, bool GompNeedsRT=false)
Returns true, if an OpenMP runtime has been added.
bool checkDebugInfoOption(const llvm::opt::Arg *A, const llvm::opt::ArgList &Args, const Driver &D, const ToolChain &TC)
std::tuple< llvm::Reloc::Model, unsigned, bool > ParsePICArgs(const ToolChain &ToolChain, const llvm::opt::ArgList &Args)
void claimNoWarnArgs(const llvm::opt::ArgList &Args)
unsigned DwarfVersionNum(StringRef ArgValue)
void AddLinkerInputs(const ToolChain &TC, const InputInfoList &Inputs, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const JobAction &JA)
unsigned getDwarfVersion(const ToolChain &TC, const llvm::opt::ArgList &Args)
bool shouldRecordCommandLine(const ToolChain &TC, const llvm::opt::ArgList &Args, bool &FRecordCommandLine, bool &GRecordCommandLine, bool &DXRecordCommandLine)
Check if the command line should be recorded in the object file.
unsigned getAMDGPUCodeObjectVersion(const Driver &D, const llvm::opt::ArgList &Args)
const llvm::opt::Arg * getDwarfNArg(const llvm::opt::ArgList &Args)
void AddTargetFeature(const llvm::opt::ArgList &Args, std::vector< StringRef > &Features, llvm::opt::OptSpecifier OnOpt, llvm::opt::OptSpecifier OffOpt, StringRef FeatureName)
SmallString< 128 > getStatsFileName(const llvm::opt::ArgList &Args, const InputInfo &Output, const InputInfo &Input, const Driver &D)
Handles the -save-stats option and returns the filename to save statistics to.
void addArchSpecificRPath(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
void addSeparateSectionFlags(const llvm::Triple &Triple, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
Append -ffunction-sections / -fdata-sections to CmdArgs when the corresponding flags are enabled (exp...
void handleVectorizeLoopsArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
Enable -fvectorize based on the optimization level selected.
void escapeSpacesAndBackslashes(const char *Arg, llvm::SmallVectorImpl< char > &Res)
Add backslashes to escape spaces and other backslashes.
bool addOpenCLBuiltinsLib(const Driver &D, const llvm::Triple &TT, const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args)
Try to link libclc, depending on the target ABI and command line arguments.
const char * getLDMOption(const llvm::Triple &T, const llvm::opt::ArgList &Args)
bool isObjCAutoRefCount(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.
bool shouldEnableVectorizerAtOLevel(const llvm::opt::ArgList &Args, bool isSlpVec)
SmallVector< InputInfo, 4 > InputInfoList
Definition Driver.h:51
Top level wrappers for InstallAPI frontend operations.
const FunctionProtoType * T