Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / lib / Target / Sparc / SparcSubtarget.h
blob8e3d05d5d7e5df224c237c39c6d827d0a927deb1
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.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_SPARC_SPARCSUBTARGET_H
14 #define LLVM_LIB_TARGET_SPARC_SPARCSUBTARGET_H
16 #include "SparcFrameLowering.h"
17 #include "SparcISelLowering.h"
18 #include "SparcInstrInfo.h"
19 #include "llvm/CodeGen/SelectionDAGTargetInfo.h"
20 #include "llvm/CodeGen/TargetSubtargetInfo.h"
21 #include "llvm/IR/DataLayout.h"
22 #include "llvm/TargetParser/Triple.h"
23 #include <string>
25 #define GET_SUBTARGETINFO_HEADER
26 #include "SparcGenSubtargetInfo.inc"
28 namespace llvm {
29 class StringRef;
31 class SparcSubtarget : public SparcGenSubtargetInfo {
32 Triple TargetTriple;
33 virtual void anchor();
35 bool Is64Bit;
37 #define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER) \
38 bool ATTRIBUTE = DEFAULT;
39 #include "SparcGenSubtargetInfo.inc"
41 SparcInstrInfo InstrInfo;
42 SparcTargetLowering TLInfo;
43 SelectionDAGTargetInfo TSInfo;
44 SparcFrameLowering FrameLowering;
46 public:
47 SparcSubtarget(const Triple &TT, const std::string &CPU,
48 const std::string &FS, const TargetMachine &TM, bool is64bit);
50 const SparcInstrInfo *getInstrInfo() const override { return &InstrInfo; }
51 const TargetFrameLowering *getFrameLowering() const override {
52 return &FrameLowering;
54 const SparcRegisterInfo *getRegisterInfo() const override {
55 return &InstrInfo.getRegisterInfo();
57 const SparcTargetLowering *getTargetLowering() const override {
58 return &TLInfo;
60 const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
61 return &TSInfo;
64 bool enableMachineScheduler() const override;
66 #define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER) \
67 bool GETTER() const { return ATTRIBUTE; }
68 #include "SparcGenSubtargetInfo.inc"
70 /// ParseSubtargetFeatures - Parses features string setting specified
71 /// subtarget options. Definition of function is auto generated by tblgen.
72 void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS);
73 SparcSubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);
75 bool is64Bit() const { return Is64Bit; }
77 /// The 64-bit ABI uses biased stack and frame pointers, so the stack frame
78 /// of the current function is the area from [%sp+BIAS] to [%fp+BIAS].
79 int64_t getStackPointerBias() const {
80 return is64Bit() ? 2047 : 0;
83 /// Given a actual stack size as determined by FrameInfo, this function
84 /// returns adjusted framesize which includes space for register window
85 /// spills and arguments.
86 int getAdjustedFrameSize(int stackSize) const;
88 bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
91 } // end namespace llvm
93 #endif