2010-09-19 02:52:28 +08: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-02 05:01:15 +08:00
|
|
|
// This file implements the PTX specific subclass of TargetSubtargetInfo.
|
2010-09-19 02:52:28 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "PTXSubtarget.h"
|
2011-07-09 13:47:46 +08:00
|
|
|
#include "PTX.h"
|
2011-03-02 11:20:28 +08:00
|
|
|
#include "llvm/Support/ErrorHandling.h"
|
2011-08-25 02:08:43 +08:00
|
|
|
#include "llvm/Support/TargetRegistry.h"
|
2010-09-19 02:52:28 +08:00
|
|
|
|
2011-07-02 04:45:01 +08:00
|
|
|
#define GET_SUBTARGETINFO_TARGET_DESC
|
2011-07-08 09:53:10 +08:00
|
|
|
#define GET_SUBTARGETINFO_CTOR
|
2011-07-02 06:36:09 +08:00
|
|
|
#include "PTXGenSubtargetInfo.inc"
|
2011-07-02 04:45:01 +08:00
|
|
|
|
2010-09-19 02:52:28 +08:00
|
|
|
using namespace llvm;
|
|
|
|
|
2011-12-20 10:50:00 +08:00
|
|
|
void PTXSubtarget::anchor() { }
|
|
|
|
|
2011-06-30 09:53:36 +08:00
|
|
|
PTXSubtarget::PTXSubtarget(const std::string &TT, const std::string &CPU,
|
|
|
|
const std::string &FS, bool is64Bit)
|
2011-07-07 15:07:08 +08:00
|
|
|
: PTXGenSubtargetInfo(TT, CPU, FS),
|
2011-07-02 04:45:01 +08:00
|
|
|
PTXTarget(PTX_COMPUTE_1_0),
|
2011-03-15 21:24:15 +08:00
|
|
|
PTXVersion(PTX_VERSION_2_0),
|
2011-03-02 15:36:48 +08:00
|
|
|
SupportsDouble(false),
|
2011-05-18 23:42:23 +08:00
|
|
|
SupportsFMA(true),
|
2011-06-25 00:27:49 +08:00
|
|
|
Is64Bit(is64Bit) {
|
2011-06-30 09:53:36 +08:00
|
|
|
std::string TARGET = CPU;
|
|
|
|
if (TARGET.empty())
|
|
|
|
TARGET = "generic";
|
2011-07-07 15:07:08 +08:00
|
|
|
ParseSubtargetFeatures(TARGET, FS);
|
2011-03-02 11:20:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string PTXSubtarget::getTargetString() const {
|
2011-06-25 00:27:49 +08:00
|
|
|
switch(PTXTarget) {
|
|
|
|
default: llvm_unreachable("Unknown PTX target");
|
2011-03-02 11:20:28 +08:00
|
|
|
case PTX_SM_1_0: return "sm_10";
|
2011-06-25 00:27:49 +08:00
|
|
|
case PTX_SM_1_1: return "sm_11";
|
|
|
|
case PTX_SM_1_2: return "sm_12";
|
2011-03-02 11:20:28 +08:00
|
|
|
case PTX_SM_1_3: return "sm_13";
|
|
|
|
case PTX_SM_2_0: return "sm_20";
|
2011-06-25 00:27:49 +08: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 11:20:28 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string PTXSubtarget::getPTXVersionString() const {
|
|
|
|
switch(PTXVersion) {
|
|
|
|
case PTX_VERSION_2_0: return "2.0";
|
|
|
|
case PTX_VERSION_2_1: return "2.1";
|
2011-03-15 21:24:15 +08:00
|
|
|
case PTX_VERSION_2_2: return "2.2";
|
2011-05-06 19:40:36 +08:00
|
|
|
case PTX_VERSION_2_3: return "2.3";
|
2011-03-02 11:20:28 +08:00
|
|
|
}
|
2012-01-11 04:47:20 +08:00
|
|
|
llvm_unreachable("Invalid PTX version");
|
2010-09-19 02:52:28 +08:00
|
|
|
}
|