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
19using 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
28AMDGPUSubtarget::AMDGPUSubtarget(StringRef TT, StringRef GPU, StringRef FS) :
29  AMDGPUGenSubtargetInfo(TT, GPU, FS),
30  DevName(GPU),
31  Is64bit(false),
32  DumpCode(false),
33  R600ALUInst(false),
34  HasVertexCache(false),
35  TexVTXClauseSize(0),
36  Gen(AMDGPUSubtarget::R600),
37  FP64(false),
38  CaymanISA(false),
39  EnableIRStructurizer(true),
40  EnableIfCvt(true),
41  WavefrontSize(0),
42  CFALUBug(false),
43  LocalMemorySize(0),
44  InstrItins(getInstrItineraryForCPU(GPU)) {
45  ParseSubtargetFeatures(GPU, FS);
46
47  if (getGeneration() <= AMDGPUSubtarget::NORTHERN_ISLANDS) {
48    InstrInfo.reset(new R600InstrInfo(*this));
49  } else {
50    InstrInfo.reset(new SIInstrInfo(*this));
51  }
52}
53
54unsigned AMDGPUSubtarget::getStackEntrySize() const {
55  assert(getGeneration() <= NORTHERN_ISLANDS);
56  switch(getWavefrontSize()) {
57  case 16:
58    return 8;
59  case 32:
60    return hasCaymanISA() ? 4 : 8;
61  case 64:
62    return 4;
63  default:
64    llvm_unreachable("Illegal wavefront size.");
65  }
66}
67