xref: /freebsd/contrib/llvm-project/llvm/lib/Target/ARM/MCTargetDesc/ARMWinCOFFStreamer.cpp (revision 62cfcf62f627e5093fb37026a6d8c98e4d2ef04c)
1 //===-- ARMWinCOFFStreamer.cpp - ARM Target WinCOFF Streamer ----*- 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 #include "ARMMCTargetDesc.h"
10 #include "llvm/MC/MCAsmBackend.h"
11 #include "llvm/MC/MCCodeEmitter.h"
12 #include "llvm/MC/MCObjectWriter.h"
13 #include "llvm/MC/MCWinCOFFStreamer.h"
14 
15 using namespace llvm;
16 
17 namespace {
18 class ARMWinCOFFStreamer : public MCWinCOFFStreamer {
19 public:
20   ARMWinCOFFStreamer(MCContext &C, std::unique_ptr<MCAsmBackend> AB,
21                      std::unique_ptr<MCCodeEmitter> CE,
22                      std::unique_ptr<MCObjectWriter> OW)
23       : MCWinCOFFStreamer(C, std::move(AB), std::move(CE), std::move(OW)) {}
24 
25   void EmitThumbFunc(MCSymbol *Symbol) override;
26   void FinishImpl() override;
27 };
28 
29 void ARMWinCOFFStreamer::EmitThumbFunc(MCSymbol *Symbol) {
30   getAssembler().setIsThumbFunc(Symbol);
31 }
32 
33 void ARMWinCOFFStreamer::FinishImpl() {
34   EmitFrames(nullptr);
35 
36   MCWinCOFFStreamer::FinishImpl();
37 }
38 }
39 
40 MCStreamer *llvm::createARMWinCOFFStreamer(
41     MCContext &Context, std::unique_ptr<MCAsmBackend> &&MAB,
42     std::unique_ptr<MCObjectWriter> &&OW,
43     std::unique_ptr<MCCodeEmitter> &&Emitter, bool RelaxAll,
44     bool IncrementalLinkerCompatible) {
45   auto *S = new ARMWinCOFFStreamer(Context, std::move(MAB), std::move(Emitter),
46                                    std::move(OW));
47   S->getAssembler().setIncrementalLinkerCompatible(IncrementalLinkerCompatible);
48   return S;
49 }
50 
51