1//===-- SystemZMCTargetDesc.cpp - SystemZ 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 SystemZ specific target descriptions.
11//
12//===----------------------------------------------------------------------===//
13
14#include "SystemZMCTargetDesc.h"
15#include "SystemZMCAsmInfo.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 "SystemZGenInstrInfo.inc"
24
25#define GET_SUBTARGETINFO_MC_DESC
26#include "SystemZGenSubtargetInfo.inc"
27
28#define GET_REGINFO_MC_DESC
29#include "SystemZGenRegisterInfo.inc"
30
31using namespace llvm;
32
33static MCInstrInfo *createSystemZMCInstrInfo() {
34  MCInstrInfo *X = new MCInstrInfo();
35  InitSystemZMCInstrInfo(X);
36  return X;
37}
38
39static MCRegisterInfo *createSystemZMCRegisterInfo(StringRef TT) {
40  MCRegisterInfo *X = new MCRegisterInfo();
41  InitSystemZMCRegisterInfo(X, 0);
42  return X;
43}
44
45static MCSubtargetInfo *createSystemZMCSubtargetInfo(StringRef TT,
46                                                     StringRef CPU,
47                                                     StringRef FS) {
48  MCSubtargetInfo *X = new MCSubtargetInfo();
49  InitSystemZMCSubtargetInfo(X, TT, CPU, FS);
50  return X;
51}
52
53static MCCodeGenInfo *createSystemZMCCodeGenInfo(StringRef TT, Reloc::Model RM,
54                                                 CodeModel::Model CM) {
55  MCCodeGenInfo *X = new MCCodeGenInfo();
56  if (RM == Reloc::Default)
57    RM = Reloc::Static;
58  X->InitMCCodeGenInfo(RM, CM);
59  return X;
60}
61
62extern "C" void LLVMInitializeSystemZTargetMC() {
63  // Register the MC asm info.
64  RegisterMCAsmInfo<SystemZMCAsmInfo> X(TheSystemZTarget);
65
66  // Register the MC codegen info.
67  TargetRegistry::RegisterMCCodeGenInfo(TheSystemZTarget,
68                                        createSystemZMCCodeGenInfo);
69
70  // Register the MC instruction info.
71  TargetRegistry::RegisterMCInstrInfo(TheSystemZTarget,
72                                      createSystemZMCInstrInfo);
73
74  // Register the MC register info.
75  TargetRegistry::RegisterMCRegInfo(TheSystemZTarget,
76                                    createSystemZMCRegisterInfo);
77
78  // Register the MC subtarget info.
79  TargetRegistry::RegisterMCSubtargetInfo(TheSystemZTarget,
80                                          createSystemZMCSubtargetInfo);
81}
82