2010-09-18 18:52:28 +00:00
|
|
|
//===- PTXSubtarget.cpp - PTX Subtarget Information ---------------*- C++ -*-=//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2011-07-01 21:01:15 +00:00
|
|
|
// This file implements the PTX specific subclass of TargetSubtargetInfo.
|
2010-09-18 18:52:28 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "PTXSubtarget.h"
|
2011-07-09 05:47:46 +00:00
|
|
|
#include "PTX.h"
|
2011-03-02 03:20:28 +00:00
|
|
|
#include "llvm/Support/ErrorHandling.h"
|
2011-08-24 18:08:43 +00:00
|
|
|
#include "llvm/Support/TargetRegistry.h"
|
2010-09-18 18:52:28 +00:00
|
|
|
|
2011-07-01 20:45:01 +00:00
|
|
|
#define GET_SUBTARGETINFO_TARGET_DESC
|
2011-07-08 01:53:10 +00:00
|
|
|
#define GET_SUBTARGETINFO_CTOR
|
2011-07-01 22:36:09 +00:00
|
|
|
#include "PTXGenSubtargetInfo.inc"
|
2011-07-01 20:45:01 +00:00
|
|
|
|
2010-09-18 18:52:28 +00:00
|
|
|
using namespace llvm;
|
|
|
|
|
2011-06-30 01:53:36 +00:00
|
|
|
PTXSubtarget::PTXSubtarget(const std::string &TT, const std::string &CPU,
|
|
|
|
const std::string &FS, bool is64Bit)
|
2011-07-07 07:07:08 +00:00
|
|
|
: PTXGenSubtargetInfo(TT, CPU, FS),
|
2011-07-01 20:45:01 +00:00
|
|
|
PTXTarget(PTX_COMPUTE_1_0),
|
2011-03-15 13:24:15 +00:00
|
|
|
PTXVersion(PTX_VERSION_2_0),
|
2011-03-02 07:36:48 +00:00
|
|
|
SupportsDouble(false),
|
2011-05-18 15:42:23 +00:00
|
|
|
SupportsFMA(true),
|
2011-06-24 16:27:49 +00:00
|
|
|
Is64Bit(is64Bit) {
|
2011-06-30 01:53:36 +00:00
|
|
|
std::string TARGET = CPU;
|
|
|
|
if (TARGET.empty())
|
|
|
|
TARGET = "generic";
|
2011-07-07 07:07:08 +00:00
|
|
|
ParseSubtargetFeatures(TARGET, FS);
|
2011-03-02 03:20:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string PTXSubtarget::getTargetString() const {
|
2011-06-24 16:27:49 +00:00
|
|
|
switch(PTXTarget) {
|
|
|
|
default: llvm_unreachable("Unknown PTX target");
|
2011-03-02 03:20:28 +00:00
|
|
|
case PTX_SM_1_0: return "sm_10";
|
2011-06-24 16:27:49 +00:00
|
|
|
case PTX_SM_1_1: return "sm_11";
|
|
|
|
case PTX_SM_1_2: return "sm_12";
|
2011-03-02 03:20:28 +00:00
|
|
|
case PTX_SM_1_3: return "sm_13";
|
|
|
|
case PTX_SM_2_0: return "sm_20";
|
2011-06-24 16:27:49 +00:00
|
|
|
case PTX_SM_2_1: return "sm_21";
|
|
|
|
case PTX_SM_2_2: return "sm_22";
|
|
|
|
case PTX_SM_2_3: return "sm_23";
|
|
|
|
case PTX_COMPUTE_1_0: return "compute_10";
|
|
|
|
case PTX_COMPUTE_1_1: return "compute_11";
|
|
|
|
case PTX_COMPUTE_1_2: return "compute_12";
|
|
|
|
case PTX_COMPUTE_1_3: return "compute_13";
|
|
|
|
case PTX_COMPUTE_2_0: return "compute_20";
|
2011-03-02 03:20:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string PTXSubtarget::getPTXVersionString() const {
|
|
|
|
switch(PTXVersion) {
|
|
|
|
default: llvm_unreachable("Unknown PTX version");
|
|
|
|
case PTX_VERSION_2_0: return "2.0";
|
|
|
|
case PTX_VERSION_2_1: return "2.1";
|
2011-03-15 13:24:15 +00:00
|
|
|
case PTX_VERSION_2_2: return "2.2";
|
2011-05-06 11:40:36 +00:00
|
|
|
case PTX_VERSION_2_3: return "2.3";
|
2011-03-02 03:20:28 +00:00
|
|
|
}
|
2010-09-18 18:52:28 +00:00
|
|
|
}
|