diff options
Diffstat (limited to 'lib/Target/NVPTX/NVPTXSubtarget.cpp')
-rw-r--r-- | lib/Target/NVPTX/NVPTXSubtarget.cpp | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/lib/Target/NVPTX/NVPTXSubtarget.cpp b/lib/Target/NVPTX/NVPTXSubtarget.cpp index 3d52532..069d6e1 100644 --- a/lib/Target/NVPTX/NVPTXSubtarget.cpp +++ b/lib/Target/NVPTX/NVPTXSubtarget.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "NVPTXSubtarget.h" +#include "NVPTXTargetMachine.h" using namespace llvm; @@ -25,17 +26,6 @@ using namespace llvm; // Pin the vtable to this file. void NVPTXSubtarget::anchor() {} -static std::string computeDataLayout(bool is64Bit) { - std::string Ret = "e"; - - if (!is64Bit) - Ret += "-p:32:32"; - - Ret += "-i64:64-v16:16-v32:32-n16:32:64"; - - return Ret; -} - NVPTXSubtarget &NVPTXSubtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS) { // Provide the default CPU if we don't have one. @@ -54,18 +44,18 @@ NVPTXSubtarget &NVPTXSubtarget::initializeSubtargetDependencies(StringRef CPU, } NVPTXSubtarget::NVPTXSubtarget(const std::string &TT, const std::string &CPU, - const std::string &FS, const TargetMachine &TM, - bool is64Bit) - : NVPTXGenSubtargetInfo(TT, CPU, FS), Is64Bit(is64Bit), PTXVersion(0), - SmVersion(20), DL(computeDataLayout(is64Bit)), - InstrInfo(initializeSubtargetDependencies(CPU, FS)), - TLInfo((const NVPTXTargetMachine &)TM), TSInfo(&DL), - FrameLowering(*this) { - - Triple T(TT); - - if (T.getOS() == Triple::NVCL) - drvInterface = NVPTX::NVCL; - else - drvInterface = NVPTX::CUDA; + const std::string &FS, + const NVPTXTargetMachine &TM) + : NVPTXGenSubtargetInfo(TT, CPU, FS), PTXVersion(0), SmVersion(20), TM(TM), + InstrInfo(), TLInfo(TM, initializeSubtargetDependencies(CPU, FS)), + TSInfo(TM.getDataLayout()), FrameLowering() {} + +bool NVPTXSubtarget::hasImageHandles() const { + // Enable handles for Kepler+, where CUDA supports indirect surfaces and + // textures + if (TM.getDrvInterface() == NVPTX::CUDA) + return (SmVersion >= 30); + + // Disabled, otherwise + return false; } |