1 //===- MCSPIRVStreamer.h - MCStreamer SPIR-V Object File Interface -*- 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 // Overrides MCObjectStreamer to disable all unnecessary features with stubs.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_MC_MCSPIRVSTREAMER_H
14 #define LLVM_MC_MCSPIRVSTREAMER_H
15 
16 #include "llvm/MC/MCAsmBackend.h"
17 #include "llvm/MC/MCCodeEmitter.h"
18 #include "llvm/MC/MCObjectStreamer.h"
19 #include "llvm/MC/MCObjectWriter.h"
20 
21 namespace llvm {
22 class MCInst;
23 class raw_ostream;
24 
25 class MCSPIRVStreamer : public MCObjectStreamer {
26 public:
27   MCSPIRVStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
28                   std::unique_ptr<MCObjectWriter> OW,
29                   std::unique_ptr<MCCodeEmitter> Emitter)
30       : MCObjectStreamer(Context, std::move(TAB), std::move(OW),
31                          std::move(Emitter)) {}
32 
33   bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override {
34     return false;
35   }
36   void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
37                         Align ByteAlignment) override {}
38   void emitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
39                     uint64_t Size = 0, Align ByteAlignment = Align(1),
40                     SMLoc Loc = SMLoc()) override {}
41 
42 private:
43   void emitInstToData(const MCInst &Inst, const MCSubtargetInfo &) override;
44 };
45 
46 } // end namespace llvm
47 
48 #endif
49