1 //===-- SparcMCTargetDesc.cpp - Sparc 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 Sparc specific target descriptions.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "SparcMCTargetDesc.h"
15 #include "SparcMCAsmInfo.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 "SparcGenInstrInfo.inc"
24
25 #define GET_SUBTARGETINFO_MC_DESC
26 #include "SparcGenSubtargetInfo.inc"
27
28 #define GET_REGINFO_MC_DESC
29 #include "SparcGenRegisterInfo.inc"
30
31 using namespace llvm;
32
createSparcMCInstrInfo()33 static MCInstrInfo *createSparcMCInstrInfo() {
34 MCInstrInfo *X = new MCInstrInfo();
35 InitSparcMCInstrInfo(X);
36 return X;
37 }
38
createSparcMCRegisterInfo(StringRef TT)39 static MCRegisterInfo *createSparcMCRegisterInfo(StringRef TT) {
40 MCRegisterInfo *X = new MCRegisterInfo();
41 InitSparcMCRegisterInfo(X, SP::I7);
42 return X;
43 }
44
createSparcMCSubtargetInfo(StringRef TT,StringRef CPU,StringRef FS)45 static MCSubtargetInfo *createSparcMCSubtargetInfo(StringRef TT, StringRef CPU,
46 StringRef FS) {
47 MCSubtargetInfo *X = new MCSubtargetInfo();
48 InitSparcMCSubtargetInfo(X, TT, CPU, FS);
49 return X;
50 }
51
createSparcMCCodeGenInfo(StringRef TT,Reloc::Model RM,CodeModel::Model CM)52 static MCCodeGenInfo *createSparcMCCodeGenInfo(StringRef TT, Reloc::Model RM,
53 CodeModel::Model CM) {
54 MCCodeGenInfo *X = new MCCodeGenInfo();
55 X->InitMCCodeGenInfo(RM, CM);
56 return X;
57 }
58
LLVMInitializeSparcTargetMC()59 extern "C" void LLVMInitializeSparcTargetMC() {
60 // Register the MC asm info.
61 RegisterMCAsmInfo<SparcELFMCAsmInfo> X(TheSparcTarget);
62 RegisterMCAsmInfo<SparcELFMCAsmInfo> Y(TheSparcV9Target);
63
64 // Register the MC codegen info.
65 TargetRegistry::RegisterMCCodeGenInfo(TheSparcTarget,
66 createSparcMCCodeGenInfo);
67 TargetRegistry::RegisterMCCodeGenInfo(TheSparcV9Target,
68 createSparcMCCodeGenInfo);
69
70 // Register the MC instruction info.
71 TargetRegistry::RegisterMCInstrInfo(TheSparcTarget, createSparcMCInstrInfo);
72
73 // Register the MC register info.
74 TargetRegistry::RegisterMCRegInfo(TheSparcTarget, createSparcMCRegisterInfo);
75
76 // Register the MC subtarget info.
77 TargetRegistry::RegisterMCSubtargetInfo(TheSparcTarget,
78 createSparcMCSubtargetInfo);
79 }
80