Mercurial > hg > Members > tobaru > cbc > CbC_llvm
comparison lib/Target/R600/AMDGPUSubtarget.cpp @ 0:95c75e76d11b
LLVM 3.4
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 12 Dec 2013 13:56:28 +0900 |
parents | |
children | e4204d083e25 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:95c75e76d11b |
---|---|
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 = true; | |
40 EnableIfCvt = true; | |
41 ParseSubtargetFeatures(GPU, FS); | |
42 DevName = GPU; | |
43 } | |
44 | |
45 bool | |
46 AMDGPUSubtarget::is64bit() const { | |
47 return Is64bit; | |
48 } | |
49 bool | |
50 AMDGPUSubtarget::hasVertexCache() const { | |
51 return HasVertexCache; | |
52 } | |
53 short | |
54 AMDGPUSubtarget::getTexVTXClauseSize() const { | |
55 return TexVTXClauseSize; | |
56 } | |
57 enum AMDGPUSubtarget::Generation | |
58 AMDGPUSubtarget::getGeneration() const { | |
59 return Gen; | |
60 } | |
61 bool | |
62 AMDGPUSubtarget::hasHWFP64() const { | |
63 return FP64; | |
64 } | |
65 bool | |
66 AMDGPUSubtarget::hasCaymanISA() const { | |
67 return CaymanISA; | |
68 } | |
69 bool | |
70 AMDGPUSubtarget::IsIRStructurizerEnabled() const { | |
71 return EnableIRStructurizer; | |
72 } | |
73 bool | |
74 AMDGPUSubtarget::isIfCvtEnabled() const { | |
75 return EnableIfCvt; | |
76 } | |
77 bool | |
78 AMDGPUSubtarget::isTargetELF() const { | |
79 return false; | |
80 } | |
81 size_t | |
82 AMDGPUSubtarget::getDefaultSize(uint32_t dim) const { | |
83 if (dim > 3) { | |
84 return 1; | |
85 } else { | |
86 return DefaultSize[dim]; | |
87 } | |
88 } | |
89 | |
90 std::string | |
91 AMDGPUSubtarget::getDataLayout() const { | |
92 std::string DataLayout = std::string( | |
93 "e" | |
94 "-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32" | |
95 "-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128" | |
96 "-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-v2048:2048:2048" | |
97 "-n32:64" | |
98 ); | |
99 | |
100 if (hasHWFP64()) { | |
101 DataLayout.append("-f64:64:64"); | |
102 } | |
103 | |
104 if (is64bit()) { | |
105 DataLayout.append("-p:64:64:64"); | |
106 } else { | |
107 DataLayout.append("-p:32:32:32"); | |
108 } | |
109 | |
110 if (Gen >= AMDGPUSubtarget::SOUTHERN_ISLANDS) { | |
111 DataLayout.append("-p3:32:32:32"); | |
112 } | |
113 | |
114 return DataLayout; | |
115 } | |
116 | |
117 std::string | |
118 AMDGPUSubtarget::getDeviceName() const { | |
119 return DevName; | |
120 } |