/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Target/MSP430/MSP430Subtarget.h
Line | Count | Source |
1 | | //===-- MSP430Subtarget.h - Define Subtarget for the MSP430 ----*- C++ -*--===// |
2 | | // |
3 | | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | | // See https://llvm.org/LICENSE.txt for license information. |
5 | | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | | // |
7 | | //===----------------------------------------------------------------------===// |
8 | | // |
9 | | // This file declares the MSP430 specific subclass of TargetSubtargetInfo. |
10 | | // |
11 | | //===----------------------------------------------------------------------===// |
12 | | |
13 | | #ifndef LLVM_LIB_TARGET_MSP430_MSP430SUBTARGET_H |
14 | | #define LLVM_LIB_TARGET_MSP430_MSP430SUBTARGET_H |
15 | | |
16 | | #include "MSP430FrameLowering.h" |
17 | | #include "MSP430ISelLowering.h" |
18 | | #include "MSP430InstrInfo.h" |
19 | | #include "MSP430RegisterInfo.h" |
20 | | #include "llvm/CodeGen/SelectionDAGTargetInfo.h" |
21 | | #include "llvm/CodeGen/TargetSubtargetInfo.h" |
22 | | #include "llvm/IR/DataLayout.h" |
23 | | #include <string> |
24 | | |
25 | | #define GET_SUBTARGETINFO_HEADER |
26 | | #include "MSP430GenSubtargetInfo.inc" |
27 | | |
28 | | namespace llvm { |
29 | | class StringRef; |
30 | | |
31 | | class MSP430Subtarget : public MSP430GenSubtargetInfo { |
32 | | public: |
33 | | enum HWMultEnum { |
34 | | NoHWMult, HWMult16, HWMult32, HWMultF5 |
35 | | }; |
36 | | |
37 | | private: |
38 | | virtual void anchor(); |
39 | | bool ExtendedInsts; |
40 | | HWMultEnum HWMultMode; |
41 | | MSP430FrameLowering FrameLowering; |
42 | | MSP430InstrInfo InstrInfo; |
43 | | MSP430TargetLowering TLInfo; |
44 | | SelectionDAGTargetInfo TSInfo; |
45 | | |
46 | | public: |
47 | | /// This constructor initializes the data members to match that |
48 | | /// of the specified triple. |
49 | | /// |
50 | | MSP430Subtarget(const Triple &TT, const std::string &CPU, |
51 | | const std::string &FS, const TargetMachine &TM); |
52 | | |
53 | | MSP430Subtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS); |
54 | | |
55 | | /// ParseSubtargetFeatures - Parses features string setting specified |
56 | | /// subtarget options. Definition of function is auto generated by tblgen. |
57 | | void ParseSubtargetFeatures(StringRef CPU, StringRef FS); |
58 | | |
59 | 77 | bool hasHWMult16() const { return HWMultMode == HWMult16; } |
60 | 75 | bool hasHWMult32() const { return HWMultMode == HWMult32; } |
61 | 73 | bool hasHWMultF5() const { return HWMultMode == HWMultF5; } |
62 | | |
63 | 11.5k | const TargetFrameLowering *getFrameLowering() const override { |
64 | 11.5k | return &FrameLowering; |
65 | 11.5k | } |
66 | 15.9k | const MSP430InstrInfo *getInstrInfo() const override { return &InstrInfo; } |
67 | 27.8k | const TargetRegisterInfo *getRegisterInfo() const override { |
68 | 27.8k | return &InstrInfo.getRegisterInfo(); |
69 | 27.8k | } |
70 | 6.07k | const MSP430TargetLowering *getTargetLowering() const override { |
71 | 6.07k | return &TLInfo; |
72 | 6.07k | } |
73 | 318 | const SelectionDAGTargetInfo *getSelectionDAGInfo() const override { |
74 | 318 | return &TSInfo; |
75 | 318 | } |
76 | | }; |
77 | | } // End llvm namespace |
78 | | |
79 | | #endif // LLVM_TARGET_MSP430_SUBTARGET_H |