1 //===- MCDXContainerStreamer.h - MCDXContainerStreamer 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 // The DXContainer format isn't a fully featured object format. It doesn't
11 // support symbols, and initially it will not support instruction data since it
12 // is used as a bitcode container for DXIL.
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_MC_MCDXCONTAINERSTREAMER_H
17 #define LLVM_MC_MCDXCONTAINERSTREAMER_H
18 
19 #include "llvm/MC/MCAsmBackend.h"
20 #include "llvm/MC/MCCodeEmitter.h"
21 #include "llvm/MC/MCObjectStreamer.h"
22 #include "llvm/MC/MCObjectWriter.h"
23 
24 namespace llvm {
25 class MCInst;
26 class raw_ostream;
27 
28 class MCDXContainerStreamer : public MCObjectStreamer {
29 public:
MCDXContainerStreamer(MCContext & Context,std::unique_ptr<MCAsmBackend> TAB,std::unique_ptr<MCObjectWriter> OW,std::unique_ptr<MCCodeEmitter> Emitter)30   MCDXContainerStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
31                         std::unique_ptr<MCObjectWriter> OW,
32                         std::unique_ptr<MCCodeEmitter> Emitter)
33       : MCObjectStreamer(Context, std::move(TAB), std::move(OW),
34                          std::move(Emitter)) {}
35 
emitSymbolAttribute(MCSymbol *,MCSymbolAttr)36   bool emitSymbolAttribute(MCSymbol *, MCSymbolAttr) override { return false; }
emitCommonSymbol(MCSymbol *,uint64_t,Align)37   void emitCommonSymbol(MCSymbol *, uint64_t, Align) override {}
38   void emitZerofill(MCSection *, MCSymbol *Symbol = nullptr, uint64_t Size = 0,
39                     Align ByteAlignment = Align(1),
40                     SMLoc Loc = SMLoc()) override {}
41 
42 private:
43   void emitInstToData(const MCInst &, const MCSubtargetInfo &) override;
44 };
45 
46 } // end namespace llvm
47 
48 #endif // LLVM_MC_MCDXCONTAINERSTREAMER_H
49