namespace driver {
class Compilation;
+ class CudaInstallationDetector;
class Driver;
class JobAction;
+ class RegisterEffectiveTriple;
class SanitizerArgs;
class Tool;
mutable std::unique_ptr<Tool> Clang;
mutable std::unique_ptr<Tool> Assemble;
mutable std::unique_ptr<Tool> Link;
+ mutable std::unique_ptr<Tool> OffloadBundler;
Tool *getClang() const;
Tool *getAssemble() const;
Tool *getLink() const;
Tool *getClangAs() const;
+ Tool *getOffloadBundler() const;
mutable std::unique_ptr<SanitizerArgs> SanitizerArguments;
+ /// The effective clang triple for the current Job.
+ mutable llvm::Triple EffectiveTriple;
+
+ /// Set the toolchain's effective clang triple.
+ void setEffectiveTriple(llvm::Triple ET) const { EffectiveTriple = ET; }
+
+ friend class RegisterEffectiveTriple;
+
protected:
MultilibSet Multilibs;
const char *DefaultLinker = "ld";
return Triple.getTriple();
}
+ /// Get the toolchain's effective clang triple.
+ const llvm::Triple &getEffectiveTriple() const {
+ assert(!EffectiveTriple.getTriple().empty() && "No effective triple");
+ return EffectiveTriple;
+ }
+
path_list &getFilePaths() { return FilePaths; }
const path_list &getFilePaths() const { return FilePaths; }
/// TranslateArgs - Create a new derived argument list for any argument
/// translations this ToolChain may wish to perform, or 0 if no tool chain
- /// specific translations are needed.
+ /// specific translations are needed. If \p DeviceOffloadKind is specified
+ /// the translation specific for that offload kind is performed.
///
/// \param BoundArch - The bound architecture name, or 0.
+ /// \param DeviceOffloadKind - The device offload kind used for the
+ /// translation.
virtual llvm::opt::DerivedArgList *
- TranslateArgs(const llvm::opt::DerivedArgList &Args,
- const char *BoundArch) const {
+ TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
+ Action::OffloadKind DeviceOffloadKind) const {
return nullptr;
}
/// LookupTypeForExtension - Return the default language type to use for the
/// given extension.
- virtual types::ID LookupTypeForExtension(const char *Ext) const;
+ virtual types::ID LookupTypeForExtension(StringRef Ext) const;
/// IsBlocksDefault - Does this tool chain enable -fblocks by default.
virtual bool IsBlocksDefault() const { return false; }
return ToolChain::CST_Libstdcxx;
}
- virtual std::string getCompilerRT(const llvm::Triple &EffectiveTriple,
- const llvm::opt::ArgList &Args,
+ virtual std::string getCompilerRT(const llvm::opt::ArgList &Args,
StringRef Component,
bool Shared = false) const;
- const char *getCompilerRTArgString(const llvm::Triple &EffectiveTriple,
- const llvm::opt::ArgList &Args,
+ const char *getCompilerRTArgString(const llvm::opt::ArgList &Args,
StringRef Component,
bool Shared = false) const;
/// needsProfileRT - returns true if instrumentation profile is on.
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.
- virtual void addProfileRTLibs(const llvm::Triple &EffectiveTriple,
- const llvm::opt::ArgList &Args,
+ virtual void addProfileRTLibs(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const;
/// \brief Add arguments to use system-specific CUDA includes.
virtual void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const;
+ /// \brief On Windows, returns the MSVC compatibility version.
+ virtual VersionTuple computeMSVCVersion(const Driver *D,
+ const llvm::opt::ArgList &Args) const;
+
/// \brief Return sanitizers which are available in this toolchain.
virtual SanitizerMask getSupportedSanitizers() const;
/// \brief Return sanitizers which are enabled by default.
virtual SanitizerMask getDefaultSanitizers() const { return 0; }
+};
+
+/// Set a ToolChain's effective triple. Reset it when the registration object
+/// is destroyed.
+class RegisterEffectiveTriple {
+ const ToolChain &TC;
+
+public:
+ RegisterEffectiveTriple(const ToolChain &TC, llvm::Triple T) : TC(TC) {
+ TC.setEffectiveTriple(T);
+ }
- /// \brief On Windows, returns the version of cl.exe. On other platforms,
- /// returns an empty VersionTuple.
- virtual VersionTuple getMSVCVersionFromExe() const { return VersionTuple(); }
+ ~RegisterEffectiveTriple() { TC.setEffectiveTriple(llvm::Triple()); }
};
} // end namespace driver