1 //===-- MSP430MCTargetDesc.cpp - MSP430 Target Descriptions ---------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file provides MSP430 specific target descriptions.
12 //===----------------------------------------------------------------------===//
14 #include "MSP430MCTargetDesc.h"
15 #include "InstPrinter/MSP430InstPrinter.h"
16 #include "MSP430MCAsmInfo.h"
17 #include "llvm/MC/MCCodeGenInfo.h"
18 #include "llvm/MC/MCInstrInfo.h"
19 #include "llvm/MC/MCRegisterInfo.h"
20 #include "llvm/MC/MCSubtargetInfo.h"
21 #include "llvm/Support/TargetRegistry.h"
25 #define GET_INSTRINFO_MC_DESC
26 #include "MSP430GenInstrInfo.inc"
28 #define GET_SUBTARGETINFO_MC_DESC
29 #include "MSP430GenSubtargetInfo.inc"
31 #define GET_REGINFO_MC_DESC
32 #include "MSP430GenRegisterInfo.inc"
34 static MCInstrInfo
*createMSP430MCInstrInfo() {
35 MCInstrInfo
*X
= new MCInstrInfo();
36 InitMSP430MCInstrInfo(X
);
40 static MCRegisterInfo
*createMSP430MCRegisterInfo(StringRef TT
) {
41 MCRegisterInfo
*X
= new MCRegisterInfo();
42 InitMSP430MCRegisterInfo(X
, MSP430::PC
);
46 static MCSubtargetInfo
*createMSP430MCSubtargetInfo(StringRef TT
, StringRef CPU
,
48 MCSubtargetInfo
*X
= new MCSubtargetInfo();
49 InitMSP430MCSubtargetInfo(X
, TT
, CPU
, FS
);
53 static MCCodeGenInfo
*createMSP430MCCodeGenInfo(StringRef TT
, Reloc::Model RM
,
55 CodeGenOpt::Level OL
) {
56 MCCodeGenInfo
*X
= new MCCodeGenInfo();
57 X
->InitMCCodeGenInfo(RM
, CM
, OL
);
61 static MCInstPrinter
*createMSP430MCInstPrinter(const Target
&T
,
62 unsigned SyntaxVariant
,
64 const MCInstrInfo
&MII
,
65 const MCRegisterInfo
&MRI
,
66 const MCSubtargetInfo
&STI
) {
67 if (SyntaxVariant
== 0)
68 return new MSP430InstPrinter(MAI
, MII
, MRI
);
72 extern "C" void LLVMInitializeMSP430TargetMC() {
73 // Register the MC asm info.
74 RegisterMCAsmInfo
<MSP430MCAsmInfo
> X(TheMSP430Target
);
76 // Register the MC codegen info.
77 TargetRegistry::RegisterMCCodeGenInfo(TheMSP430Target
,
78 createMSP430MCCodeGenInfo
);
80 // Register the MC instruction info.
81 TargetRegistry::RegisterMCInstrInfo(TheMSP430Target
, createMSP430MCInstrInfo
);
83 // Register the MC register info.
84 TargetRegistry::RegisterMCRegInfo(TheMSP430Target
,
85 createMSP430MCRegisterInfo
);
87 // Register the MC subtarget info.
88 TargetRegistry::RegisterMCSubtargetInfo(TheMSP430Target
,
89 createMSP430MCSubtargetInfo
);
91 // Register the MCInstPrinter.
92 TargetRegistry::RegisterMCInstPrinter(TheMSP430Target
,
93 createMSP430MCInstPrinter
);