aboutsummaryrefslogtreecommitdiff
path: root/clang/include/clang/Driver/ToolChain.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang/include/clang/Driver/ToolChain.h')
-rw-r--r--clang/include/clang/Driver/ToolChain.h57
1 files changed, 55 insertions, 2 deletions
diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h
index 26d8d43dd2fc..7495e08fe6e6 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -16,7 +16,9 @@
#include "clang/Driver/Action.h"
#include "clang/Driver/Multilib.h"
#include "clang/Driver/Types.h"
+#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/FloatingPointMode.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
@@ -137,6 +139,7 @@ private:
mutable std::unique_ptr<Tool> Flang;
mutable std::unique_ptr<Tool> Assemble;
mutable std::unique_ptr<Tool> Link;
+ mutable std::unique_ptr<Tool> StaticLibTool;
mutable std::unique_ptr<Tool> IfsMerge;
mutable std::unique_ptr<Tool> OffloadBundler;
mutable std::unique_ptr<Tool> OffloadWrapper;
@@ -145,6 +148,7 @@ private:
Tool *getFlang() const;
Tool *getAssemble() const;
Tool *getLink() const;
+ Tool *getStaticLibTool() const;
Tool *getIfsMerge() const;
Tool *getClangAs() const;
Tool *getOffloadBundler() const;
@@ -172,6 +176,7 @@ protected:
virtual Tool *buildAssembler() const;
virtual Tool *buildLinker() const;
+ virtual Tool *buildStaticLibTool() const;
virtual Tool *getTool(Action::ActionClass AC) const;
/// \name Utilities for implementing subclasses.
@@ -293,6 +298,22 @@ public:
const llvm::opt::DerivedArgList &Args, bool SameTripleAsHost,
SmallVectorImpl<llvm::opt::Arg *> &AllocatedArgs) const;
+ /// Append the argument following \p A to \p DAL assuming \p A is an Xarch
+ /// argument. If \p AllocatedArgs is null pointer, synthesized arguments are
+ /// added to \p DAL, otherwise they are appended to \p AllocatedArgs.
+ virtual void TranslateXarchArgs(
+ const llvm::opt::DerivedArgList &Args, llvm::opt::Arg *&A,
+ llvm::opt::DerivedArgList *DAL,
+ SmallVectorImpl<llvm::opt::Arg *> *AllocatedArgs = nullptr) const;
+
+ /// Translate -Xarch_ arguments. If there are no such arguments, return
+ /// a null pointer, otherwise return a DerivedArgList containing the
+ /// translated arguments.
+ virtual llvm::opt::DerivedArgList *
+ TranslateXarchArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
+ Action::OffloadKind DeviceOffloadKind,
+ SmallVectorImpl<llvm::opt::Arg *> *AllocatedArgs) const;
+
/// Choose a tool to use to handle the action \p JA.
///
/// This can be overridden when a particular ToolChain needs to use
@@ -308,6 +329,9 @@ public:
/// the linker suffix or name.
std::string GetLinkerPath() const;
+ /// Returns the linker path for emitting a static library.
+ std::string GetStaticLibToolPath() const;
+
/// Dispatch to the specific toolchain for verbose printing.
///
/// This is used when handling the verbose option to print detailed,
@@ -395,6 +419,11 @@ public:
getCompilerRTArgString(const llvm::opt::ArgList &Args, StringRef Component,
FileType Type = ToolChain::FT_Static) const;
+ std::string getCompilerRTBasename(const llvm::opt::ArgList &Args,
+ StringRef Component,
+ FileType Type = ToolChain::FT_Static,
+ bool AddArch = true) const;
+
// Returns target specific runtime path if it exists.
virtual Optional<std::string> getRuntimePath() const;
@@ -513,6 +542,10 @@ public:
/// FIXME: this really belongs on some sort of DeploymentTarget abstraction
virtual bool hasBlocksRuntime() const { return true; }
+ /// Return the sysroot, possibly searching for a default sysroot using
+ /// target-specific logic.
+ virtual std::string computeSysRoot() const;
+
/// Add the clang cc1 arguments for system include paths.
///
/// This routine is responsible for adding the necessary cc1 arguments to
@@ -571,12 +604,19 @@ public:
virtual void AddCCKextLibArgs(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const;
+ /// If a runtime library exists that sets global flags for unsafe floating
+ /// point math, return true.
+ ///
+ /// This checks for presence of the -Ofast, -ffast-math or -funsafe-math flags.
+ virtual bool isFastMathRuntimeAvailable(
+ const llvm::opt::ArgList &Args, std::string &Path) const;
+
/// AddFastMathRuntimeIfAvailable - If a runtime library exists that sets
/// global flags for unsafe floating point math, add it and return true.
///
/// This checks for presence of the -Ofast, -ffast-math or -funsafe-math flags.
- virtual bool AddFastMathRuntimeIfAvailable(
- const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const;
+ bool addFastMathRuntimeIfAvailable(
+ const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const;
/// addProfileRTLibs - When -fprofile-instr-profile is specified, try to pass
/// a suitable profile runtime library to the linker.
@@ -587,6 +627,10 @@ public:
virtual void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const;
+ /// Add arguments to use system-specific HIP includes.
+ virtual void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs,
+ llvm::opt::ArgStringList &CC1Args) const;
+
/// Add arguments to use MCU GCC toolchain includes.
virtual void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const;
@@ -606,6 +650,15 @@ public:
/// Returns true when it's possible to split LTO unit to use whole
/// program devirtualization and CFI santiizers.
virtual bool canSplitThinLTOUnit() const { return true; }
+
+ /// Returns the output denormal handling type in the default floating point
+ /// environment for the given \p FPType if given. Otherwise, the default
+ /// assumed mode for any floating point type.
+ virtual llvm::DenormalMode getDefaultDenormalModeForType(
+ const llvm::opt::ArgList &DriverArgs, const JobAction &JA,
+ const llvm::fltSemantics *FPType = nullptr) const {
+ return llvm::DenormalMode::getIEEE();
+ }
};
/// Set a ToolChain's effective triple. Reset it when the registration object