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 "AMDGPUTargetMachine.h"
17#include "MCTargetDesc/R600MCTargetDesc.h"
18
19using namespace llvm;
20
21#define DEBUG_TYPE "r600-subtarget"
22
23#define GET_SUBTARGETINFO_TARGET_DESC
24#define GET_SUBTARGETINFO_CTOR
25#include "R600GenSubtargetInfo.inc"
26
27R600Subtarget::R600Subtarget(const Triple &TT, StringRef GPU, StringRef FS,
28 const AMDGPUTargetMachine &TM)
29 : R600GenSubtargetInfo(TT, GPU, /*TuneCPU*/ GPU, FS),
30 AMDGPUSubtarget(TT, TM.getCLOpts()), InstrInfo(*this),
31 FrameLowering(TargetFrameLowering::StackGrowsUp, getStackAlignment(), 0),
32 TLInfo(TM, initializeSubtargetDependencies(TT, GPU, FS)),
33 InstrItins(getInstrItineraryForCPU(CPU: GPU)) {
34 LocalMemorySize = AddressableLocalMemorySize;
35 // R600 has no MaxWavesPerEU subtarget feature.
36 MaxWavesPerEU = 10;
37 TSInfo = std::make_unique<AMDGPUSelectionDAGInfo>();
38}
39
40R600Subtarget::~R600Subtarget() = default;
41
42const SelectionDAGTargetInfo *R600Subtarget::getSelectionDAGInfo() const {
43 return TSInfo.get();
44}
45
46R600Subtarget &R600Subtarget::initializeSubtargetDependencies(const Triple &TT,
47 StringRef GPU,
48 StringRef FS) {
49 ParseSubtargetFeatures(CPU: GPU, /*TuneCPU*/ GPU, FS);
50
51 HasMulU24 = getGeneration() >= EVERGREEN;
52 HasMulI24 = hasCaymanISA();
53
54 return *this;
55}
56