blob: 18a93052c99310c0d603f18df58ced4f1e768615 [file] [log] [blame]
Eric Christopher50880d02010-09-18 18:52:28 +00001//===- PTXSubtarget.cpp - PTX Subtarget Information ---------------*- C++ -*-=//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the PTX specific subclass of TargetSubtarget.
11//
12//===----------------------------------------------------------------------===//
13
14#include "PTXSubtarget.h"
Che-Liang Chioufd8978b2011-03-02 03:20:28 +000015#include "llvm/Support/ErrorHandling.h"
Eric Christopher50880d02010-09-18 18:52:28 +000016
17using namespace llvm;
18
Che-Liang Chioufd8978b2011-03-02 03:20:28 +000019PTXSubtarget::PTXSubtarget(const std::string &TT, const std::string &FS)
20 : PTXShaderModel(PTX_SM_1_0),
21 PTXVersion(PTX_VERSION_1_4) {
22 std::string TARGET = "generic";
23 ParseSubtargetFeatures(FS, TARGET);
24}
25
26std::string PTXSubtarget::getTargetString() const {
27 switch(PTXShaderModel) {
28 default: llvm_unreachable("Unknown shader model");
29 case PTX_SM_1_0: return "sm_10";
30 case PTX_SM_1_3: return "sm_13";
31 case PTX_SM_2_0: return "sm_20";
32 }
33}
34
35std::string PTXSubtarget::getPTXVersionString() const {
36 switch(PTXVersion) {
37 default: llvm_unreachable("Unknown PTX version");
38 case PTX_VERSION_1_4: return "1.4";
39 case PTX_VERSION_2_0: return "2.0";
40 case PTX_VERSION_2_1: return "2.1";
41 }
Eric Christopher50880d02010-09-18 18:52:28 +000042}
43
44#include "PTXGenSubtarget.inc"