LLVM  10.0.0svn
NVPTXMCTargetDesc.cpp
Go to the documentation of this file.
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.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "NVPTXInstPrinter.h"
14 #include "NVPTXMCAsmInfo.h"
15 #include "NVPTXMCTargetDesc.h"
16 #include "NVPTXTargetStreamer.h"
18 #include "llvm/MC/MCInstrInfo.h"
19 #include "llvm/MC/MCRegisterInfo.h"
22 
23 using namespace llvm;
24 
25 #define GET_INSTRINFO_MC_DESC
26 #include "NVPTXGenInstrInfo.inc"
27 
28 #define GET_SUBTARGETINFO_MC_DESC
29 #include "NVPTXGenSubtargetInfo.inc"
30 
31 #define GET_REGINFO_MC_DESC
32 #include "NVPTXGenRegisterInfo.inc"
33 
35  MCInstrInfo *X = new MCInstrInfo();
36  InitNVPTXMCInstrInfo(X);
37  return X;
38 }
39 
42  // PTX does not have a return address register.
43  InitNVPTXMCRegisterInfo(X, 0);
44  return X;
45 }
46 
47 static MCSubtargetInfo *
49  return createNVPTXMCSubtargetInfoImpl(TT, CPU, FS);
50 }
51 
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;
60 }
61 
64  MCInstPrinter *, bool) {
65  return new NVPTXTargetStreamer(S);
66 }
67 
68 // Force static initialization.
69 extern "C" void LLVMInitializeNVPTXTargetMC() {
71  // Register the MC asm info.
73 
74  // Register the MC instruction info.
76 
77  // Register the MC register info.
79 
80  // Register the MC subtarget info.
82 
83  // Register the MCInstPrinter.
85 
86  // Register the MCTargetStreamer.
88  }
89 }
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
This class represents lattice values for constants.
Definition: AllocatorList.h:23
formatted_raw_ostream - A raw_ostream that wraps another one and keeps track of line and column posit...
Target specific streamer interface.
Definition: MCStreamer.h:84
static void RegisterMCInstPrinter(Target &T, Target::MCInstPrinterCtorTy Fn)
RegisterMCInstPrinter - Register a MCInstPrinter implementation for the given target.
static void RegisterAsmTargetStreamer(Target &T, Target::AsmTargetStreamerCtorTy Fn)
static MCInstrInfo * createNVPTXMCInstrInfo()
Target & getTheNVPTXTarget64()
static MCTargetStreamer * createTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &, MCInstPrinter *, bool)
static MCSubtargetInfo * createNVPTXMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
Target & getTheNVPTXTarget32()
Streaming machine code generation interface.
Definition: MCStreamer.h:189
unsigned const MachineRegisterInfo * MRI
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:23
static void RegisterMCSubtargetInfo(Target &T, Target::MCSubtargetInfoCtorFnTy Fn)
RegisterMCSubtargetInfo - Register a MCSubtargetInfo implementation for the given target...
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:43
static void RegisterMCRegInfo(Target &T, Target::MCRegInfoCtorFnTy Fn)
RegisterMCRegInfo - Register a MCRegisterInfo implementation for the given target.
Target - Wrapper for Target specific information.
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:39
static void RegisterMCInstrInfo(Target &T, Target::MCInstrInfoCtorFnTy Fn)
RegisterMCInstrInfo - Register a MCInstrInfo implementation for the given target. ...
static MCRegisterInfo * createNVPTXMCRegisterInfo(const Triple &TT)
Generic base class for all target subtargets.
void LLVMInitializeNVPTXTargetMC()
Implments NVPTX-specific streamer.
RegisterMCAsmInfo - Helper template for registering a target assembly info implementation.
static MCInstPrinter * createNVPTXMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48