| Jia Liu | b22310f | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===-- MSP430Subtarget.h - Define Subtarget for the MSP430 ----*- C++ -*--===// |
| Anton Korobeynikov | 1013800 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 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 | // |
| Evan Cheng | 0d639a2 | 2011-07-01 21:01:15 +0000 | [diff] [blame] | 10 | // This file declares the MSP430 specific subclass of TargetSubtargetInfo. |
| Anton Korobeynikov | 1013800 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 14 | #ifndef LLVM_LIB_TARGET_MSP430_MSP430SUBTARGET_H |
| 15 | #define LLVM_LIB_TARGET_MSP430_MSP430SUBTARGET_H |
| Anton Korobeynikov | 1013800 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 16 | |
| Eric Christopher | 1f86cca | 2014-06-27 01:14:54 +0000 | [diff] [blame] | 17 | #include "MSP430FrameLowering.h" |
| Eric Christopher | 1f86cca | 2014-06-27 01:14:54 +0000 | [diff] [blame] | 18 | #include "MSP430ISelLowering.h" |
| Chandler Carruth | d990388 | 2015-01-14 11:23:27 +0000 | [diff] [blame] | 19 | #include "MSP430InstrInfo.h" |
| Eric Christopher | 1f86cca | 2014-06-27 01:14:54 +0000 | [diff] [blame] | 20 | #include "MSP430RegisterInfo.h" |
| Benjamin Kramer | f9172fd4 | 2016-01-27 16:32:26 +0000 | [diff] [blame] | 21 | #include "llvm/CodeGen/SelectionDAGTargetInfo.h" |
| Eric Christopher | 1f86cca | 2014-06-27 01:14:54 +0000 | [diff] [blame] | 22 | #include "llvm/IR/DataLayout.h" |
| Evan Cheng | 0d639a2 | 2011-07-01 21:01:15 +0000 | [diff] [blame] | 23 | #include "llvm/Target/TargetSubtargetInfo.h" |
| Craig Topper | b25fda9 | 2012-03-17 18:46:09 +0000 | [diff] [blame] | 24 | #include <string> |
| Anton Korobeynikov | 1013800 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 25 | |
| Evan Cheng | 54b68e3 | 2011-07-01 20:45:01 +0000 | [diff] [blame] | 26 | #define GET_SUBTARGETINFO_HEADER |
| Evan Cheng | c9c090d | 2011-07-01 22:36:09 +0000 | [diff] [blame] | 27 | #include "MSP430GenSubtargetInfo.inc" |
| Evan Cheng | 54b68e3 | 2011-07-01 20:45:01 +0000 | [diff] [blame] | 28 | |
| Anton Korobeynikov | 1013800 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 29 | namespace llvm { |
| Evan Cheng | 1a72add6 | 2011-07-07 07:07:08 +0000 | [diff] [blame] | 30 | class StringRef; |
| Anton Korobeynikov | 1013800 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 31 | |
| Evan Cheng | 54b68e3 | 2011-07-01 20:45:01 +0000 | [diff] [blame] | 32 | class MSP430Subtarget : public MSP430GenSubtargetInfo { |
| Vadzim Dambrouski | 49dd6e6 | 2017-05-23 21:49:42 +0000 | [diff] [blame] | 33 | public: |
| 34 | enum HWMultEnum { |
| 35 | NoHWMult, HWMult16, HWMult32, HWMultF5 |
| 36 | }; |
| 37 | |
| 38 | private: |
| David Blaikie | a379b181 | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 39 | virtual void anchor(); |
| Anton Korobeynikov | 1013800 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 40 | bool ExtendedInsts; |
| Vadzim Dambrouski | 49dd6e6 | 2017-05-23 21:49:42 +0000 | [diff] [blame] | 41 | HWMultEnum HWMultMode; |
| Eric Christopher | 1f86cca | 2014-06-27 01:14:54 +0000 | [diff] [blame] | 42 | MSP430FrameLowering FrameLowering; |
| 43 | MSP430InstrInfo InstrInfo; |
| 44 | MSP430TargetLowering TLInfo; |
| Benjamin Kramer | f9172fd4 | 2016-01-27 16:32:26 +0000 | [diff] [blame] | 45 | SelectionDAGTargetInfo TSInfo; |
| Eric Christopher | 1f86cca | 2014-06-27 01:14:54 +0000 | [diff] [blame] | 46 | |
| Anton Korobeynikov | 1013800 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 47 | public: |
| 48 | /// This constructor initializes the data members to match that |
| Daniel Dunbar | 31b44e8 | 2009-08-02 22:11:08 +0000 | [diff] [blame] | 49 | /// of the specified triple. |
| Anton Korobeynikov | 1013800 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 50 | /// |
| Daniel Sanders | a73f1fd | 2015-06-10 12:11:26 +0000 | [diff] [blame] | 51 | MSP430Subtarget(const Triple &TT, const std::string &CPU, |
| Eric Christopher | 1f86cca | 2014-06-27 01:14:54 +0000 | [diff] [blame] | 52 | const std::string &FS, const TargetMachine &TM); |
| 53 | |
| 54 | MSP430Subtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS); |
| Anton Korobeynikov | 1013800 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 55 | |
| 56 | /// ParseSubtargetFeatures - Parses features string setting specified |
| 57 | /// subtarget options. Definition of function is auto generated by tblgen. |
| Evan Cheng | 1a72add6 | 2011-07-07 07:07:08 +0000 | [diff] [blame] | 58 | void ParseSubtargetFeatures(StringRef CPU, StringRef FS); |
| Eric Christopher | 1f86cca | 2014-06-27 01:14:54 +0000 | [diff] [blame] | 59 | |
| Vadzim Dambrouski | 49dd6e6 | 2017-05-23 21:49:42 +0000 | [diff] [blame] | 60 | bool hasHWMult16() const { return HWMultMode == HWMult16; } |
| 61 | bool hasHWMult32() const { return HWMultMode == HWMult32; } |
| 62 | bool hasHWMultF5() const { return HWMultMode == HWMultF5; } |
| 63 | |
| Eric Christopher | d913448 | 2014-08-04 21:25:23 +0000 | [diff] [blame] | 64 | const TargetFrameLowering *getFrameLowering() const override { |
| 65 | return &FrameLowering; |
| 66 | } |
| 67 | const MSP430InstrInfo *getInstrInfo() const override { return &InstrInfo; } |
| Eric Christopher | d913448 | 2014-08-04 21:25:23 +0000 | [diff] [blame] | 68 | const TargetRegisterInfo *getRegisterInfo() const override { |
| Eric Christopher | 1f86cca | 2014-06-27 01:14:54 +0000 | [diff] [blame] | 69 | return &InstrInfo.getRegisterInfo(); |
| 70 | } |
| Eric Christopher | d913448 | 2014-08-04 21:25:23 +0000 | [diff] [blame] | 71 | const MSP430TargetLowering *getTargetLowering() const override { |
| 72 | return &TLInfo; |
| 73 | } |
| Benjamin Kramer | f9172fd4 | 2016-01-27 16:32:26 +0000 | [diff] [blame] | 74 | const SelectionDAGTargetInfo *getSelectionDAGInfo() const override { |
| Eric Christopher | d913448 | 2014-08-04 21:25:23 +0000 | [diff] [blame] | 75 | return &TSInfo; |
| 76 | } |
| Anton Korobeynikov | 1013800 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 77 | }; |
| Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 78 | } // End llvm namespace |
| Anton Korobeynikov | 1013800 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 79 | |
| 80 | #endif // LLVM_TARGET_MSP430_SUBTARGET_H |