LLVM 22.0.0git
SparcSubtarget.h
Go to the documentation of this file.
1//===-- SparcSubtarget.h - Define Subtarget for the SPARC -------*- C++ -*-===//
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 declares the SPARC specific subclass of TargetSubtargetInfo.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_SPARC_SPARCSUBTARGET_H
14#define LLVM_LIB_TARGET_SPARC_SPARCSUBTARGET_H
15
17#include "SparcFrameLowering.h"
18#include "SparcISelLowering.h"
19#include "SparcInstrInfo.h"
21#include "llvm/IR/DataLayout.h"
24#include <string>
25
26#define GET_SUBTARGETINFO_HEADER
27#include "SparcGenSubtargetInfo.inc"
28
29namespace llvm {
30class StringRef;
31
33 // ReserveRegister[i] - Register #i is not available as a general purpose
34 // register.
35 BitVector ReserveRegister;
36
37 virtual void anchor();
38
39#define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER) \
40 bool ATTRIBUTE = DEFAULT;
41#include "SparcGenSubtargetInfo.inc"
42
43 SparcInstrInfo InstrInfo;
44 SparcTargetLowering TLInfo;
45 std::unique_ptr<const SelectionDAGTargetInfo> TSInfo;
46 SparcFrameLowering FrameLowering;
47
48public:
49 SparcSubtarget(const StringRef &CPU, const StringRef &TuneCPU,
50 const StringRef &FS, const TargetMachine &TM);
51
52 ~SparcSubtarget() override;
53
54 const SparcInstrInfo *getInstrInfo() const override { return &InstrInfo; }
55 const TargetFrameLowering *getFrameLowering() const override {
56 return &FrameLowering;
57 }
58 const SparcRegisterInfo *getRegisterInfo() const override {
59 return &InstrInfo.getRegisterInfo();
60 }
61 const SparcTargetLowering *getTargetLowering() const override {
62 return &TLInfo;
63 }
64
65 const SelectionDAGTargetInfo *getSelectionDAGInfo() const override;
66
67 bool enableMachineScheduler() const override;
68
69#define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER) \
70 bool GETTER() const { return ATTRIBUTE; }
71#include "SparcGenSubtargetInfo.inc"
72
73 /// ParseSubtargetFeatures - Parses features string setting specified
74 /// subtarget options. Definition of function is auto generated by tblgen.
77 StringRef TuneCPU,
78 StringRef FS);
79
80 /// The 64-bit ABI uses biased stack and frame pointers, so the stack frame
81 /// of the current function is the area from [%sp+BIAS] to [%fp+BIAS].
82 int64_t getStackPointerBias() const {
83 return is64Bit() ? 2047 : 0;
84 }
85
86 bool isRegisterReserved(MCPhysReg PhysReg) const {
87 return ReserveRegister[PhysReg];
88 }
89
90 /// Given a actual stack size as determined by FrameInfo, this function
91 /// returns adjusted framesize which includes space for register window
92 /// spills and arguments.
93 int getAdjustedFrameSize(int stackSize) const;
94};
95
96} // end namespace llvm
97
98#endif
static bool is64Bit(const char *name)
Targets can subclass this to parameterize the SelectionDAG lowering and instruction selection process...
const SparcRegisterInfo * getRegisterInfo() const override
int64_t getStackPointerBias() const
The 64-bit ABI uses biased stack and frame pointers, so the stack frame of the current function is th...
const SparcTargetLowering * getTargetLowering() const override
~SparcSubtarget() override
int getAdjustedFrameSize(int stackSize) const
Given a actual stack size as determined by FrameInfo, this function returns adjusted framesize which ...
bool enableMachineScheduler() const override
const TargetFrameLowering * getFrameLowering() const override
SparcSubtarget(const StringRef &CPU, const StringRef &TuneCPU, const StringRef &FS, const TargetMachine &TM)
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
ParseSubtargetFeatures - Parses features string setting specified subtarget options.
SparcSubtarget & initializeSubtargetDependencies(StringRef CPU, StringRef TuneCPU, StringRef FS)
bool isRegisterReserved(MCPhysReg PhysReg) const
const SparcInstrInfo * getInstrInfo() const override
const SelectionDAGTargetInfo * getSelectionDAGInfo() const override
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
Information about stack frame layout on the target.
This is an optimization pass for GlobalISel generic memory operations.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
Definition MCRegister.h:21