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