brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 5710cf2 Raw
45 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9#include "MCTargetDesc/SPIRVMCTargetDesc.h"10#include "llvm/MC/MCAsmBackend.h"11#include "llvm/MC/MCAssembler.h"12#include "llvm/MC/MCObjectWriter.h"13#include "llvm/MC/MCSPIRVObjectWriter.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 MCFragment &, const MCFixup &, const MCValue &Target,24                  uint8_t *Data, uint64_t Value, bool IsResolved) override {}25 26  std::unique_ptr<MCObjectTargetWriter>27  createObjectTargetWriter() const override {28    return std::make_unique<MCSPIRVObjectTargetWriter>();29  }30 31  bool writeNopData(raw_ostream &OS, uint64_t Count,32                    const MCSubtargetInfo *STI) const override {33    return false;34  }35};36 37} // end anonymous namespace38 39MCAsmBackend *llvm::createSPIRVAsmBackend(const Target &T,40                                          const MCSubtargetInfo &STI,41                                          const MCRegisterInfo &MRI,42                                          const MCTargetOptions &) {43  return new SPIRVAsmBackend(llvm::endianness::little);44}45