1 //===-- ARMWinCOFFStreamer.cpp - ARM Target WinCOFF Streamer ----*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "ARMMCTargetDesc.h"
11 #include "llvm/MC/MCAsmBackend.h"
12 #include "llvm/MC/MCCodeEmitter.h"
13 #include "llvm/MC/MCObjectWriter.h"
14 #include "llvm/MC/MCWinCOFFStreamer.h"
15 
16 using namespace llvm;
17 
18 namespace {
19 class ARMWinCOFFStreamer : public MCWinCOFFStreamer {
20 public:
21   ARMWinCOFFStreamer(MCContext &C, std::unique_ptr<MCAsmBackend> AB,
22                      std::unique_ptr<MCCodeEmitter> CE,
23                      std::unique_ptr<MCObjectWriter> OW)
24       : MCWinCOFFStreamer(C, std::move(AB), std::move(CE), std::move(OW)) {}
25 
26   void EmitAssemblerFlag(MCAssemblerFlag Flag) override;
27   void EmitThumbFunc(MCSymbol *Symbol) override;
28   void FinishImpl() override;
29 };
30 
31 void ARMWinCOFFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
32   switch (Flag) {
33   default: llvm_unreachable("not implemented");
34   case MCAF_SyntaxUnified:
UnwindOpcodeStreamer(SmallVectorImpl<uint8_t> & V)35   case MCAF_Code16:
36     break;
37   }
EmitByte(uint8_t elem)38 }
39 
40 void ARMWinCOFFStreamer::EmitThumbFunc(MCSymbol *Symbol) {
41   getAssembler().setIsThumbFunc(Symbol);
42 }
43 
EmitSize(size_t Size)44 void ARMWinCOFFStreamer::FinishImpl() {
45   EmitFrames(nullptr);
46 
47   MCWinCOFFStreamer::FinishImpl();
48 }
49 }
50 
51 MCStreamer *llvm::createARMWinCOFFStreamer(
EmitPersonalityIndex(unsigned PI)52     MCContext &Context, std::unique_ptr<MCAsmBackend> &&MAB,
53     std::unique_ptr<MCObjectWriter> &&OW,
54     std::unique_ptr<MCCodeEmitter> &&Emitter, bool RelaxAll,
55     bool IncrementalLinkerCompatible) {
56   auto *S = new ARMWinCOFFStreamer(Context, std::move(MAB), std::move(Emitter),
57                                    std::move(OW));
58   S->getAssembler().setIncrementalLinkerCompatible(IncrementalLinkerCompatible);
59   return S;
60 }
61 
62