AMDGPUSubtarget.cpp revision dce4a407a24b04eebc6a376f8e62b41aaa7b071f
1//===-- AMDGPUSubtarget.cpp - AMDGPU Subtarget Information ----------------===//
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/// \file
11/// \brief Implements the AMDGPU specific subclass of TargetSubtarget.
12//
13//===----------------------------------------------------------------------===//
14
15#include "AMDGPUSubtarget.h"
16
17using namespace llvm;
18
19#define DEBUG_TYPE "amdgpu-subtarget"
20
21#define GET_SUBTARGETINFO_ENUM
22#define GET_SUBTARGETINFO_TARGET_DESC
23#define GET_SUBTARGETINFO_CTOR
24#include "AMDGPUGenSubtargetInfo.inc"
25
26AMDGPUSubtarget::AMDGPUSubtarget(StringRef TT, StringRef CPU, StringRef FS) :
27  AMDGPUGenSubtargetInfo(TT, CPU, FS), DumpCode(false) {
28    InstrItins = getInstrItineraryForCPU(CPU);
29
30  // Default card
31  StringRef GPU = CPU;
32  Is64bit = false;
33  HasVertexCache = false;
34  TexVTXClauseSize = 0;
35  Gen = AMDGPUSubtarget::R600;
36  FP64 = false;
37  CaymanISA = false;
38  EnableIRStructurizer = true;
39  EnableIfCvt = true;
40  WavefrontSize = 0;
41  CFALUBug = false;
42  ParseSubtargetFeatures(GPU, FS);
43  DevName = GPU;
44}
45
46bool
47AMDGPUSubtarget::is64bit() const  {
48  return Is64bit;
49}
50bool
51AMDGPUSubtarget::hasVertexCache() const {
52  return HasVertexCache;
53}
54short
55AMDGPUSubtarget::getTexVTXClauseSize() const {
56  return TexVTXClauseSize;
57}
58enum AMDGPUSubtarget::Generation
59AMDGPUSubtarget::getGeneration() const {
60  return Gen;
61}
62bool
63AMDGPUSubtarget::hasHWFP64() const {
64  return FP64;
65}
66bool
67AMDGPUSubtarget::hasCaymanISA() const {
68  return CaymanISA;
69}
70bool
71AMDGPUSubtarget::IsIRStructurizerEnabled() const {
72  return EnableIRStructurizer;
73}
74bool
75AMDGPUSubtarget::isIfCvtEnabled() const {
76  return EnableIfCvt;
77}
78unsigned
79AMDGPUSubtarget::getWavefrontSize() const {
80  return WavefrontSize;
81}
82unsigned
83AMDGPUSubtarget::getStackEntrySize() const {
84  assert(getGeneration() <= NORTHERN_ISLANDS);
85  switch(getWavefrontSize()) {
86  case 16:
87    return 8;
88  case 32:
89    if (hasCaymanISA())
90      return 4;
91    else
92      return 8;
93  case 64:
94    return 4;
95  default:
96    llvm_unreachable("Illegal wavefront size.");
97  }
98}
99bool
100AMDGPUSubtarget::hasCFAluBug() const {
101  assert(getGeneration() <= NORTHERN_ISLANDS);
102  return CFALUBug;
103}
104bool
105AMDGPUSubtarget::isTargetELF() const {
106  return false;
107}
108
109std::string
110AMDGPUSubtarget::getDeviceName() const {
111  return DevName;
112}
113