1249259Sdim//===-- AMDGPUSubtarget.cpp - AMDGPU Subtarget Information ----------------===// 2249259Sdim// 3249259Sdim// The LLVM Compiler Infrastructure 4249259Sdim// 5249259Sdim// This file is distributed under the University of Illinois Open Source 6249259Sdim// License. See LICENSE.TXT for details. 7249259Sdim// 8249259Sdim//===----------------------------------------------------------------------===// 9249259Sdim// 10249259Sdim/// \file 11249259Sdim/// \brief Implements the AMDGPU specific subclass of TargetSubtarget. 12249259Sdim// 13249259Sdim//===----------------------------------------------------------------------===// 14249259Sdim 15249259Sdim#include "AMDGPUSubtarget.h" 16249259Sdim 17249259Sdimusing namespace llvm; 18249259Sdim 19249259Sdim#define GET_SUBTARGETINFO_ENUM 20249259Sdim#define GET_SUBTARGETINFO_TARGET_DESC 21249259Sdim#define GET_SUBTARGETINFO_CTOR 22249259Sdim#include "AMDGPUGenSubtargetInfo.inc" 23249259Sdim 24249259SdimAMDGPUSubtarget::AMDGPUSubtarget(StringRef TT, StringRef CPU, StringRef FS) : 25249259Sdim AMDGPUGenSubtargetInfo(TT, CPU, FS), DumpCode(false) { 26249259Sdim InstrItins = getInstrItineraryForCPU(CPU); 27249259Sdim 28249259Sdim memset(CapsOverride, 0, sizeof(*CapsOverride) 29249259Sdim * AMDGPUDeviceInfo::MaxNumberCapabilities); 30249259Sdim // Default card 31249259Sdim StringRef GPU = CPU; 32249259Sdim Is64bit = false; 33249259Sdim DefaultSize[0] = 64; 34249259Sdim DefaultSize[1] = 1; 35249259Sdim DefaultSize[2] = 1; 36251662Sdim HasVertexCache = false; 37249259Sdim ParseSubtargetFeatures(GPU, FS); 38249259Sdim DevName = GPU; 39249259Sdim Device = AMDGPUDeviceInfo::getDeviceFromName(DevName, this, Is64bit); 40249259Sdim} 41249259Sdim 42249259SdimAMDGPUSubtarget::~AMDGPUSubtarget() { 43249259Sdim delete Device; 44249259Sdim} 45249259Sdim 46249259Sdimbool 47249259SdimAMDGPUSubtarget::isOverride(AMDGPUDeviceInfo::Caps caps) const { 48249259Sdim assert(caps < AMDGPUDeviceInfo::MaxNumberCapabilities && 49249259Sdim "Caps index is out of bounds!"); 50249259Sdim return CapsOverride[caps]; 51249259Sdim} 52249259Sdimbool 53249259SdimAMDGPUSubtarget::is64bit() const { 54249259Sdim return Is64bit; 55249259Sdim} 56249259Sdimbool 57251662SdimAMDGPUSubtarget::hasVertexCache() const { 58251662Sdim return HasVertexCache; 59251662Sdim} 60251662Sdimbool 61249259SdimAMDGPUSubtarget::isTargetELF() const { 62249259Sdim return false; 63249259Sdim} 64249259Sdimsize_t 65249259SdimAMDGPUSubtarget::getDefaultSize(uint32_t dim) const { 66249259Sdim if (dim > 3) { 67249259Sdim return 1; 68249259Sdim } else { 69249259Sdim return DefaultSize[dim]; 70249259Sdim } 71249259Sdim} 72249259Sdim 73249259Sdimstd::string 74249259SdimAMDGPUSubtarget::getDataLayout() const { 75249259Sdim if (!Device) { 76249259Sdim return std::string("e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16" 77249259Sdim "-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:32:32" 78249259Sdim "-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64" 79249259Sdim "-v96:128:128-v128:128:128-v192:256:256-v256:256:256" 80249259Sdim "-v512:512:512-v1024:1024:1024-v2048:2048:2048-a0:0:64"); 81249259Sdim } 82249259Sdim return Device->getDataLayout(); 83249259Sdim} 84249259Sdim 85249259Sdimstd::string 86249259SdimAMDGPUSubtarget::getDeviceName() const { 87249259Sdim return DevName; 88249259Sdim} 89249259Sdimconst AMDGPUDevice * 90249259SdimAMDGPUSubtarget::device() const { 91249259Sdim return Device; 92249259Sdim} 93