• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/Support/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 
createAlphaMCInstrInfo()34 static MCInstrInfo *createAlphaMCInstrInfo() {
35   MCInstrInfo *X = new MCInstrInfo();
36   InitAlphaMCInstrInfo(X);
37   return X;
38 }
39 
createAlphaMCRegisterInfo(StringRef TT)40 static MCRegisterInfo *createAlphaMCRegisterInfo(StringRef TT) {
41   MCRegisterInfo *X = new MCRegisterInfo();
42   InitAlphaMCRegisterInfo(X, Alpha::R26);
43   return X;
44 }
45 
createAlphaMCSubtargetInfo(StringRef TT,StringRef CPU,StringRef FS)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 
createAlphaMCCodeGenInfo(StringRef TT,Reloc::Model RM,CodeModel::Model CM)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.
LLVMInitializeAlphaTargetMC()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 }
79