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.");
53 if (TargetPointerWidth == 32)
61 if (!HostTriple.isNVPTX())
68 switch (TargetPointerWidth) {
80 llvm_unreachable(
"TargetPointerWidth must be 32 or 64");
90 IntWidth = HostTarget->getIntWidth();
91 IntAlign = HostTarget->getIntAlign();
103 NewAlign = HostTarget->getNewAlign();
105 HostTarget->getDefaultAlignForAttributeAligned();
106 SizeType = HostTarget->getSizeType();
111 WIntType = HostTarget->getWIntType();
142 return llvm::makeArrayRef(GCCRegNames);
146 return llvm::StringSwitch<bool>(Feature)
147 .Cases(
"ptx",
"nvptx",
true)
156 if (Opts.CUDAIsDevice) {
158 std::string CUDAArchCode = [
this] {
161 assert(
false &&
"No GPU arch when compiling CUDA device code.");
190 llvm_unreachable(
"unhandled CudaArch");
192 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
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
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...