Path: blob/main/contrib/llvm-project/llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVAsmBackend.cpp
35294 views
//===-- SPIRVAsmBackend.cpp - SPIR-V Assembler Backend ---------*- C++ -*--===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "MCTargetDesc/SPIRVMCTargetDesc.h"9#include "llvm/MC/MCAsmBackend.h"10#include "llvm/MC/MCAssembler.h"11#include "llvm/MC/MCObjectWriter.h"12#include "llvm/Support/EndianStream.h"1314using namespace llvm;1516namespace {1718class SPIRVAsmBackend : public MCAsmBackend {19public:20SPIRVAsmBackend(llvm::endianness Endian) : MCAsmBackend(Endian) {}2122void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,23const MCValue &Target, MutableArrayRef<char> Data,24uint64_t Value, bool IsResolved,25const MCSubtargetInfo *STI) const override {}2627std::unique_ptr<MCObjectTargetWriter>28createObjectTargetWriter() const override {29return createSPIRVObjectTargetWriter();30}3132unsigned getNumFixupKinds() const override { return 1; }3334bool mayNeedRelaxation(const MCInst &Inst,35const MCSubtargetInfo &STI) const override {36return false;37}3839void relaxInstruction(MCInst &Inst,40const MCSubtargetInfo &STI) const override {}4142bool writeNopData(raw_ostream &OS, uint64_t Count,43const MCSubtargetInfo *STI) const override {44return false;45}46};4748} // end anonymous namespace4950MCAsmBackend *llvm::createSPIRVAsmBackend(const Target &T,51const MCSubtargetInfo &STI,52const MCRegisterInfo &MRI,53const MCTargetOptions &) {54return new SPIRVAsmBackend(llvm::endianness::little);55}565758