1 //===-- MBlazeMCTargetDesc.cpp - MBlaze Target Descriptions -----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file provides MBlaze specific target descriptions.
12 //===----------------------------------------------------------------------===//
14 #include "MBlazeMCTargetDesc.h"
15 #include "MBlazeMCAsmInfo.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"
21 #define GET_INSTRINFO_MC_DESC
22 #include "MBlazeGenInstrInfo.inc"
24 #define GET_SUBTARGETINFO_MC_DESC
25 #include "MBlazeGenSubtargetInfo.inc"
27 #define GET_REGINFO_MC_DESC
28 #include "MBlazeGenRegisterInfo.inc"
33 static MCInstrInfo *createMBlazeMCInstrInfo() {
34 MCInstrInfo *X = new MCInstrInfo();
35 InitMBlazeMCInstrInfo(X);
39 static MCRegisterInfo *createMBlazeMCRegisterInfo(StringRef TT) {
40 MCRegisterInfo *X = new MCRegisterInfo();
41 InitMBlazeMCRegisterInfo(X, MBlaze::R15);
45 static MCSubtargetInfo *createMBlazeMCSubtargetInfo(StringRef TT, StringRef CPU,
47 MCSubtargetInfo *X = new MCSubtargetInfo();
48 InitMBlazeMCSubtargetInfo(X, TT, CPU, FS);
52 static MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) {
54 switch (TheTriple.getOS()) {
56 return new MBlazeMCAsmInfo();
60 static MCCodeGenInfo *createMBlazeMCCodeGenInfo(StringRef TT, Reloc::Model RM,
61 CodeModel::Model CM) {
62 MCCodeGenInfo *X = new MCCodeGenInfo();
63 if (RM == Reloc::Default)
65 if (CM == CodeModel::Default)
66 CM = CodeModel::Small;
67 X->InitMCCodeGenInfo(RM, CM);
71 // Force static initialization.
72 extern "C" void LLVMInitializeMBlazeTargetMC() {
73 // Register the MC asm info.
74 RegisterMCAsmInfoFn X(TheMBlazeTarget, createMCAsmInfo);
76 // Register the MC codegen info.
77 TargetRegistry::RegisterMCCodeGenInfo(TheMBlazeTarget,
78 createMBlazeMCCodeGenInfo);
80 // Register the MC instruction info.
81 TargetRegistry::RegisterMCInstrInfo(TheMBlazeTarget, createMBlazeMCInstrInfo);
83 // Register the MC register info.
84 TargetRegistry::RegisterMCRegInfo(TheMBlazeTarget,
85 createMBlazeMCRegisterInfo);
87 // Register the MC subtarget info.
88 TargetRegistry::RegisterMCSubtargetInfo(TheMBlazeTarget,
89 createMBlazeMCSubtargetInfo);