LLVM  14.0.0git
VESubtarget.cpp
Go to the documentation of this file.
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"
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 
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 
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; }
llvm::alignTo
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Definition: Alignment.h:148
MathExtras.h
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::VESubtarget::ParseSubtargetFeatures
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
ParseSubtargetFeatures - Parses features string setting specified subtarget options.
llvm::X86AS::FS
@ FS
Definition: X86.h:188
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::VESubtarget::initializeSubtargetDependencies
VESubtarget & initializeSubtargetDependencies(StringRef CPU, StringRef FS)
Definition: VESubtarget.cpp:28
llvm::VESubtarget::VESubtarget
VESubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM)
Definition: VESubtarget.cpp:44
llvm::VESubtarget::getAdjustedFrameSize
uint64_t getAdjustedFrameSize(uint64_t FrameSize) const
Given a actual stack size as determined by FrameInfo, this function returns adjusted framesize which ...
Definition: VESubtarget.cpp:50
VEGenSubtargetInfo
llvm::TargetFrameLowering::getStackAlign
Align getStackAlign() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
Definition: TargetFrameLowering.h:100
llvm::VESubtarget::getRsaSize
unsigned getRsaSize(void) const
Get the size of RSA, return address, and frame pointer as described in VEFrameLowering....
Definition: VESubtarget.h:79
llvm::VESubtarget::enableMachineScheduler
bool enableMachineScheduler() const override
Definition: VESubtarget.cpp:61
uint64_t
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:80
llvm::VEFrameLowering
Definition: VEFrameLowering.h:23
llvm::VESubtarget::getFrameLowering
const VEFrameLowering * getFrameLowering() const override
Definition: VESubtarget.h:52
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
this
Analysis the ScalarEvolution expression for r is this
Definition: README.txt:8
VE.h
llvm::VESubtarget
Definition: VESubtarget.h:31
VESubtarget.h
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
TargetRegistry.h