#include "Cuda.h"
#include "CommonArgs.h"
#include "clang/Basic/Cuda.h"
#include "clang/Config/config.h"
#include "clang/Driver/Compilation.h"
#include "clang/Driver/Distro.h"
#include "clang/Driver/Driver.h"
#include "clang/Driver/DriverDiagnostic.h"
#include "clang/Driver/InputInfo.h"
#include "clang/Driver/Options.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/FormatAdapters.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/Program.h"
#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/TargetParser/Host.h"
#include "llvm/TargetParser/TargetParser.h"
#include <system_error>
usingnamespaceclang::driver;
usingnamespaceclang::driver::toolchains;
usingnamespaceclang::driver::tools;
usingnamespaceclang;
usingnamespacellvm::opt;
namespace {
CudaVersion getCudaVersion(uint32_t raw_version) { … }
CudaVersion parseCudaHFile(llvm::StringRef Input) { … }
}
void CudaInstallationDetector::WarnIfUnsupportedVersion() { … }
CudaInstallationDetector::CudaInstallationDetector(
const Driver &D, const llvm::Triple &HostTriple,
const llvm::opt::ArgList &Args)
: … { … }
void CudaInstallationDetector::AddCudaIncludeArgs(
const ArgList &DriverArgs, ArgStringList &CC1Args) const { … }
void CudaInstallationDetector::CheckCudaVersionSupportsArch(
OffloadArch Arch) const { … }
void CudaInstallationDetector::print(raw_ostream &OS) const { … }
namespace {
enum DeviceDebugInfoLevel { … };
}
static DeviceDebugInfoLevel mustEmitDebugInfo(const ArgList &Args) { … }
void NVPTX::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const { … }
static bool shouldIncludePTX(const ArgList &Args, StringRef InputArch) { … }
void NVPTX::FatBinary::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const { … }
void NVPTX::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const { … }
void NVPTX::getNVPTXTargetFeatures(const Driver &D, const llvm::Triple &Triple,
const llvm::opt::ArgList &Args,
std::vector<StringRef> &Features) { … }
NVPTXToolChain::NVPTXToolChain(const Driver &D, const llvm::Triple &Triple,
const llvm::Triple &HostTriple,
const ArgList &Args, bool Freestanding = false)
: … { … }
NVPTXToolChain::NVPTXToolChain(const Driver &D, const llvm::Triple &Triple,
const ArgList &Args)
: … { … }
llvm::opt::DerivedArgList *
NVPTXToolChain::TranslateArgs(const llvm::opt::DerivedArgList &Args,
StringRef BoundArch,
Action::OffloadKind OffloadKind) const { … }
void NVPTXToolChain::addClangTargetOptions(
const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args,
Action::OffloadKind DeviceOffloadingKind) const { … }
bool NVPTXToolChain::supportsDebugInfoOption(const llvm::opt::Arg *A) const { … }
void NVPTXToolChain::adjustDebugInfoKind(
llvm::codegenoptions::DebugInfoKind &DebugInfoKind,
const ArgList &Args) const { … }
Expected<SmallVector<std::string>>
NVPTXToolChain::getSystemGPUArchs(const ArgList &Args) const { … }
CudaToolChain::CudaToolChain(const Driver &D, const llvm::Triple &Triple,
const ToolChain &HostTC, const ArgList &Args)
: … { … }
void CudaToolChain::addClangTargetOptions(
const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args,
Action::OffloadKind DeviceOffloadingKind) const { … }
llvm::DenormalMode CudaToolChain::getDefaultDenormalModeForType(
const llvm::opt::ArgList &DriverArgs, const JobAction &JA,
const llvm::fltSemantics *FPType) const { … }
void CudaToolChain::AddCudaIncludeArgs(const ArgList &DriverArgs,
ArgStringList &CC1Args) const { … }
std::string CudaToolChain::getInputFilename(const InputInfo &Input) const { … }
llvm::opt::DerivedArgList *
CudaToolChain::TranslateArgs(const llvm::opt::DerivedArgList &Args,
StringRef BoundArch,
Action::OffloadKind DeviceOffloadKind) const { … }
Tool *NVPTXToolChain::buildAssembler() const { … }
Tool *NVPTXToolChain::buildLinker() const { … }
Tool *CudaToolChain::buildAssembler() const { … }
Tool *CudaToolChain::buildLinker() const { … }
void CudaToolChain::addClangWarningOptions(ArgStringList &CC1Args) const { … }
ToolChain::CXXStdlibType
CudaToolChain::GetCXXStdlibType(const ArgList &Args) const { … }
void CudaToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
ArgStringList &CC1Args) const { … }
void CudaToolChain::AddClangCXXStdlibIncludeArgs(const ArgList &Args,
ArgStringList &CC1Args) const { … }
void CudaToolChain::AddIAMCUIncludeArgs(const ArgList &Args,
ArgStringList &CC1Args) const { … }
SanitizerMask CudaToolChain::getSupportedSanitizers() const { … }
VersionTuple CudaToolChain::computeMSVCVersion(const Driver *D,
const ArgList &Args) const { … }