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