LLVM 24.0.0git
MSP430Subtarget.h
Go to the documentation of this file.
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"
21#include "llvm/IR/DataLayout.h"
22#include <string>
23
24namespace llvm::MSP430 {
25enum class HWMult { None, HW16, HW32, F5 };
26} // namespace llvm::MSP430
27
28#define OPTIONS_STRUCT_DECL
29#include "MSP430Options.inc"
30
31#define GET_SUBTARGETINFO_HEADER
32#include "MSP430GenSubtargetInfo.inc"
33
34namespace llvm {
35class MSP430TargetMachine;
36class StringRef;
37
39 const MSP430Options &CLOpts;
40 virtual void anchor();
41 bool ExtendedInsts = false;
43 MSP430InstrInfo InstrInfo;
45 std::unique_ptr<const SelectionDAGTargetInfo> TSInfo;
46 MSP430FrameLowering FrameLowering;
47
48public:
49 /// This constructor initializes the data members to match that
50 /// of the specified triple.
51 ///
52 MSP430Subtarget(const Triple &TT, const std::string &CPU,
53 const std::string &FS, const MSP430TargetMachine &TM);
54
55 ~MSP430Subtarget() override;
56
57 const MSP430Options &getCLOpts() const { return CLOpts; }
58
60
61 /// ParseSubtargetFeatures - Parses features string setting specified
62 /// subtarget options. Definition of function is auto generated by tblgen.
64
65 bool hasHWMult16() const { return HWMultMode == MSP430::HWMult::HW16; }
66 bool hasHWMult32() const { return HWMultMode == MSP430::HWMult::HW32; }
67 bool hasHWMultF5() const { return HWMultMode == MSP430::HWMult::F5; }
68
69 const TargetFrameLowering *getFrameLowering() const override {
70 return &FrameLowering;
71 }
72 const MSP430InstrInfo *getInstrInfo() const override { return &InstrInfo; }
73 const MSP430RegisterInfo *getRegisterInfo() const override {
74 return &getInstrInfo()->getRegisterInfo();
75 }
76
77 const MSP430TargetLowering *getTargetLowering() const override {
78 return &TLInfo;
79 }
80
81 const SelectionDAGTargetInfo *getSelectionDAGInfo() const override;
82
83 void initLibcallLoweringInfo(LibcallLoweringInfo &Info) const override;
84};
85} // End llvm namespace
86
87#endif // LLVM_TARGET_MSP430_SUBTARGET_H
Tracks which library functions to use for a particular subtarget or function.
const MSP430RegisterInfo & getRegisterInfo() const
getRegisterInfo - TargetInstrInfo is a superset of MRegister info.
const SelectionDAGTargetInfo * getSelectionDAGInfo() const override
const MSP430RegisterInfo * getRegisterInfo() const override
const MSP430InstrInfo * getInstrInfo() const override
const MSP430TargetLowering * getTargetLowering() const override
~MSP430Subtarget() override
MSP430Subtarget & initializeSubtargetDependencies(StringRef CPU, StringRef FS)
MSP430Subtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const MSP430TargetMachine &TM)
This constructor initializes the data members to match that of the specified triple.
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
ParseSubtargetFeatures - Parses features string setting specified subtarget options.
const MSP430Options & getCLOpts() const
const TargetFrameLowering * getFrameLowering() const override
void initLibcallLoweringInfo(LibcallLoweringInfo &Info) const override
Targets can subclass this to parameterize the SelectionDAG lowering and instruction selection process...
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
Information about stack frame layout on the target.
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:48
This is an optimization pass for GlobalISel generic memory operations.