Jia Liu | b22310f | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===-- MSP430Subtarget.cpp - MSP430 Subtarget Information ----------------===// |
Anton Korobeynikov | 1013800 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
Anton Korobeynikov | 1013800 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
Evan Cheng | 0d639a2 | 2011-07-01 21:01:15 +0000 | [diff] [blame] | 9 | // This file implements the MSP430 specific subclass of TargetSubtargetInfo. |
Anton Korobeynikov | 1013800 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #include "MSP430Subtarget.h" |
| 14 | #include "MSP430.h" |
Evan Cheng | 2bb4035 | 2011-08-24 18:08:43 +0000 | [diff] [blame] | 15 | #include "llvm/Support/TargetRegistry.h" |
Evan Cheng | 54b68e3 | 2011-07-01 20:45:01 +0000 | [diff] [blame] | 16 | |
Chandler Carruth | d174b72 | 2014-04-22 02:03:14 +0000 | [diff] [blame] | 17 | using namespace llvm; |
| 18 | |
Chandler Carruth | e96dd89 | 2014-04-21 22:55:11 +0000 | [diff] [blame] | 19 | #define DEBUG_TYPE "msp430-subtarget" |
| 20 | |
Vadzim Dambrouski | 49dd6e6 | 2017-05-23 21:49:42 +0000 | [diff] [blame] | 21 | static cl::opt<MSP430Subtarget::HWMultEnum> |
| 22 | HWMultModeOption("mhwmult", cl::Hidden, |
| 23 | cl::desc("Hardware multiplier use mode for MSP430"), |
| 24 | cl::init(MSP430Subtarget::NoHWMult), |
| 25 | cl::values( |
| 26 | clEnumValN(MSP430Subtarget::NoHWMult, "none", |
| 27 | "Do not use hardware multiplier"), |
| 28 | clEnumValN(MSP430Subtarget::HWMult16, "16bit", |
| 29 | "Use 16-bit hardware multiplier"), |
| 30 | clEnumValN(MSP430Subtarget::HWMult32, "32bit", |
| 31 | "Use 32-bit hardware multiplier"), |
| 32 | clEnumValN(MSP430Subtarget::HWMultF5, "f5series", |
| 33 | "Use F5 series hardware multiplier"))); |
| 34 | |
Evan Cheng | 54b68e3 | 2011-07-01 20:45:01 +0000 | [diff] [blame] | 35 | #define GET_SUBTARGETINFO_TARGET_DESC |
Evan Cheng | 4d1ca96 | 2011-07-08 01:53:10 +0000 | [diff] [blame] | 36 | #define GET_SUBTARGETINFO_CTOR |
Evan Cheng | c9c090d | 2011-07-01 22:36:09 +0000 | [diff] [blame] | 37 | #include "MSP430GenSubtargetInfo.inc" |
Anton Korobeynikov | 1013800 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 38 | |
David Blaikie | a379b181 | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 39 | void MSP430Subtarget::anchor() { } |
| 40 | |
Eric Christopher | 43768e3 | 2015-03-03 17:54:39 +0000 | [diff] [blame] | 41 | MSP430Subtarget & |
| 42 | MSP430Subtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS) { |
Vadzim Dambrouski | 49dd6e6 | 2017-05-23 21:49:42 +0000 | [diff] [blame] | 43 | ExtendedInsts = false; |
| 44 | HWMultMode = NoHWMult; |
| 45 | |
| 46 | std::string CPUName = CPU; |
| 47 | if (CPUName.empty()) |
| 48 | CPUName = "msp430"; |
| 49 | |
| 50 | ParseSubtargetFeatures(CPUName, FS); |
| 51 | |
| 52 | if (HWMultModeOption != NoHWMult) |
| 53 | HWMultMode = HWMultModeOption; |
| 54 | |
Eric Christopher | 1f86cca | 2014-06-27 01:14:54 +0000 | [diff] [blame] | 55 | return *this; |
Anton Korobeynikov | 1013800 | 2009-05-03 12:57:15 +0000 | [diff] [blame] | 56 | } |
Eric Christopher | 1f86cca | 2014-06-27 01:14:54 +0000 | [diff] [blame] | 57 | |
Daniel Sanders | a73f1fd | 2015-06-10 12:11:26 +0000 | [diff] [blame] | 58 | MSP430Subtarget::MSP430Subtarget(const Triple &TT, const std::string &CPU, |
Eric Christopher | 1f86cca | 2014-06-27 01:14:54 +0000 | [diff] [blame] | 59 | const std::string &FS, const TargetMachine &TM) |
Daniel Sanders | 50f1723 | 2015-09-15 16:17:27 +0000 | [diff] [blame] | 60 | : MSP430GenSubtargetInfo(TT, CPU, FS), FrameLowering(), |
Mehdi Amini | 157e5a6 | 2015-07-09 02:10:08 +0000 | [diff] [blame] | 61 | InstrInfo(initializeSubtargetDependencies(CPU, FS)), TLInfo(TM, *this) {} |