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, Compilation &C);
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
155void addAsNeededOption(const ToolChain &TC, const llvm::opt::ArgList &Args,
156 llvm::opt::ArgStringList &CmdArgs, bool as_needed);
157
158llvm::opt::Arg *getLastCSProfileGenerateArg(const llvm::opt::ArgList &Args);
159llvm::opt::Arg *getLastProfileUseArg(const llvm::opt::ArgList &Args);
160llvm::opt::Arg *getLastProfileSampleUseArg(const llvm::opt::ArgList &Args);
161
162bool isObjCAutoRefCount(const llvm::opt::ArgList &Args);
163
164llvm::StringRef getLTOParallelism(const llvm::opt::ArgList &Args,
165 const Driver &D);
166
167bool areOptimizationsEnabled(const llvm::opt::ArgList &Args);
168
169bool isUseSeparateSections(const llvm::Triple &Triple);
170/// Append -ffunction-sections / -fdata-sections to \p CmdArgs when the
171/// corresponding flags are enabled (explicitly or by target default).
172void addSeparateSectionFlags(const llvm::Triple &Triple,
173 const llvm::opt::ArgList &Args,
174 llvm::opt::ArgStringList &CmdArgs);
175// Parse -mtls-dialect=. Return true if the target supports both general-dynamic
176// and TLSDESC, and TLSDESC is requested.
177bool isTLSDESCEnabled(const ToolChain &TC, const llvm::opt::ArgList &Args);
178
179/// \p EnvVar is split by system delimiter for environment variables.
180/// If \p ArgName is "-I", "-L", or an empty string, each entry from \p EnvVar
181/// is prefixed by \p ArgName then added to \p Args. Otherwise, for each
182/// entry of \p EnvVar, \p ArgName is added to \p Args first, then the entry
183/// itself is added.
184void addDirectoryList(const llvm::opt::ArgList &Args,
185 llvm::opt::ArgStringList &CmdArgs, const char *ArgName,
186 const char *EnvVar);
187
188void AddTargetFeature(const llvm::opt::ArgList &Args,
189 std::vector<StringRef> &Features,
190 llvm::opt::OptSpecifier OnOpt,
191 llvm::opt::OptSpecifier OffOpt, StringRef FeatureName);
192
193std::string getCPUName(const Driver &D, const llvm::opt::ArgList &Args,
194 const llvm::Triple &T, bool FromAs = false);
195
196void getTargetFeatures(const Driver &D, const llvm::Triple &Triple,
197 const llvm::opt::ArgList &Args,
198 llvm::opt::ArgStringList &CmdArgs, bool ForAS,
199 bool IsAux = false);
200
201/// Iterate \p Args and convert -mxxx to +xxx and -mno-xxx to -xxx and
202/// append it to \p Features.
203///
204/// Note: Since \p Features may contain default values before calling
205/// this function, or may be appended with entries to override arguments,
206/// entries in \p Features are not unique.
207void handleTargetFeaturesGroup(const Driver &D, const llvm::Triple &Triple,
208 const llvm::opt::ArgList &Args,
209 std::vector<StringRef> &Features,
210 llvm::opt::OptSpecifier Group);
211
212/// If there are multiple +xxx or -xxx features, keep the last one.
214
215/// Handles the -save-stats option and returns the filename to save statistics
216/// to.
217SmallString<128> getStatsFileName(const llvm::opt::ArgList &Args,
218 const InputInfo &Output,
219 const InputInfo &Input, const Driver &D);
220
221/// \p Flag must be a flag accepted by the driver.
222void addMultilibFlag(bool Enabled, const StringRef Flag,
223 Multilib::flags_list &Flags);
224
225void addX86AlignBranchArgs(const Driver &D, const llvm::opt::ArgList &Args,
226 llvm::opt::ArgStringList &CmdArgs, bool IsLTO,
227 const StringRef PluginOptPrefix = "");
228
230 const llvm::opt::ArgList &Args);
231
232unsigned getAMDGPUCodeObjectVersion(const Driver &D,
233 const llvm::opt::ArgList &Args);
234
236 const llvm::opt::ArgList &Args);
237
238void addMachineOutlinerArgs(const Driver &D, const llvm::opt::ArgList &Args,
239 llvm::opt::ArgStringList &CmdArgs,
240 const llvm::Triple &Triple, bool IsLTO,
241 const StringRef PluginOptPrefix = "");
242
244 const llvm::opt::ArgList &Args,
245 llvm::opt::ArgStringList &CmdArgs,
246 const llvm::Triple &Triple);
247
248void addOpenMPDeviceRTL(const Driver &D, const llvm::opt::ArgList &DriverArgs,
249 llvm::opt::ArgStringList &CC1Args,
250 StringRef BitcodeSuffix, const llvm::Triple &Triple,
251 const ToolChain &HostTC);
252
253/// Try to link libclc, depending on the target ABI and command line
254/// arguments.
255///
256/// \return true if libclc should be linked for the compile.
257bool addOpenCLBuiltinsLib(const Driver &D, const llvm::Triple &TT,
258 const llvm::opt::ArgList &DriverArgs,
259 llvm::opt::ArgStringList &CC1Args);
260
261void addOutlineAtomicsArgs(const Driver &D, const ToolChain &TC,
262 const llvm::opt::ArgList &Args,
263 llvm::opt::ArgStringList &CmdArgs,
264 const llvm::Triple &Triple);
265void addOffloadCompressArgs(const llvm::opt::ArgList &TCArgs,
266 llvm::opt::ArgStringList &CmdArgs,
267 bool EmitCompressionFormat = false);
268void addMCModel(const Driver &D, const llvm::opt::ArgList &Args,
269 const llvm::Triple &Triple,
270 const llvm::Reloc::Model &RelocationModel,
271 llvm::opt::ArgStringList &CmdArgs);
272
273/// Handle the -f{no}-color-diagnostics and -f{no}-diagnostics-colors options.
274void handleColorDiagnosticsArgs(const Driver &D, const llvm::opt::ArgList &Args,
275 llvm::opt::ArgStringList &CmdArgs);
276
277/// Add backslashes to escape spaces and other backslashes.
278/// This is used for the space-separated argument list specified with
279/// the -dwarf-debug-flags option.
280void escapeSpacesAndBackslashes(const char *Arg,
282
283/// Join the args in the given ArgList, escape spaces and backslashes and
284/// return the joined string. This is used when saving the command line as a
285/// result of using either the -frecord-command-line or -grecord-command-line
286/// options. The lifetime of the returned c-string will match that of the Args
287/// argument.
288const char *renderEscapedCommandLine(const ToolChain &TC,
289 const llvm::opt::ArgList &Args);
290
291/// Check if the command line should be recorded in the object file. This is
292/// done if either -frecord-command-line or -grecord-command-line options have
293/// been passed. This also does some error checking since -frecord-command-line
294/// is currently only supported on ELF platforms. The last two boolean
295/// arguments are out parameters and will be set depending on the command
296/// line options that were passed.
298 const llvm::opt::ArgList &Args,
299 bool &FRecordCommandLine, bool &GRecordCommandLine,
300 bool &DXRecordCommandLine);
301
302void renderGlobalISelOptions(const Driver &D, const llvm::opt::ArgList &Args,
303 llvm::opt::ArgStringList &CmdArgs,
304 const llvm::Triple &Triple);
305
306void renderCommonIntegerOverflowOptions(const llvm::opt::ArgList &Args,
307 llvm::opt::ArgStringList &CmdArgs,
308 bool IsMSVCCompat);
309
310bool shouldEnableVectorizerAtOLevel(const llvm::opt::ArgList &Args,
311 bool isSlpVec);
312
313/// Enable -floop-interchange based on the optimization level selected.
314void handleInterchangeLoopsArgs(const llvm::opt::ArgList &Args,
315 llvm::opt::ArgStringList &CmdArgs);
316
317/// Enable -fvectorize based on the optimization level selected.
318void handleVectorizeLoopsArgs(const llvm::opt::ArgList &Args,
319 llvm::opt::ArgStringList &CmdArgs);
320
321/// Enable -fslp-vectorize based on the optimization level selected.
322void handleVectorizeSLPArgs(const llvm::opt::ArgList &Args,
323 llvm::opt::ArgStringList &CmdArgs);
324
325// Convert ComplexRangeKind to a string that can be passed as a frontend option.
327
328// Render a frontend option corresponding to ComplexRangeKind.
330
331// Set the complex range and output a warning as needed.
332void setComplexRange(const Driver &D, StringRef NewOpt,
333 LangOptions::ComplexRangeKind NewRange, StringRef &LastOpt,
335
336// This function expects that the inputs to llvm-link will be specified by the
337// caller, but the output is handled by this function, with the optional ability
338// to set the output filename.
340 const JobAction &JA,
341 const InputInfoList &JobInputs,
342 const llvm::opt::ArgStringList &LinkerInputs,
343 const InputInfo &Output,
344 const llvm::opt::ArgList &Args,
345 const char *OutputFilename = nullptr);
346
347} // end namespace tools
348} // end namespace driver
349} // end namespace clang
350
352getFramePointerKind(const llvm::opt::ArgList &Args, const llvm::Triple &Triple);
353
354#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:93
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:92
SmallVector< std::string, 16 > path_list
Definition ToolChain.h:94
Tool - Information on a specific compilation tool.
Definition Tool.h:31
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 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 addOffloadCompressArgs(const llvm::opt::ArgList &TCArgs, llvm::opt::ArgStringList &CmdArgs, bool EmitCompressionFormat=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)
bool addSanitizerRuntimes(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, Compilation &C)
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 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 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:49
Top level wrappers for InstallAPI frontend operations.
const FunctionProtoType * T