David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 1 | //===--- CommonArgs.h - Args handling for multiple toolchains ---*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_COMMONARGS_H |
| 11 | #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_COMMONARGS_H |
| 12 | |
| 13 | #include "InputInfo.h" |
| 14 | #include "clang/Driver/Driver.h" |
| 15 | #include "clang/Driver/Tool.h" |
| 16 | #include "clang/Driver/ToolChain.h" |
| 17 | #include "llvm/Support/CodeGen.h" |
| 18 | |
| 19 | namespace clang { |
| 20 | namespace driver { |
| 21 | namespace tools { |
| 22 | |
| 23 | void addPathIfExists(const Driver &D, const Twine &Path, |
| 24 | ToolChain::path_list &Paths); |
| 25 | |
| 26 | void AddLinkerInputs(const ToolChain &TC, const InputInfoList &Inputs, |
| 27 | const llvm::opt::ArgList &Args, |
| 28 | llvm::opt::ArgStringList &CmdArgs, const JobAction &JA); |
| 29 | |
| 30 | void claimNoWarnArgs(const llvm::opt::ArgList &Args); |
| 31 | |
| 32 | bool addSanitizerRuntimes(const ToolChain &TC, const llvm::opt::ArgList &Args, |
| 33 | llvm::opt::ArgStringList &CmdArgs); |
| 34 | |
| 35 | void linkSanitizerRuntimeDeps(const ToolChain &TC, |
| 36 | llvm::opt::ArgStringList &CmdArgs); |
| 37 | |
Dean Michael Berris | 6244037 | 2018-04-06 03:53:04 +0000 | [diff] [blame] | 38 | bool addXRayRuntime(const ToolChain &TC, const llvm::opt::ArgList &Args, |
| 39 | llvm::opt::ArgStringList &CmdArgs); |
| 40 | |
| 41 | void linkXRayRuntimeDeps(const ToolChain &TC, |
| 42 | llvm::opt::ArgStringList &CmdArgs); |
| 43 | |
David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 44 | void AddRunTimeLibs(const ToolChain &TC, const Driver &D, |
| 45 | llvm::opt::ArgStringList &CmdArgs, |
| 46 | const llvm::opt::ArgList &Args); |
| 47 | |
Gheorghe-Teodor Bercea | 2c92693 | 2017-08-08 14:33:05 +0000 | [diff] [blame] | 48 | void AddOpenMPLinkerScript(const ToolChain &TC, Compilation &C, |
| 49 | const InputInfo &Output, |
| 50 | const InputInfoList &Inputs, |
| 51 | const llvm::opt::ArgList &Args, |
| 52 | llvm::opt::ArgStringList &CmdArgs, |
| 53 | const JobAction &JA); |
| 54 | |
Yaxun Liu | 29155b0 | 2018-05-18 15:07:56 +0000 | [diff] [blame^] | 55 | void AddHIPLinkerScript(const ToolChain &TC, Compilation &C, |
| 56 | const InputInfo &Output, const InputInfoList &Inputs, |
| 57 | const llvm::opt::ArgList &Args, |
| 58 | llvm::opt::ArgStringList &CmdArgs, const JobAction &JA, |
| 59 | const Tool &T); |
| 60 | |
David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 61 | const char *SplitDebugName(const llvm::opt::ArgList &Args, |
| 62 | const InputInfo &Input); |
| 63 | |
| 64 | void SplitDebugInfo(const ToolChain &TC, Compilation &C, const Tool &T, |
| 65 | const JobAction &JA, const llvm::opt::ArgList &Args, |
| 66 | const InputInfo &Output, const char *OutFile); |
| 67 | |
| 68 | void AddGoldPlugin(const ToolChain &ToolChain, const llvm::opt::ArgList &Args, |
Florian Hahn | 2e081d1 | 2018-04-20 12:50:10 +0000 | [diff] [blame] | 69 | llvm::opt::ArgStringList &CmdArgs, const InputInfo &Output, |
| 70 | const InputInfo &Input, bool IsThinLTO); |
David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 71 | |
| 72 | std::tuple<llvm::Reloc::Model, unsigned, bool> |
| 73 | ParsePICArgs(const ToolChain &ToolChain, const llvm::opt::ArgList &Args); |
| 74 | |
Saleem Abdulrasool | 3fe5b7a | 2018-04-19 23:14:57 +0000 | [diff] [blame] | 75 | unsigned ParseFunctionAlignment(const ToolChain &TC, |
| 76 | const llvm::opt::ArgList &Args); |
| 77 | |
David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 78 | void AddAssemblerKPIC(const ToolChain &ToolChain, |
| 79 | const llvm::opt::ArgList &Args, |
| 80 | llvm::opt::ArgStringList &CmdArgs); |
| 81 | |
| 82 | void addArchSpecificRPath(const ToolChain &TC, const llvm::opt::ArgList &Args, |
| 83 | llvm::opt::ArgStringList &CmdArgs); |
Jonas Hahnfeld | 8ea76fa | 2017-04-19 13:55:39 +0000 | [diff] [blame] | 84 | /// Returns true, if an OpenMP runtime has been added. |
| 85 | bool addOpenMPRuntime(llvm::opt::ArgStringList &CmdArgs, const ToolChain &TC, |
| 86 | const llvm::opt::ArgList &Args, |
| 87 | bool IsOffloadingHost = false, bool GompNeedsRT = false); |
David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 88 | |
| 89 | llvm::opt::Arg *getLastProfileUseArg(const llvm::opt::ArgList &Args); |
Dehao Chen | ea4b78f | 2017-03-21 21:40:53 +0000 | [diff] [blame] | 90 | llvm::opt::Arg *getLastProfileSampleUseArg(const llvm::opt::ArgList &Args); |
David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 91 | |
| 92 | bool isObjCAutoRefCount(const llvm::opt::ArgList &Args); |
| 93 | |
| 94 | unsigned getLTOParallelism(const llvm::opt::ArgList &Args, const Driver &D); |
| 95 | |
| 96 | bool areOptimizationsEnabled(const llvm::opt::ArgList &Args); |
| 97 | |
| 98 | bool isUseSeparateSections(const llvm::Triple &Triple); |
| 99 | |
| 100 | void addDirectoryList(const llvm::opt::ArgList &Args, |
| 101 | llvm::opt::ArgStringList &CmdArgs, const char *ArgName, |
| 102 | const char *EnvVar); |
| 103 | |
| 104 | void AddTargetFeature(const llvm::opt::ArgList &Args, |
| 105 | std::vector<StringRef> &Features, |
| 106 | llvm::opt::OptSpecifier OnOpt, |
| 107 | llvm::opt::OptSpecifier OffOpt, StringRef FeatureName); |
| 108 | |
| 109 | std::string getCPUName(const llvm::opt::ArgList &Args, const llvm::Triple &T, |
| 110 | bool FromAs = false); |
| 111 | |
| 112 | void handleTargetFeaturesGroup(const llvm::opt::ArgList &Args, |
| 113 | std::vector<StringRef> &Features, |
| 114 | llvm::opt::OptSpecifier Group); |
| 115 | |
Florian Hahn | 2e081d1 | 2018-04-20 12:50:10 +0000 | [diff] [blame] | 116 | /// Handles the -save-stats option and returns the filename to save statistics |
| 117 | /// to. |
| 118 | SmallString<128> getStatsFileName(const llvm::opt::ArgList &Args, |
| 119 | const InputInfo &Output, |
| 120 | const InputInfo &Input, const Driver &D); |
David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 121 | } // end namespace tools |
| 122 | } // end namespace driver |
| 123 | } // end namespace clang |
| 124 | |
| 125 | #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_COMMONARGS_H |