LLVM 20.0.0git
SPIRVAsmBackend.cpp
Go to the documentation of this file.
1//===-- SPIRVAsmBackend.cpp - SPIR-V Assembler Backend ---------*- 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
11#include "llvm/MC/MCAssembler.h"
14
15using namespace llvm;
16
17namespace {
18
19class SPIRVAsmBackend : public MCAsmBackend {
20public:
21 SPIRVAsmBackend(llvm::endianness Endian) : MCAsmBackend(Endian) {}
22
23 void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
25 uint64_t Value, bool IsResolved,
26 const MCSubtargetInfo *STI) const override {}
27
28 std::unique_ptr<MCObjectTargetWriter>
29 createObjectTargetWriter() const override {
31 }
32
33 unsigned getNumFixupKinds() const override { return 1; }
34
35 bool mayNeedRelaxation(const MCInst &Inst,
36 const MCSubtargetInfo &STI) const override {
37 return false;
38 }
39
40 void relaxInstruction(MCInst &Inst,
41 const MCSubtargetInfo &STI) const override {}
42
44 const MCSubtargetInfo *STI) const override {
45 return false;
46 }
47};
48
49} // end anonymous namespace
50
52 const MCSubtargetInfo &STI,
53 const MCRegisterInfo &MRI,
54 const MCTargetOptions &) {
55 return new SPIRVAsmBackend(llvm::endianness::little);
56}
unsigned const MachineRegisterInfo * MRI
PowerPC TLS Dynamic Call Fixup
endianness Endian
raw_pwrite_stream & OS
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:42
virtual bool writeNopData(raw_ostream &OS, uint64_t Count, const MCSubtargetInfo *STI) const =0
Write an (optimal) nop sequence of Count bytes to the given output.
virtual void relaxInstruction(MCInst &Inst, const MCSubtargetInfo &STI) const
Relax the instruction in the given fragment to the next wider instruction.
Definition: MCAsmBackend.h:179
virtual bool mayNeedRelaxation(const MCInst &Inst, const MCSubtargetInfo &STI) const
Check whether the given instruction may need relaxation.
Definition: MCAsmBackend.h:155
virtual std::unique_ptr< MCObjectTargetWriter > createObjectTargetWriter() const =0
virtual unsigned getNumFixupKinds() const =0
Get the number of target specific fixup kinds.
virtual void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup, const MCValue &Target, MutableArrayRef< char > Data, uint64_t Value, bool IsResolved, const MCSubtargetInfo *STI) const =0
Apply the Value for given Fixup into the provided data fragment, at the offset specified by the fixup...
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:71
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Generic base class for all target subtargets.
This represents an "assembler immediate".
Definition: MCValue.h:36
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Definition: ArrayRef.h:307
Target - Wrapper for Target specific information.
LLVM Value Representation.
Definition: Value.h:74
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
std::unique_ptr< MCObjectTargetWriter > createSPIRVObjectTargetWriter()
MCAsmBackend * createSPIRVAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options)
endianness
Definition: bit.h:70