LLVM 24.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
25#define OPTIONS_STRUCT_DECL
26#include "SparcOptions.inc"
27
28#define GET_SUBTARGETINFO_HEADER
29#include "SparcGenSubtargetInfo.inc"
30
31namespace llvm {
32class SparcTargetMachine;
33class StringRef;
34
36 const SparcOptions &CLOpts;
37
38 // ReserveRegister[i] - Register #i is not available as a general purpose
39 // register.
40 BitVector ReserveRegister;
41
42 virtual void anchor();
43
44#define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER) \
45 bool ATTRIBUTE = DEFAULT;
46#include "SparcGenSubtargetInfo.inc"
47
48 SparcInstrInfo InstrInfo;
49 SparcTargetLowering TLInfo;
50 std::unique_ptr<const SelectionDAGTargetInfo> TSInfo;
51 SparcFrameLowering FrameLowering;
52
53public:
54 SparcSubtarget(const StringRef &CPU, const StringRef &TuneCPU,
55 const StringRef &FS, const SparcTargetMachine &TM);
56
57 ~SparcSubtarget() override;
58
59 const SparcOptions &getCLOpts() const { return CLOpts; }
60
61 const SparcInstrInfo *getInstrInfo() const override { return &InstrInfo; }
62 const TargetFrameLowering *getFrameLowering() const override {
63 return &FrameLowering;
64 }
65 const SparcRegisterInfo *getRegisterInfo() const override {
66 return &InstrInfo.getRegisterInfo();
67 }
68 const SparcTargetLowering *getTargetLowering() const override {
69 return &TLInfo;
70 }
71
72 const SelectionDAGTargetInfo *getSelectionDAGInfo() const override;
73
74 void initLibcallLoweringInfo(LibcallLoweringInfo &Info) const override;
75
76 bool enableMachineScheduler() const override;
77
78#define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER) \
79 bool GETTER() const { return ATTRIBUTE; }
80#include "SparcGenSubtargetInfo.inc"
81
82 /// ParseSubtargetFeatures - Parses features string setting specified
83 /// subtarget options. Definition of function is auto generated by tblgen.
86 StringRef TuneCPU,
87 StringRef FS);
88
89 /// The 64-bit ABI uses biased stack and frame pointers, so the stack frame
90 /// of the current function is the area from [%sp+BIAS] to [%fp+BIAS].
91 int64_t getStackPointerBias() const {
92 return is64Bit() ? 2047 : 0;
93 }
94
95 bool isRegisterReserved(MCPhysReg PhysReg) const {
96 return ReserveRegister[PhysReg];
97 }
98
99 /// Given a actual stack size as determined by FrameInfo, this function
100 /// returns adjusted framesize which includes space for register window
101 /// spills and arguments.
102 int getAdjustedFrameSize(int stackSize) const;
103};
104
105} // end namespace llvm
106
107#endif
static bool is64Bit(const char *name)
Tracks which library functions to use for a particular subtarget or function.
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...
void initLibcallLoweringInfo(LibcallLoweringInfo &Info) const override
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
SparcSubtarget(const StringRef &CPU, const StringRef &TuneCPU, const StringRef &FS, const SparcTargetMachine &TM)
const TargetFrameLowering * getFrameLowering() const override
const SparcOptions & getCLOpts() const
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
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
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