2012-02-18 12:03:15 +00:00
|
|
|
//===-- MSP430MCTargetDesc.cpp - MSP430 Target Descriptions ---------------===//
|
2011-07-14 20:59:42 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file provides MSP430 specific target descriptions.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "MSP430MCTargetDesc.h"
|
2011-07-25 21:20:24 +00:00
|
|
|
#include "InstPrinter/MSP430InstPrinter.h"
|
2012-12-03 16:50:05 +00:00
|
|
|
#include "MSP430MCAsmInfo.h"
|
2011-08-23 20:15:21 +00:00
|
|
|
#include "llvm/MC/MCCodeGenInfo.h"
|
2011-07-14 20:59:42 +00:00
|
|
|
#include "llvm/MC/MCInstrInfo.h"
|
|
|
|
#include "llvm/MC/MCRegisterInfo.h"
|
|
|
|
#include "llvm/MC/MCSubtargetInfo.h"
|
2011-08-24 18:08:43 +00:00
|
|
|
#include "llvm/Support/TargetRegistry.h"
|
2011-07-14 20:59:42 +00:00
|
|
|
|
|
|
|
#define GET_INSTRINFO_MC_DESC
|
|
|
|
#include "MSP430GenInstrInfo.inc"
|
|
|
|
|
|
|
|
#define GET_SUBTARGETINFO_MC_DESC
|
|
|
|
#include "MSP430GenSubtargetInfo.inc"
|
|
|
|
|
|
|
|
#define GET_REGINFO_MC_DESC
|
|
|
|
#include "MSP430GenRegisterInfo.inc"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2011-07-14 23:50:31 +00:00
|
|
|
static MCInstrInfo *createMSP430MCInstrInfo() {
|
2011-07-14 20:59:42 +00:00
|
|
|
MCInstrInfo *X = new MCInstrInfo();
|
|
|
|
InitMSP430MCInstrInfo(X);
|
|
|
|
return X;
|
|
|
|
}
|
|
|
|
|
2011-07-18 20:57:22 +00:00
|
|
|
static MCRegisterInfo *createMSP430MCRegisterInfo(StringRef TT) {
|
|
|
|
MCRegisterInfo *X = new MCRegisterInfo();
|
|
|
|
InitMSP430MCRegisterInfo(X, MSP430::PCW);
|
|
|
|
return X;
|
|
|
|
}
|
|
|
|
|
2011-07-14 23:50:31 +00:00
|
|
|
static MCSubtargetInfo *createMSP430MCSubtargetInfo(StringRef TT, StringRef CPU,
|
|
|
|
StringRef FS) {
|
2011-07-14 20:59:42 +00:00
|
|
|
MCSubtargetInfo *X = new MCSubtargetInfo();
|
|
|
|
InitMSP430MCSubtargetInfo(X, TT, CPU, FS);
|
|
|
|
return X;
|
|
|
|
}
|
|
|
|
|
2011-07-23 00:01:04 +00:00
|
|
|
static MCCodeGenInfo *createMSP430MCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
2011-11-16 08:38:26 +00:00
|
|
|
CodeModel::Model CM,
|
|
|
|
CodeGenOpt::Level OL) {
|
2011-07-19 06:37:02 +00:00
|
|
|
MCCodeGenInfo *X = new MCCodeGenInfo();
|
2011-11-16 08:38:26 +00:00
|
|
|
X->InitMCCodeGenInfo(RM, CM, OL);
|
2011-07-19 06:37:02 +00:00
|
|
|
return X;
|
|
|
|
}
|
|
|
|
|
2011-07-25 21:20:24 +00:00
|
|
|
static MCInstPrinter *createMSP430MCInstPrinter(const Target &T,
|
|
|
|
unsigned SyntaxVariant,
|
2011-09-07 17:24:38 +00:00
|
|
|
const MCAsmInfo &MAI,
|
2012-04-02 06:09:36 +00:00
|
|
|
const MCInstrInfo &MII,
|
2012-03-05 19:33:20 +00:00
|
|
|
const MCRegisterInfo &MRI,
|
2011-09-07 17:24:38 +00:00
|
|
|
const MCSubtargetInfo &STI) {
|
2011-07-25 21:20:24 +00:00
|
|
|
if (SyntaxVariant == 0)
|
2012-04-02 06:09:36 +00:00
|
|
|
return new MSP430InstPrinter(MAI, MII, MRI);
|
2011-07-25 21:20:24 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-07-22 21:58:54 +00:00
|
|
|
extern "C" void LLVMInitializeMSP430TargetMC() {
|
|
|
|
// Register the MC asm info.
|
|
|
|
RegisterMCAsmInfo<MSP430MCAsmInfo> X(TheMSP430Target);
|
|
|
|
|
|
|
|
// Register the MC codegen info.
|
2011-07-19 06:37:02 +00:00
|
|
|
TargetRegistry::RegisterMCCodeGenInfo(TheMSP430Target,
|
|
|
|
createMSP430MCCodeGenInfo);
|
2011-07-22 21:58:54 +00:00
|
|
|
|
|
|
|
// Register the MC instruction info.
|
|
|
|
TargetRegistry::RegisterMCInstrInfo(TheMSP430Target, createMSP430MCInstrInfo);
|
|
|
|
|
|
|
|
// Register the MC register info.
|
|
|
|
TargetRegistry::RegisterMCRegInfo(TheMSP430Target,
|
|
|
|
createMSP430MCRegisterInfo);
|
|
|
|
|
|
|
|
// Register the MC subtarget info.
|
|
|
|
TargetRegistry::RegisterMCSubtargetInfo(TheMSP430Target,
|
|
|
|
createMSP430MCSubtargetInfo);
|
2011-07-25 21:20:24 +00:00
|
|
|
|
|
|
|
// Register the MCInstPrinter.
|
|
|
|
TargetRegistry::RegisterMCInstPrinter(TheMSP430Target,
|
|
|
|
createMSP430MCInstPrinter);
|
2011-07-19 06:37:02 +00:00
|
|
|
}
|