LLVM  5.0.0
SparcSubtarget.h
Go to the documentation of this file.
1 //===-- SparcSubtarget.h - Define Subtarget for the SPARC -------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares the SPARC specific subclass of TargetSubtargetInfo.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_SPARC_SPARCSUBTARGET_H
15 #define LLVM_LIB_TARGET_SPARC_SPARCSUBTARGET_H
16 
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 
29 namespace llvm {
30 class StringRef;
31 
33  Triple TargetTriple;
34  virtual void anchor();
35  bool UseSoftMulDiv;
36  bool IsV9;
37  bool IsLeon;
38  bool V8DeprecatedInsts;
39  bool IsVIS, IsVIS2, IsVIS3;
40  bool Is64Bit;
41  bool HasHardQuad;
42  bool UsePopc;
43  bool UseSoftFloat;
44 
45  // LEON features
46  bool HasUmacSmac;
47  bool HasLeonCasa;
48  bool InsertNOPLoad;
49  bool FixFSMULD;
50  bool ReplaceFMULS;
51  bool FixAllFDIVSQRT;
52  bool DetectRoundChange;
53  bool PerformSDIVReplace;
54 
55  SparcInstrInfo InstrInfo;
56  SparcTargetLowering TLInfo;
58  SparcFrameLowering FrameLowering;
59 
60 public:
61  SparcSubtarget(const Triple &TT, const std::string &CPU,
62  const std::string &FS, const TargetMachine &TM, bool is64bit);
63 
64  const SparcInstrInfo *getInstrInfo() const override { return &InstrInfo; }
65  const TargetFrameLowering *getFrameLowering() const override {
66  return &FrameLowering;
67  }
68  const SparcRegisterInfo *getRegisterInfo() const override {
69  return &InstrInfo.getRegisterInfo();
70  }
71  const SparcTargetLowering *getTargetLowering() const override {
72  return &TLInfo;
73  }
74  const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
75  return &TSInfo;
76  }
77 
78  bool enableMachineScheduler() const override;
79 
80  bool useSoftMulDiv() const { return UseSoftMulDiv; }
81  bool isV9() const { return IsV9; }
82  bool isLeon() const { return IsLeon; }
83  bool isVIS() const { return IsVIS; }
84  bool isVIS2() const { return IsVIS2; }
85  bool isVIS3() const { return IsVIS3; }
86  bool useDeprecatedV8Instructions() const { return V8DeprecatedInsts; }
87  bool hasHardQuad() const { return HasHardQuad; }
88  bool usePopc() const { return UsePopc; }
89  bool useSoftFloat() const { return UseSoftFloat; }
90 
91  // Leon options
92  bool hasUmacSmac() const { return HasUmacSmac; }
93  bool performSDIVReplace() const { return PerformSDIVReplace; }
94  bool hasLeonCasa() const { return HasLeonCasa; }
95  bool insertNOPLoad() const { return InsertNOPLoad; }
96  bool fixFSMULD() const { return FixFSMULD; }
97  bool replaceFMULS() const { return ReplaceFMULS; }
98  bool fixAllFDIVSQRT() const { return FixAllFDIVSQRT; }
99  bool detectRoundChange() const { return DetectRoundChange; }
100 
101  /// ParseSubtargetFeatures - Parses features string setting specified
102  /// subtarget options. Definition of function is auto generated by tblgen.
105 
106  bool is64Bit() const { return Is64Bit; }
107 
108  /// The 64-bit ABI uses biased stack and frame pointers, so the stack frame
109  /// of the current function is the area from [%sp+BIAS] to [%fp+BIAS].
110  int64_t getStackPointerBias() const {
111  return is64Bit() ? 2047 : 0;
112  }
113 
114  /// Given a actual stack size as determined by FrameInfo, this function
115  /// returns adjusted framesize which includes space for register window
116  /// spills and arguments.
117  int getAdjustedFrameSize(int stackSize) const;
118 
119  bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
120 };
121 
122 } // end namespace llvm
123 
124 #endif
bool useDeprecatedV8Instructions() const
SparcSubtarget & initializeSubtargetDependencies(StringRef CPU, StringRef FS)
bool isVIS3() const
bool isLeon() const
bool fixAllFDIVSQRT() const
SparcSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM, bool is64bit)
const SparcInstrInfo * getInstrInfo() const override
bool replaceFMULS() const
bool isOSLinux() const
Tests whether the OS is Linux.
Definition: Triple.h:561
bool isVIS() const
const SparcRegisterInfo & getRegisterInfo() const
getRegisterInfo - TargetInstrInfo is a superset of MRegister info.
bool fixFSMULD() const
bool enableMachineScheduler() const override
bool performSDIVReplace() const
const SparcTargetLowering * getTargetLowering() const override
Targets can subclass this to parameterize the SelectionDAG lowering and instruction selection process...
void ParseSubtargetFeatures(StringRef CPU, StringRef FS)
ParseSubtargetFeatures - Parses features string setting specified subtarget options.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
const SparcRegisterInfo * getRegisterInfo() const override
const TargetFrameLowering * getFrameLowering() const override
const SelectionDAGTargetInfo * getSelectionDAGInfo() const override
bool hasHardQuad() const
bool usePopc() const
bool isTargetLinux() const
Information about stack frame layout on the target.
bool hasLeonCasa() const
bool isVIS2() const
int getAdjustedFrameSize(int stackSize) const
Given a actual stack size as determined by FrameInfo, this function returns adjusted framesize which ...
bool hasUmacSmac() const
bool insertNOPLoad() const
bool useSoftMulDiv() const
bool isV9() const
bool is64Bit() const
bool detectRoundChange() const
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:56
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
int64_t getStackPointerBias() const
The 64-bit ABI uses biased stack and frame pointers, so the stack frame of the current function is th...
bool useSoftFloat() const