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 SPARC_SUBTARGET_H
15 #define SPARC_SUBTARGET_H
17 #include "SparcFrameLowering.h"
18 #include "SparcInstrInfo.h"
19 #include "SparcISelLowering.h"
20 #include "SparcJITInfo.h"
21 #include "SparcSelectionDAGInfo.h"
22 #include "llvm/IR/DataLayout.h"
23 #include "llvm/Target/TargetFrameLowering.h"
24 #include "llvm/Target/TargetSubtargetInfo.h"
27 #define GET_SUBTARGETINFO_HEADER
28 #include "SparcGenSubtargetInfo.inc"
33 class SparcSubtarget : public SparcGenSubtargetInfo {
34 virtual void anchor();
36 bool V8DeprecatedInsts;
37 bool IsVIS, IsVIS2, IsVIS3;
41 const DataLayout DL; // Calculates type size & alignment
42 SparcInstrInfo InstrInfo;
43 SparcTargetLowering TLInfo;
44 SparcSelectionDAGInfo TSInfo;
45 SparcFrameLowering FrameLowering;
49 SparcSubtarget(const std::string &TT, const std::string &CPU,
50 const std::string &FS, TargetMachine &TM, bool is64bit);
52 const SparcInstrInfo *getInstrInfo() const { return &InstrInfo; }
53 const TargetFrameLowering *getFrameLowering() const { return &FrameLowering; }
54 const SparcRegisterInfo *getRegisterInfo() const {
55 return &InstrInfo.getRegisterInfo();
57 const SparcTargetLowering *getTargetLowering() const { return &TLInfo; }
58 const SparcSelectionDAGInfo *getSelectionDAGInfo() const { return &TSInfo; }
59 SparcJITInfo *getJITInfo() { return &JITInfo; }
60 const DataLayout *getDataLayout() const { return &DL; }
62 bool isV9() const { return IsV9; }
63 bool isVIS() const { return IsVIS; }
64 bool isVIS2() const { return IsVIS2; }
65 bool isVIS3() const { return IsVIS3; }
66 bool useDeprecatedV8Instructions() const { return V8DeprecatedInsts; }
67 bool hasHardQuad() const { return HasHardQuad; }
68 bool usePopc() const { return UsePopc; }
70 /// ParseSubtargetFeatures - Parses features string setting specified
71 /// subtarget options. Definition of function is auto generated by tblgen.
72 void ParseSubtargetFeatures(StringRef CPU, 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;
90 } // end namespace llvm