]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/blob - contrib/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
Copy head to stable/9 as part of 9.0-RELEASE release cycle.
[FreeBSD/stable/9.git] / contrib / llvm / lib / Target / PowerPC / MCTargetDesc / PPCMCTargetDesc.cpp
1 //===-- PPCMCTargetDesc.cpp - PowerPC 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 PowerPC specific target descriptions.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "PPCMCTargetDesc.h"
15 #include "PPCMCAsmInfo.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 "PPCGenInstrInfo.inc"
23
24 #define GET_SUBTARGETINFO_MC_DESC
25 #include "PPCGenSubtargetInfo.inc"
26
27 #define GET_REGINFO_MC_DESC
28 #include "PPCGenRegisterInfo.inc"
29
30 using namespace llvm;
31
32 static MCInstrInfo *createPPCMCInstrInfo() {
33   MCInstrInfo *X = new MCInstrInfo();
34   InitPPCMCInstrInfo(X);
35   return X;
36 }
37
38 extern "C" void LLVMInitializePowerPCMCInstrInfo() {
39   TargetRegistry::RegisterMCInstrInfo(ThePPC32Target, createPPCMCInstrInfo);
40   TargetRegistry::RegisterMCInstrInfo(ThePPC64Target, createPPCMCInstrInfo);
41 }
42
43
44 static MCSubtargetInfo *createPPCMCSubtargetInfo(StringRef TT, StringRef CPU,
45                                                  StringRef FS) {
46   MCSubtargetInfo *X = new MCSubtargetInfo();
47   InitPPCMCSubtargetInfo(X, TT, CPU, FS);
48   return X;
49 }
50
51 extern "C" void LLVMInitializePowerPCMCSubtargetInfo() {
52   TargetRegistry::RegisterMCSubtargetInfo(ThePPC32Target,
53                                           createPPCMCSubtargetInfo);
54   TargetRegistry::RegisterMCSubtargetInfo(ThePPC64Target,
55                                           createPPCMCSubtargetInfo);
56 }
57
58 static MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) {
59   Triple TheTriple(TT);
60   bool isPPC64 = TheTriple.getArch() == Triple::ppc64;
61   if (TheTriple.isOSDarwin())
62     return new PPCMCAsmInfoDarwin(isPPC64);
63   return new PPCLinuxMCAsmInfo(isPPC64);
64   
65 }
66
67 extern "C" void LLVMInitializePowerPCMCAsmInfo() {
68   RegisterMCAsmInfoFn C(ThePPC32Target, createMCAsmInfo);
69   RegisterMCAsmInfoFn D(ThePPC64Target, createMCAsmInfo);  
70 }