diff options
author | David L. Jones <dlj@google.com> | 2017-02-24 00:28:01 +0000 |
---|---|---|
committer | David L. Jones <dlj@google.com> | 2017-02-24 00:28:01 +0000 |
commit | ecc6de35fba933b1081a7847b3687f2e99b3e34c (patch) | |
tree | 0d52b76a397f2f0c1aad6535e4c73273a37d06ee /clang/lib/Driver/Tools.h | |
parent | 3e0c0688e994efe9a7d6cb302b36d88b0d77b283 (diff) | |
download | bcm5719-llvm-ecc6de35fba933b1081a7847b3687f2e99b3e34c.tar.gz bcm5719-llvm-ecc6de35fba933b1081a7847b3687f2e99b3e34c.zip |
[Driver] Move architecture-specific free helper functions to their own files.
This patch moves helper functions that are CPU-specific out of Driver.cpp and to
separate implementation files. The new files are named for the architecture,
e.g. ARMArch.cpp.
The next step after this will be to move OS-specific code, which I expect will
include many of the tool implementations, to similarly separate files.
Some CPU-specific functions are not being moved just yet. In cases where the
only caller is the platform-specific tools, I plan to move them together. An
example is Hexagon, where the only caller of the architecture-specific functions
are the tools themselves. (I'm happy to revise this choice, it just seems like
less churn to me.)
This does mean that some functions which were previously static are now exposed
through the library header Driver.h.
Reviewers: rsmith, javed.absar
Subscribers: aemerson, danalbert, srhines, dschuff, jyknight, nemanjai, mgorny, cfe-commits
Differential Revision: https://reviews.llvm.org/D30315
llvm-svn: 296056
Diffstat (limited to 'clang/lib/Driver/Tools.h')
-rw-r--r-- | clang/lib/Driver/Tools.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/clang/lib/Driver/Tools.h b/clang/lib/Driver/Tools.h index 9d5b892d424..33f940ae424 100644 --- a/clang/lib/Driver/Tools.h +++ b/clang/lib/Driver/Tools.h @@ -38,11 +38,23 @@ class Compiler; } using llvm::opt::ArgStringList; +using llvm::opt::ArgList; SmallString<128> getCompilerRT(const ToolChain &TC, const llvm::opt::ArgList &Args, StringRef Component, bool Shared = false); +std::string getCPUName(const ArgList &Args, const llvm::Triple &T, + bool FromAs = false); + +void AddTargetFeature(const ArgList &Args, std::vector<StringRef> &Features, + llvm::opt::OptSpecifier OnOpt, + llvm::opt::OptSpecifier OffOpt, StringRef FeatureName); + +void handleTargetFeaturesGroup(const ArgList &Args, + std::vector<StringRef> &Features, + llvm::opt::OptSpecifier Group); + /// \brief Clang compiler tool. class LLVM_LIBRARY_VISIBILITY Clang : public Tool { public: @@ -321,6 +333,11 @@ bool hasCompactBranches(StringRef &CPU); void getMipsCPUAndABI(const llvm::opt::ArgList &Args, const llvm::Triple &Triple, StringRef &CPUName, StringRef &ABIName); +void getMIPSTargetFeatures(const Driver &D, const llvm::Triple &Triple, + const ArgList &Args, + std::vector<StringRef> &Features); +StringRef getGnuCompatibleMipsABIName(StringRef ABI); +mips::FloatABI getMipsFloatABI(const Driver &D, const ArgList &Args); std::string getMipsABILibSuffix(const llvm::opt::ArgList &Args, const llvm::Triple &Triple); bool hasMipsAbiArg(const llvm::opt::ArgList &Args, const char *Value); @@ -332,6 +349,7 @@ bool isFPXXDefault(const llvm::Triple &Triple, StringRef CPUName, bool shouldUseFPXX(const llvm::opt::ArgList &Args, const llvm::Triple &Triple, StringRef CPUName, StringRef ABIName, mips::FloatABI FloatABI); + } // end namespace mips namespace ppc { @@ -803,8 +821,23 @@ enum class FloatABI { }; FloatABI getARMFloatABI(const ToolChain &TC, const llvm::opt::ArgList &Args); + +bool useAAPCSForMachO(const llvm::Triple &T); +void getARMArchCPUFromArgs(const ArgList &Args, llvm::StringRef &Arch, + llvm::StringRef &CPU, bool FromAs = false); +void getARMTargetFeatures(const ToolChain &TC, const llvm::Triple &Triple, + const ArgList &Args, ArgStringList &CmdArgs, + std::vector<StringRef> &Features, bool ForAS); +int getARMSubArchVersionNumber(const llvm::Triple &Triple); +bool isARMMProfile(const llvm::Triple &Triple); } // end namespace arm +namespace aarch64 { +void getAArch64TargetFeatures(const Driver &D, const ArgList &Args, + std::vector<StringRef> &Features); +std::string getAArch64TargetCPU(const ArgList &Args, llvm::opt::Arg *&A); +} // end namespace aarch64 + namespace ppc { enum class FloatABI { Invalid, @@ -813,6 +846,11 @@ enum class FloatABI { }; FloatABI getPPCFloatABI(const Driver &D, const llvm::opt::ArgList &Args); + +std::string getPPCTargetCPU(const ArgList &Args); +void getPPCTargetFeatures(const Driver &D, const llvm::Triple &Triple, + const ArgList &Args, + std::vector<StringRef> &Features); } // end namespace ppc namespace sparc { @@ -823,6 +861,11 @@ enum class FloatABI { }; FloatABI getSparcFloatABI(const Driver &D, const llvm::opt::ArgList &Args); + +void getSparcTargetFeatures(const Driver &D, const ArgList &Args, + std::vector<StringRef> &Features); +const char *getSparcAsmModeForCPU(StringRef Name, + const llvm::Triple &Triple); } // end namespace sparc namespace XCore { @@ -1003,6 +1046,20 @@ public: }; } // end namespace AVR +namespace systemz { +const char *getSystemZTargetCPU(const ArgList &Args); +void getSystemZTargetFeatures(const ArgList &Args, + std::vector<StringRef> &Features); +} // end namespace systemz + +namespace x86 { +const char *getX86TargetCPU(const ArgList &Args, + const llvm::Triple &Triple); +void getX86TargetFeatures(const Driver &D, const llvm::Triple &Triple, + const ArgList &Args, + std::vector<StringRef> &Features); +} // end namespace x86 + } // end namespace tools } // end namespace driver } // end namespace clang |