Combine all MC initialization routines into one. e.g. InitializeX86MCAsmInfo,
[oota-llvm.git] / lib / Target / Alpha / MCTargetDesc / AlphaMCTargetDesc.cpp
1 //===-- AlphaMCTargetDesc.cpp - Alpha 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 Alpha specific target descriptions.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "AlphaMCTargetDesc.h"
15 #include "AlphaMCAsmInfo.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 "AlphaGenInstrInfo.inc"
23
24 #define GET_SUBTARGETINFO_MC_DESC
25 #include "AlphaGenSubtargetInfo.inc"
26
27 #define GET_REGINFO_MC_DESC
28 #include "AlphaGenRegisterInfo.inc"
29
30 using namespace llvm;
31
32
33 static MCInstrInfo *createAlphaMCInstrInfo() {
34   MCInstrInfo *X = new MCInstrInfo();
35   InitAlphaMCInstrInfo(X);
36   return X;
37 }
38
39 static MCRegisterInfo *createAlphaMCRegisterInfo(StringRef TT) {
40   MCRegisterInfo *X = new MCRegisterInfo();
41   InitAlphaMCRegisterInfo(X, Alpha::R26);
42   return X;
43 }
44
45 static MCSubtargetInfo *createAlphaMCSubtargetInfo(StringRef TT, StringRef CPU,
46                                                    StringRef FS) {
47   MCSubtargetInfo *X = new MCSubtargetInfo();
48   InitAlphaMCSubtargetInfo(X, TT, CPU, FS);
49   return X;
50 }
51
52 MCCodeGenInfo *createAlphaMCCodeGenInfo(StringRef TT, Reloc::Model RM,
53                                         CodeModel::Model CM) {
54   MCCodeGenInfo *X = new MCCodeGenInfo();
55   X->InitMCCodeGenInfo(Reloc::PIC_, CM);
56   return X;
57 }
58
59 // Force static initialization.
60 extern "C" void LLVMInitializeAlphaTargetMC() {
61   // Register the MC asm info.
62   RegisterMCAsmInfo<AlphaMCAsmInfo> X(TheAlphaTarget);
63
64   // Register the MC codegen info.
65   TargetRegistry::RegisterMCCodeGenInfo(TheAlphaTarget,
66                                         createAlphaMCCodeGenInfo);
67
68   // Register the MC instruction info.
69   TargetRegistry::RegisterMCInstrInfo(TheAlphaTarget, createAlphaMCInstrInfo);
70
71   // Register the MC register info.
72   TargetRegistry::RegisterMCRegInfo(TheAlphaTarget, createAlphaMCRegisterInfo);
73
74   // Register the MC subtarget info.
75   TargetRegistry::RegisterMCSubtargetInfo(TheAlphaTarget,
76                                           createAlphaMCSubtargetInfo);
77 }