R600: Use LDS and vectors for private memory
[oota-llvm.git] / lib / Target / R600 / AMDGPUSubtarget.cpp
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 #include "R600InstrInfo.h"
17 #include "SIInstrInfo.h"
18
19 using namespace llvm;
20
21 #define DEBUG_TYPE "amdgpu-subtarget"
22
23 #define GET_SUBTARGETINFO_ENUM
24 #define GET_SUBTARGETINFO_TARGET_DESC
25 #define GET_SUBTARGETINFO_CTOR
26 #include "AMDGPUGenSubtargetInfo.inc"
27
28 AMDGPUSubtarget::AMDGPUSubtarget(StringRef TT, StringRef CPU, StringRef FS) :
29   AMDGPUGenSubtargetInfo(TT, CPU, FS), DumpCode(false) {
30     InstrItins = getInstrItineraryForCPU(CPU);
31
32   // Default card
33   StringRef GPU = CPU;
34   Is64bit = false;
35   HasVertexCache = false;
36   TexVTXClauseSize = 0;
37   Gen = AMDGPUSubtarget::R600;
38   FP64 = false;
39   CaymanISA = false;
40   EnableIRStructurizer = true;
41   EnableIfCvt = true;
42   WavefrontSize = 0;
43   CFALUBug = false;
44   LocalMemorySize = 0;
45   ParseSubtargetFeatures(GPU, FS);
46   DevName = GPU;
47
48   if (getGeneration() <= AMDGPUSubtarget::NORTHERN_ISLANDS) {
49     InstrInfo.reset(new R600InstrInfo(*this));
50   } else {
51     InstrInfo.reset(new SIInstrInfo(*this));
52   }
53 }
54
55 bool
56 AMDGPUSubtarget::is64bit() const  {
57   return Is64bit;
58 }
59 bool
60 AMDGPUSubtarget::hasVertexCache() const {
61   return HasVertexCache;
62 }
63 short
64 AMDGPUSubtarget::getTexVTXClauseSize() const {
65   return TexVTXClauseSize;
66 }
67 enum AMDGPUSubtarget::Generation
68 AMDGPUSubtarget::getGeneration() const {
69   return Gen;
70 }
71 bool
72 AMDGPUSubtarget::hasHWFP64() const {
73   return FP64;
74 }
75 bool
76 AMDGPUSubtarget::hasCaymanISA() const {
77   return CaymanISA;
78 }
79 bool
80 AMDGPUSubtarget::IsIRStructurizerEnabled() const {
81   return EnableIRStructurizer;
82 }
83 bool
84 AMDGPUSubtarget::isIfCvtEnabled() const {
85   return EnableIfCvt;
86 }
87 unsigned
88 AMDGPUSubtarget::getWavefrontSize() const {
89   return WavefrontSize;
90 }
91 unsigned
92 AMDGPUSubtarget::getStackEntrySize() const {
93   assert(getGeneration() <= NORTHERN_ISLANDS);
94   switch(getWavefrontSize()) {
95   case 16:
96     return 8;
97   case 32:
98     if (hasCaymanISA())
99       return 4;
100     else
101       return 8;
102   case 64:
103     return 4;
104   default:
105     llvm_unreachable("Illegal wavefront size.");
106   }
107 }
108 bool
109 AMDGPUSubtarget::hasCFAluBug() const {
110   assert(getGeneration() <= NORTHERN_ISLANDS);
111   return CFALUBug;
112 }
113 int
114 AMDGPUSubtarget::getLocalMemorySize() const {
115   return LocalMemorySize;
116 }
117 bool
118 AMDGPUSubtarget::isTargetELF() const {
119   return false;
120 }
121
122 std::string
123 AMDGPUSubtarget::getDeviceName() const {
124   return DevName;
125 }