Combine all MC initialization routines into one. e.g. InitializeX86MCAsmInfo,
[oota-llvm.git] / lib / Target / MSP430 / MCTargetDesc / MSP430MCTargetDesc.cpp
1 //===-- MSP430MCTargetDesc.cpp - MSP430 Target Descriptions -----*- C++ -*-===//
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 //
10 // This file provides MSP430 specific target descriptions.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "MSP430MCTargetDesc.h"
15 #include "MSP430MCAsmInfo.h"
16 #include "llvm/MC/MCInstrInfo.h"
17 #include "llvm/MC/MCRegisterInfo.h"
18 #include "llvm/MC/MCSubtargetInfo.h"
19 #include "llvm/Target/TargetRegistry.h"
20
21 #define GET_INSTRINFO_MC_DESC
22 #include "MSP430GenInstrInfo.inc"
23
24 #define GET_SUBTARGETINFO_MC_DESC
25 #include "MSP430GenSubtargetInfo.inc"
26
27 #define GET_REGINFO_MC_DESC
28 #include "MSP430GenRegisterInfo.inc"
29
30 using namespace llvm;
31
32 static MCInstrInfo *createMSP430MCInstrInfo() {
33   MCInstrInfo *X = new MCInstrInfo();
34   InitMSP430MCInstrInfo(X);
35   return X;
36 }
37
38 static MCRegisterInfo *createMSP430MCRegisterInfo(StringRef TT) {
39   MCRegisterInfo *X = new MCRegisterInfo();
40   InitMSP430MCRegisterInfo(X, MSP430::PCW);
41   return X;
42 }
43
44 static MCSubtargetInfo *createMSP430MCSubtargetInfo(StringRef TT, StringRef CPU,
45                                                     StringRef FS) {
46   MCSubtargetInfo *X = new MCSubtargetInfo();
47   InitMSP430MCSubtargetInfo(X, TT, CPU, FS);
48   return X;
49 }
50
51 MCCodeGenInfo *createMSP430MCCodeGenInfo(StringRef TT, Reloc::Model RM,
52                                          CodeModel::Model CM) {
53   MCCodeGenInfo *X = new MCCodeGenInfo();
54   X->InitMCCodeGenInfo(RM, CM);
55   return X;
56 }
57
58 extern "C" void LLVMInitializeMSP430TargetMC() {
59   // Register the MC asm info.
60   RegisterMCAsmInfo<MSP430MCAsmInfo> X(TheMSP430Target);
61
62   // Register the MC codegen info.
63   TargetRegistry::RegisterMCCodeGenInfo(TheMSP430Target,
64                                         createMSP430MCCodeGenInfo);
65
66   // Register the MC instruction info.
67   TargetRegistry::RegisterMCInstrInfo(TheMSP430Target, createMSP430MCInstrInfo);
68
69   // Register the MC register info.
70   TargetRegistry::RegisterMCRegInfo(TheMSP430Target,
71                                     createMSP430MCRegisterInfo);
72
73   // Register the MC subtarget info.
74   TargetRegistry::RegisterMCSubtargetInfo(TheMSP430Target,
75                                           createMSP430MCSubtargetInfo);
76 }