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 "llvm/MC/TargetRegistry.h" 15 16 using namespace llvm; 17 18 #define DEBUG_TYPE "msp430-subtarget" 19 20 static cl::opt<MSP430Subtarget::HWMultEnum> 21 HWMultModeOption("mhwmult", cl::Hidden, 22 cl::desc("Hardware multiplier use mode for MSP430"), 23 cl::init(MSP430Subtarget::NoHWMult), 24 cl::values( 25 clEnumValN(MSP430Subtarget::NoHWMult, "none", 26 "Do not use hardware multiplier"), 27 clEnumValN(MSP430Subtarget::HWMult16, "16bit", 28 "Use 16-bit hardware multiplier"), 29 clEnumValN(MSP430Subtarget::HWMult32, "32bit", 30 "Use 32-bit hardware multiplier"), 31 clEnumValN(MSP430Subtarget::HWMultF5, "f5series", 32 "Use F5 series hardware multiplier"))); 33 34 #define GET_SUBTARGETINFO_TARGET_DESC 35 #define GET_SUBTARGETINFO_CTOR 36 #include "MSP430GenSubtargetInfo.inc" 37 38 void MSP430Subtarget::anchor() { } 39 40 MSP430Subtarget & 41 MSP430Subtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS) { 42 ExtendedInsts = false; 43 HWMultMode = NoHWMult; 44 45 StringRef CPUName = CPU; 46 if (CPUName.empty()) 47 CPUName = "msp430"; 48 49 ParseSubtargetFeatures(CPUName, /*TuneCPU*/ CPUName, FS); 50 51 if (HWMultModeOption != NoHWMult) 52 HWMultMode = HWMultModeOption; 53 54 return *this; 55 } 56 57 MSP430Subtarget::MSP430Subtarget(const Triple &TT, const std::string &CPU, 58 const std::string &FS, const TargetMachine &TM) 59 : MSP430GenSubtargetInfo(TT, CPU, /*TuneCPU*/ CPU, FS), 60 InstrInfo(initializeSubtargetDependencies(CPU, FS)), TLInfo(TM, *this), 61 FrameLowering(*this) {} 62