Jia Liu | b22310f | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===-- SparcSubtarget.h - Define Subtarget for the SPARC -------*- C++ -*-===// |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | f3ebc3f | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
Evan Cheng | 0d639a2 | 2011-07-01 21:01:15 +0000 | [diff] [blame] | 10 | // This file declares the SPARC specific subclass of TargetSubtargetInfo. |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef SPARC_SUBTARGET_H |
| 15 | #define SPARC_SUBTARGET_H |
| 16 | |
Evan Cheng | 0d639a2 | 2011-07-01 21:01:15 +0000 | [diff] [blame] | 17 | #include "llvm/Target/TargetSubtargetInfo.h" |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 18 | #include <string> |
| 19 | |
Evan Cheng | 54b68e3 | 2011-07-01 20:45:01 +0000 | [diff] [blame] | 20 | #define GET_SUBTARGETINFO_HEADER |
Evan Cheng | c9c090d | 2011-07-01 22:36:09 +0000 | [diff] [blame] | 21 | #include "SparcGenSubtargetInfo.inc" |
Evan Cheng | 54b68e3 | 2011-07-01 20:45:01 +0000 | [diff] [blame] | 22 | |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 23 | namespace llvm { |
Evan Cheng | 1a72add6 | 2011-07-07 07:07:08 +0000 | [diff] [blame] | 24 | class StringRef; |
Daniel Dunbar | 31b44e8 | 2009-08-02 22:11:08 +0000 | [diff] [blame] | 25 | |
Evan Cheng | 54b68e3 | 2011-07-01 20:45:01 +0000 | [diff] [blame] | 26 | class SparcSubtarget : public SparcGenSubtargetInfo { |
David Blaikie | a379b181 | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 27 | virtual void anchor(); |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 28 | bool IsV9; |
| 29 | bool V8DeprecatedInsts; |
Venkatraman Govindaraju | f9a202a | 2014-03-02 19:31:21 +0000 | [diff] [blame^] | 30 | bool IsVIS, IsVIS2, IsVIS3; |
Chris Lattner | 8228b11 | 2010-02-04 06:34:01 +0000 | [diff] [blame] | 31 | bool Is64Bit; |
Venkatraman Govindaraju | 35e0c38 | 2013-08-25 18:30:06 +0000 | [diff] [blame] | 32 | bool HasHardQuad; |
Jakob Stoklund Olesen | ead3b3d | 2014-01-26 06:09:59 +0000 | [diff] [blame] | 33 | bool UsePopc; |
Venkatraman Govindaraju | a54533ed | 2013-06-04 18:33:25 +0000 | [diff] [blame] | 34 | |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 35 | public: |
Evan Cheng | fe6e405 | 2011-06-30 01:53:36 +0000 | [diff] [blame] | 36 | SparcSubtarget(const std::string &TT, const std::string &CPU, |
| 37 | const std::string &FS, bool is64bit); |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 38 | |
| 39 | bool isV9() const { return IsV9; } |
| 40 | bool isVIS() const { return IsVIS; } |
Venkatraman Govindaraju | f9a202a | 2014-03-02 19:31:21 +0000 | [diff] [blame^] | 41 | bool isVIS2() const { return IsVIS2; } |
| 42 | bool isVIS3() const { return IsVIS3; } |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 43 | bool useDeprecatedV8Instructions() const { return V8DeprecatedInsts; } |
Venkatraman Govindaraju | 35e0c38 | 2013-08-25 18:30:06 +0000 | [diff] [blame] | 44 | bool hasHardQuad() const { return HasHardQuad; } |
Jakob Stoklund Olesen | ead3b3d | 2014-01-26 06:09:59 +0000 | [diff] [blame] | 45 | bool usePopc() const { return UsePopc; } |
Venkatraman Govindaraju | a54533ed | 2013-06-04 18:33:25 +0000 | [diff] [blame] | 46 | |
| 47 | /// ParseSubtargetFeatures - Parses features string setting specified |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 48 | /// subtarget options. Definition of function is auto generated by tblgen. |
Evan Cheng | 1a72add6 | 2011-07-07 07:07:08 +0000 | [diff] [blame] | 49 | void ParseSubtargetFeatures(StringRef CPU, StringRef FS); |
Venkatraman Govindaraju | a54533ed | 2013-06-04 18:33:25 +0000 | [diff] [blame] | 50 | |
Chris Lattner | 8228b11 | 2010-02-04 06:34:01 +0000 | [diff] [blame] | 51 | bool is64Bit() const { return Is64Bit; } |
Jakob Stoklund Olesen | 03d9f7f | 2013-04-06 21:38:57 +0000 | [diff] [blame] | 52 | |
| 53 | /// The 64-bit ABI uses biased stack and frame pointers, so the stack frame |
| 54 | /// of the current function is the area from [%sp+BIAS] to [%fp+BIAS]. |
| 55 | int64_t getStackPointerBias() const { |
| 56 | return is64Bit() ? 2047 : 0; |
| 57 | } |
Venkatraman Govindaraju | 3521dcd | 2013-06-01 04:51:18 +0000 | [diff] [blame] | 58 | |
| 59 | /// Given a actual stack size as determined by FrameInfo, this function |
| 60 | /// returns adjusted framesize which includes space for register window |
| 61 | /// spills and arguments. |
| 62 | int getAdjustedFrameSize(int stackSize) const; |
| 63 | |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 64 | }; |
| 65 | |
| 66 | } // end namespace llvm |
| 67 | |
| 68 | #endif |