1 //===-- XCoreMCTargetDesc.cpp - XCore Target Descriptions -----------------===//
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/MCCodeGenInfo.h"
17 #include "llvm/MC/MCInstrInfo.h"
18 #include "llvm/MC/MCRegisterInfo.h"
19 #include "llvm/MC/MCSubtargetInfo.h"
20 #include "llvm/Support/ErrorHandling.h"
21 #include "llvm/Support/TargetRegistry.h"
23 #define GET_INSTRINFO_MC_DESC
24 #include "XCoreGenInstrInfo.inc"
26 #define GET_SUBTARGETINFO_MC_DESC
27 #include "XCoreGenSubtargetInfo.inc"
29 #define GET_REGINFO_MC_DESC
30 #include "XCoreGenRegisterInfo.inc"
34 static MCInstrInfo *createXCoreMCInstrInfo() {
35 MCInstrInfo *X = new MCInstrInfo();
36 InitXCoreMCInstrInfo(X);
40 static MCRegisterInfo *createXCoreMCRegisterInfo(StringRef TT) {
41 MCRegisterInfo *X = new MCRegisterInfo();
42 InitXCoreMCRegisterInfo(X, XCore::LR);
46 static MCSubtargetInfo *createXCoreMCSubtargetInfo(StringRef TT, StringRef CPU,
48 MCSubtargetInfo *X = new MCSubtargetInfo();
49 InitXCoreMCSubtargetInfo(X, TT, CPU, FS);
53 static MCAsmInfo *createXCoreMCAsmInfo(const Target &T, StringRef TT) {
54 MCAsmInfo *MAI = new XCoreMCAsmInfo(T, TT);
56 // Initial state of the frame pointer is SP.
57 MachineLocation Dst(MachineLocation::VirtualFP);
58 MachineLocation Src(XCore::SP, 0);
59 MAI->addInitialFrameState(0, Dst, Src);
64 static MCCodeGenInfo *createXCoreMCCodeGenInfo(StringRef TT, Reloc::Model RM,
66 CodeGenOpt::Level OL) {
67 MCCodeGenInfo *X = new MCCodeGenInfo();
68 X->InitMCCodeGenInfo(RM, CM, OL);
72 // Force static initialization.
73 extern "C" void LLVMInitializeXCoreTargetMC() {
74 // Register the MC asm info.
75 RegisterMCAsmInfoFn X(TheXCoreTarget, createXCoreMCAsmInfo);
77 // Register the MC codegen info.
78 TargetRegistry::RegisterMCCodeGenInfo(TheXCoreTarget,
79 createXCoreMCCodeGenInfo);
81 // Register the MC instruction info.
82 TargetRegistry::RegisterMCInstrInfo(TheXCoreTarget, createXCoreMCInstrInfo);
84 // Register the MC register info.
85 TargetRegistry::RegisterMCRegInfo(TheXCoreTarget, createXCoreMCRegisterInfo);
87 // Register the MC subtarget info.
88 TargetRegistry::RegisterMCSubtargetInfo(TheXCoreTarget,
89 createXCoreMCSubtargetInfo);