LLVM 19.0.0git
MSP430Subtarget.cpp
Go to the documentation of this file.
1//===-- MSP430Subtarget.cpp - MSP430 Subtarget Information ----------------===//
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 implements the MSP430 specific subclass of TargetSubtargetInfo.
10//
11//===----------------------------------------------------------------------===//
12
13#include "MSP430Subtarget.h"
14#include "MSP430.h"
16
17using namespace llvm;
18
19#define DEBUG_TYPE "msp430-subtarget"
20
23 cl::desc("Hardware multiplier use mode for MSP430"),
27 "Do not use hardware multiplier"),
29 "Use 16-bit hardware multiplier"),
31 "Use 32-bit hardware multiplier"),
33 "Use F5 series hardware multiplier")));
34
35#define GET_SUBTARGETINFO_TARGET_DESC
36#define GET_SUBTARGETINFO_CTOR
37#include "MSP430GenSubtargetInfo.inc"
38
39void MSP430Subtarget::anchor() { }
40
43 ExtendedInsts = false;
44 HWMultMode = NoHWMult;
45
46 StringRef CPUName = CPU;
47 if (CPUName.empty())
48 CPUName = "msp430";
49
50 ParseSubtargetFeatures(CPUName, /*TuneCPU*/ CPUName, FS);
51
53 HWMultMode = HWMultModeOption;
54
55 return *this;
56}
57
58MSP430Subtarget::MSP430Subtarget(const Triple &TT, const std::string &CPU,
59 const std::string &FS, const TargetMachine &TM)
60 : MSP430GenSubtargetInfo(TT, CPU, /*TuneCPU*/ CPU, FS),
61 InstrInfo(initializeSubtargetDependencies(CPU, FS)), TLInfo(TM, *this),
62 FrameLowering(*this) {}
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
Definition: CommandLine.h:693
static cl::opt< MSP430Subtarget::HWMultEnum > HWMultModeOption("mhwmult", cl::Hidden, cl::desc("Hardware multiplier use mode for MSP430"), cl::init(MSP430Subtarget::NoHWMult), cl::values(clEnumValN(MSP430Subtarget::NoHWMult, "none", "Do not use hardware multiplier"), clEnumValN(MSP430Subtarget::HWMult16, "16bit", "Use 16-bit hardware multiplier"), clEnumValN(MSP430Subtarget::HWMult32, "32bit", "Use 32-bit hardware multiplier"), clEnumValN(MSP430Subtarget::HWMultF5, "f5series", "Use F5 series hardware multiplier")))
const char LLVMTargetMachineRef TM
MSP430Subtarget & initializeSubtargetDependencies(StringRef CPU, StringRef FS)
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
ParseSubtargetFeatures - Parses features string setting specified subtarget options.
MSP430Subtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM)
This constructor initializes the data members to match that of the specified triple.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
constexpr bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:134
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:76
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
Definition: CommandLine.h:718
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:450
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18