xref: /freebsd/contrib/llvm-project/llvm/lib/Target/AMDGPU/R600Subtarget.cpp (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
1349cc55cSDimitry Andric //===-- R600Subtarget.cpp - R600 Subtarget Information --------------------===//
2349cc55cSDimitry Andric //
3349cc55cSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4349cc55cSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5349cc55cSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6349cc55cSDimitry Andric //
7349cc55cSDimitry Andric //===----------------------------------------------------------------------===//
8349cc55cSDimitry Andric //
9349cc55cSDimitry Andric /// \file
10349cc55cSDimitry Andric /// Implements the R600 specific subclass of TargetSubtarget.
11349cc55cSDimitry Andric //
12349cc55cSDimitry Andric //===----------------------------------------------------------------------===//
13349cc55cSDimitry Andric 
14349cc55cSDimitry Andric #include "R600Subtarget.h"
15349cc55cSDimitry Andric #include "MCTargetDesc/R600MCTargetDesc.h"
16349cc55cSDimitry Andric 
17349cc55cSDimitry Andric using namespace llvm;
18349cc55cSDimitry Andric 
19349cc55cSDimitry Andric #define DEBUG_TYPE "r600-subtarget"
20349cc55cSDimitry Andric 
21349cc55cSDimitry Andric #define GET_SUBTARGETINFO_TARGET_DESC
22349cc55cSDimitry Andric #define GET_SUBTARGETINFO_CTOR
23349cc55cSDimitry Andric #include "R600GenSubtargetInfo.inc"
24349cc55cSDimitry Andric 
R600Subtarget(const Triple & TT,StringRef GPU,StringRef FS,const TargetMachine & TM)25349cc55cSDimitry Andric R600Subtarget::R600Subtarget(const Triple &TT, StringRef GPU, StringRef FS,
26349cc55cSDimitry Andric                              const TargetMachine &TM)
27349cc55cSDimitry Andric     : R600GenSubtargetInfo(TT, GPU, /*TuneCPU*/ GPU, FS), AMDGPUSubtarget(TT),
28349cc55cSDimitry Andric       InstrInfo(*this),
29349cc55cSDimitry Andric       FrameLowering(TargetFrameLowering::StackGrowsUp, getStackAlignment(), 0),
30349cc55cSDimitry Andric       TLInfo(TM, initializeSubtargetDependencies(TT, GPU, FS)),
31*bdd1243dSDimitry Andric       InstrItins(getInstrItineraryForCPU(GPU)) {
32*bdd1243dSDimitry Andric   AddressableLocalMemorySize = LocalMemorySize;
33*bdd1243dSDimitry Andric }
34349cc55cSDimitry Andric 
initializeSubtargetDependencies(const Triple & TT,StringRef GPU,StringRef FS)35349cc55cSDimitry Andric R600Subtarget &R600Subtarget::initializeSubtargetDependencies(const Triple &TT,
36349cc55cSDimitry Andric                                                               StringRef GPU,
37349cc55cSDimitry Andric                                                               StringRef FS) {
38349cc55cSDimitry Andric   SmallString<256> FullFS("+promote-alloca,");
39349cc55cSDimitry Andric   FullFS += FS;
40349cc55cSDimitry Andric   ParseSubtargetFeatures(GPU, /*TuneCPU*/ GPU, FullFS);
41349cc55cSDimitry Andric 
42349cc55cSDimitry Andric   HasMulU24 = getGeneration() >= EVERGREEN;
43349cc55cSDimitry Andric   HasMulI24 = hasCaymanISA();
44349cc55cSDimitry Andric 
45349cc55cSDimitry Andric   return *this;
46349cc55cSDimitry Andric }
47