Rewrite the CMake build to use explicit dependencies between libraries,
[oota-llvm.git] / lib / Target / XCore / MCTargetDesc / XCoreMCTargetDesc.cpp
1 //===-- XCoreMCTargetDesc.cpp - XCore 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 XCore specific target descriptions.
11 //
12 //===----------------------------------------------------------------------===//
13
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"
20
21 #define GET_INSTRINFO_MC_DESC
22 #include "XCoreGenInstrInfo.inc"
23
24 #define GET_SUBTARGETINFO_MC_DESC
25 #include "XCoreGenSubtargetInfo.inc"
26
27 #define GET_REGINFO_MC_DESC
28 #include "XCoreGenRegisterInfo.inc"
29
30 using namespace llvm;
31
32 static MCInstrInfo *createXCoreMCInstrInfo() {
33   MCInstrInfo *X = new MCInstrInfo();
34   InitXCoreMCInstrInfo(X);
35   return X;
36 }
37
38 static MCRegisterInfo *createXCoreMCRegisterInfo(StringRef TT) {
39   MCRegisterInfo *X = new MCRegisterInfo();
40   InitXCoreMCRegisterInfo(X, XCore::LR);
41   return X;
42 }
43
44 static MCSubtargetInfo *createXCoreMCSubtargetInfo(StringRef TT, StringRef CPU,
45                                                    StringRef FS) {
46   MCSubtargetInfo *X = new MCSubtargetInfo();
47   InitXCoreMCSubtargetInfo(X, TT, CPU, FS);
48   return X;
49 }
50
51 static MCAsmInfo *createXCoreMCAsmInfo(const Target &T, StringRef TT) {
52   MCAsmInfo *MAI = new XCoreMCAsmInfo(T, TT);
53
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);
58
59   return MAI;
60 }
61
62 static MCCodeGenInfo *createXCoreMCCodeGenInfo(StringRef TT, Reloc::Model RM,
63                                                CodeModel::Model CM) {
64   MCCodeGenInfo *X = new MCCodeGenInfo();
65   X->InitMCCodeGenInfo(RM, CM);
66   return X;
67 }
68
69 // Force static initialization.
70 extern "C" void LLVMInitializeXCoreTargetMC() {
71   // Register the MC asm info.
72   RegisterMCAsmInfoFn X(TheXCoreTarget, createXCoreMCAsmInfo);
73
74   // Register the MC codegen info.
75   TargetRegistry::RegisterMCCodeGenInfo(TheXCoreTarget,
76                                         createXCoreMCCodeGenInfo);
77
78   // Register the MC instruction info.
79   TargetRegistry::RegisterMCInstrInfo(TheXCoreTarget, createXCoreMCInstrInfo);
80
81   // Register the MC register info.
82   TargetRegistry::RegisterMCRegInfo(TheXCoreTarget, createXCoreMCRegisterInfo);
83
84   // Register the MC subtarget info.
85   TargetRegistry::RegisterMCSubtargetInfo(TheXCoreTarget,
86                                           createXCoreMCSubtargetInfo);
87 }