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