Canonicalize header guards into a common format.
[oota-llvm.git] / lib / Target / Sparc / SparcSubtarget.h
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 "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"
25 #include <string>
26
27 #define GET_SUBTARGETINFO_HEADER
28 #include "SparcGenSubtargetInfo.inc"
29
30 namespace llvm {
31 class StringRef;
32
33 class SparcSubtarget : public SparcGenSubtargetInfo {
34   virtual void anchor();
35   bool IsV9;
36   bool V8DeprecatedInsts;
37   bool IsVIS, IsVIS2, IsVIS3;
38   bool Is64Bit;
39   bool HasHardQuad;
40   bool UsePopc;
41   const DataLayout DL;       // Calculates type size & alignment
42   SparcInstrInfo InstrInfo;
43   SparcTargetLowering TLInfo;
44   SparcSelectionDAGInfo TSInfo;
45   SparcFrameLowering FrameLowering;
46   SparcJITInfo JITInfo;
47
48 public:
49   SparcSubtarget(const std::string &TT, const std::string &CPU,
50                  const std::string &FS, TargetMachine &TM, bool is64bit);
51
52   const SparcInstrInfo *getInstrInfo() const override { return &InstrInfo; }
53   const TargetFrameLowering *getFrameLowering() const override {
54     return &FrameLowering;
55   }
56   const SparcRegisterInfo *getRegisterInfo() const override {
57     return &InstrInfo.getRegisterInfo();
58   }
59   const SparcTargetLowering *getTargetLowering() const override {
60     return &TLInfo;
61   }
62   const SparcSelectionDAGInfo *getSelectionDAGInfo() const override {
63     return &TSInfo;
64   }
65   SparcJITInfo *getJITInfo() override { return &JITInfo; }
66   const DataLayout *getDataLayout() const override { return &DL; }
67
68   bool isV9() const { return IsV9; }
69   bool isVIS() const { return IsVIS; }
70   bool isVIS2() const { return IsVIS2; }
71   bool isVIS3() const { return IsVIS3; }
72   bool useDeprecatedV8Instructions() const { return V8DeprecatedInsts; }
73   bool hasHardQuad() const { return HasHardQuad; }
74   bool usePopc() const { return UsePopc; }
75
76   /// ParseSubtargetFeatures - Parses features string setting specified
77   /// subtarget options.  Definition of function is auto generated by tblgen.
78   void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
79   SparcSubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);
80
81   bool is64Bit() const { return Is64Bit; }
82
83   /// The 64-bit ABI uses biased stack and frame pointers, so the stack frame
84   /// of the current function is the area from [%sp+BIAS] to [%fp+BIAS].
85   int64_t getStackPointerBias() const {
86     return is64Bit() ? 2047 : 0;
87   }
88
89   /// Given a actual stack size as determined by FrameInfo, this function
90   /// returns adjusted framesize which includes space for register window
91   /// spills and arguments.
92   int getAdjustedFrameSize(int stackSize) const;
93
94 };
95
96 } // end namespace llvm
97
98 #endif