LLVM  10.0.0
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"
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  // Determine default and user specified characteristics
31  std::string CPUName = CPU;
32  if (CPUName.empty())
33  CPUName = "ve";
34 
35  // Parse features string.
36  ParseSubtargetFeatures(CPUName, FS);
37 
38  return *this;
39 }
40 
41 VESubtarget::VESubtarget(const Triple &TT, const std::string &CPU,
42  const std::string &FS, const TargetMachine &TM)
43  : VEGenSubtargetInfo(TT, CPU, FS), TargetTriple(TT),
44  InstrInfo(initializeSubtargetDependencies(CPU, FS)), TLInfo(TM, *this),
45  FrameLowering(*this) {}
46 
47 int VESubtarget::getAdjustedFrameSize(int frameSize) const {
48 
49  // VE stack frame:
50  //
51  // +----------------------------------------+
52  // | Locals and temporaries |
53  // +----------------------------------------+
54  // | Parameter area for callee |
55  // 176(fp) | |
56  // +----------------------------------------+
57  // | Register save area (RSA) for callee |
58  // | |
59  // 16(fp) | 20 * 8 bytes |
60  // +----------------------------------------+
61  // 8(fp) | Return address |
62  // +----------------------------------------+
63  // 0(fp) | Frame pointer of caller |
64  // --------+----------------------------------------+--------
65  // | Locals and temporaries for callee |
66  // +----------------------------------------+
67  // | Parameter area for callee of callee |
68  // +----------------------------------------+
69  // 16(sp) | RSA for callee of callee |
70  // +----------------------------------------+
71  // 8(sp) | Return address |
72  // +----------------------------------------+
73  // 0(sp) | Frame pointer of callee |
74  // +----------------------------------------+
75 
76  // RSA frame:
77  // +----------------------------------------------+
78  // 168(fp) | %s33 |
79  // +----------------------------------------------+
80  // | %s19...%s32 |
81  // +----------------------------------------------+
82  // 48(fp) | %s18 |
83  // +----------------------------------------------+
84  // 40(fp) | Linkage area register (%s17) |
85  // +----------------------------------------------+
86  // 32(fp) | Procedure linkage table register (%plt=%s16) |
87  // +----------------------------------------------+
88  // 24(fp) | Global offset table register (%got=%s15) |
89  // +----------------------------------------------+
90  // 16(fp) | Thread pointer register (%tp=%s14) |
91  // +----------------------------------------------+
92 
93  frameSize += 176; // for RSA, RA, and FP
94  frameSize = alignTo(frameSize, 16); // requires 16 bytes alignment
95 
96  return frameSize;
97 }
98 
99 bool VESubtarget::enableMachineScheduler() const { return true; }
This class represents lattice values for constants.
Definition: AllocatorList.h:23
VESubtarget & initializeSubtargetDependencies(StringRef CPU, StringRef FS)
Definition: VESubtarget.cpp:28
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:43
int getAdjustedFrameSize(int stackSize) const
Given a actual stack size as determined by FrameInfo, this function returns adjusted framesize which ...
Definition: VESubtarget.cpp:47
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Definition: Alignment.h:163
bool enableMachineScheduler() const override
Definition: VESubtarget.cpp:99
VESubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM)
Definition: VESubtarget.cpp:41
void ParseSubtargetFeatures(StringRef CPU, StringRef FS)
ParseSubtargetFeatures - Parses features string setting specified subtarget options.
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:65
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:54