OSDN Git Service

resolved conflicts for merge of 8f698b54 to master
[android-x86/external-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/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 "XCoreGenInstrInfo.inc"
24
25 #define GET_SUBTARGETINFO_MC_DESC
26 #include "XCoreGenSubtargetInfo.inc"
27
28 #define GET_REGINFO_MC_DESC
29 #include "XCoreGenRegisterInfo.inc"
30
31 using namespace llvm;
32
33 static MCInstrInfo *createXCoreMCInstrInfo() {
34   MCInstrInfo *X = new MCInstrInfo();
35   InitXCoreMCInstrInfo(X);
36   return X;
37 }
38
39 static MCRegisterInfo *createXCoreMCRegisterInfo(StringRef TT) {
40   MCRegisterInfo *X = new MCRegisterInfo();
41   InitXCoreMCRegisterInfo(X, XCore::LR);
42   return X;
43 }
44
45 static MCSubtargetInfo *createXCoreMCSubtargetInfo(StringRef TT, StringRef CPU,
46                                                    StringRef FS) {
47   MCSubtargetInfo *X = new MCSubtargetInfo();
48   InitXCoreMCSubtargetInfo(X, TT, CPU, FS);
49   return X;
50 }
51
52 static MCAsmInfo *createXCoreMCAsmInfo(const Target &T, StringRef TT) {
53   MCAsmInfo *MAI = new XCoreMCAsmInfo(T, TT);
54
55   // Initial state of the frame pointer is SP.
56   MachineLocation Dst(MachineLocation::VirtualFP);
57   MachineLocation Src(XCore::SP, 0);
58   MAI->addInitialFrameState(0, Dst, Src);
59
60   return MAI;
61 }
62
63 static MCCodeGenInfo *createXCoreMCCodeGenInfo(StringRef TT, Reloc::Model RM,
64                                                CodeModel::Model CM,
65                                                CodeGenOpt::Level OL) {
66   MCCodeGenInfo *X = new MCCodeGenInfo();
67   X->InitMCCodeGenInfo(RM, CM, OL);
68   return X;
69 }
70
71 // Force static initialization.
72 extern "C" void LLVMInitializeXCoreTargetMC() {
73   // Register the MC asm info.
74   RegisterMCAsmInfoFn X(TheXCoreTarget, createXCoreMCAsmInfo);
75
76   // Register the MC codegen info.
77   TargetRegistry::RegisterMCCodeGenInfo(TheXCoreTarget,
78                                         createXCoreMCCodeGenInfo);
79
80   // Register the MC instruction info.
81   TargetRegistry::RegisterMCInstrInfo(TheXCoreTarget, createXCoreMCInstrInfo);
82
83   // Register the MC register info.
84   TargetRegistry::RegisterMCRegInfo(TheXCoreTarget, createXCoreMCRegisterInfo);
85
86   // Register the MC subtarget info.
87   TargetRegistry::RegisterMCSubtargetInfo(TheXCoreTarget,
88                                           createXCoreMCSubtargetInfo);
89 }