LLVM  8.0.0svn
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"
23 #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  bool HasNoFSMULD;
45  bool HasNoFMULS;
46 
47  // LEON features
48  bool HasUmacSmac;
49  bool HasLeonCasa;
50  bool HasPWRPSR;
51  bool InsertNOPLoad;
52  bool FixAllFDIVSQRT;
53  bool DetectRoundChange;
54  bool HasLeonCycleCounter;
55 
56  SparcInstrInfo InstrInfo;
57  SparcTargetLowering TLInfo;
59  SparcFrameLowering FrameLowering;
60 
61 public:
62  SparcSubtarget(const Triple &TT, const std::string &CPU,
63  const std::string &FS, const TargetMachine &TM, bool is64bit);
64 
65  const SparcInstrInfo *getInstrInfo() const override { return &InstrInfo; }
66  const TargetFrameLowering *getFrameLowering() const override {
67  return &FrameLowering;
68  }
69  const SparcRegisterInfo *getRegisterInfo() const override {
70  return &InstrInfo.getRegisterInfo();
71  }
72  const SparcTargetLowering *getTargetLowering() const override {
73  return &TLInfo;
74  }
75  const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
76  return &TSInfo;
77  }
78 
79  bool enableMachineScheduler() const override;
80 
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; }
93 
94  // Leon options
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; }
102 
103  /// ParseSubtargetFeatures - Parses features string setting specified
104  /// subtarget options. Definition of function is auto generated by tblgen.
107 
108  bool is64Bit() const { return Is64Bit; }
109 
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;
114  }
115 
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;
120 
121  bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
122 };
123 
124 } // end namespace llvm
125 
126 #endif
bool hasNoFSMULD() const
bool usePopc() const
SparcSubtarget & initializeSubtargetDependencies(StringRef CPU, StringRef FS)
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
SparcSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM, bool is64bit)
bool hasHardQuad() const
const SparcInstrInfo * getInstrInfo() const override
bool isTargetLinux() const
bool insertNOPLoad() const
bool useSoftFloat() const
bool hasLeonCycleCounter() const
bool fixAllFDIVSQRT() const
bool useSoftMulDiv() const
int64_t getStackPointerBias() const
The 64-bit ABI uses biased stack and frame pointers, so the stack frame of the current function is th...
int getAdjustedFrameSize(int stackSize) const
Given a actual stack size as determined by FrameInfo, this function returns adjusted framesize which ...
bool hasNoFMULS() const
bool enableMachineScheduler() const override
const SparcRegisterInfo & getRegisterInfo() const
getRegisterInfo - TargetInstrInfo is a superset of MRegister info.
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 hasPWRPSR() const
Information about stack frame layout on the target.
bool isOSLinux() const
Tests whether the OS is Linux.
Definition: Triple.h:576
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:59
bool detectRoundChange() const
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
bool hasUmacSmac() const
bool useDeprecatedV8Instructions() const
bool hasLeonCasa() const