2012-02-18 20:03:15 +08:00
|
|
|
//===-- MSP430Subtarget.cpp - MSP430 Subtarget Information ----------------===//
|
2009-05-03 20:57:15 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2009-05-03 20:57:15 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2011-07-02 05:01:15 +08:00
|
|
|
// This file implements the MSP430 specific subclass of TargetSubtargetInfo.
|
2009-05-03 20:57:15 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "MSP430Subtarget.h"
|
|
|
|
#include "MSP430.h"
|
2011-08-25 02:08:43 +08:00
|
|
|
#include "llvm/Support/TargetRegistry.h"
|
2011-07-02 04:45:01 +08:00
|
|
|
|
2014-04-22 10:03:14 +08:00
|
|
|
using namespace llvm;
|
|
|
|
|
2014-04-22 06:55:11 +08:00
|
|
|
#define DEBUG_TYPE "msp430-subtarget"
|
|
|
|
|
2017-05-24 05:49:42 +08:00
|
|
|
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")));
|
|
|
|
|
2011-07-02 04:45:01 +08:00
|
|
|
#define GET_SUBTARGETINFO_TARGET_DESC
|
2011-07-08 09:53:10 +08:00
|
|
|
#define GET_SUBTARGETINFO_CTOR
|
2011-07-02 06:36:09 +08:00
|
|
|
#include "MSP430GenSubtargetInfo.inc"
|
2009-05-03 20:57:15 +08:00
|
|
|
|
2011-12-20 10:50:00 +08:00
|
|
|
void MSP430Subtarget::anchor() { }
|
|
|
|
|
2015-03-04 01:54:39 +08:00
|
|
|
MSP430Subtarget &
|
|
|
|
MSP430Subtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS) {
|
2017-05-24 05:49:42 +08:00
|
|
|
ExtendedInsts = false;
|
|
|
|
HWMultMode = NoHWMult;
|
|
|
|
|
|
|
|
std::string CPUName = CPU;
|
|
|
|
if (CPUName.empty())
|
|
|
|
CPUName = "msp430";
|
|
|
|
|
|
|
|
ParseSubtargetFeatures(CPUName, FS);
|
|
|
|
|
|
|
|
if (HWMultModeOption != NoHWMult)
|
|
|
|
HWMultMode = HWMultModeOption;
|
|
|
|
|
2014-06-27 09:14:54 +08:00
|
|
|
return *this;
|
2009-05-03 20:57:15 +08:00
|
|
|
}
|
2014-06-27 09:14:54 +08:00
|
|
|
|
2015-06-10 20:11:26 +08:00
|
|
|
MSP430Subtarget::MSP430Subtarget(const Triple &TT, const std::string &CPU,
|
2014-06-27 09:14:54 +08:00
|
|
|
const std::string &FS, const TargetMachine &TM)
|
2015-09-16 00:17:27 +08:00
|
|
|
: MSP430GenSubtargetInfo(TT, CPU, FS), FrameLowering(),
|
2015-07-09 10:10:08 +08:00
|
|
|
InstrInfo(initializeSubtargetDependencies(CPU, FS)), TLInfo(TM, *this) {}
|