LLVM 17.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"
23
24#define GET_INSTRINFO_MC_DESC
25#define ENABLE_INSTR_PREDICATE_VERIFIER
26#include "SPIRVGenInstrInfo.inc"
27
28#define GET_SUBTARGETINFO_MC_DESC
29#include "SPIRVGenSubtargetInfo.inc"
30
31#define GET_REGINFO_MC_DESC
32#include "SPIRVGenRegisterInfo.inc"
33
34using namespace llvm;
35
37 MCInstrInfo *X = new MCInstrInfo();
38 InitSPIRVMCInstrInfo(X);
39 return X;
40}
41
44 return X;
45}
46
47static MCSubtargetInfo *
49 return createSPIRVMCSubtargetInfoImpl(TT, CPU, /*TuneCPU*/ CPU, FS);
50}
51
52static MCStreamer *
54 std::unique_ptr<MCAsmBackend> &&MAB,
55 std::unique_ptr<MCObjectWriter> &&OW,
56 std::unique_ptr<MCCodeEmitter> &&Emitter, bool RelaxAll) {
57 return createSPIRVStreamer(Ctx, std::move(MAB), std::move(OW),
58 std::move(Emitter), RelaxAll);
59}
60
63 MCInstPrinter *, bool) {
64 return new SPIRVTargetStreamer(S);
65}
66
68 unsigned SyntaxVariant,
69 const MCAsmInfo &MAI,
70 const MCInstrInfo &MII,
71 const MCRegisterInfo &MRI) {
72 assert(SyntaxVariant == 0);
73 return new SPIRVInstPrinter(MAI, MII, MRI);
74}
75
76namespace {
77
78class SPIRVMCInstrAnalysis : public MCInstrAnalysis {
79public:
80 explicit SPIRVMCInstrAnalysis(const MCInstrInfo *Info)
82};
83
84} // end anonymous namespace
85
87 return new SPIRVMCInstrAnalysis(Info);
88}
89
102 }
103}
unsigned const MachineRegisterInfo * MRI
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:127
dxil DXContainer Global Emitter
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static MCInstrAnalysis * createSPIRVInstrAnalysis(const MCInstrInfo *Info)
static MCTargetStreamer * createTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &, MCInstPrinter *, bool)
static MCInstrInfo * createSPIRVMCInstrInfo()
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSPIRVTargetMC()
static MCSubtargetInfo * createSPIRVMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)
static MCRegisterInfo * createSPIRVMCRegisterInfo(const Triple &TT)
static MCInstPrinter * createSPIRVMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
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)
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
Context object for machine code objects.
Definition: MCContext.h:76
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:44
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:26
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Streaming machine code generation interface.
Definition: MCStreamer.h:212
Generic base class for all target subtargets.
Target specific streamer interface.
Definition: MCStreamer.h:93
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
formatted_raw_ostream - A raw_ostream that wraps another one and keeps track of line and column posit...
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
MCCodeEmitter * createSPIRVMCCodeEmitter(const MCInstrInfo &MCII, MCContext &Ctx)
MCStreamer * createSPIRVStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE, bool RelaxAll)
Target & getTheSPIRV32Target()
Target & getTheSPIRV64Target()
MCAsmBackend * createSPIRVAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options)
RegisterMCAsmInfo - Helper template for registering a target assembly info implementation.
static void RegisterMCRegInfo(Target &T, Target::MCRegInfoCtorFnTy Fn)
RegisterMCRegInfo - Register a MCRegisterInfo implementation for the given target.
static void RegisterMCAsmBackend(Target &T, Target::MCAsmBackendCtorTy Fn)
RegisterMCAsmBackend - Register a MCAsmBackend implementation for the given target.
static void RegisterMCCodeEmitter(Target &T, Target::MCCodeEmitterCtorTy Fn)
RegisterMCCodeEmitter - Register a MCCodeEmitter implementation for the given target.
static void RegisterMCSubtargetInfo(Target &T, Target::MCSubtargetInfoCtorFnTy Fn)
RegisterMCSubtargetInfo - Register a MCSubtargetInfo implementation for the given target.
static void RegisterMCInstrAnalysis(Target &T, Target::MCInstrAnalysisCtorFnTy Fn)
RegisterMCInstrAnalysis - Register a MCInstrAnalysis implementation for the given target.
static void RegisterSPIRVStreamer(Target &T, Target::SPIRVStreamerCtorTy Fn)
static void RegisterMCInstPrinter(Target &T, Target::MCInstPrinterCtorTy Fn)
RegisterMCInstPrinter - Register a MCInstPrinter implementation for the given target.
static void RegisterMCInstrInfo(Target &T, Target::MCInstrInfoCtorFnTy Fn)
RegisterMCInstrInfo - Register a MCInstrInfo implementation for the given target.
static void RegisterAsmTargetStreamer(Target &T, Target::AsmTargetStreamerCtorTy Fn)