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