1 //===-- R600Subtarget.cpp - R600 Subtarget Information --------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 /// \file 10 /// Implements the R600 specific subclass of TargetSubtarget. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #include "R600Subtarget.h" 15 #include "AMDGPUSelectionDAGInfo.h" 16 #include "MCTargetDesc/R600MCTargetDesc.h" 17 18 using namespace llvm; 19 20 #define DEBUG_TYPE "r600-subtarget" 21 22 #define GET_SUBTARGETINFO_TARGET_DESC 23 #define GET_SUBTARGETINFO_CTOR 24 #include "R600GenSubtargetInfo.inc" 25 26 R600Subtarget::R600Subtarget(const Triple &TT, StringRef GPU, StringRef FS, 27 const TargetMachine &TM) 28 : R600GenSubtargetInfo(TT, GPU, /*TuneCPU*/ GPU, FS), AMDGPUSubtarget(TT), 29 InstrInfo(*this), 30 FrameLowering(TargetFrameLowering::StackGrowsUp, getStackAlignment(), 0), 31 TLInfo(TM, initializeSubtargetDependencies(TT, GPU, FS)), 32 InstrItins(getInstrItineraryForCPU(GPU)) { 33 LocalMemorySize = AddressableLocalMemorySize; 34 TSInfo = std::make_unique<AMDGPUSelectionDAGInfo>(); 35 } 36 37 R600Subtarget::~R600Subtarget() = default; 38 39 const SelectionDAGTargetInfo *R600Subtarget::getSelectionDAGInfo() const { 40 return TSInfo.get(); 41 } 42 43 R600Subtarget &R600Subtarget::initializeSubtargetDependencies(const Triple &TT, 44 StringRef GPU, 45 StringRef FS) { 46 SmallString<256> FullFS("+promote-alloca,"); 47 FullFS += FS; 48 ParseSubtargetFeatures(GPU, /*TuneCPU*/ GPU, FullFS); 49 50 HasMulU24 = getGeneration() >= EVERGREEN; 51 HasMulI24 = hasCaymanISA(); 52 53 return *this; 54 } 55