R600: Use StructurizeCFGPass for non SI targets
[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
17 using namespace llvm;
18
19 #define GET_SUBTARGETINFO_ENUM
20 #define GET_SUBTARGETINFO_TARGET_DESC
21 #define GET_SUBTARGETINFO_CTOR
22 #include "AMDGPUGenSubtargetInfo.inc"
23
24 AMDGPUSubtarget::AMDGPUSubtarget(StringRef TT, StringRef CPU, StringRef FS) :
25   AMDGPUGenSubtargetInfo(TT, CPU, FS), DumpCode(false) {
26     InstrItins = getInstrItineraryForCPU(CPU);
27
28   // Default card
29   StringRef GPU = CPU;
30   Is64bit = false;
31   DefaultSize[0] = 64;
32   DefaultSize[1] = 1;
33   DefaultSize[2] = 1;
34   HasVertexCache = false;
35   TexVTXClauseSize = 0;
36   Gen = AMDGPUSubtarget::R600;
37   FP64 = false;
38   CaymanISA = false;
39   EnableIRStructurizer = false;
40   ParseSubtargetFeatures(GPU, FS);
41   DevName = GPU;
42 }
43
44 bool
45 AMDGPUSubtarget::is64bit() const  {
46   return Is64bit;
47 }
48 bool
49 AMDGPUSubtarget::hasVertexCache() const {
50   return HasVertexCache;
51 }
52 short
53 AMDGPUSubtarget::getTexVTXClauseSize() const {
54   return TexVTXClauseSize;
55 }
56 enum AMDGPUSubtarget::Generation
57 AMDGPUSubtarget::getGeneration() const {
58   return Gen;
59 }
60 bool
61 AMDGPUSubtarget::hasHWFP64() const {
62   return FP64;
63 }
64 bool
65 AMDGPUSubtarget::hasCaymanISA() const {
66   return CaymanISA;
67 }
68 bool
69 AMDGPUSubtarget::IsIRStructurizerEnabled() const {
70   return EnableIRStructurizer;
71 }
72 bool
73 AMDGPUSubtarget::isTargetELF() const {
74   return false;
75 }
76 size_t
77 AMDGPUSubtarget::getDefaultSize(uint32_t dim) const {
78   if (dim > 3) {
79     return 1;
80   } else {
81     return DefaultSize[dim];
82   }
83 }
84
85 std::string
86 AMDGPUSubtarget::getDataLayout() const {
87   std::string DataLayout = std::string(
88    "e"
89    "-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32"
90    "-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128"
91    "-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-v2048:2048:2048"
92    "-n32:64"
93   );
94
95   if (hasHWFP64()) {
96     DataLayout.append("-f64:64:64");
97   }
98
99   if (is64bit()) {
100     DataLayout.append("-p:64:64:64");
101   } else {
102     DataLayout.append("-p:32:32:32");
103   }
104
105   if (Gen >= AMDGPUSubtarget::SOUTHERN_ISLANDS) {
106     DataLayout.append("-p3:32:32:32");
107   }
108
109   return DataLayout;
110 }
111
112 std::string
113 AMDGPUSubtarget::getDeviceName() const {
114   return DevName;
115 }