xref: /llvm-project/llvm/lib/Target/VE/VESubtarget.cpp (revision ed8019d9fbed2e6a6b08f8f73e9fa54a24f3ed52)
1 //===-- VESubtarget.cpp - VE 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 // This file implements the VE specific subclass of TargetSubtargetInfo.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "VESubtarget.h"
14 #include "llvm/MC/TargetRegistry.h"
15 
16 using namespace llvm;
17 
18 #define DEBUG_TYPE "ve-subtarget"
19 
20 #define GET_SUBTARGETINFO_TARGET_DESC
21 #define GET_SUBTARGETINFO_CTOR
22 #include "VEGenSubtargetInfo.inc"
23 
24 void VESubtarget::anchor() {}
25 
26 VESubtarget &VESubtarget::initializeSubtargetDependencies(StringRef CPU,
27                                                           StringRef FS) {
28   // Default feature settings
29   EnableVPU = false;
30 
31   // Determine default and user specified characteristics
32   std::string CPUName = std::string(CPU);
33   if (CPUName.empty())
34     CPUName = "generic";
35 
36   // Parse features string.
37   ParseSubtargetFeatures(CPUName, /*TuneCPU=*/CPU, FS);
38 
39   return *this;
40 }
41 
42 VESubtarget::VESubtarget(const Triple &TT, const std::string &CPU,
43                          const std::string &FS, const TargetMachine &TM)
44     : VEGenSubtargetInfo(TT, CPU, /*TuneCPU=*/CPU, FS), TargetTriple(TT),
45       InstrInfo(initializeSubtargetDependencies(CPU, FS)), TLInfo(TM, *this),
46       FrameLowering(*this) {}
47 
48 uint64_t VESubtarget::getAdjustedFrameSize(uint64_t FrameSize) const {
49   // Calculate adjusted frame size by adding the size of RSA frame,
50   // return address, and frame poitner as described in VEFrameLowering.cpp.
51   const VEFrameLowering *TFL = getFrameLowering();
52 
53   FrameSize += getRsaSize();
54   FrameSize = alignTo(FrameSize, TFL->getStackAlign());
55 
56   return FrameSize;
57 }
58 
59 bool VESubtarget::enableMachineScheduler() const { return true; }
60