1 //===-- AMDGPUSubtarget.cpp - AMDGPU Subtarget Information ----------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// \brief Implements the AMDGPU specific subclass of TargetSubtarget.
13 //===----------------------------------------------------------------------===//
15 #include "AMDGPUSubtarget.h"
16 #include "R600InstrInfo.h"
17 #include "SIInstrInfo.h"
19 #include "llvm/ADT/SmallString.h"
23 #define DEBUG_TYPE "amdgpu-subtarget"
25 #define GET_SUBTARGETINFO_ENUM
26 #define GET_SUBTARGETINFO_TARGET_DESC
27 #define GET_SUBTARGETINFO_CTOR
28 #include "AMDGPUGenSubtargetInfo.inc"
30 AMDGPUSubtarget::AMDGPUSubtarget(StringRef TT, StringRef GPU, StringRef FS) :
31 AMDGPUGenSubtargetInfo(TT, GPU, FS),
36 HasVertexCache(false),
38 Gen(AMDGPUSubtarget::R600),
41 EnableIRStructurizer(true),
42 EnablePromoteAlloca(false),
47 InstrItins(getInstrItineraryForCPU(GPU)) {
49 SmallString<256> FullFS("+promote-alloca,");
52 ParseSubtargetFeatures(GPU, FullFS);
54 if (getGeneration() <= AMDGPUSubtarget::NORTHERN_ISLANDS) {
55 InstrInfo.reset(new R600InstrInfo(*this));
57 InstrInfo.reset(new SIInstrInfo(*this));
61 unsigned AMDGPUSubtarget::getStackEntrySize() const {
62 assert(getGeneration() <= NORTHERN_ISLANDS);
63 switch(getWavefrontSize()) {
67 return hasCaymanISA() ? 4 : 8;
71 llvm_unreachable("Illegal wavefront size.");