19 #include "llvm/ADT/StringSwitch.h" 21 using namespace clang;
25 #define BUILTIN(ID, TYPE, ATTRS) \ 26 {#ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, nullptr}, 27 #define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) \ 28 {#ID, TYPE, ATTRS, HEADER, ALL_LANGUAGES, nullptr}, 29 #define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) \ 30 {#ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, FEATURE}, 31 #include "clang/Basic/BuiltinsNVPTX.def" 34 const char *
const NVPTXTargetInfo::GCCRegNames[] = {
"r0"};
38 unsigned TargetPointerWidth)
40 assert((TargetPointerWidth == 32 || TargetPointerWidth == 64) &&
41 "NVPTX only supports 32- and 64-bit modes.");
45 if (!Feature.startswith(
"+ptx"))
47 PTXVersion = llvm::StringSwitch<unsigned>(Feature)
69 if (TargetPointerWidth == 32)
73 "e-p3:32:32-p4:32:32-p5:32:32-i64:64-i128:128-v16:16-v32:32-n16:32:64");
80 if (!HostTriple.isNVPTX())
87 switch (TargetPointerWidth) {
99 llvm_unreachable(
"TargetPointerWidth must be 32 or 64");
109 IntWidth = HostTarget->getIntWidth();
110 IntAlign = HostTarget->getIntAlign();
122 NewAlign = HostTarget->getNewAlign();
124 HostTarget->getDefaultAlignForAttributeAligned();
125 SizeType = HostTarget->getSizeType();
130 WIntType = HostTarget->getWIntType();
161 return llvm::makeArrayRef(GCCRegNames);
165 return llvm::StringSwitch<bool>(Feature)
166 .Cases(
"ptx",
"nvptx",
true)
174 if (Opts.CUDAIsDevice) {
176 std::string CUDAArchCode = [
this] {
197 assert(
false &&
"No GPU arch when compiling CUDA device code.");
230 llvm_unreachable(
"unhandled CudaArch");
232 Builder.
defineMacro(
"__CUDA_ARCH__", CUDAArchCode);
Defines the clang::MacroBuilder utility class.
unsigned char LongLongWidth
Options for controlling the target.
std::string HostTriple
When compiling for the device side, contains the triple used to compile for the host.
ArrayRef< Builtin::Info > getTargetBuiltins() const override
Return information about target-specific builtins for the current primary target, and info about whic...
unsigned ZeroLengthBitfieldBoundary
If non-zero, specifies a fixed alignment value for bitfields that follow zero length bitfield...
unsigned char MinGlobalAlign
ArrayRef< const char * > getGCCRegNames() const override
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
unsigned char DefaultAlignForAttributeAligned
unsigned char PointerWidth
NVPTXTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts, unsigned TargetPointerWidth)
unsigned char DoubleWidth
bool hasFeature(StringRef Feature) const override
Determine whether the given target has the given feature.
Exposes information about the current target.
void resetDataLayout(StringRef DL)
unsigned UseExplicitBitFieldAlignment
Whether explicit bit field alignment attributes are honored.
TargetInfo * AllocateTarget(const llvm::Triple &Triple, const TargetOptions &Opts)
Enumerates target-specific builtins in their own namespaces within namespace clang.
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods --------------------——===//
const LangASMap * AddrSpaceMap
unsigned char DoubleAlign
std::vector< std::string > FeaturesAsWritten
The list of target specific features to enable or disable, as written on the command line...
unsigned UseZeroLengthBitfieldAlignment
Whether zero length bitfields (e.g., int : 0;) force alignment of the next bitfield.
unsigned char PointerAlign
Dataflow Directional Tag Classes.
unsigned char LongLongAlign
bool NVPTXUseShortPointers
If enabled, use 32-bit pointers for accessing const/local/shared address space.
static const unsigned NVPTXAddrSpaceMap[]
unsigned char MaxAtomicInlineWidth
void defineMacro(const Twine &Name, const Twine &Value="1")
Append a #define line for macro of the form "\#define Name Value\n".
unsigned UseBitFieldTypeAlignment
Control whether the alignment of bit-field types is respected when laying out structures.
Defines enum values for all the target-independent builtin functions.
bool UseAddrSpaceMapMangling
Specify if mangling based on address space map should be used or not for language specific address sp...