LLVM  15.0.0git
SPIRVMCTargetDesc.cpp
Go to the documentation of this file.
1 //===-- SPIRVMCTargetDesc.cpp - SPIR-V 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 SPIR-V specific target descriptions.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "SPIRVMCTargetDesc.h"
14 #include "SPIRVInstPrinter.h"
15 #include "SPIRVMCAsmInfo.h"
16 #include "SPIRVTargetStreamer.h"
19 #include "llvm/MC/MCInstrInfo.h"
20 #include "llvm/MC/MCRegisterInfo.h"
22 #include "llvm/MC/TargetRegistry.h"
23 
24 #define GET_INSTRINFO_MC_DESC
25 #include "SPIRVGenInstrInfo.inc"
26 
27 #define GET_SUBTARGETINFO_MC_DESC
28 #include "SPIRVGenSubtargetInfo.inc"
29 
30 #define GET_REGINFO_MC_DESC
31 #include "SPIRVGenRegisterInfo.inc"
32 
33 using namespace llvm;
34 
36  MCInstrInfo *X = new MCInstrInfo();
37  InitSPIRVMCInstrInfo(X);
38  return X;
39 }
40 
43  return X;
44 }
45 
46 static MCSubtargetInfo *
48  return createSPIRVMCSubtargetInfoImpl(TT, CPU, /*TuneCPU*/ CPU, FS);
49 }
50 
51 static MCStreamer *
53  std::unique_ptr<MCAsmBackend> &&MAB,
54  std::unique_ptr<MCObjectWriter> &&OW,
55  std::unique_ptr<MCCodeEmitter> &&Emitter, bool RelaxAll) {
56  return createSPIRVStreamer(Ctx, std::move(MAB), std::move(OW),
57  std::move(Emitter), RelaxAll);
58 }
59 
62  MCInstPrinter *, bool) {
63  return new SPIRVTargetStreamer(S);
64 }
65 
67  unsigned SyntaxVariant,
68  const MCAsmInfo &MAI,
69  const MCInstrInfo &MII,
70  const MCRegisterInfo &MRI) {
71  assert(SyntaxVariant == 0);
72  return new SPIRVInstPrinter(MAI, MII, MRI);
73 }
74 
75 namespace {
76 
77 class SPIRVMCInstrAnalysis : public MCInstrAnalysis {
78 public:
79  explicit SPIRVMCInstrAnalysis(const MCInstrInfo *Info)
80  : MCInstrAnalysis(Info) {}
81 };
82 
83 } // end anonymous namespace
84 
86  return new SPIRVMCInstrAnalysis(Info);
87 }
88 
101  }
102 }
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
createSPIRVMCInstPrinter
static MCInstPrinter * createSPIRVMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
Definition: SPIRVMCTargetDesc.cpp:66
SPIRVMCAsmInfo.h
T
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:76
LLVMInitializeSPIRVTargetMC
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSPIRVTargetMC()
Definition: SPIRVMCTargetDesc.cpp:89
llvm::Target
Target - Wrapper for Target specific information.
Definition: TargetRegistry.h:145
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:1015
llvm::TargetRegistry::RegisterMCInstrAnalysis
static void RegisterMCInstrAnalysis(Target &T, Target::MCInstrAnalysisCtorFnTy Fn)
RegisterMCInstrAnalysis - Register a MCInstrAnalysis implementation for the given target.
Definition: TargetRegistry.h:858
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
SPIRVMCTargetDesc.h
createSPIRVMCSubtargetInfo
static MCSubtargetInfo * createSPIRVMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)
Definition: SPIRVMCTargetDesc.cpp:47
llvm::SPIRVTargetStreamer
Definition: SPIRVTargetStreamer.h:18
llvm::TargetRegistry::RegisterMCInstPrinter
static void RegisterMCInstPrinter(Target &T, Target::MCInstPrinterCtorTy Fn)
RegisterMCInstPrinter - Register a MCInstPrinter implementation for the given target.
Definition: TargetRegistry.h:965
SPIRVTargetInfo.h
llvm::MCStreamer
Streaming machine code generation interface.
Definition: MCStreamer.h:212
llvm::createSPIRVMCCodeEmitter
MCCodeEmitter * createSPIRVMCCodeEmitter(const MCInstrInfo &MCII, MCContext &Ctx)
Definition: SPIRVMCCodeEmitter.cpp:59
llvm::getTheSPIRV32Target
Target & getTheSPIRV32Target()
Definition: SPIRVTargetInfo.cpp:14
MCInstrInfo.h
SPIRVInstPrinter.h
llvm::MCInstrAnalysis
Definition: MCInstrAnalysis.h:30
MCSubtargetInfo.h
llvm::MCTargetStreamer
Target specific streamer interface.
Definition: MCStreamer.h:93
Info
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
SPIRVTargetStreamer.h
X
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
llvm::TargetRegistry::RegisterMCAsmBackend
static void RegisterMCAsmBackend(Target &T, Target::MCAsmBackendCtorTy Fn)
RegisterMCAsmBackend - Register a MCAsmBackend implementation for the given target.
Definition: TargetRegistry.h:912
llvm::MCInstPrinter
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:43
LLVM_EXTERNAL_VISIBILITY
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:126
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::TargetRegistry::RegisterSPIRVStreamer
static void RegisterSPIRVStreamer(Target &T, Target::SPIRVStreamerCtorTy Fn)
Definition: TargetRegistry.h:994
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
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::X86AS::FS
@ FS
Definition: X86.h:192
llvm::TargetRegistry::RegisterMCSubtargetInfo
static void RegisterMCSubtargetInfo(Target &T, Target::MCSubtargetInfoCtorFnTy Fn)
RegisterMCSubtargetInfo - Register a MCSubtargetInfo implementation for the given target.
Definition: TargetRegistry.h:885
MCInstrAnalysis.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::RegisterMCAsmInfo
RegisterMCAsmInfo - Helper template for registering a target assembly info implementation.
Definition: TargetRegistry.h:1120
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::createSPIRVStreamer
MCStreamer * createSPIRVStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE, bool RelaxAll)
Definition: MCSPIRVStreamer.cpp:35
llvm::MCRegisterInfo
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Definition: MCRegisterInfo.h:135
llvm::getTheSPIRV64Target
Target & getTheSPIRV64Target()
Definition: SPIRVTargetInfo.cpp:18
MRI
unsigned const MachineRegisterInfo * MRI
Definition: AArch64AdvSIMDScalarPass.cpp:105
createSPIRVMCRegisterInfo
static MCRegisterInfo * createSPIRVMCRegisterInfo(const Triple &TT)
Definition: SPIRVMCTargetDesc.cpp:41
llvm::TargetRegistry::RegisterMCInstrInfo
static void RegisterMCInstrInfo(Target &T, Target::MCInstrInfoCtorFnTy Fn)
RegisterMCInstrInfo - Register a MCInstrInfo implementation for the given target.
Definition: TargetRegistry.h:852
llvm::TargetRegistry::RegisterMCCodeEmitter
static void RegisterMCCodeEmitter(Target &T, Target::MCCodeEmitterCtorTy Fn)
RegisterMCCodeEmitter - Register a MCCodeEmitter implementation for the given target.
Definition: TargetRegistry.h:978
llvm::MCInstrInfo
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:26
createTargetAsmStreamer
static MCTargetStreamer * createTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &, MCInstPrinter *, bool)
Definition: SPIRVMCTargetDesc.cpp:60
llvm::TargetRegistry::RegisterMCRegInfo
static void RegisterMCRegInfo(Target &T, Target::MCRegInfoCtorFnTy Fn)
RegisterMCRegInfo - Register a MCRegisterInfo implementation for the given target.
Definition: TargetRegistry.h:872
createSPIRVInstrAnalysis
static MCInstrAnalysis * createSPIRVInstrAnalysis(const MCInstrInfo *Info)
Definition: SPIRVMCTargetDesc.cpp:85
llvm::createSPIRVAsmBackend
MCAsmBackend * createSPIRVAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options)
Definition: SPIRVAsmBackend.cpp:58
llvm::SPIRVInstPrinter
Definition: SPIRVInstPrinter.h:19
createSPIRVMCInstrInfo
static MCInstrInfo * createSPIRVMCInstrInfo()
Definition: SPIRVMCTargetDesc.cpp:35
TargetRegistry.h
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:76
createSPIRVMCStreamer
static MCStreamer * createSPIRVMCStreamer(const Triple &T, MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&MAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&Emitter, bool RelaxAll)
Definition: SPIRVMCTargetDesc.cpp:52