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