LLVM 22.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 "VESelectionDAGInfo.h"
16
17using namespace llvm;
18
19#define DEBUG_TYPE "ve-subtarget"
20
21#define GET_SUBTARGETINFO_TARGET_DESC
22#define GET_SUBTARGETINFO_CTOR
23#include "VEGenSubtargetInfo.inc"
24
25void VESubtarget::anchor() {}
26
28 StringRef FS) {
29 // Default feature settings
30 EnableVPU = false;
31
32 // Determine default and user specified characteristics
33 std::string CPUName = std::string(CPU);
34 if (CPUName.empty())
35 CPUName = "generic";
36
37 // Parse features string.
38 ParseSubtargetFeatures(CPUName, /*TuneCPU=*/CPU, FS);
39
40 return *this;
41}
42
43VESubtarget::VESubtarget(const Triple &TT, const std::string &CPU,
44 const std::string &FS, const TargetMachine &TM)
45 : VEGenSubtargetInfo(TT, CPU, /*TuneCPU=*/CPU, FS), TargetTriple(TT),
46 InstrInfo(initializeSubtargetDependencies(CPU, FS)), TLInfo(TM, *this),
47 FrameLowering(*this) {
48 TSInfo = std::make_unique<VESelectionDAGInfo>();
49}
50
52
54 return TSInfo.get();
55}
56
58 // Calculate adjusted frame size by adding the size of RSA frame,
59 // return address, and frame poitner as described in VEFrameLowering.cpp.
60 const VEFrameLowering *TFL = getFrameLowering();
61
62 FrameSize += getRsaSize();
63 FrameSize = alignTo(FrameSize, TFL->getStackAlign());
64
65 return FrameSize;
66}
67
68bool VESubtarget::enableMachineScheduler() const { return true; }
Targets can subclass this to parameterize the SelectionDAG lowering and instruction selection process...
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
Align getStackAlign() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
Primary interface to the complete machine description for the target machine.
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:47
~VESubtarget() override
uint64_t getAdjustedFrameSize(uint64_t FrameSize) const
Given a actual stack size as determined by FrameInfo, this function returns adjusted framesize which ...
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
ParseSubtargetFeatures - Parses features string setting specified subtarget options.
bool enableMachineScheduler() const override
unsigned getRsaSize() const
Get the size of RSA, return address, and frame pointer as described in VEFrameLowering....
Definition VESubtarget.h:79
const SelectionDAGTargetInfo * getSelectionDAGInfo() const override
VESubtarget & initializeSubtargetDependencies(StringRef CPU, StringRef FS)
VESubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM)
const VEFrameLowering * getFrameLowering() const override
Definition VESubtarget.h:53
This is an optimization pass for GlobalISel generic memory operations.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Definition Alignment.h:144