Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 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" |
Tom Stellard | 2e59a45 | 2014-06-13 01:32:00 +0000 | [diff] [blame] | 16 | #include "R600InstrInfo.h" |
| 17 | #include "SIInstrInfo.h" |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 18 | |
| 19 | using namespace llvm; |
| 20 | |
Chandler Carruth | e96dd89 | 2014-04-21 22:55:11 +0000 | [diff] [blame] | 21 | #define DEBUG_TYPE "amdgpu-subtarget" |
| 22 | |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 23 | #define GET_SUBTARGETINFO_ENUM |
| 24 | #define GET_SUBTARGETINFO_TARGET_DESC |
| 25 | #define GET_SUBTARGETINFO_CTOR |
| 26 | #include "AMDGPUGenSubtargetInfo.inc" |
| 27 | |
Matt Arsenault | d782d05 | 2014-06-27 17:57:00 +0000 | [diff] [blame^] | 28 | AMDGPUSubtarget::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 Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 45 | ParseSubtargetFeatures(GPU, FS); |
Tom Stellard | 2e59a45 | 2014-06-13 01:32:00 +0000 | [diff] [blame] | 46 | |
| 47 | if (getGeneration() <= AMDGPUSubtarget::NORTHERN_ISLANDS) { |
| 48 | InstrInfo.reset(new R600InstrInfo(*this)); |
| 49 | } else { |
| 50 | InstrInfo.reset(new SIInstrInfo(*this)); |
| 51 | } |
Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame] | 52 | } |
| 53 | |
Matt Arsenault | d782d05 | 2014-06-27 17:57:00 +0000 | [diff] [blame^] | 54 | unsigned AMDGPUSubtarget::getStackEntrySize() const { |
Tom Stellard | a40f971 | 2014-01-22 21:55:43 +0000 | [diff] [blame] | 55 | assert(getGeneration() <= NORTHERN_ISLANDS); |
| 56 | switch(getWavefrontSize()) { |
| 57 | case 16: |
| 58 | return 8; |
| 59 | case 32: |
Matt Arsenault | d782d05 | 2014-06-27 17:57:00 +0000 | [diff] [blame^] | 60 | return hasCaymanISA() ? 4 : 8; |
Tom Stellard | a40f971 | 2014-01-22 21:55:43 +0000 | [diff] [blame] | 61 | case 64: |
| 62 | return 4; |
| 63 | default: |
| 64 | llvm_unreachable("Illegal wavefront size."); |
| 65 | } |
| 66 | } |