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
76const char *SplitDebugName(const JobAction &JA, const llvm::opt::ArgList &Args,
77 const InputInfo &Input, const InputInfo &Output);
78
79void SplitDebugInfo(const ToolChain &TC, Compilation &C, const Tool &T,
80 const JobAction &JA, const llvm::opt::ArgList &Args,
81 const InputInfo &Output, const char *OutFile);
82
83void addDTLTOOptions(const ToolChain &ToolChain, const llvm::opt::ArgList &Args,
84 llvm::opt::ArgStringList &CmdArgs);
85
86void addLTOOptions(const ToolChain &ToolChain, const llvm::opt::ArgList &Args,
87 llvm::opt::ArgStringList &CmdArgs, const InputInfo &Output,
88 const InputInfoList &Inputs, bool IsThinLTO);
89
90const char *RelocationModelName(llvm::Reloc::Model Model);
91
92std::tuple<llvm::Reloc::Model, unsigned, bool>
93ParsePICArgs(const ToolChain &ToolChain, const llvm::opt::ArgList &Args);
94
95bool getStaticPIE(const llvm::opt::ArgList &Args, const ToolChain &TC);
96
98 const llvm::opt::ArgList &Args);
99
100void addDebugInfoKind(llvm::opt::ArgStringList &CmdArgs,
101 llvm::codegenoptions::DebugInfoKind DebugInfoKind);
102
103llvm::codegenoptions::DebugInfoKind
104debugLevelToInfoKind(const llvm::opt::Arg &A);
105
106// Extract the integer N from a string spelled "-dwarf-N", returning 0
107// on mismatch. The StringRef input (rather than an Arg) allows
108// for use by the "-Xassembler" option parser.
109unsigned DwarfVersionNum(StringRef ArgValue);
110// Find a DWARF format version option.
111// This function is a complementary for DwarfVersionNum().
112const llvm::opt::Arg *getDwarfNArg(const llvm::opt::ArgList &Args);
113unsigned getDwarfVersion(const ToolChain &TC, const llvm::opt::ArgList &Args);
114
116
118 const llvm::opt::ArgList &Args,
119 llvm::opt::Arg *&Arg);
120
121bool checkDebugInfoOption(const llvm::opt::Arg *A,
122 const llvm::opt::ArgList &Args, const Driver &D,
123 const ToolChain &TC);
124
126 const llvm::opt::ArgList &Args,
127 llvm::opt::ArgStringList &CmdArgs);
128
130 const llvm::opt::ArgList &Args,
131 llvm::opt::ArgStringList &CmdArgs);
132
133void addArchSpecificRPath(const ToolChain &TC, const llvm::opt::ArgList &Args,
134 llvm::opt::ArgStringList &CmdArgs);
136 const llvm::opt::ArgList &Args,
137 llvm::opt::ArgStringList &CmdArgs);
138
140 llvm::opt::ArgStringList &CmdArgs,
141 const ToolChain &TC,
142 const llvm::opt::ArgList &Args);
143
144/// Returns true, if an OpenMP runtime has been added.
145bool addOpenMPRuntime(const Compilation &C, llvm::opt::ArgStringList &CmdArgs,
146 const ToolChain &TC, const llvm::opt::ArgList &Args,
147 bool ForceStaticHostRuntime = false,
148 bool IsOffloadingHost = false, bool GompNeedsRT = false);
149
150/// Adds offloading options for OpenMP host compilation to \p CmdArgs.
152 const llvm::opt::ArgList &Args,
153 llvm::opt::ArgStringList &CmdArgs);
154
156 const llvm::opt::ArgList &Args,
157 llvm::opt::ArgStringList &CmdArgs);
158
159void addAsNeededOption(const ToolChain &TC, const llvm::opt::ArgList &Args,
160 llvm::opt::ArgStringList &CmdArgs, bool as_needed);
161
162llvm::opt::Arg *getLastCSProfileGenerateArg(const llvm::opt::ArgList &Args);
163llvm::opt::Arg *getLastProfileUseArg(const llvm::opt::ArgList &Args);
164llvm::opt::Arg *getLastProfileSampleUseArg(const llvm::opt::ArgList &Args);
165
166bool isObjCAutoRefCount(const llvm::opt::ArgList &Args);
167
168llvm::StringRef getLTOParallelism(const llvm::opt::ArgList &Args,
169 const Driver &D);
170
171bool areOptimizationsEnabled(const llvm::opt::ArgList &Args);
172
173bool isUseSeparateSections(const llvm::Triple &Triple);
174/// Append -ffunction-sections / -fdata-sections to \p CmdArgs when the
175/// corresponding flags are enabled (explicitly or by target default).
176void addSeparateSectionFlags(const llvm::Triple &Triple,
177 const llvm::opt::ArgList &Args,
178 llvm::opt::ArgStringList &CmdArgs);
179// Parse -mtls-dialect=. Return true if the target supports both general-dynamic
180// and TLSDESC, and TLSDESC is requested.
181bool isTLSDESCEnabled(const ToolChain &TC, const llvm::opt::ArgList &Args);
182
183/// \p EnvVar is split by system delimiter for environment variables.
184/// If \p ArgName is "-I", "-L", or an empty string, each entry from \p EnvVar
185/// is prefixed by \p ArgName then added to \p Args. Otherwise, for each
186/// entry of \p EnvVar, \p ArgName is added to \p Args first, then the entry
187/// itself is added.
188void addDirectoryList(const llvm::opt::ArgList &Args,
189 llvm::opt::ArgStringList &CmdArgs, const char *ArgName,
190 const char *EnvVar);
191
192void AddTargetFeature(const llvm::opt::ArgList &Args,
193 std::vector<StringRef> &Features,
194 llvm::opt::OptSpecifier OnOpt,
195 llvm::opt::OptSpecifier OffOpt, StringRef FeatureName);
196
197std::string getCPUName(const Driver &D, const llvm::opt::ArgList &Args,
198 const llvm::Triple &T, bool FromAs = false);
199
200void getTargetFeatures(const Driver &D, const llvm::Triple &Triple,
201 const llvm::opt::ArgList &Args,
202 llvm::opt::ArgStringList &CmdArgs, bool ForAS,
203 bool IsAux = false);
204
205/// Iterate \p Args and convert -mxxx to +xxx and -mno-xxx to -xxx and
206/// append it to \p Features.
207///
208/// Note: Since \p Features may contain default values before calling
209/// this function, or may be appended with entries to override arguments,
210/// entries in \p Features are not unique.
211void handleTargetFeaturesGroup(const Driver &D, const llvm::Triple &Triple,
212 const llvm::opt::ArgList &Args,
213 std::vector<StringRef> &Features,
214 llvm::opt::OptSpecifier Group);
215
216/// If there are multiple +xxx or -xxx features, keep the last one.
218
219/// Handles the -save-stats option and returns the filename to save statistics
220/// to.
221SmallString<128> getStatsFileName(const llvm::opt::ArgList &Args,
222 const InputInfo &Output,
223 const InputInfo &Input, const Driver &D);
224
225/// \p Flag must be a flag accepted by the driver.
226void addMultilibFlag(bool Enabled, const StringRef Flag,
227 Multilib::flags_list &Flags);
228
229void addX86AlignBranchArgs(const Driver &D, const llvm::opt::ArgList &Args,
230 llvm::opt::ArgStringList &CmdArgs, bool IsLTO,
231 const StringRef PluginOptPrefix = "");
232
234 const llvm::opt::ArgList &Args);
235
236unsigned getAMDGPUCodeObjectVersion(const Driver &D,
237 const llvm::opt::ArgList &Args);
238
240 const llvm::opt::ArgList &Args);
241
242void addMachineOutlinerArgs(const Driver &D, const llvm::opt::ArgList &Args,
243 llvm::opt::ArgStringList &CmdArgs,
244 const llvm::Triple &Triple, bool IsLTO,
245 const StringRef PluginOptPrefix = "");
246
248 const llvm::opt::ArgList &Args,
249 llvm::opt::ArgStringList &CmdArgs,
250 const llvm::Triple &Triple);
251
252void addOpenMPDeviceRTL(const Driver &D, const llvm::opt::ArgList &DriverArgs,
253 llvm::opt::ArgStringList &CC1Args,
254 StringRef BitcodeSuffix, const llvm::Triple &Triple,
255 const ToolChain &HostTC);
256
257/// Try to link libclc, depending on the target ABI and command line
258/// arguments.
259///
260/// \return true if libclc should be linked for the compile.
261bool addOpenCLBuiltinsLib(const Driver &D, const llvm::Triple &TT,
262 const llvm::opt::ArgList &DriverArgs,
263 llvm::opt::ArgStringList &CC1Args);
264
265void addOutlineAtomicsArgs(const Driver &D, const ToolChain &TC,
266 const llvm::opt::ArgList &Args,
267 llvm::opt::ArgStringList &CmdArgs,
268 const llvm::Triple &Triple);
269void addOffloadCompressArgs(const llvm::opt::ArgList &TCArgs,
270 llvm::opt::ArgStringList &CmdArgs);
271void addMCModel(const Driver &D, const llvm::opt::ArgList &Args,
272 const llvm::Triple &Triple,
273 const llvm::Reloc::Model &RelocationModel,
274 llvm::opt::ArgStringList &CmdArgs);
275
276/// Handle the -f{no}-color-diagnostics and -f{no}-diagnostics-colors options.
277void handleColorDiagnosticsArgs(const Driver &D, const llvm::opt::ArgList &Args,
278 llvm::opt::ArgStringList &CmdArgs);
279
280/// Add backslashes to escape spaces and other backslashes.
281/// This is used for the space-separated argument list specified with
282/// the -dwarf-debug-flags option.
283void escapeSpacesAndBackslashes(const char *Arg,
285
286/// Join the args in the given ArgList, escape spaces and backslashes and
287/// return the joined string. This is used when saving the command line as a
288/// result of using either the -frecord-command-line or -grecord-command-line
289/// options. The lifetime of the returned c-string will match that of the Args
290/// argument.
291const char *renderEscapedCommandLine(const ToolChain &TC,
292 const llvm::opt::ArgList &Args);
293
294/// Check if the command line should be recorded in the object file. This is
295/// done if either -frecord-command-line or -grecord-command-line options have
296/// been passed. This also does some error checking since -frecord-command-line
297/// is currently only supported on ELF platforms. The last two boolean
298/// arguments are out parameters and will be set depending on the command
299/// line options that were passed.
301 const llvm::opt::ArgList &Args,
302 bool &FRecordCommandLine, bool &GRecordCommandLine,
303 bool &DXRecordCommandLine);
304
305void renderGlobalISelOptions(const Driver &D, const llvm::opt::ArgList &Args,
306 llvm::opt::ArgStringList &CmdArgs,
307 const llvm::Triple &Triple);
308
309void renderCommonIntegerOverflowOptions(const llvm::opt::ArgList &Args,
310 llvm::opt::ArgStringList &CmdArgs,
311 bool IsMSVCCompat);
312
313bool shouldEnableVectorizerAtOLevel(const llvm::opt::ArgList &Args,
314 bool isSlpVec);
315
316/// Enable -floop-interchange based on the optimization level selected.
317void handleInterchangeLoopsArgs(const llvm::opt::ArgList &Args,
318 llvm::opt::ArgStringList &CmdArgs);
319
320/// Enable -fvectorize based on the optimization level selected.
321void handleVectorizeLoopsArgs(const llvm::opt::ArgList &Args,
322 llvm::opt::ArgStringList &CmdArgs);
323
324/// Enable -fslp-vectorize based on the optimization level selected.
325void handleVectorizeSLPArgs(const llvm::opt::ArgList &Args,
326 llvm::opt::ArgStringList &CmdArgs);
327
328// Convert ComplexRangeKind to a string that can be passed as a frontend option.
330
331// Render a frontend option corresponding to ComplexRangeKind.
333
334// Set the complex range and output a warning as needed.
335void setComplexRange(const Driver &D, StringRef NewOpt,
336 LangOptions::ComplexRangeKind NewRange, StringRef &LastOpt,
338
339// This function expects that the inputs to llvm-link will be specified by the
340// caller, but the output is handled by this function, with the optional ability
341// to set the output filename.
343 const JobAction &JA,
344 const InputInfoList &JobInputs,
345 const llvm::opt::ArgStringList &LinkerInputs,
346 const InputInfo &Output,
347 const llvm::opt::ArgList &Args,
348 const char *OutputFilename = nullptr);
349
350} // end namespace tools
351} // end namespace driver
352} // end namespace clang
353
355getFramePointerKind(const llvm::opt::ArgList &Args, const llvm::Triple &Triple);
356
357#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:96
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 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)
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)
void addSplitMachineFunctionsArgs(const Driver &D, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const llvm::Triple &Triple)
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:52
Top level wrappers for InstallAPI frontend operations.
const FunctionProtoType * T