0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 //===-- AMDGPUSubtarget.cpp - AMDGPU Subtarget Information ----------------===//
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 //
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 // The LLVM Compiler Infrastructure
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 //
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 // This file is distributed under the University of Illinois Open Source
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 // License. See LICENSE.TXT for details.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 //
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 //===----------------------------------------------------------------------===//
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 //
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 /// \file
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 /// \brief Implements the AMDGPU specific subclass of TargetSubtarget.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 //
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 //===----------------------------------------------------------------------===//
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15 #include "AMDGPUSubtarget.h"
|
77
|
16 #include "R600ISelLowering.h"
|
|
17 #include "R600InstrInfo.h"
|
|
18 #include "R600MachineScheduler.h"
|
|
19 #include "SIInstrInfo.h"
|
|
20 #include "SIISelLowering.h"
|
|
21 #include "llvm/ADT/SmallString.h"
|
|
22
|
|
23 #include "llvm/ADT/SmallString.h"
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
25 using namespace llvm;
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
26
|
77
|
27 #define DEBUG_TYPE "amdgpu-subtarget"
|
|
28
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
29 #define GET_SUBTARGETINFO_ENUM
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
30 #define GET_SUBTARGETINFO_TARGET_DESC
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
31 #define GET_SUBTARGETINFO_CTOR
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
32 #include "AMDGPUGenSubtargetInfo.inc"
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
33
|
77
|
34 static std::string computeDataLayout(const AMDGPUSubtarget &ST) {
|
|
35 std::string Ret = "e-p:32:32";
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
36
|
77
|
37 if (ST.is64bit()) {
|
|
38 // 32-bit private, local, and region pointers. 64-bit global and constant.
|
|
39 Ret += "-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-p24:64:64";
|
|
40 }
|
|
41
|
|
42 Ret += "-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256"
|
|
43 "-v512:512-v1024:1024-v2048:2048-n32:64";
|
|
44
|
|
45 return Ret;
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
46 }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
47
|
77
|
48 AMDGPUSubtarget &
|
|
49 AMDGPUSubtarget::initializeSubtargetDependencies(StringRef GPU, StringRef FS) {
|
|
50 // Determine default and user-specified characteristics
|
|
51 // On SI+, we want FP64 denormals to be on by default. FP32 denormals can be
|
|
52 // enabled, but some instructions do not respect them and they run at the
|
|
53 // double precision rate, so don't enable by default.
|
|
54 //
|
|
55 // We want to be able to turn these off, but making this a subtarget feature
|
|
56 // for SI has the unhelpful behavior that it unsets everything else if you
|
|
57 // disable it.
|
|
58
|
|
59 SmallString<256> FullFS("+promote-alloca,+fp64-denormals,");
|
|
60 FullFS += FS;
|
|
61
|
|
62 ParseSubtargetFeatures(GPU, FullFS);
|
|
63
|
|
64 // FIXME: I don't think think Evergreen has any useful support for
|
|
65 // denormals, but should be checked. Should we issue a warning somewhere
|
|
66 // if someone tries to enable these?
|
|
67 if (getGeneration() <= AMDGPUSubtarget::NORTHERN_ISLANDS) {
|
|
68 FP32Denormals = false;
|
|
69 FP64Denormals = false;
|
|
70 }
|
|
71 return *this;
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
72 }
|
77
|
73
|
|
74 AMDGPUSubtarget::AMDGPUSubtarget(StringRef TT, StringRef GPU, StringRef FS,
|
|
75 TargetMachine &TM)
|
|
76 : AMDGPUGenSubtargetInfo(TT, GPU, FS), DevName(GPU), Is64bit(false),
|
|
77 DumpCode(false), R600ALUInst(false), HasVertexCache(false),
|
|
78 TexVTXClauseSize(0), Gen(AMDGPUSubtarget::R600), FP64(false),
|
|
79 FP64Denormals(false), FP32Denormals(false), CaymanISA(false),
|
|
80 EnableIRStructurizer(true), EnablePromoteAlloca(false), EnableIfCvt(true),
|
|
81 WavefrontSize(0), CFALUBug(false), LocalMemorySize(0),
|
|
82 DL(computeDataLayout(initializeSubtargetDependencies(GPU, FS))),
|
|
83 FrameLowering(TargetFrameLowering::StackGrowsUp,
|
|
84 64 * 16, // Maximum stack alignment (long16)
|
|
85 0),
|
|
86 InstrItins(getInstrItineraryForCPU(GPU)) {
|
|
87
|
|
88 if (getGeneration() <= AMDGPUSubtarget::NORTHERN_ISLANDS) {
|
|
89 InstrInfo.reset(new R600InstrInfo(*this));
|
|
90 TLInfo.reset(new R600TargetLowering(TM));
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
91 } else {
|
77
|
92 InstrInfo.reset(new SIInstrInfo(*this));
|
|
93 TLInfo.reset(new SITargetLowering(TM));
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
94 }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
95 }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
96
|
77
|
97 unsigned AMDGPUSubtarget::getStackEntrySize() const {
|
|
98 assert(getGeneration() <= NORTHERN_ISLANDS);
|
|
99 switch(getWavefrontSize()) {
|
|
100 case 16:
|
|
101 return 8;
|
|
102 case 32:
|
|
103 return hasCaymanISA() ? 4 : 8;
|
|
104 case 64:
|
|
105 return 4;
|
|
106 default:
|
|
107 llvm_unreachable("Illegal wavefront size.");
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
108 }
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
109 }
|