[X86][BMI] Pull out schedule classes from bmi_andn<> and bmi_bls<>
[llvm-core.git] / lib / Target / NVPTX / MCTargetDesc / NVPTXMCTargetDesc.cpp
blobc8b85b2718a654dfd30a0ff3471aa2498f396f55
1 //===-- NVPTXMCTargetDesc.cpp - NVPTX Target Descriptions -------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file provides NVPTX specific target descriptions.
11 //===----------------------------------------------------------------------===//
13 #include "NVPTXInstPrinter.h"
14 #include "NVPTXMCAsmInfo.h"
15 #include "NVPTXMCTargetDesc.h"
16 #include "NVPTXTargetStreamer.h"
17 #include "TargetInfo/NVPTXTargetInfo.h"
18 #include "llvm/MC/MCInstrInfo.h"
19 #include "llvm/MC/MCRegisterInfo.h"
20 #include "llvm/MC/MCSubtargetInfo.h"
21 #include "llvm/Support/TargetRegistry.h"
23 using namespace llvm;
25 #define GET_INSTRINFO_MC_DESC
26 #include "NVPTXGenInstrInfo.inc"
28 #define GET_SUBTARGETINFO_MC_DESC
29 #include "NVPTXGenSubtargetInfo.inc"
31 #define GET_REGINFO_MC_DESC
32 #include "NVPTXGenRegisterInfo.inc"
34 static MCInstrInfo *createNVPTXMCInstrInfo() {
35 MCInstrInfo *X = new MCInstrInfo();
36 InitNVPTXMCInstrInfo(X);
37 return X;
40 static MCRegisterInfo *createNVPTXMCRegisterInfo(const Triple &TT) {
41 MCRegisterInfo *X = new MCRegisterInfo();
42 // PTX does not have a return address register.
43 InitNVPTXMCRegisterInfo(X, 0);
44 return X;
47 static MCSubtargetInfo *
48 createNVPTXMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS) {
49 return createNVPTXMCSubtargetInfoImpl(TT, CPU, FS);
52 static MCInstPrinter *createNVPTXMCInstPrinter(const Triple &T,
53 unsigned SyntaxVariant,
54 const MCAsmInfo &MAI,
55 const MCInstrInfo &MII,
56 const MCRegisterInfo &MRI) {
57 if (SyntaxVariant == 0)
58 return new NVPTXInstPrinter(MAI, MII, MRI);
59 return nullptr;
62 static MCTargetStreamer *createTargetAsmStreamer(MCStreamer &S,
63 formatted_raw_ostream &,
64 MCInstPrinter *, bool) {
65 return new NVPTXTargetStreamer(S);
68 // Force static initialization.
69 extern "C" void LLVMInitializeNVPTXTargetMC() {
70 for (Target *T : {&getTheNVPTXTarget32(), &getTheNVPTXTarget64()}) {
71 // Register the MC asm info.
72 RegisterMCAsmInfo<NVPTXMCAsmInfo> X(*T);
74 // Register the MC instruction info.
75 TargetRegistry::RegisterMCInstrInfo(*T, createNVPTXMCInstrInfo);
77 // Register the MC register info.
78 TargetRegistry::RegisterMCRegInfo(*T, createNVPTXMCRegisterInfo);
80 // Register the MC subtarget info.
81 TargetRegistry::RegisterMCSubtargetInfo(*T, createNVPTXMCSubtargetInfo);
83 // Register the MCInstPrinter.
84 TargetRegistry::RegisterMCInstPrinter(*T, createNVPTXMCInstPrinter);
86 // Register the MCTargetStreamer.
87 TargetRegistry::RegisterAsmTargetStreamer(*T, createTargetAsmStreamer);