Revert r247692: Replace Triple with a new TargetTuple in MCTargetDesc/* and related...
[oota-llvm.git] / lib / Target / MSP430 / MCTargetDesc / MSP430MCTargetDesc.cpp
1 //===-- MSP430MCTargetDesc.cpp - MSP430 Target Descriptions ---------------===//
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 "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"
22
23 using namespace llvm;
24
25 #define GET_INSTRINFO_MC_DESC
26 #include "MSP430GenInstrInfo.inc"
27
28 #define GET_SUBTARGETINFO_MC_DESC
29 #include "MSP430GenSubtargetInfo.inc"
30
31 #define GET_REGINFO_MC_DESC
32 #include "MSP430GenRegisterInfo.inc"
33
34 static MCInstrInfo *createMSP430MCInstrInfo() {
35   MCInstrInfo *X = new MCInstrInfo();
36   InitMSP430MCInstrInfo(X);
37   return X;
38 }
39
40 static MCRegisterInfo *createMSP430MCRegisterInfo(const Triple &TT) {
41   MCRegisterInfo *X = new MCRegisterInfo();
42   InitMSP430MCRegisterInfo(X, MSP430::PC);
43   return X;
44 }
45
46 static MCSubtargetInfo *
47 createMSP430MCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS) {
48   return createMSP430MCSubtargetInfoImpl(TT, CPU, FS);
49 }
50
51 static MCCodeGenInfo *createMSP430MCCodeGenInfo(const Triple &TT,
52                                                 Reloc::Model RM,
53                                                 CodeModel::Model CM,
54                                                 CodeGenOpt::Level OL) {
55   MCCodeGenInfo *X = new MCCodeGenInfo();
56   X->initMCCodeGenInfo(RM, CM, OL);
57   return X;
58 }
59
60 static MCInstPrinter *createMSP430MCInstPrinter(const Triple &T,
61                                                 unsigned SyntaxVariant,
62                                                 const MCAsmInfo &MAI,
63                                                 const MCInstrInfo &MII,
64                                                 const MCRegisterInfo &MRI) {
65   if (SyntaxVariant == 0)
66     return new MSP430InstPrinter(MAI, MII, MRI);
67   return nullptr;
68 }
69
70 extern "C" void LLVMInitializeMSP430TargetMC() {
71   // Register the MC asm info.
72   RegisterMCAsmInfo<MSP430MCAsmInfo> X(TheMSP430Target);
73
74   // Register the MC codegen info.
75   TargetRegistry::RegisterMCCodeGenInfo(TheMSP430Target,
76                                         createMSP430MCCodeGenInfo);
77
78   // Register the MC instruction info.
79   TargetRegistry::RegisterMCInstrInfo(TheMSP430Target, createMSP430MCInstrInfo);
80
81   // Register the MC register info.
82   TargetRegistry::RegisterMCRegInfo(TheMSP430Target,
83                                     createMSP430MCRegisterInfo);
84
85   // Register the MC subtarget info.
86   TargetRegistry::RegisterMCSubtargetInfo(TheMSP430Target,
87                                           createMSP430MCSubtargetInfo);
88
89   // Register the MCInstPrinter.
90   TargetRegistry::RegisterMCInstPrinter(TheMSP430Target,
91                                         createMSP430MCInstPrinter);
92 }