blob: b83c290c1f030e1ff70a0d09a6a4ed7e74acb9e7 [file] [log] [blame]
Tom Stellard75aadc22012-12-11 21:25:42 +00001//===-- 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"
Tom Stellard2e59a452014-06-13 01:32:00 +000016#include "R600InstrInfo.h"
17#include "SIInstrInfo.h"
Tom Stellard75aadc22012-12-11 21:25:42 +000018
19using namespace llvm;
20
Chandler Carruthe96dd892014-04-21 22:55:11 +000021#define DEBUG_TYPE "amdgpu-subtarget"
22
Tom Stellard75aadc22012-12-11 21:25:42 +000023#define GET_SUBTARGETINFO_ENUM
24#define GET_SUBTARGETINFO_TARGET_DESC
25#define GET_SUBTARGETINFO_CTOR
26#include "AMDGPUGenSubtargetInfo.inc"
27
Matt Arsenaultd782d052014-06-27 17:57:00 +000028AMDGPUSubtarget::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)) {
Tom Stellard75aadc22012-12-11 21:25:42 +000045 ParseSubtargetFeatures(GPU, FS);
Tom Stellard2e59a452014-06-13 01:32:00 +000046
47 if (getGeneration() <= AMDGPUSubtarget::NORTHERN_ISLANDS) {
48 InstrInfo.reset(new R600InstrInfo(*this));
49 } else {
50 InstrInfo.reset(new SIInstrInfo(*this));
51 }
Tom Stellard75aadc22012-12-11 21:25:42 +000052}
53
Matt Arsenaultd782d052014-06-27 17:57:00 +000054unsigned AMDGPUSubtarget::getStackEntrySize() const {
Tom Stellarda40f9712014-01-22 21:55:43 +000055 assert(getGeneration() <= NORTHERN_ISLANDS);
56 switch(getWavefrontSize()) {
57 case 16:
58 return 8;
59 case 32:
Matt Arsenaultd782d052014-06-27 17:57:00 +000060 return hasCaymanISA() ? 4 : 8;
Tom Stellarda40f9712014-01-22 21:55:43 +000061 case 64:
62 return 4;
63 default:
64 llvm_unreachable("Illegal wavefront size.");
65 }
66}