1 //===-- XCoreMCTargetDesc.cpp - XCore 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 XCore specific target descriptions.
12 //===----------------------------------------------------------------------===//
14 #include "XCoreMCTargetDesc.h"
15 #include "XCoreMCAsmInfo.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 "XCoreGenInstrInfo.inc"
24 #define GET_SUBTARGETINFO_MC_DESC
25 #include "XCoreGenSubtargetInfo.inc"
27 #define GET_REGINFO_MC_DESC
28 #include "XCoreGenRegisterInfo.inc"
32 static MCInstrInfo *createXCoreMCInstrInfo() {
33 MCInstrInfo *X = new MCInstrInfo();
34 InitXCoreMCInstrInfo(X);
38 static MCRegisterInfo *createXCoreMCRegisterInfo(StringRef TT) {
39 MCRegisterInfo *X = new MCRegisterInfo();
40 InitXCoreMCRegisterInfo(X, XCore::LR);
44 static MCSubtargetInfo *createXCoreMCSubtargetInfo(StringRef TT, StringRef CPU,
46 MCSubtargetInfo *X = new MCSubtargetInfo();
47 InitXCoreMCSubtargetInfo(X, TT, CPU, FS);
51 static MCAsmInfo *createXCoreMCAsmInfo(const Target &T, StringRef TT) {
52 MCAsmInfo *MAI = new XCoreMCAsmInfo(T, TT);
54 // Initial state of the frame pointer is SP.
55 MachineLocation Dst(MachineLocation::VirtualFP);
56 MachineLocation Src(XCore::SP, 0);
57 MAI->addInitialFrameState(0, Dst, Src);
62 MCCodeGenInfo *createXCoreMCCodeGenInfo(StringRef TT, Reloc::Model RM,
63 CodeModel::Model CM) {
64 MCCodeGenInfo *X = new MCCodeGenInfo();
65 X->InitMCCodeGenInfo(RM, CM);
69 // Force static initialization.
70 extern "C" void LLVMInitializeXCoreTargetMC() {
71 // Register the MC asm info.
72 RegisterMCAsmInfoFn X(TheXCoreTarget, createXCoreMCAsmInfo);
74 // Register the MC codegen info.
75 TargetRegistry::RegisterMCCodeGenInfo(TheXCoreTarget,
76 createXCoreMCCodeGenInfo);
78 // Register the MC instruction info.
79 TargetRegistry::RegisterMCInstrInfo(TheXCoreTarget, createXCoreMCInstrInfo);
81 // Register the MC register info.
82 TargetRegistry::RegisterMCRegInfo(TheXCoreTarget, createXCoreMCRegisterInfo);
84 // Register the MC subtarget info.
85 TargetRegistry::RegisterMCSubtargetInfo(TheXCoreTarget,
86 createXCoreMCSubtargetInfo);