1 //===-- SparcSubtarget.h - Define Subtarget for the SPARC -------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the SPARC specific subclass of TargetSubtargetInfo.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_SPARC_SPARCSUBTARGET_H
15 #define LLVM_LIB_TARGET_SPARC_SPARCSUBTARGET_H
17 #include "SparcFrameLowering.h"
18 #include "SparcISelLowering.h"
19 #include "SparcInstrInfo.h"
20 #include "llvm/CodeGen/SelectionDAGTargetInfo.h"
21 #include "llvm/CodeGen/TargetFrameLowering.h"
22 #include "llvm/CodeGen/TargetSubtargetInfo.h"
23 #include "llvm/IR/DataLayout.h"
26 #define GET_SUBTARGETINFO_HEADER
27 #include "SparcGenSubtargetInfo.inc"
32 class SparcSubtarget : public SparcGenSubtargetInfo {
34 virtual void anchor();
38 bool V8DeprecatedInsts;
39 bool IsVIS, IsVIS2, IsVIS3;
53 bool DetectRoundChange;
54 bool HasLeonCycleCounter;
56 SparcInstrInfo InstrInfo;
57 SparcTargetLowering TLInfo;
58 SelectionDAGTargetInfo TSInfo;
59 SparcFrameLowering FrameLowering;
62 SparcSubtarget(const Triple &TT, const std::string &CPU,
63 const std::string &FS, const TargetMachine &TM, bool is64bit);
65 const SparcInstrInfo *getInstrInfo() const override { return &InstrInfo; }
66 const TargetFrameLowering *getFrameLowering() const override {
67 return &FrameLowering;
69 const SparcRegisterInfo *getRegisterInfo() const override {
70 return &InstrInfo.getRegisterInfo();
72 const SparcTargetLowering *getTargetLowering() const override {
75 const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
79 bool enableMachineScheduler() const override;
81 bool useSoftMulDiv() const { return UseSoftMulDiv; }
82 bool isV9() const { return IsV9; }
83 bool isLeon() const { return IsLeon; }
84 bool isVIS() const { return IsVIS; }
85 bool isVIS2() const { return IsVIS2; }
86 bool isVIS3() const { return IsVIS3; }
87 bool useDeprecatedV8Instructions() const { return V8DeprecatedInsts; }
88 bool hasHardQuad() const { return HasHardQuad; }
89 bool usePopc() const { return UsePopc; }
90 bool useSoftFloat() const { return UseSoftFloat; }
91 bool hasNoFSMULD() const { return HasNoFSMULD; }
92 bool hasNoFMULS() const { return HasNoFMULS; }
95 bool hasUmacSmac() const { return HasUmacSmac; }
96 bool hasLeonCasa() const { return HasLeonCasa; }
97 bool hasPWRPSR() const { return HasPWRPSR; }
98 bool insertNOPLoad() const { return InsertNOPLoad; }
99 bool fixAllFDIVSQRT() const { return FixAllFDIVSQRT; }
100 bool detectRoundChange() const { return DetectRoundChange; }
101 bool hasLeonCycleCounter() const { return HasLeonCycleCounter; }
103 /// ParseSubtargetFeatures - Parses features string setting specified
104 /// subtarget options. Definition of function is auto generated by tblgen.
105 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
106 SparcSubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);
108 bool is64Bit() const { return Is64Bit; }
110 /// The 64-bit ABI uses biased stack and frame pointers, so the stack frame
111 /// of the current function is the area from [%sp+BIAS] to [%fp+BIAS].
112 int64_t getStackPointerBias() const {
113 return is64Bit() ? 2047 : 0;
116 /// Given a actual stack size as determined by FrameInfo, this function
117 /// returns adjusted framesize which includes space for register window
118 /// spills and arguments.
119 int getAdjustedFrameSize(int stackSize) const;
121 bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
124 } // end namespace llvm