LLVM  4.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 IsV9;
36  bool IsLeon;
37  bool V8DeprecatedInsts;
38  bool IsVIS, IsVIS2, IsVIS3;
39  bool Is64Bit;
40  bool HasHardQuad;
41  bool UsePopc;
42  bool UseSoftFloat;
43 
44  // LEON features
45  bool HasUmacSmac;
46  bool HasLeonCasa;
47  bool InsertNOPLoad;
48  bool FixFSMULD;
49  bool ReplaceFMULS;
50  bool FixAllFDIVSQRT;
51  bool DetectRoundChange;
52  bool PerformSDIVReplace;
53 
54  SparcInstrInfo InstrInfo;
55  SparcTargetLowering TLInfo;
57  SparcFrameLowering FrameLowering;
58 
59 public:
60  SparcSubtarget(const Triple &TT, const std::string &CPU,
61  const std::string &FS, const TargetMachine &TM, bool is64bit);
62 
63  const SparcInstrInfo *getInstrInfo() const override { return &InstrInfo; }
64  const TargetFrameLowering *getFrameLowering() const override {
65  return &FrameLowering;
66  }
67  const SparcRegisterInfo *getRegisterInfo() const override {
68  return &InstrInfo.getRegisterInfo();
69  }
70  const SparcTargetLowering *getTargetLowering() const override {
71  return &TLInfo;
72  }
73  const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
74  return &TSInfo;
75  }
76 
77  bool enableMachineScheduler() const override;
78 
79  bool isV9() const { return IsV9; }
80  bool isLeon() const { return IsLeon; }
81  bool isVIS() const { return IsVIS; }
82  bool isVIS2() const { return IsVIS2; }
83  bool isVIS3() const { return IsVIS3; }
84  bool useDeprecatedV8Instructions() const { return V8DeprecatedInsts; }
85  bool hasHardQuad() const { return HasHardQuad; }
86  bool usePopc() const { return UsePopc; }
87  bool useSoftFloat() const { return UseSoftFloat; }
88 
89  // Leon options
90  bool hasUmacSmac() const { return HasUmacSmac; }
91  bool performSDIVReplace() const { return PerformSDIVReplace; }
92  bool hasLeonCasa() const { return HasLeonCasa; }
93  bool insertNOPLoad() const { return InsertNOPLoad; }
94  bool fixFSMULD() const { return FixFSMULD; }
95  bool replaceFMULS() const { return ReplaceFMULS; }
96  bool fixAllFDIVSQRT() const { return FixAllFDIVSQRT; }
97  bool detectRoundChange() const { return DetectRoundChange; }
98 
99  /// ParseSubtargetFeatures - Parses features string setting specified
100  /// subtarget options. Definition of function is auto generated by tblgen.
103 
104  bool is64Bit() const { return Is64Bit; }
105 
106  /// The 64-bit ABI uses biased stack and frame pointers, so the stack frame
107  /// of the current function is the area from [%sp+BIAS] to [%fp+BIAS].
108  int64_t getStackPointerBias() const {
109  return is64Bit() ? 2047 : 0;
110  }
111 
112  /// Given a actual stack size as determined by FrameInfo, this function
113  /// returns adjusted framesize which includes space for register window
114  /// spills and arguments.
115  int getAdjustedFrameSize(int stackSize) const;
116 
117  bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
118 };
119 
120 } // end namespace llvm
121 
122 #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:550
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 isV9() const
bool is64Bit() const
bool detectRoundChange() const
Primary interface to the complete machine description for the target machine.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:47
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