LLVM  17.0.0git
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 "NVPTXMCTargetDesc.h"
14 #include "NVPTXInstPrinter.h"
15 #include "NVPTXMCAsmInfo.h"
16 #include "NVPTXTargetStreamer.h"
18 #include "llvm/MC/MCInstrInfo.h"
19 #include "llvm/MC/MCRegisterInfo.h"
21 #include "llvm/MC/TargetRegistry.h"
22 
23 using namespace llvm;
24 
25 #define GET_INSTRINFO_MC_DESC
26 #define ENABLE_INSTR_PREDICATE_VERIFIER
27 #include "NVPTXGenInstrInfo.inc"
28 
29 #define GET_SUBTARGETINFO_MC_DESC
30 #include "NVPTXGenSubtargetInfo.inc"
31 
32 #define GET_REGINFO_MC_DESC
33 #include "NVPTXGenRegisterInfo.inc"
34 
36  MCInstrInfo *X = new MCInstrInfo();
37  InitNVPTXMCInstrInfo(X);
38  return X;
39 }
40 
43  // PTX does not have a return address register.
44  InitNVPTXMCRegisterInfo(X, 0);
45  return X;
46 }
47 
48 static MCSubtargetInfo *
50  return createNVPTXMCSubtargetInfoImpl(TT, CPU, /*TuneCPU*/ CPU, FS);
51 }
52 
54  unsigned SyntaxVariant,
55  const MCAsmInfo &MAI,
56  const MCInstrInfo &MII,
57  const MCRegisterInfo &MRI) {
58  if (SyntaxVariant == 0)
59  return new NVPTXInstPrinter(MAI, MII, MRI);
60  return nullptr;
61 }
62 
65  MCInstPrinter *, bool) {
66  return new NVPTXAsmTargetStreamer(S);
67 }
68 
70  return new NVPTXTargetStreamer(S);
71 }
72 
73 // Force static initialization.
76  // Register the MC asm info.
78 
79  // Register the MC instruction info.
81 
82  // Register the MC register info.
84 
85  // Register the MC subtarget info.
87 
88  // Register the MCInstPrinter.
90 
91  // Register the MCTargetStreamer.
93 
94  // Register the MCTargetStreamer.
96  }
97 }
NVPTXInstPrinter.h
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
T
llvm::Target
Target - Wrapper for Target specific information.
Definition: TargetRegistry.h:149
llvm::MCAsmInfo
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
llvm::TargetRegistry::RegisterAsmTargetStreamer
static void RegisterAsmTargetStreamer(Target &T, Target::AsmTargetStreamerCtorTy Fn)
Definition: TargetRegistry.h:1036
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
llvm::X86AS::FS
@ FS
Definition: X86.h:201
NVPTXMCAsmInfo.h
createNVPTXMCInstrInfo
static MCInstrInfo * createNVPTXMCInstrInfo()
Definition: NVPTXMCTargetDesc.cpp:35
NVPTXTargetStreamer.h
llvm::TargetRegistry::RegisterMCInstPrinter
static void RegisterMCInstPrinter(Target &T, Target::MCInstPrinterCtorTy Fn)
RegisterMCInstPrinter - Register a MCInstPrinter implementation for the given target.
Definition: TargetRegistry.h:986
createNVPTXMCSubtargetInfo
static MCSubtargetInfo * createNVPTXMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)
Definition: NVPTXMCTargetDesc.cpp:49
NVPTXTargetInfo.h
llvm::MCStreamer
Streaming machine code generation interface.
Definition: MCStreamer.h:212
LLVMInitializeNVPTXTargetMC
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeNVPTXTargetMC()
Definition: NVPTXMCTargetDesc.cpp:74
createNullTargetStreamer
static MCTargetStreamer * createNullTargetStreamer(MCStreamer &S)
Definition: NVPTXMCTargetDesc.cpp:69
MCInstrInfo.h
MCSubtargetInfo.h
llvm::MCTargetStreamer
Target specific streamer interface.
Definition: MCStreamer.h:93
llvm::NVPTXInstPrinter
Definition: NVPTXInstPrinter.h:22
X
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
llvm::getTheNVPTXTarget64
Target & getTheNVPTXTarget64()
Definition: NVPTXTargetInfo.cpp:17
llvm::MCInstPrinter
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:44
LLVM_EXTERNAL_VISIBILITY
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:127
createTargetAsmStreamer
static MCTargetStreamer * createTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &, MCInstPrinter *, bool)
Definition: NVPTXMCTargetDesc.cpp:63
MCRegisterInfo.h
llvm::formatted_raw_ostream
formatted_raw_ostream - A raw_ostream that wraps another one and keeps track of line and column posit...
Definition: FormattedStream.h:30
llvm::TargetRegistry::RegisterMCSubtargetInfo
static void RegisterMCSubtargetInfo(Target &T, Target::MCSubtargetInfoCtorFnTy Fn)
RegisterMCSubtargetInfo - Register a MCSubtargetInfo implementation for the given target.
Definition: TargetRegistry.h:906
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm::RegisterMCAsmInfo
RegisterMCAsmInfo - Helper template for registering a target assembly info implementation.
Definition: TargetRegistry.h:1156
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::MCRegisterInfo
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Definition: MCRegisterInfo.h:135
MRI
unsigned const MachineRegisterInfo * MRI
Definition: AArch64AdvSIMDScalarPass.cpp:105
llvm::NVPTXTargetStreamer
Implments NVPTX-specific streamer.
Definition: NVPTXTargetStreamer.h:18
llvm::TargetRegistry::RegisterMCInstrInfo
static void RegisterMCInstrInfo(Target &T, Target::MCInstrInfoCtorFnTy Fn)
RegisterMCInstrInfo - Register a MCInstrInfo implementation for the given target.
Definition: TargetRegistry.h:873
llvm::MCInstrInfo
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:26
llvm::TargetRegistry::RegisterMCRegInfo
static void RegisterMCRegInfo(Target &T, Target::MCRegInfoCtorFnTy Fn)
RegisterMCRegInfo - Register a MCRegisterInfo implementation for the given target.
Definition: TargetRegistry.h:893
llvm::TargetRegistry::RegisterNullTargetStreamer
static void RegisterNullTargetStreamer(Target &T, Target::NullTargetStreamerCtorTy Fn)
Definition: TargetRegistry.h:1031
llvm::NVPTXAsmTargetStreamer
Definition: NVPTXTargetStreamer.h:53
NVPTXMCTargetDesc.h
createNVPTXMCRegisterInfo
static MCRegisterInfo * createNVPTXMCRegisterInfo(const Triple &TT)
Definition: NVPTXMCTargetDesc.cpp:41
createNVPTXMCInstPrinter
static MCInstPrinter * createNVPTXMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
Definition: NVPTXMCTargetDesc.cpp:53
TargetRegistry.h
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:76
llvm::getTheNVPTXTarget32
Target & getTheNVPTXTarget32()
Definition: NVPTXTargetInfo.cpp:13